### 🧪 ethereum/execution-spec-tests for Gnosis Chain🦉✨? ##### danceratopz and spencer (EF) ##### 2024-11-20 <style> .reveal .slides > section > section { text-align:left; } code { font-size: 0.8em; /* Set the desired font size for inline code */ } pre { max-height: 500px; /* Set the desired height for code blocks */ overflow: auto; /* Add scroll if needed */ padding: 15px; /* Add padding for a better look */ background-color: #f5f5f5; /* Optional: Light background to make the code more readable */ } pre code { font-size: 0.8em; /* Set the desired font size for code blocks */ } p { text-align: left; } .top-left-label { position: fixed; top: -70px; left: 30px; font-size: 30px; font-weight: bold; color: #555; } .team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; justify-items: center; margin-top: 5px; } .team-member { text-align: center; font-size: 12px; } .team-member img { border-radius: 50%; width: 100px; height: 100px; } </style> --- <div class="top-left-label">🧪 EEST/ Testing Team (EF)</div> <div class="team-grid"> <div class="team-member"> <img src="https://github.com/marioevz.png" alt="Mario's profile picture" width="100"> <p><b>Mario: <code>@marioevz</code></b></p> </div> <div class="team-member"> <img src="https://github.com/danceratopz.png" alt="Dan's profile picture" width="100"> <p><b>Dan: <code>@danceratopz</code></b></p> </div> <div class="team-member"> <img src="https://github.com/winsvega.png" alt="Dimitry's profile picture" width="100"> <p><b>Dimitry: <code>@winsvega</code></b></p> </div> <div class="team-member"> <img src="https://github.com/spencer-tb.png" alt="Spencer's profile picture" width="100"> <p><b>spencer: <code>@spencer-tb</code></b></p> </div> <div class="team-member"> <img src="https://storage.googleapis.com/ethereum-hackmd/upload_81d94ebcf6874601cfcbdf6831495123.png" alt="Unknown profile picture" width="100"> <p><b>new el tester: <code>@anon1</code></b></p> </div> <div class="team-member"> <img src="https://storage.googleapis.com/ethereum-hackmd/upload_81d94ebcf6874601cfcbdf6831495123.png" alt="Unknown profile picture" width="100"> <p><b>new cl tester: <code>@anon2</code></b></p> </div> </div> <div style="text-align: left;font-size: 0.4em;"> <p> Responsibilities: </p> <ul> <li>Implement cross-client EL spec tests.</li> <li>Maintain/improve associated tooling.</li> <li>Also work on/with ethereum/hive.</li> </ul> </div> <!-- --- ### Overview: Old - ethereum/tests 1. ethereum/tests (4697 tests for Cancun): - `./src/`: Collection of test cases (YAML) used since Frontier. - `./tests/`: Contains the generated JSON test fixtures. 2. ethereum/retesteth: - Tool to "fill" the tests YAML-> JSON --> --- ### Overview: Old - Filling <div style="flex: 1; text-align: center;"> <img src="https://storage.googleapis.com/ethereum-hackmd/upload_cff1b23e831d1906bde60b58b5782e4b.png" style="max-width: 100%; height: auto;"> </div> (requires reference EVM implementation) --- ### Overview: Old - Status **ethereum/tests Status**: - Still required for Prague (clients should execute these tests for pre-Shanghai functionality). - Goal: Move tests to execution-spec-tests - Deprecation in 2025? --- #### Overview: New - execution-spec-tests - ethereum/execution-spec-tests (EEST): 1. Body of test cases expressed in Python 2. Python + **pytest** framework to fill test cases --- #### Overview: New - Filling in EEST <div style="flex: 1; text-align: center;"> <img src="https://storage.googleapis.com/ethereum-hackmd/upload_8041bb6196b69470b19d1e069dcf4b2c.png" style="max-width: 100%; height: auto;"> </div> (requires reference EVM implementation - typically EELS) <!-- --- #### Focus on EEST - ethereum/tests <br> → ethereum/execution-spec-tests - we should focus on the new. --> --- #### Example Test Function ```python [1|2|6-12|14-15|17-24|26-28|30] @pytest.mark.valid_from("Istanbul") def test_chainid(state_test: StateTestFiller, pre: Alloc): """ Test CHAINID opcode. """ env = Environment( fee_recipient="0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", difficulty=0x20000, gas_limit=10000000000, number=1, timestamp=1000, ) contract_address = pre.deploy_contract(Op.SSTORE(1, Op.CHAINID) + Op.STOP) sender = pre.fund_eoa() tx = Transaction( ty=0x0, chain_id=0x01, to=contract_address, gas_limit=100000000, gas_price=10, sender=sender, ) post = { contract_address: Account(storage={"0x01": "0x01"}), } state_test(env=env, pre=pre, post=post, tx=tx) ``` --- #### Where's the Chain Logic? 1. Reference EVM implementation (`t8n`). 2. [`src/ethereum_test_forks/forks/forks.py`](https://github.com/ethereum/execution-spec-tests/blob/e546b9c251a089a026493503ded40ab0d2d34dac/src/ethereum_test_forks/forks/forks.py#L38). 3. `Transaction` object. 4. `Environment` object. 5. `./tests/**/*.py`? a. Potentially in post conditions (bad). b. Test logic (simply invalid for Gnosis). 6. Some other places (eg, supported opcodes). --- <section data-background-iframe="https://ethereum.github.io/execution-spec-tests/main/library/ethereum_test_forks/#ethereum_test_forks.Prague" data-background-interactive> </section> --- #### (Ambitious?) Goal Gnosis chain support achieved via: 1. Making execution-spec-tests more extendable. 2. Creating a new repository gnosis-specific repository that implements: a. Plugins for the chain logic. b. Adds additional test cases if necessary. 3. Use Gnosis-specific plugins using existing EEST infra. --- #### Filling Mainnet Pytest ini file: ```ini [pytest] python_files = *.py testpaths = ../mainnet/tests/ addopts = -p pytest_plugins.concurrency -p pytest_plugins.filler.pre_alloc -p pytest_plugins.solc.solc -p pytest_plugins.filler.filler -p pytest_plugins.shared.execute_fill -p pytest_plugins.forks.forks -p pytest_plugins.eels_resolver -p pytest_plugins.help.help ``` --- #### Filling Gnosis? Pytest ini file: ```ini [pytest] python_files = *.py testpaths = ../mainnet/tests/ gnosis/tests addopts = -p pytest_plugins.concurrency -p pytest_plugins.filler.pre_alloc -p pytest_plugins.solc.solc -p pytest_plugins.filler.filler -p pytest_plugins.shared.execute_fill -p pytest_plugins.forks.forks -p pytest_plugins.eels_resolver -p pytest_plugins.help.help -p gnosis.forks -p gnosis.environment -p gnosis.transaction ``` --- #### Thanks! --- #### Open Questions - Can we avoid forking ethereum/execution-spec-tests (EEST)? - At all? - Partially: Fork, but only modify `./tests`? This depends on.. - How well can we abstract the chain logic in EEST? I hope we can answer this **together** (**sooon**). ---
{"title":"ethereum/execution-spec-tests for Gnosis Chain?","tags":"Talk, Ethereum, Testing, Spec","slideOptions":{"transition":"slide"}}
    277 views