Skip to content

Conversation

jochem-brouwer
Copy link
Member

@jochem-brouwer jochem-brouwer commented Sep 4, 2025

🗒️ Description

This PR adds tests to test the very big in state XEN contract in various situations. To actually test this, ensure that your state backend reflects the big mainnet size, i.e. run this on top of a mainnet fork. This test uses address stubs as described in #2073

For this test, you need to provide: --address-stubs '{"XEN_CONTRACT": "0x06450dEe7FD2Fb8E39061434BAbCFC05599a6Fb8", "MATH_CONTRACT": "0x4bBA9B6B49f3dFA6615f079E9d66B0AA68B04A4d"}' to use the mainnet contracts for this.

The initial test claimRank(1) and then claimMintReward(). This is the first draft of this test, and we will expand this with more situations, such as claimRank(1) and then claimMintReward() plus claimRank(1) again, or variants with claimMintRewardAndShare(uint256,uint256) or claimMintRewardAndStake(uint256,uint256).

NOTE: the test sets the timestamp automatically by moving it forward 3600*24 seconds.

Will be merge ready once this is tested so we know if this works and if test cases are added.

TODOs:

  • Add sanity checks in the test to ensure that the calls into XEN do what we expect
  • Ensure that the test fills the entire block for a performance test (so calculate how many proxy contracts we can create -> currently hardcoded at 10)
  • Add more scenarios
  • Check with EEST: if address stubs are not provided, test does not error out if these stubs are not there. Is this wanted?

🔗 Related Issues or PRs

N/A.

✅ Checklist

  • All: Ran fast tox checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    uvx --with=tox-uv tox -e lint,typecheck,spellcheck,markdownlint
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Considered adding an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.
  • Tests: For PRs implementing a missed test case, update the post-mortem document to add an entry the list.
  • Ported Tests: All converted JSON/YML tests from ethereum/tests or tests/static have been assigned @ported_from marker.

@jochem-brouwer jochem-brouwer added the scope:tests Scope: Changes EL client test cases in `./tests` label Sep 4, 2025
@jochem-brouwer
Copy link
Member Author

image

7.7k SSTOREs using already-existing (this is setup in the deployment phase of the test) storage keys of the XEN contract, mainnet fork, 60M gas, running at 310MGas/s. This is however a test in ideal circumstances: no peering, no reorgs, no txpool, no nothing, but this does look promising.

I'd also like to see what happens on perfnet-2 where the client is under more stress.

NOTE: These are of course super preliminary results, I have to spin up the other clients and to gather reliable results.

@jochem-brouwer jochem-brouwer changed the title feat(tests): add initial XEN test feat(tests): Add Mainnet "big-state" related tests (XEN-related attack scenarios) Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:tests Scope: Changes EL client test cases in `./tests`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant