@@ -70,7 +70,7 @@ func memoryCopierGas(stackpos int) gasFunc {
70
70
return 0 , err
71
71
}
72
72
// And gas for copying data, charged per word at param.CopyGas
73
- words , overflow := bigUint64 ( stack .Back (stackpos ))
73
+ words , overflow := stack .Back (stackpos ). Uint64WithOverflow ( )
74
74
if overflow {
75
75
return 0 , ErrGasUintOverflow
76
76
}
96
96
func gasSStore (evm * EVM , contract * Contract , stack * Stack , mem * Memory , memorySize uint64 ) (uint64 , error ) {
97
97
var (
98
98
y , x = stack .Back (1 ), stack .Back (0 )
99
- current = evm .StateDB .GetState (contract .Address (), common .BigToHash ( x ))
99
+ current = evm .StateDB .GetState (contract .Address (), common .Hash ( x . Bytes32 () ))
100
100
)
101
101
// The legacy gas metering only takes into consideration the current state
102
102
// Legacy rules should be applied if we are in Petersburg (removal of EIP-1283)
@@ -131,11 +131,11 @@ func gasSStore(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySi
131
131
// 2.2.2. If original value equals new value (this storage slot is reset)
132
132
// 2.2.2.1. If original value is 0, add 19800 gas to refund counter.
133
133
// 2.2.2.2. Otherwise, add 4800 gas to refund counter.
134
- value := common .BigToHash ( y )
134
+ value := common .Hash ( y . Bytes32 () )
135
135
if current == value { // noop (1)
136
136
return params .NetSstoreNoopGas , nil
137
137
}
138
- original := evm .StateDB .GetCommittedState (contract .Address (), common .BigToHash ( x ))
138
+ original := evm .StateDB .GetCommittedState (contract .Address (), common .Hash ( x . Bytes32 () ))
139
139
if original == current {
140
140
if original == (common.Hash {}) { // create slot (2.1.1)
141
141
return params .NetSstoreInitGas , nil
@@ -183,14 +183,14 @@ func gasSStoreEIP2200(evm *EVM, contract *Contract, stack *Stack, mem *Memory, m
183
183
// Gas sentry honoured, do the actual gas calculation based on the stored value
184
184
var (
185
185
y , x = stack .Back (1 ), stack .Back (0 )
186
- current = evm .StateDB .GetState (contract .Address (), common .BigToHash ( x ))
186
+ current = evm .StateDB .GetState (contract .Address (), common .Hash ( x . Bytes32 () ))
187
187
)
188
- value := common .BigToHash ( y )
188
+ value := common .Hash ( y . Bytes32 () )
189
189
190
190
if current == value { // noop (1)
191
191
return params .SstoreNoopGasEIP2200 , nil
192
192
}
193
- original := evm .StateDB .GetCommittedState (contract .Address (), common .BigToHash ( x ))
193
+ original := evm .StateDB .GetCommittedState (contract .Address (), common .Hash ( x . Bytes32 () ))
194
194
if original == current {
195
195
if original == (common.Hash {}) { // create slot (2.1.1)
196
196
return params .SstoreInitGasEIP2200 , nil
@@ -219,7 +219,7 @@ func gasSStoreEIP2200(evm *EVM, contract *Contract, stack *Stack, mem *Memory, m
219
219
220
220
func makeGasLog (n uint64 ) gasFunc {
221
221
return func (evm * EVM , contract * Contract , stack * Stack , mem * Memory , memorySize uint64 ) (uint64 , error ) {
222
- requestedSize , overflow := bigUint64 ( stack .Back (1 ))
222
+ requestedSize , overflow := stack .Back (1 ). Uint64WithOverflow ( )
223
223
if overflow {
224
224
return 0 , ErrGasUintOverflow
225
225
}
@@ -252,7 +252,7 @@ func gasSha3(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memorySize
252
252
if err != nil {
253
253
return 0 , err
254
254
}
255
- wordGas , overflow := bigUint64 ( stack .Back (1 ))
255
+ wordGas , overflow := stack .Back (1 ). Uint64WithOverflow ( )
256
256
if overflow {
257
257
return 0 , ErrGasUintOverflow
258
258
}
@@ -286,7 +286,7 @@ func gasCreate2(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memoryS
286
286
if err != nil {
287
287
return 0 , err
288
288
}
289
- wordGas , overflow := bigUint64 ( stack .Back (2 ))
289
+ wordGas , overflow := stack .Back (2 ). Uint64WithOverflow ( )
290
290
if overflow {
291
291
return 0 , ErrGasUintOverflow
292
292
}
@@ -328,8 +328,8 @@ func gasExpEIP158(evm *EVM, contract *Contract, stack *Stack, mem *Memory, memor
328
328
func gasCall (evm * EVM , contract * Contract , stack * Stack , mem * Memory , memorySize uint64 ) (uint64 , error ) {
329
329
var (
330
330
gas uint64
331
- transfersValue = stack .Back (2 ).Sign () != 0
332
- address = common .BigToAddress (stack .Back (1 ))
331
+ transfersValue = ! stack .Back (2 ).IsZero ()
332
+ address = common .Address (stack .Back (1 ). Bytes20 ( ))
333
333
)
334
334
if evm .chainRules .IsEIP158 {
335
335
if transfersValue && evm .StateDB .Empty (address ) {
@@ -422,7 +422,7 @@ func gasSelfdestruct(evm *EVM, contract *Contract, stack *Stack, mem *Memory, me
422
422
// EIP150 homestead gas reprice fork:
423
423
if evm .chainRules .IsEIP150 {
424
424
gas = params .SelfdestructGasEIP150
425
- var address = common .BigToAddress (stack .Back (0 ))
425
+ var address = common .Address (stack .Back (0 ). Bytes20 ( ))
426
426
427
427
if evm .chainRules .IsEIP158 {
428
428
// if empty and transfers value
0 commit comments