Skip to content

feat(fixtures,specs,types): Verify address collisions during pre-alloc grouping phase #1922

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

marioevz
Copy link
Member

🗒️ Description

Detects different tests writing different accounts to the same address in the pre-allocation in the same group, and fails early if that's the case.

It works by the following procedure:

  • When the test function finishes writing to the test's pre and the grouping logic tries to flush the pre into the existing grouping's pre, it first collects keys existing in both allocations.
  • If there is an address that is present in both allocations, the accounts are compared an expected to be exactly equal.
  • If the accounts are equal, the grouping continues: This works because the pre-allocation is located in the genesis and we revert to genesis during consume engine-x, so even though the two tests access and (potentially) modify the same account, when the revert to genesis happens the account also reverts to the original state expected by both tests.
  • If no collisions were detected in any of the tests assigned to the worker, the grouped pre-allocation is saved to file.
  • If a worker attempts to write to file and a group file is already there (two tests in different workers using the same grouping for example), when the files are merged the collision detection is also enabled.
  • The phase-1 of the pre-alloc grouping fails if the collision is detected at any point.

This is helpful to debug static tests and quickly detect when two static tests with same hard-coded addresses interfere with each other.

🔗 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).

@marioevz marioevz requested a review from felix314159 July 17, 2025 22:13
@marioevz marioevz added type:feat type: Feature scope:fill Scope: fill command labels Jul 17, 2025
@felix314159
Copy link
Collaborator

Can you provide an example command (ideally a minimal / fast one) that we can use to see the different behavior (before this PR vs after the PR)?

@marioevz
Copy link
Member Author

Can you provide an example command (ideally a minimal / fast one) that we can use to see the different behavior (before this PR vs after the PR)?

You can try this command:

uv run fill --clean --fork=Cancun --fill-static-tests --generate-pre-alloc-groups tests/static/state_tests/Shanghai/stEIP3855_push0/ -x

Before and after this PR: before it fails until the second phase, and after it fails during the first phase because it detects the collision early.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:fill Scope: fill command type:feat type: Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants