Skip to content

Commit

Permalink
evm: fix swapn stack validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jochem-brouwer committed Aug 7, 2024
1 parent d2cef57 commit 1a8e23a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/evm/src/eof/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,7 @@ function validateOpcodes(
} else if (opcode === 0xe7) {
// SWAPN
const toSwap = code[ptr + 1]
// TODO: EVMONEs test wants this to be `toSwap + 2`, but that seems to be incorrect
// Will keep `toSwap + 1` for now
if (toSwap + 1 > minStackCurrent) {
if (toSwap + 2 > minStackCurrent) {
validationError(EOFError.StackUnderflow)
}
} else if (opcode === 0xe8) {
Expand Down

0 comments on commit 1a8e23a

Please sign in to comment.