@@ -23,8 +23,6 @@ import (
23
23
24
24
"github.com/ethereum/go-ethereum/common"
25
25
"github.com/ethereum/go-ethereum/core/tracing"
26
- "github.com/ethereum/go-ethereum/core/types"
27
- "github.com/ethereum/go-ethereum/crypto"
28
26
"github.com/ethereum/go-ethereum/params"
29
27
"github.com/holiman/uint256"
30
28
)
@@ -709,65 +707,8 @@ func enableEOF(jt *JumpTable) {
709
707
}
710
708
}
711
709
712
- // opExtCodeCopyEIP7702 implements the EIP-7702 variation of opExtCodeCopy.
713
- func opExtCodeCopyEIP7702 (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
714
- var (
715
- stack = scope .Stack
716
- a = stack .pop ()
717
- memOffset = stack .pop ()
718
- codeOffset = stack .pop ()
719
- length = stack .pop ()
720
- )
721
- uint64CodeOffset , overflow := codeOffset .Uint64WithOverflow ()
722
- if overflow {
723
- uint64CodeOffset = math .MaxUint64
724
- }
725
- code := interpreter .evm .StateDB .GetCode (common .Address (a .Bytes20 ()))
726
- if _ , ok := types .ParseDelegation (code ); ok {
727
- code = types .DelegationPrefix [:2 ]
728
- }
729
- codeCopy := getData (code , uint64CodeOffset , length .Uint64 ())
730
- scope .Memory .Set (memOffset .Uint64 (), length .Uint64 (), codeCopy )
731
-
732
- return nil , nil
733
- }
734
-
735
- // opExtCodeSizeEIP7702 implements the EIP-7702 variation of opExtCodeSize.
736
- func opExtCodeSizeEIP7702 (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
737
- slot := scope .Stack .peek ()
738
- code := interpreter .evm .StateDB .GetCode (common .Address (slot .Bytes20 ()))
739
- if _ , ok := types .ParseDelegation (code ); ok {
740
- code = types .DelegationPrefix [:2 ]
741
- }
742
- slot .SetUint64 (uint64 (len (code )))
743
- return nil , nil
744
- }
745
-
746
- // opExtCodeHashEIP7702 implements the EIP-7702 variation of opExtCodeHash.
747
- func opExtCodeHashEIP7702 (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
748
- slot := scope .Stack .peek ()
749
- addr := common .Address (slot .Bytes20 ())
750
- if interpreter .evm .StateDB .Empty (addr ) {
751
- slot .Clear ()
752
- return nil , nil
753
- }
754
- code := interpreter .evm .StateDB .GetCode (addr )
755
- if _ , ok := types .ParseDelegation (code ); ok {
756
- // If the code is a delegation, return the prefix without version.
757
- slot .SetBytes (crypto .Keccak256 (types .DelegationPrefix [:2 ]))
758
- } else {
759
- // Otherwise, return normal code hash.
760
- slot .SetBytes (interpreter .evm .StateDB .GetCodeHash (addr ).Bytes ())
761
- }
762
- return nil , nil
763
- }
764
-
765
710
// enable7702 the EIP-7702 changes to support delegation designators.
766
711
func enable7702 (jt * JumpTable ) {
767
- jt [EXTCODECOPY ].execute = opExtCodeCopyEIP7702
768
- jt [EXTCODESIZE ].execute = opExtCodeSizeEIP7702
769
- jt [EXTCODEHASH ].execute = opExtCodeHashEIP7702
770
-
771
712
jt [CALL ].dynamicGas = gasCallEIP7702
772
713
jt [CALLCODE ].dynamicGas = gasCallCodeEIP7702
773
714
jt [STATICCALL ].dynamicGas = gasStaticCallEIP7702
0 commit comments