@@ -109,7 +109,7 @@ type statefulPrecompileOutput struct {
109
109
ChainID * big.Int
110
110
Addresses * libevm.AddressContext
111
111
StateValue common.Hash
112
- ValueReceived * uint256.Int
112
+ CallValue * uint256.Int
113
113
ReadOnly bool
114
114
BlockNumber , Difficulty * big.Int
115
115
BlockTime uint64
@@ -169,7 +169,7 @@ func TestNewStatefulPrecompile(t *testing.T) {
169
169
ChainID : env .ChainConfig ().ChainID ,
170
170
Addresses : env .Addresses (),
171
171
StateValue : env .ReadOnlyState ().GetState (precompile , slot ),
172
- ValueReceived : env .Value (),
172
+ CallValue : env .Value (),
173
173
ReadOnly : env .ReadOnly (),
174
174
BlockNumber : env .BlockNumber (),
175
175
BlockTime : env .BlockTime (),
@@ -197,12 +197,13 @@ func TestNewStatefulPrecompile(t *testing.T) {
197
197
}
198
198
input := rng .Bytes (8 )
199
199
stateValue := rng .Hash ()
200
- transferValue := rng .Uint256 ()
200
+ callCallerValue := rng .Uint256 ()
201
+ callPrecompileValue := rng .Uint256 ()
201
202
chainID := rng .BigUint64 ()
202
203
203
204
caller := common .HexToAddress ("CA11E12" ) // caller of the precompile
204
205
eoa := common .HexToAddress ("E0A" ) // caller of the precompile-caller
205
- callerContract := vm .NewContract (vm .AccountRef (eoa ), vm .AccountRef (caller ), uint256 . NewInt ( 0 ) , 1e6 )
206
+ callerContract := vm .NewContract (vm .AccountRef (eoa ), vm .AccountRef (caller ), callCallerValue , 1e6 )
206
207
207
208
state , evm := ethtest .NewZeroEVM (
208
209
t ,
@@ -225,10 +226,10 @@ func TestNewStatefulPrecompile(t *testing.T) {
225
226
}
226
227
227
228
tests := []struct {
228
- name string
229
- call func () ([]byte , uint64 , error )
230
- wantAddresses * libevm.AddressContext
231
- wantTransferValue * uint256.Int
229
+ name string
230
+ call func () ([]byte , uint64 , error )
231
+ wantAddresses * libevm.AddressContext
232
+ wantCallValue * uint256.Int
232
233
// Note that this only covers evm.readOnly being true because of the
233
234
// precompile's call. See TestInheritReadOnly for alternate case.
234
235
wantReadOnly bool
@@ -237,21 +238,21 @@ func TestNewStatefulPrecompile(t *testing.T) {
237
238
{
238
239
name : "EVM.Call()" ,
239
240
call : func () ([]byte , uint64 , error ) {
240
- return evm .Call (callerContract , precompile , input , gasLimit , transferValue )
241
+ return evm .Call (callerContract , precompile , input , gasLimit , callPrecompileValue )
241
242
},
242
243
wantAddresses : & libevm.AddressContext {
243
244
Origin : eoa ,
244
245
EVMSemantic : rawAddresses ,
245
246
Raw : & rawAddresses ,
246
247
},
247
- wantReadOnly : false ,
248
- wantTransferValue : transferValue ,
249
- wantCallType : vm .Call ,
248
+ wantReadOnly : false ,
249
+ wantCallValue : callPrecompileValue ,
250
+ wantCallType : vm .Call ,
250
251
},
251
252
{
252
253
name : "EVM.CallCode()" ,
253
254
call : func () ([]byte , uint64 , error ) {
254
- return evm .CallCode (callerContract , precompile , input , gasLimit , transferValue )
255
+ return evm .CallCode (callerContract , precompile , input , gasLimit , callPrecompileValue )
255
256
},
256
257
wantAddresses : & libevm.AddressContext {
257
258
Origin : eoa ,
@@ -261,9 +262,9 @@ func TestNewStatefulPrecompile(t *testing.T) {
261
262
},
262
263
Raw : & rawAddresses ,
263
264
},
264
- wantReadOnly : false ,
265
- wantTransferValue : transferValue ,
266
- wantCallType : vm .CallCode ,
265
+ wantReadOnly : false ,
266
+ wantCallValue : callPrecompileValue ,
267
+ wantCallType : vm .CallCode ,
267
268
},
268
269
{
269
270
name : "EVM.DelegateCall()" ,
@@ -278,9 +279,9 @@ func TestNewStatefulPrecompile(t *testing.T) {
278
279
},
279
280
Raw : & rawAddresses ,
280
281
},
281
- wantReadOnly : false ,
282
- wantTransferValue : uint256 . NewInt ( 0 ) ,
283
- wantCallType : vm .DelegateCall ,
282
+ wantReadOnly : false ,
283
+ wantCallValue : callCallerValue ,
284
+ wantCallType : vm .DelegateCall ,
284
285
},
285
286
{
286
287
name : "EVM.StaticCall()" ,
@@ -292,9 +293,9 @@ func TestNewStatefulPrecompile(t *testing.T) {
292
293
EVMSemantic : rawAddresses ,
293
294
Raw : & rawAddresses ,
294
295
},
295
- wantReadOnly : true ,
296
- wantTransferValue : uint256 .NewInt (0 ),
297
- wantCallType : vm .StaticCall ,
296
+ wantReadOnly : true ,
297
+ wantCallValue : uint256 .NewInt (0 ),
298
+ wantCallType : vm .StaticCall ,
298
299
},
299
300
}
300
301
@@ -304,7 +305,7 @@ func TestNewStatefulPrecompile(t *testing.T) {
304
305
ChainID : chainID ,
305
306
Addresses : tt .wantAddresses ,
306
307
StateValue : stateValue ,
307
- ValueReceived : tt .wantTransferValue ,
308
+ CallValue : tt .wantCallValue ,
308
309
ReadOnly : tt .wantReadOnly ,
309
310
BlockNumber : header .Number ,
310
311
BlockTime : header .Time ,
0 commit comments