The evm-dafny repository contains five directories and five stand-alone files the most remarkable of which are the following:
-
github/workflowsconsists of the build process of different modules and their dependencies, -
fixturescontains the ethereum tests to generate, to test our system against, -
resourcescontains the log of tests which have been generated and our system is tested against, -
srccomprises the backbone of our system including the formal semantics of the Dafny-EVM. It contains three subdirectories: -
testsconsists of the list of ethereum tests we are currently running, -
build.gradleconsists of build instructions with thegradletool,
We organize the Source Files of the Dafny-EVM according to a three-layer architecture explained further below.
The architecture of the Source Files comprises the three layers; top, middle and the bottom layer, as shown in the image below. The top of the stack image, shows the [High Level] modules containing bytecode semantics and top-level types. We locate in the middle of the image, modules of the Middle Level which contain abstractions of the main components. The bottom of the stack depicts the modules placed at the Low Level which specify fundamental primitives (e.g. for manipulating bytes and ints).
The source files including our formalisation of the EVM semantics, the state, gas calculations, and helper modules appear under the directory src/dafny. The architecture of the source files accords with the three layer model explained above.
-
evmscontains modules each of which specify an extension of our EVM with a particular hardfork of users' choice, for exampleberlin.dfy. -
opcodes.dfyencodes all of the EVM opcodes. -
evm.dfyprovides a generic mechanism for building extensions on our EVM based on a hardfork of users' choice. -
evmstate.dfyspecifies various EVM states and how to perform operations on them. -
bytecode.dfyincludes the implementation of the EVM opcodes' semantics. -
gas.dfyspecifies gas charging calculations.
code.dfyis an implementation of read-only code region of the EVM.context.dfyimplements the execution context of a transaction.memory.dfyis a specification of the EVM's volatile memory.precompiled.dfyimplements precompiled contracts.stack.dfyspecifies the stack of EVM together with stack operations.storage.dfyis an implementation of the EVM storage including functionalities for performing operations on the storage.substate.dfyencodes the substate of the EVM.worldstate.dfyspecifies the world state of the ethereum.
option.dfybytes.dfyimplements an specification of machine bytes together with methods for performing operations on them.int.dfyspecifies machine words of various length both signed and unsigned.extern.dfyinterfaces Dafny with Java.
