-
Notifications
You must be signed in to change notification settings - Fork 395
feat(benchmarks): fix benchmark for BALANCE scenario for Osaka #1862
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
base: forks/osaka
Are you sure you want to change the base?
Conversation
Signed-off-by: Ignacio Hagopian <[email protected]>
| ) | ||
| else: | ||
| max_creations_per_tx = num_target_accounts | ||
| factory_code = ( |
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.
TL;DR: the factory code that creates the accounts (if not absent_accounts), just creates the maximum allowed per tx in this setup phase. If in >= Osaka, it does a safe estimation so the setup phase doens't fail. If < Osaka, just does one transaction as before.
| else: | ||
| max_creations_per_tx = num_target_accounts | ||
| factory_code = ( | ||
| Op.CALLDATALOAD(0) # addr_start |
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.
For >= Osaka, we need this extra CALLDATALOAD so the setup phase with multiple txs keeps creating the target accounts in a continuous way.
| Transaction( | ||
| to=factory_address, | ||
| data=Hash(addr_start), | ||
| gas_limit=tx_gas_limit_cap or env.gas_limit, |
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.
Depending on < Osaka or >= Osaka the gas limit is different if we can fit or not in 1 tx.
| Op.CALLDATALOAD(0) # address_start | ||
| + Op.CALLDATALOAD(32) # num_to_query |
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.
For >= Osaka, the attack code now has two new parameters via CALLDATALOAD, which are required for all the attacking txs to target their respective (non-overlapping) accounts.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/osaka #1862 +/- ##
================================================
+ Coverage 53.45% 87.31% +33.86%
================================================
Files 743 541 -202
Lines 44076 32832 -11244
Branches 3891 3015 -876
================================================
+ Hits 23559 28668 +5109
+ Misses 20306 3557 -16749
- Partials 211 607 +396
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:
|
🗒️ Description
This PR fixes the
est_ext_account_query_coldbenchmark to work in Osaka.To validate this still does what we want, tested with 30M attack:
test_account_query.py::test_ext_account_query_cold[fork_Prague-blockchain_test-absent_accounts_False-opcode_BALANCE]= 214M cyclestest_account_query.py::test_ext_account_query_cold[fork_Prague-blockchain_test-absent_accounts_True-opcode_BALANCE]= 98M cyclestest_account_query.py::test_ext_account_query_cold[fork_Prague-blockchain_test-absent_accounts_False-opcode_BALANCE]= 213M cyclestest_account_query.py::test_ext_account_query_cold[fork_Prague-blockchain_test-absent_accounts_True-opcode_BALANCE]= 96M cyclestest_account_query.py::test_ext_account_query_cold[fork_Prague-blockchain_test-absent_accounts_False-opcode_BALANCE]= 214M cyclestest_account_query.py::test_ext_account_query_cold[fork_Prague-blockchain_test-absent_accounts_True-opcode_BALANCE]= 98M cycles🔗 Related Issues or PRs
#1695
✅ Checklist
toxchecks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx tox -e statictype(scope):.