eof-etk Infrastructure User Experience

The problem eof-etk solves

EOF (EVM Object Format) is a series of proposals for introducing a versioned format for EVM bytecode, considered for inclusion in Pectra network upgrade of Ethereum Execution Layer. See https://evmobjectformat.org/, also https://eips.ethereum.org/EIPS/eip-7692 and https://github.com/ipsilon/eof/blob/main/spec/eof.md

etk (https://github.com/quilt/etk) is a developer toolkit and assembly language for EVM, written in Rust.

Integration of EOF support into etk assembly allows to generate EOF-compliant bytecode by writing smart contract code in low-level assembly language. As of now there is no production-ready EOF bytecode compiler/assembler and established compiler projects (Solidity, Vyper) are only starting to support EOF. Generating EOF bytecode needed for testing EVM implemenations is mostly done using ad-hoc tooling. Support in etk provides access to using EOF to a wider audience of EVM enthusiasts.

What was achieved

  • New syntax for defining code/data sections was proposed and supported in parser.
  • EOF container bytecode is generated in case at least one section is defined.
  • It is possible to define multiple code sections and a data section in a contract.
  • Defining code section type using attributes like “section .code inputs=1 outputs=0 max_stack_height=2”
  • Basic validation of section definitions order
  • Calculating correct section size when %push() macro and labels are used
  • Bonus: a bug fixed https://github.com/quilt/etk/pull/147

Next steps

  • Supporting new instructions proposed by EOF
  • Supporting nested container sections
  • Automatic calculation of max_stack_height
  • Updating documentation

Challenges you ran into

  • Lack of Rust skills
  • Needed to learn basics of Pest language used by etk for parser grammar definition. (https://pest.rs)
  • Lack of time.

Technology used

Rust, EVM, EOF.