tl;dr
- EELS is a reference implementation of the Python runtime layer.
- It is up to date with the main network.
- He completes the tests and passes the existing ones.
- Below is an example of an EIP implemented in EELS.
Introduction
After more than a year of development, we are pleased to publicly present the Ethereum Execution Layer Specification (affectionately known as EELS.) EELS is a Python reference implementation of the core components of an Ethereum runtime client focused on readability and clarity. Designed as a spiritual successor to the Yellow paper it’s more programmer friendly and up to date with post-merge forks, EELS can populate and run state tests, track mainnet1and is a great place to prototype new EIPs.
EELS provides full protocol snapshots at every fork, including upcoming ones, making it much easier to follow than EIP (which only offer modifications) and production clients (which often mix multiple forks in the same code path.)
History
As of 2021, as a project of the ConsenSys Quilt Team and the Ethereum Foundation, the eth1.0 specification (as it was then called) was inspired by the sheer frustration of having to decipher the cryptic notation of the Yellow Book (Figure 1) to understand the specific behavior of an EVM instruction.
Building on success Consensus Layer Specificationwe set out to create a similar executable specification for the execution layer.
Here
Today, EELS is consumable as traditional Python repository and as documentation renderedIt’s still a little rough around the edges and doesn’t provide much in the way of annotations or explanations in English about what the various parts do, but those will come with time.
It’s just Python
Hopefully a side-by-side comparison of the Yellow Book and the equivalent EELS code can show why EELS is a valuable addition:
While Figure 2 could be digestible for academics, Figure 3 is definitely more natural for programmers.
Here is a video step by step procedure to add a simple EVM instruction if that’s your kind of thing.
Writing tests
It bears repeating: EELS is just regular Python. It can be tested like any other Python library! In addition to the whole Ethereum/tests Next, we also have a selection of py test tests.
With a little help from execution-specification-testsall tests written for EELS can also be applied to production clients!2
Show differences
Having snapshots at each fork is very useful for a smart contract developer who wants to see the specifics of how an EVM instruction works, but is not very useful for client developers themselves. For them, EELS can show the differences between forks:
An example of EIP
EIP-6780 is the first EIP to obtain an EELS implementation provided by the author, William Ballet! Let’s take a look.
First, we present a contracts_created variable to the EVM with transaction-level scope:
@dataclass class Environment: caller: Address block_hashes: List(Hash32) origin: Address coinbase: Address number: Uint base_fee_per_gas: Uint gas_limit: Uint gas_price: Uint time: U256 prev_randao: Bytes32 state: State chain_id: U64 + created_contracts: Set(Address)
Second, we note which contracts were created in each transaction:
+ evm.env.created_contracts.add(contract_address)
Finally, we modify self-destruction So this only works for the contracts mentioned in contracts_created:
- # register account for deletion - evm.accounts_to_delete.add(originator) - + # Only continue if the contract has been created in the same tx + if originator in evm.env.created_contracts: + + # register account for deletion + evm.accounts_to_delete.add(originator) +
Future
We want EELS to become the default way to specify basic EIPs, the first place EIP authors go to prototype their proposals, and the best possible reference on how Ethereum works.
If you would like to contribute or prototype your EIP, join us on the #features channel or retrieve a number from our deposit.