Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit ce98793

Browse files
committed
core/vm: merge opJumpdest to opJump/opJumpi
1 parent 265bf11 commit ce98793

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

core/vm/instructions.go

+14
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,13 @@ func opJump(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byt
526526
return nil, ErrInvalidJump
527527
}
528528
*pc = pos.Uint64()
529+
530+
// Next instruction is definitely opJumpDest, which does nothing, so execute it immediately by consuming the gas required and skipping it
531+
interpreter.evm.Context.Counter++
532+
if !scope.Contract.UseGas(params.JumpdestGas) {
533+
return nil, ErrOutOfGas
534+
}
535+
*pc++
529536
return nil, nil
530537
}
531538

@@ -536,6 +543,13 @@ func opJumpi(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by
536543
return nil, ErrInvalidJump
537544
}
538545
*pc = pos.Uint64()
546+
547+
// Next instruction is definitely opJumpDest, which does nothing, so execute it immediately by consuming the gas required and skipping it
548+
interpreter.evm.Context.Counter++
549+
if !scope.Contract.UseGas(params.JumpdestGas) {
550+
return nil, ErrOutOfGas
551+
}
552+
*pc++
539553
} else {
540554
*pc++
541555
}

0 commit comments

Comments
 (0)