@@ -89,8 +89,8 @@ func enable1884(jt *JumpTable) {
89
89
}
90
90
}
91
91
92
- func opSelfBalance (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
93
- balance := interpreter . evm .StateDB .GetBalance (scope .Contract .Address ())
92
+ func opSelfBalance (pc * uint64 , evm * EVM , scope * ScopeContext ) ([]byte , error ) {
93
+ balance := evm .StateDB .GetBalance (scope .Contract .Address ())
94
94
scope .Stack .push (balance )
95
95
return nil , nil
96
96
}
@@ -108,8 +108,8 @@ func enable1344(jt *JumpTable) {
108
108
}
109
109
110
110
// opChainID implements CHAINID opcode
111
- func opChainID (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
112
- chainId , _ := uint256 .FromBig (interpreter . evm .chainConfig .ChainID )
111
+ func opChainID (pc * uint64 , evm * EVM , scope * ScopeContext ) ([]byte , error ) {
112
+ chainId , _ := uint256 .FromBig (evm .chainConfig .ChainID )
113
113
scope .Stack .push (chainId )
114
114
return nil , nil
115
115
}
@@ -199,28 +199,28 @@ func enable1153(jt *JumpTable) {
199
199
}
200
200
201
201
// opTload implements TLOAD opcode
202
- func opTload (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
202
+ func opTload (pc * uint64 , evm * EVM , scope * ScopeContext ) ([]byte , error ) {
203
203
loc := scope .Stack .peek ()
204
204
hash := common .Hash (loc .Bytes32 ())
205
- val := interpreter . evm .StateDB .GetTransientState (scope .Contract .Address (), hash )
205
+ val := evm .StateDB .GetTransientState (scope .Contract .Address (), hash )
206
206
loc .SetBytes (val .Bytes ())
207
207
return nil , nil
208
208
}
209
209
210
210
// opTstore implements TSTORE opcode
211
- func opTstore (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
212
- if interpreter .readOnly {
211
+ func opTstore (pc * uint64 , evm * EVM , scope * ScopeContext ) ([]byte , error ) {
212
+ if evm .readOnly {
213
213
return nil , ErrWriteProtection
214
214
}
215
215
loc := scope .Stack .pop ()
216
216
val := scope .Stack .pop ()
217
- interpreter . evm .StateDB .SetTransientState (scope .Contract .Address (), loc .Bytes32 (), val .Bytes32 ())
217
+ evm .StateDB .SetTransientState (scope .Contract .Address (), loc .Bytes32 (), val .Bytes32 ())
218
218
return nil , nil
219
219
}
220
220
221
221
// opBaseFee implements BASEFEE opcode
222
- func opBaseFee (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
223
- baseFee , _ := uint256 .FromBig (interpreter . evm .Context .BaseFee )
222
+ func opBaseFee (pc * uint64 , evm * EVM , scope * ScopeContext ) ([]byte , error ) {
223
+ baseFee , _ := uint256 .FromBig (evm .Context .BaseFee )
224
224
scope .Stack .push (baseFee )
225
225
return nil , nil
226
226
}
@@ -237,7 +237,7 @@ func enable3855(jt *JumpTable) {
237
237
}
238
238
239
239
// opPush0 implements the PUSH0 opcode
240
- func opPush0 (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
240
+ func opPush0 (pc * uint64 , evm * EVM , scope * ScopeContext ) ([]byte , error ) {
241
241
scope .Stack .push (new (uint256.Int ))
242
242
return nil , nil
243
243
}
@@ -263,7 +263,7 @@ func enable5656(jt *JumpTable) {
263
263
}
264
264
265
265
// opMcopy implements the MCOPY opcode (https://eips.ethereum.org/EIPS/eip-5656)
266
- func opMcopy (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
266
+ func opMcopy (pc * uint64 , evm * EVM , scope * ScopeContext ) ([]byte , error ) {
267
267
var (
268
268
dst = scope .Stack .pop ()
269
269
src = scope .Stack .pop ()
@@ -276,10 +276,10 @@ func opMcopy(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]by
276
276
}
277
277
278
278
// opBlobHash implements the BLOBHASH opcode
279
- func opBlobHash (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
279
+ func opBlobHash (pc * uint64 , evm * EVM , scope * ScopeContext ) ([]byte , error ) {
280
280
index := scope .Stack .peek ()
281
- if index .LtUint64 (uint64 (len (interpreter . evm .TxContext .BlobHashes ))) {
282
- blobHash := interpreter . evm .TxContext .BlobHashes [index .Uint64 ()]
281
+ if index .LtUint64 (uint64 (len (evm .TxContext .BlobHashes ))) {
282
+ blobHash := evm .TxContext .BlobHashes [index .Uint64 ()]
283
283
index .SetBytes32 (blobHash [:])
284
284
} else {
285
285
index .Clear ()
@@ -288,14 +288,14 @@ func opBlobHash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([
288
288
}
289
289
290
290
// opBlobBaseFee implements BLOBBASEFEE opcode
291
- func opBlobBaseFee (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
292
- blobBaseFee , _ := uint256 .FromBig (interpreter . evm .Context .BlobBaseFee )
291
+ func opBlobBaseFee (pc * uint64 , evm * EVM , scope * ScopeContext ) ([]byte , error ) {
292
+ blobBaseFee , _ := uint256 .FromBig (evm .Context .BlobBaseFee )
293
293
scope .Stack .push (blobBaseFee )
294
294
return nil , nil
295
295
}
296
296
297
297
// opCLZ implements the CLZ opcode (count leading zero bytes)
298
- func opCLZ (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
298
+ func opCLZ (pc * uint64 , evm * EVM , scope * ScopeContext ) ([]byte , error ) {
299
299
x := scope .Stack .peek ()
300
300
x .SetUint64 (256 - uint64 (x .BitLen ()))
301
301
return nil , nil
@@ -342,7 +342,7 @@ func enable6780(jt *JumpTable) {
342
342
}
343
343
}
344
344
345
- func opExtCodeCopyEIP4762 (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
345
+ func opExtCodeCopyEIP4762 (pc * uint64 , evm * EVM , scope * ScopeContext ) ([]byte , error ) {
346
346
var (
347
347
stack = scope .Stack
348
348
a = stack .pop ()
@@ -355,10 +355,10 @@ func opExtCodeCopyEIP4762(pc *uint64, interpreter *EVMInterpreter, scope *ScopeC
355
355
uint64CodeOffset = math .MaxUint64
356
356
}
357
357
addr := common .Address (a .Bytes20 ())
358
- code := interpreter . evm .StateDB .GetCode (addr )
358
+ code := evm .StateDB .GetCode (addr )
359
359
paddedCodeCopy , copyOffset , nonPaddedCopyLength := getDataAndAdjustedBounds (code , uint64CodeOffset , length .Uint64 ())
360
- consumed , wanted := interpreter . evm .AccessEvents .CodeChunksRangeGas (addr , copyOffset , nonPaddedCopyLength , uint64 (len (code )), false , scope .Contract .Gas )
361
- scope .Contract .UseGas (consumed , interpreter . evm .Config .Tracer , tracing .GasChangeUnspecified )
360
+ consumed , wanted := evm .AccessEvents .CodeChunksRangeGas (addr , copyOffset , nonPaddedCopyLength , uint64 (len (code )), false , scope .Contract .Gas )
361
+ scope .Contract .UseGas (consumed , evm .Config .Tracer , tracing .GasChangeUnspecified )
362
362
if consumed < wanted {
363
363
return nil , ErrOutOfGas
364
364
}
@@ -370,7 +370,7 @@ func opExtCodeCopyEIP4762(pc *uint64, interpreter *EVMInterpreter, scope *ScopeC
370
370
// opPush1EIP4762 handles the special case of PUSH1 opcode for EIP-4762, which
371
371
// need not worry about the adjusted bound logic when adding the PUSHDATA to
372
372
// the list of access events.
373
- func opPush1EIP4762 (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
373
+ func opPush1EIP4762 (pc * uint64 , evm * EVM , scope * ScopeContext ) ([]byte , error ) {
374
374
var (
375
375
codeLen = uint64 (len (scope .Contract .Code ))
376
376
integer = new (uint256.Int )
@@ -383,8 +383,8 @@ func opPush1EIP4762(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext
383
383
// touch next chunk if PUSH1 is at the boundary. if so, *pc has
384
384
// advanced past this boundary.
385
385
contractAddr := scope .Contract .Address ()
386
- consumed , wanted := interpreter . evm .AccessEvents .CodeChunksRangeGas (contractAddr , * pc + 1 , uint64 (1 ), uint64 (len (scope .Contract .Code )), false , scope .Contract .Gas )
387
- scope .Contract .UseGas (wanted , interpreter . evm .Config .Tracer , tracing .GasChangeUnspecified )
386
+ consumed , wanted := evm .AccessEvents .CodeChunksRangeGas (contractAddr , * pc + 1 , uint64 (1 ), uint64 (len (scope .Contract .Code )), false , scope .Contract .Gas )
387
+ scope .Contract .UseGas (wanted , evm .Config .Tracer , tracing .GasChangeUnspecified )
388
388
if consumed < wanted {
389
389
return nil , ErrOutOfGas
390
390
}
@@ -396,7 +396,7 @@ func opPush1EIP4762(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext
396
396
}
397
397
398
398
func makePushEIP4762 (size uint64 , pushByteSize int ) executionFunc {
399
- return func (pc * uint64 , interpreter * EVMInterpreter , scope * ScopeContext ) ([]byte , error ) {
399
+ return func (pc * uint64 , evm * EVM , scope * ScopeContext ) ([]byte , error ) {
400
400
var (
401
401
codeLen = len (scope .Contract .Code )
402
402
start = min (codeLen , int (* pc + 1 ))
@@ -411,8 +411,8 @@ func makePushEIP4762(size uint64, pushByteSize int) executionFunc {
411
411
412
412
if ! scope .Contract .IsDeployment && ! scope .Contract .IsSystemCall {
413
413
contractAddr := scope .Contract .Address ()
414
- consumed , wanted := interpreter . evm .AccessEvents .CodeChunksRangeGas (contractAddr , uint64 (start ), uint64 (pushByteSize ), uint64 (len (scope .Contract .Code )), false , scope .Contract .Gas )
415
- scope .Contract .UseGas (consumed , interpreter . evm .Config .Tracer , tracing .GasChangeUnspecified )
414
+ consumed , wanted := evm .AccessEvents .CodeChunksRangeGas (contractAddr , uint64 (start ), uint64 (pushByteSize ), uint64 (len (scope .Contract .Code )), false , scope .Contract .Gas )
415
+ scope .Contract .UseGas (consumed , evm .Config .Tracer , tracing .GasChangeUnspecified )
416
416
if consumed < wanted {
417
417
return nil , ErrOutOfGas
418
418
}
0 commit comments