-
Couldn't load subscription status.
- Fork 185
refactor(benchmark): update to benchmark test wrapper #2160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(benchmark): update to benchmark test wrapper #2160
Conversation
eb1fc44 to
619f1cf
Compare
41bc03e to
cc03678
Compare
beb239d to
b51eba1
Compare
b51eba1 to
50b6b30
Compare
|
The change in the PR might be large, but it could be split into smaller parts:
Below are files that contains smaller amount of test cases, it would be nice if someone could first review some of them, so that i could apply initial feedback to the remaining cases.
This is the largest one, but most of the changes are identical, i already documented the tests that contains logic changes above.
|
5d5ffda to
d77d3a4
Compare
|
The opcode count comparison result: https://gist.github.com/LouisTsai-Csie/74189c969201871d641a785ab9966090 |
|
Pushed a commit that changes the following:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I left only two comments but it's fine by me if we instead create issues for them.
e2f2024 to
454bdd6
Compare
|
Thanks @marioevz for the fix, i rebase the code and fix some issue.
This is final comparison, except Please review the discussion above for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved again!
I've fixed the setup_blocks for them to always be included in the test.
* refactor(benchmark): update code generator interface * refactor(benchmark): update worst bytecode scenario * refactor(benchmark): update worst compute scenario * refactor(benchmark): update worst memory scenario * refactor(benchmark): update worst opcode scenario * refactor(benchmark): update worst statefule scenario * refactor(benchmark): update modexp cases by parameterization * refactor: remove blockchain filler in worst block cases * refactor: update blockhash case * fix: resolve failing blob and block has tests * fix: update linting comment length * fix linting and typing issue * fix incorrect logic for missing coverage * refactor unop worst case * refactor(tests/benchmark): Optimize generators usages * refactor(benchmark): Improve max_iterations calculation * feat(benchmark): add setup_blocks and update tests * fix(specs): Make sure setup blocks are always used --------- Co-authored-by: Mario Vega <[email protected]>
🗒️ Description
Enhanced Interface
In the original benchmark helpers, the repeated code pattern is structured as:
This PR adds a new cleanup section before each iteration, and the interface change accordingly:
Refactoring target
Updating to benchmark wrapper
JumpLoopGeneratororExtCodeGeneratorfor repeated pattern.Unifying the variable names
setupfor the code pattern before thebytecodeloop (instead ofcode_prefix,calldata).attack_blockfor the actual benchmark execution pattern (instead ofcode_loop_body,attack_iter,code_sequence,loop_body,code_segment,op_sequence, oriter_block).cleanupfor the phase after the execution loop (instead ofcode_suffix,code_loop_footer).gas_benchmark_valuefor the benchmark gas limit (instead ofattack_gas_limit).tx_gas_limitfor the transaction gas limit cap (instead oftx_gas_limit_cap) -> this should be avoided as the wrapper automatically handle such scenario.Removing redundant parameters
gas_benchmark_valueas it is configured automaticallyfork,envparam if not used in functionImplementation Note
Most of the test logic remains the same, but the following cases differ and may be worth a closer look from reviewers.
test_worst_returndatasize_zerotest_worst_keccaktest_worst_binop_simpletest_worst_unoptest_worst_calldatacopytest_block_full_datatest_worst_blockhashSome test cases have not been refactored, as they would require significantly more effort and may even need to be rewritten. I suggest skipping these for now and updating them in a separate PR:
test_worst_bytecode_single_opcodeAdditionally, some test cases may fail on the Osaka fork:
test_worst_address_state_coldtest_worst_selfdestruct_existingtest_worst_selfdestruct_createdtest_worst_selfdestruct_initcode🔗 Related Issues or PRs
Requires PR #1956 and PR #1945
Relevant discussion: issue ethereum/execution-specs#1557
✅ Checklist
toxchecks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx --with=tox-uv tox -e lint,typecheck,spellcheck,markdownlinttype(scope):.mkdocs servelocally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_frommarker.