Skip to content

Conversation

@jsign
Copy link
Collaborator

@jsign jsign commented Dec 8, 2025

🗒️ Description

This PR fixes the est_ext_account_query_cold benchmark to work in Osaka.

To validate this still does what we want, tested with 30M attack:

  • Before this PR with Prague:
    • test_account_query.py::test_ext_account_query_cold[fork_Prague-blockchain_test-absent_accounts_False-opcode_BALANCE] = 214M cycles
    • test_account_query.py::test_ext_account_query_cold[fork_Prague-blockchain_test-absent_accounts_True-opcode_BALANCE] = 98M cycles
  • With this PR:
    • Filled with Osaka:
      • test_account_query.py::test_ext_account_query_cold[fork_Prague-blockchain_test-absent_accounts_False-opcode_BALANCE] = 213M cycles
      • test_account_query.py::test_ext_account_query_cold[fork_Prague-blockchain_test-absent_accounts_True-opcode_BALANCE] = 96M cycles
      • Conclusion: the difference sounds reasonable reg the gas lost in partitioning in txs.
    • Filled with Prague:
      • test_account_query.py::test_ext_account_query_cold[fork_Prague-blockchain_test-absent_accounts_False-opcode_BALANCE] = 214M cycles
      • test_account_query.py::test_ext_account_query_cold[fork_Prague-blockchain_test-absent_accounts_True-opcode_BALANCE] = 98M cycles
      • Conclusion: same as pre-PR.

🔗 Related Issues or PRs

#1695

✅ Checklist

  • All: Ran fast tox checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    uvx tox -e static
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).

)
else:
max_creations_per_tx = num_target_accounts
factory_code = (
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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,
Copy link
Collaborator Author

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.

Comment on lines +543 to +544
Op.CALLDATALOAD(0) # address_start
+ Op.CALLDATALOAD(32) # num_to_query
Copy link
Collaborator Author

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.

@jsign jsign marked this pull request as ready for review December 8, 2025 14:49
@jsign jsign requested a review from LouisTsai-Csie December 8, 2025 14:49
@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.31%. Comparing base (519eb26) to head (b33f648).
⚠️ Report is 25 commits behind head on forks/osaka.

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     
Flag Coverage Δ
unittests 87.31% <ø> (+33.86%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant