@@ -23,8 +23,6 @@ import {
23
23
bytesToHex ,
24
24
bytesToInt ,
25
25
concatBytes ,
26
- equalsBytes ,
27
- hexToBytes ,
28
26
setLengthLeft ,
29
27
} from '@ethereumjs/util'
30
28
import { keccak256 } from 'ethereum-cryptography/keccak.js'
@@ -33,7 +31,6 @@ import { EOFContainer, EOFContainerMode } from '../eof/container.js'
33
31
import { EOFError } from '../eof/errors.js'
34
32
import { EOFBYTES , EOFHASH , isEOF } from '../eof/util.js'
35
33
import { ERROR } from '../exceptions.js'
36
- import { DELEGATION_7702_FLAG } from '../types.js'
37
34
38
35
import {
39
36
createAddressFromStackBigInt ,
@@ -61,44 +58,6 @@ export interface AsyncOpHandler {
61
58
62
59
export type OpHandler = SyncOpHandler | AsyncOpHandler
63
60
64
- // The PR https://github.com/ethereum/EIPs/pull/8969 has two definitions of the
65
- // designator: the original (0xef0100) and the designator added in the changes (0xef01)
66
- const eip7702Designator = hexToBytes ( '0xef01' )
67
- const eip7702HashBigInt = bytesToBigInt ( keccak256 ( eip7702Designator ) )
68
-
69
- function getEIP7702DelegatedAddress ( code : Uint8Array ) {
70
- if ( equalsBytes ( code . slice ( 0 , 3 ) , DELEGATION_7702_FLAG ) ) {
71
- return new Address ( code . slice ( 3 , 24 ) )
72
- }
73
- }
74
-
75
- /**
76
- * This method performs checks to transform the code which the EVM observes regarding EIP-7702.
77
- * If the code is 7702-delegated code, it will retrieve the code of the designated address
78
- * in case of an executable operation (`isReadOperation` == false), or the 7702 designator
79
- * code in case of a read operation
80
- * @param runState
81
- * @param code
82
- * @param isReadOperation Boolean to determine if the target code is meant to be read or executed (default: `false`)
83
- * @returns
84
- */
85
- async function eip7702CodeCheck (
86
- runState : RunState ,
87
- code : Uint8Array ,
88
- isReadOperation : boolean = false ,
89
- ) {
90
- const address = getEIP7702DelegatedAddress ( code )
91
- if ( address !== undefined ) {
92
- if ( isReadOperation ) {
93
- return eip7702Designator
94
- } else {
95
- return runState . stateManager . getCode ( address )
96
- }
97
- }
98
-
99
- return code
100
- }
101
-
102
61
// the opcode functions
103
62
export const handlers : Map < number , OpHandler > = new Map ( [
104
63
// 0x00: STOP
@@ -551,17 +510,15 @@ export const handlers: Map<number, OpHandler> = new Map([
551
510
// 0x3b: EXTCODESIZE
552
511
[
553
512
0x3b ,
554
- async function ( runState , common ) {
513
+ async function ( runState ) {
555
514
const addressBigInt = runState . stack . pop ( )
556
515
const address = createAddressFromStackBigInt ( addressBigInt )
557
516
// EOF check
558
- let code = await runState . stateManager . getCode ( address )
517
+ const code = await runState . stateManager . getCode ( address )
559
518
if ( isEOF ( code ) ) {
560
519
// In legacy code, the target code is treated as to be "EOFBYTES" code
561
520
runState . stack . push ( BigInt ( EOFBYTES . length ) )
562
521
return
563
- } else if ( common . isActivatedEIP ( 7702 ) ) {
564
- code = await eip7702CodeCheck ( runState , code , true )
565
522
}
566
523
567
524
const size = BigInt ( code . length )
@@ -572,7 +529,7 @@ export const handlers: Map<number, OpHandler> = new Map([
572
529
// 0x3c: EXTCODECOPY
573
530
[
574
531
0x3c ,
575
- async function ( runState , common ) {
532
+ async function ( runState ) {
576
533
const [ addressBigInt , memOffset , codeOffset , dataLength ] = runState . stack . popN ( 4 )
577
534
578
535
if ( dataLength !== BIGINT_0 ) {
@@ -582,8 +539,6 @@ export const handlers: Map<number, OpHandler> = new Map([
582
539
if ( isEOF ( code ) ) {
583
540
// In legacy code, the target code is treated as to be "EOFBYTES" code
584
541
code = EOFBYTES
585
- } else if ( common . isActivatedEIP ( 7702 ) ) {
586
- code = await eip7702CodeCheck ( runState , code , true )
587
542
}
588
543
589
544
const data = getDataSlice ( code , codeOffset , dataLength )
@@ -596,7 +551,7 @@ export const handlers: Map<number, OpHandler> = new Map([
596
551
// 0x3f: EXTCODEHASH
597
552
[
598
553
0x3f ,
599
- async function ( runState , common ) {
554
+ async function ( runState ) {
600
555
const addressBigInt = runState . stack . pop ( )
601
556
const address = createAddressFromStackBigInt ( addressBigInt )
602
557
@@ -607,13 +562,6 @@ export const handlers: Map<number, OpHandler> = new Map([
607
562
// Therefore, push the hash of EOFBYTES to the stack
608
563
runState . stack . push ( bytesToBigInt ( EOFHASH ) )
609
564
return
610
- } else if ( common . isActivatedEIP ( 7702 ) ) {
611
- const possibleDelegatedAddress = getEIP7702DelegatedAddress ( code )
612
- if ( possibleDelegatedAddress !== undefined ) {
613
- // The account is delegated by an EIP-7702 tx. Push the EIP-7702 designator hash to the stack
614
- runState . stack . push ( eip7702HashBigInt )
615
- return
616
- }
617
565
}
618
566
619
567
const account = await runState . stateManager . getAccount ( address )
0 commit comments