Skip to content

fix(tests/zkevm): update jump seq for valid dest #1710

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

LouisTsai-Csie
Copy link
Collaborator

@LouisTsai-Csie LouisTsai-Csie commented Jun 3, 2025

🗒️ Description

There is an issue with the original test case: the jump target is not a valid JUMPDEST operation.
More details could be found in the discussion.

The updated version precomputes valid jump destinations to improve the density of JUMP operations.

The repeated pattern is structured as follows:

0x00 PUSH2 DEST
0x03 JUMP
0x04 JUMPDEST
...

The first JUMPDEST is at offset 0x04. Since each pattern occupies 5 bytes, subsequent JUMPDEST locations can be calculated as 4 + 5 * i, where i is the pattern index. The total code size must remain within the allowed limit.

🔗 Related Issues

✅ Checklist

  • All: Set appropriate labels for the changes.
  • All: Considered squashing commits to improve commit history.
  • All: Added an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • Tests: All converted JSON/YML tests from ethereum/tests/tests/static have been assigned @ported_from marker.
  • Tests: A PR with removal of converted JSON/YML blockchain tests from ethereum/tests have been opened.
  • Tests: Included the type and version of evm t8n tool used to locally execute test cases: e.g., ref with commit hash or geth 1.13.1-stable-3f40e65.
  • 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.

def jump_seq():
return Op.JUMP(Op.ADD(Op.PC, 1)) + Op.JUMPDEST
def jump_seq(dest: int):
return Op.JUMP(Op.PUSH2(dest)) + Op.JUMPDEST
Copy link
Member

@jochem-brouwer jochem-brouwer Jun 4, 2025

Choose a reason for hiding this comment

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

I think this test should be written as Op.JUMPDEST + Op.JUMP(Op.PUSH0) (no need for a loop) 😄 👍

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.

2 participants