Skip to content

ISSUE 251 (added JUMPDEST validation and invalid jump test cases)#471

Merged
0xkarmacoma merged 2 commits into
a16z:mainfrom
Jayakumar2812:fix-jumpdest-validation
Mar 7, 2025
Merged

ISSUE 251 (added JUMPDEST validation and invalid jump test cases)#471
0xkarmacoma merged 2 commits into
a16z:mainfrom
Jayakumar2812:fix-jumpdest-validation

Conversation

@Jayakumar2812

Copy link
Copy Markdown
Contributor

ISSUE 251

JUMPDEST VALIDATION

  • Updated SEVM.jump() to enforce valid jump destinations (Lines 2873-2876):
         target = int_of(dst)
         if target not in ex.pgm.valid_jump_destinations():
             # Invalid jump target – halt execution
             raise InvalidJumpDestError(f"Invalid jump destination: 0x{target:X}")
  • Updated SEVM.jumpi() to enforce JUMPDEST validation (Lines 2837-2838):
         if target not in ex.pgm.valid_jump_destinations():
             raise InvalidJumpDestError(f"Invalid jump destination: 0x{target:X}")

ADDED VALID AND INVALID JUMP & JUMPI TEST CASES

  • test_valid_jump()
  • test_invalid_jump()
  • test_valid_jumpi()
  • test_invalid_jumpi()
  • test_jumpi_false_no_error()
  • test_jump_into_push_data()

Comment thread tests/test_sevm.py Outdated
Comment thread tests/test_sevm.py Outdated
Comment thread tests/test_sevm.py Outdated
Comment thread tests/test_sevm.py Outdated
Comment thread tests/test_sevm.py Outdated

@0xkarmacoma 0xkarmacoma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking good now, thanks @Jayakumar2812!

@0xkarmacoma

Copy link
Copy Markdown
Contributor

Fixes #251

@0xkarmacoma 0xkarmacoma merged commit 2a5632f into a16z:main Mar 7, 2025
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