fix(test-benchmark): nonce mismatch issue in SLOAD & SSTORE benchmark#2617
fix(test-benchmark): nonce mismatch issue in SLOAD & SSTORE benchmark#2617LouisTsai-Csie wants to merge 1 commit intoethereum:forks/amsterdamfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #2617 +/- ##
================================================
Coverage 86.24% 86.24%
================================================
Files 599 599
Lines 36984 36984
Branches 3795 3795
================================================
Hits 31895 31895
Misses 4525 4525
Partials 564 564
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I don´t understand, why does this seem to fix the issue? |
673369f to
78a2094
Compare
|
@jochem-brouwer i've updated the PR description, please take a look at the |
|
Cool. This makes sense! This is indeed an intermediate option to fix this now, we should look for a more robust option ASAP. Can we track this in an issue? This is specifically when fill vs execute mode diverges. We could also mark these type of tests to be filled with execute by default throwing a warning when we try to fill with "fill". |
|
@jochem-brouwer I have the PR for the refactor, please take a look if you are interested! With this approach, we could remove ethRPC instance and only rely on the stub integration. |
|
If this run was generated on changes of this PR: https://github.com/NethermindEth/gas-benchmarks/actions/runs/23949903761 then this benchmark now fills correctly, or is this also fixed by #2624? |
🗒️ Description
Here is the summary for the payload verification for
test_sload_bloatedandtest_sstore_bloated.Payload Information
Related Link
Network Information
Please check
_STORAGE_BLOATED_EOA_KEYSvariable undertests/benchmark/stateful/helpers.py, and convert the private key into the account address.I verify the correctness with (1) the nonce being used and (2) the opcode count value. The verification script is as follows:
{ "name": "block-parser", "version": "1.0.0", "type": "module", "description": "Script to parse and process blockchain blocks", "main": "block.js", "scripts": { "start": "node block.js" }, "dependencies": { "@ethereumjs/tx": "^5.4.0", "@ethereumjs/util": "^9.1.0", "@ethereumjs/rlp": "^4.0.0" } }Please place them under the same folder path and run
npm install. Once completed, update the filepath in the script and runnpm startornode block.jstest_sstore_bloated
Configuration
Please check this generated-stateful-tests-stateful-perf-devnet-3-23949562466 for
test_single_opcode.py__test_sstore_bloated[fork_Osaka-benchmark_test-existing_slots_False-write_new_value_False-token_name_1GB-benchmark_90M].txtfile (undersetupfolder), i use it as an example.In the
block.jsfile, please update the filepath and points to the file mentioned above.The result shows that the nonce in the authorization list starts at 6 for
init_txand 7 forruntime_tx, which matches the on-chain nonce value.From the opcode count file for this payload generation, the (
SSTORE,SLOAD) opcode counts are (4049, 6), while the (SSTORE,SLOAD) opcode counts for the local fill mode run are (4074, 23). IMO this difference is reasonable as the local fill mode run includes the system contract interaction.I have manually reviewed the other combinations for the test. The nonce value in the payloads match the ones on the live network.
test_sload_bloated
Configuration
Please check this generated-stateful-tests-stateful-perf-devnet-3-23949903761 file for
test_single_opcode.py__test_sload_bloated[fork_Osaka-benchmark_test-existing_slots_False-token_name_1GB-benchmark_90M].txtfile (under thesetupfolder). I've reviewed the nonce value using the same approach astest_sstore_bloatedand ensure it is the same as the ones on the live network.For the opcode count, the (
SSTORE,SLOAD) pair of the payload is (41855, 6) while for local fill mode it is (41873, 30). I consider this is within the safe area, as the latter one includes the opcode count for system contract interaction.How to locally fill the test? Please follow the example command:
Postmortem
Why do we need this new
live_eth_rpcfixture? And why does the previous test run not fetch the nonce value from the network?EELS has two test modes: execute-remote, which provides an
eth_rpcfixture to interact with a live network, and fill, which has no such fixture.The previous implementation declared
eth_rpc: EthRPC | None = Noneas a test parameter, expecting execute-remote to inject the liveEthRPCinstance and fill mode to fall back toNone.However, because pytest treats a parameter with a default value as already satisfied, it never overrides the default with the actual fixture, so even in execute-remote mode,
eth_rpcwas alwaysNoneand the on-chain nonce was never fetched. The workaround introduces a newlive_eth_rpcbridge fixture that internally callsrequest.getfixturevalue("eth_rpc")to dynamically look up the real fixture when it exists (execute-remote) and returnsNonewhen it does not (fill mode); tests now declarelive_eth_rpcwithout a default, forcing pytest to always resolve it. That said, this is not an ideal long-term approach for all remaining test cases, we need a mechanism that takes a private key as input, interacts with the corresponding on-chain account, and automatically manages nonce increments, since handling this manually is fragile.🔗 Related Issues or PRs
N/A.
✅ Checklist
just statictype(scope):.mkdocs servelocally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_frommarker.Cute Animal Picture