feat(tests): Add Mainnet "big-state" related tests (XEN-related attack scenarios) #2101
+598
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🗒️ 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 thenclaimMintReward()
. This is the first draft of this test, and we will expand this with more situations, such asclaimRank(1)
and thenclaimMintReward()
plusclaimRank(1)
again, or variants withclaimMintRewardAndShare(uint256,uint256)
orclaimMintRewardAndStake(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:
🔗 Related Issues or PRs
N/A.
✅ Checklist
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
type(scope):
.mkdocs serve
locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_from
marker.