Skip to content

Commit

Permalink
core/vm: merge opJumpdest to opJump/opJumpi
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco4203 committed Jul 8, 2024
1 parent 265bf11 commit ce98793
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,13 @@ func opJump(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byt
return nil, ErrInvalidJump
}
*pc = pos.Uint64()

// Next instruction is definitely opJumpDest, which does nothing, so execute it immediately by consuming the gas required and skipping it
interpreter.evm.Context.Counter++
if !scope.Contract.UseGas(params.JumpdestGas) {
return nil, ErrOutOfGas
}
*pc++
return nil, nil
}

Expand All @@ -536,6 +543,13 @@ func opJumpi(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by
return nil, ErrInvalidJump
}
*pc = pos.Uint64()

// Next instruction is definitely opJumpDest, which does nothing, so execute it immediately by consuming the gas required and skipping it
interpreter.evm.Context.Counter++
if !scope.Contract.UseGas(params.JumpdestGas) {
return nil, ErrOutOfGas
}
*pc++
} else {
*pc++
}
Expand Down

0 comments on commit ce98793

Please sign in to comment.