Skip to content

feat(tests): add test for large args offset with size zero on CALL opcode #2057

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 1 commit into
base: main
Choose a base branch
from

Conversation

JereSalo
Copy link
Contributor

🗒️ Description

Hi! I believe a test like this exists for other opcodes but not for CALL, it is one of those that have a very large offset but size zero and therefore execution shouldn't revert because of the offset. In ethrex we had a bug that was fixed in this PR. I created this test and tried it out before and after the fix and it detects the bug.
I am making these tests just for the CALL opcode but they apply to all xCALL opcodes, I don't know what the nicest way of making this more generic is. But generally this would be enough because these opcodes tend to have pretty similar logic inside of them.

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

@JereSalo JereSalo marked this pull request as ready for review August 20, 2025 21:00
Comment on lines +154 to +159
@pytest.mark.valid_from("Berlin")
def test_call_large_args_offset_size_zero(
state_test: StateTestFiller,
pre: Alloc,
fork: Fork,
):
Copy link
Collaborator

@LouisTsai-Csie LouisTsai-Csie Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! If you want to expand the test to all the call related operation, you can parametrize these ops like:

@pytest.mark.parametrize(
    "call_opcode",
    [
        Op.STATICCALL,
        Op.DELEGATECALL,
        Op.CALLCODE,
    ],
)

And then pass these opcode in the function, and replace the Op.CALL with call_opcode in your test.

@pytest.mark.valid_from("Berlin")
def test_call_large_args_offset_size_zero(
    state_test: StateTestFiller,
    pre: Alloc,
    fork: Fork,
+  call_opcode: Op
):

Some reference implementation here, here and here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this comment, and ideally we can use @pytest.mark.with_all_call_opcodes in this case.

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.

3 participants