|
4 | 4 | [](https://codecov.io/gh/ethereum/execution-specs) |
5 | 5 | [](https://github.com/ethereum/execution-specs/actions/workflows/test.yaml) |
6 | 6 |
|
| 7 | +## Monadized `execution-specs` and spec tests |
| 8 | + |
| 9 | +**IMPORTANT: Read this first if you're planning to use it for [Monad](https://www.monad.xyz/).** |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +This fork implements the execution layer client features specific to Monad. |
| 14 | + |
| 15 | +It mainly serves as an alternative implementation of https://github.com/category-labs/monad, and a tool to generate (fill) spec tests for it to consume. |
| 16 | + |
| 17 | +### Getting started |
| 18 | + |
| 19 | +1. Install `uv`: `curl -LsSf https://astral.sh/uv/install.sh | sh` |
| 20 | +2. Clone and setup: |
| 21 | + |
| 22 | +```bash |
| 23 | +git clone --depth 1 https://github.com/monad-developers/execution-specs |
| 24 | +cd execution-specs |
| 25 | +uv python install 3.12 |
| 26 | +uv python pin 3.12 |
| 27 | +uv sync --all-extras |
| 28 | +``` |
| 29 | +3. Fill all monadized spec tests as of writing this (see below for explanation of flags): |
| 30 | + |
| 31 | +```bash |
| 32 | +uv run fill --clean -m "blockchain_test or transaction_test" --from MONAD_EIGHT --until MONAD_NEXT --chain-id 143 -n auto tests |
| 33 | +``` |
| 34 | + |
| 35 | +4. The test fixtures to be found in `fixtures/` directory under repo root. |
| 36 | + |
| 37 | +(c.f. [somewhat outdated upstream "Getting started"](https://eest.ethereum.org/main/getting_started/installation/)) |
| 38 | + |
| 39 | +### Filling tests |
| 40 | + |
| 41 | +Filling tests is the process of running Python generators of spec tests [like ones you can find here](./tests/monad_eight/reserve_balance/test_transfers.py), to generate JSON files with test fixtures. The fixtures are then in turn consumed by `monad`. In the process of filling the tests, the Python implementation of Monad execution layer is used to produce reference results including the state root. |
| 42 | + |
| 43 | +#### `uv run fill` flags |
| 44 | + |
| 45 | +- **`-m blockchain_test or transaction_test`**: causes these two flavors of fixtures to be generated |
| 46 | + - `blockchain_test` is the currently supported by `monad` flavor of a spec test checking correctness of the state transition. Note this includes `blockchain_test_from_state_test`, meaning that all `state_test(...)` fillers are included |
| 47 | + - `transaction_test` is also supported, tests only correctness of static transaction checks |
| 48 | +- **`--from MONAD_EIGHT --until MONAD_NEXT`**: hardforks for which to generate fixtures. Must match with those defined in `monad`, inclusive |
| 49 | +- **`--chain-id 143`**: must be specified for signatures and EIP-7702 to work correctly |
| 50 | +- **`-n auto`**: from `pytest`, parallel execution of tests |
| 51 | +- **`tests`**: root directory to traverse to discover tests |
| 52 | + - inside the tests are organized by EIP/MIP and the hardfork when they **became relevant**. For Monad these are `monad_eight` and `monad_nine` as of writing this. Here hardfork is informative only, doesn't need to match with `monad`. |
| 53 | + - note that tests relevant for previous hardforks, e.g. `tests/prague/eip7702_set_code_tx`, are filled for hardforks requested with `--from`, `--until` flags, respecting any constraints the test itself might define. In other words, in the invocation above, EIP-7702 tests **will be filled** |
| 54 | + |
| 55 | +`pytest` flags are in general supported, while `--traces` will give you detailed EVM step traces. Refer to https://eest.ethereum.org/main/filling_tests/ for more details. |
| 56 | + |
| 57 | +### Gotchas |
| 58 | + |
| 59 | +- not all Ethereum-only features have been switched off, e.g. eth-specific system contracts and tx types are available in the monadized `execution-specs` implementation. We're skipping their respective spec tests, and we don't have tests testing lack of these features in Monad. |
| 60 | +- we're going to be keeping up with upstream changes (currently `forks/amsterdam` branch). This should work by opening a PR with the upstream changes to be commit-merged into our default branch (currently `forks/monad_nine`). |
| 61 | +- when adding a new Monad-hardfork we should use the [`ethereum-spec-new-fork` tool](./CONTRIBUTING.md#new-fork-tool) provided to clone the parent hardfork into the new hardfork. If that new Monad-hardfork also adopts upstream (Ethereum) hardfork improvements, you will need to apply these yourself. |
| 62 | + |
| 63 | +--- |
| 64 | + |
7 | 65 | ## Description |
8 | 66 |
|
9 | 67 | This repository contains the specifications related to the Ethereum execution client, specifically the [pyspec](/src/ethereum/__init__.py) and specifications for [network upgrades](/src/ethereum/__init__.py). The [JSON-RPC API specification](https://github.com/ethereum/execution-apis) can be found in a separate repository. |
|
0 commit comments