refactor(test-benchmark): update test_account_access, add keccak256 overhead scenario#2947
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #2947 +/- ##
===================================================
+ Coverage 90.32% 93.21% +2.88%
===================================================
Files 620 620
Lines 36686 38793 +2107
Branches 3341 3342 +1
===================================================
+ Hits 33138 36160 +3022
+ Misses 2979 1773 -1206
- Partials 569 860 +291
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
9561e54 to
b5832cd
Compare
|
I've rebased the PR and updated the description, please review and integrate contract deployment into state-actor. cc @jochem-brouwer |
6ef4781 to
4f7cf29
Compare
4f7cf29 to
e45bc6d
Compare
00a346c to
8525c02
Compare
| # Runtime only uses MEM[0:0x6000]. | ||
| code = Op.MSTORE(0, bytes(Op.JUMPDEST * 32)) | ||
| for size in (1 << s for s in range(5, 15)): | ||
| code += Op.MCOPY(size, 0, size) |
There was a problem hiding this comment.
It helps if this has the hint 1 << 5 = 32 (so the first MCOPY is Op.MCOPY(32, 0, 32) (so it copies the just MSTOREd 32 bytes of JUMPDEST from 0-32 to offset 32, i.e. doubles the memory which has JUMPDEST, and the initial code for this is correct)
8525c02 to
7ea7b98
Compare
| # Runtime code size of the jochemnet contract (EIP-170 limit). | ||
| JOCHEMNET_RUNTIME_SIZE = 0x6000 | ||
|
|
There was a problem hiding this comment.
Based on my current understanding, we want to do the repricing based on the old max code size value (0x6000), could you please confirm? cc @jochem-brouwer
This is applied to all the following contract variants. Note that if i use fork.max_code_size() instead, this would be affected by eip-7954.
| # Deterministic EIP-7702 delegate authorities: | ||
| # Authority i delegates to EXISTING_CONTRACT_DIFF receiver i. | ||
| DELEGATE_BASE_KEY = int.from_bytes( | ||
| keccak256(b"gas-repricings-7702-delegate"), "big" | ||
| ) |
There was a problem hiding this comment.
Starting from this range, we delegate to EXISTING_CONTRACT_DIFF contracts for a certain count. See test_deploy_existing_contracts. I need to verify if the current count is sufficient.
7c586e4 to
7ea7b98
Compare
🗒️ Description
The original
test_account_accesstargets contracts created by theBittrexcontroller factory. This requiresCREATEaddress calculations, introducing significant overhead and it is hard to precisely control overEXPandKECCAK256inputs.We introduced several changes in this PR:
test_account_accessfromtest_single_opcode.pytotest_account_query.pyEXISTING_CONTRACTparametrization, addingEXISTING_CONTRACT_MINIMAL,EXISTING_CONTRACT_SAMEandEXISTING_CONTRACT_DIFFparametrization.account_creator.pyandaccount_sender_receiver.py-> we should removetests/benchmark/{compute, stateful}/helpers.pyin the future to share the helper function.test_deploy_existing_contractsthat would be used for contract deployment, this includes deployingEXISTING_CONTRACT_*instance and necessary delegation.deployed contract and initcode for each parametrization:
EXISTING_CONTRACT_MINIMAL
initcode:
RETURN(PUSH1(0), PUSH1(1))deployed code:
STOPEXISTING_CONTRACT_SAME
initcode:
deployed code:
STOP JUMPDEST JUMPDEST ... ... ... JUMPDEST (fill until max code size)
EXISTING_CONTRACT_DIFF
initcode:
deployed code:
STOP STOP ... STOP ADDRESS JUMPDEST ... ... ... JUMPDEST (fill until max code size)
🔗 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