Skip to content

Improve generic EOF header #181

@chfast

Description

@chfast

Current situation

In the current spec the structure of the EVMv1 header is not very generic. In particular we have:

  • mandatory and optional sections (therefore also header entries)
  • single and array sections; there is no generic rule which section is which
  • mandatory sections of size zero (data) and non-empty optional sections (containers)

I believe, two historically separated decisions contributed to this:

  • we decided that it is easier to define the data section as mandatory with the potential zero size; back then all sections were mandatory,
  • later we added optional subcontainers section; because it is optional we don't allow it to be of size zero.

Also it is important to note that in the future we are going to mostly extend EOFv1 by adding optional sections.

Potential improvements

Data section is optional

  1. Forbid sections of size 0. For array sections, the count and all sizes must not be 0.
  2. Having 1, the data section must be optional.

Indicate single/array section kind

  1. Introduce a bit in the section id indicating a section of this kind is single. E.g. limit the ids range to 0–0x7f. The 0x80 bit indicates the section is single. Sections are ordered by id & 0x7f. Example new ids in order:
    • type: 0x81
    • code: 0x02
    • containers: 0x03
    • data: 0xff

Implementation considerations

The changes allow improving the header parser implementation. You can have a generic EOF version agnostic header parser. The parser should all sections as optional and build internal representation of the EOF sections. In the second phase of validation we can check if the mandatory sections required by specific EOF version are present. Similarly, we can check any other version-specific requirements (e.g. type section matching the number of code sections).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions