@@ -584,12 +584,14 @@ func opJump(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byt
584584 return nil , errStopToken
585585 }
586586 pos := scope .Stack .pop ()
587- if ! scope . Contract . validJumpdest ( & pos ) {
587+ if interpreter . evm . chainRules . IsEIP4762 {
588588 statelessGas , wanted := interpreter .evm .TxContext .Accesses .TouchCodeChunksRangeAndChargeGas (scope .Contract .CodeAddr [:], pos .Uint64 (), 1 , uint64 (len (scope .Contract .Code )), false , scope .Contract .Gas )
589589 scope .Contract .UseGas (statelessGas )
590590 if statelessGas < wanted {
591591 return nil , ErrOutOfGas
592592 }
593+ }
594+ if ! scope .Contract .validJumpdest (& pos ) {
593595 return nil , ErrInvalidJump
594596 }
595597 * pc = pos .Uint64 () - 1 // pc will be increased by the interpreter loop
@@ -602,12 +604,14 @@ func opJumpi(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by
602604 }
603605 pos , cond := scope .Stack .pop (), scope .Stack .pop ()
604606 if ! cond .IsZero () {
605- if ! scope . Contract . validJumpdest ( & pos ) {
607+ if interpreter . evm . chainRules . IsEIP4762 {
606608 statelessGas , wanted := interpreter .evm .TxContext .Accesses .TouchCodeChunksRangeAndChargeGas (scope .Contract .CodeAddr [:], pos .Uint64 (), 1 , uint64 (len (scope .Contract .Code )), false , scope .Contract .Gas )
607609 scope .Contract .UseGas (statelessGas )
608610 if statelessGas < wanted {
609611 return nil , ErrOutOfGas
610612 }
613+ }
614+ if ! scope .Contract .validJumpdest (& pos ) {
611615 return nil , ErrInvalidJump
612616 }
613617 * pc = pos .Uint64 () - 1 // pc will be increased by the interpreter loop
0 commit comments