@@ -111,15 +111,15 @@ func WasmStateStoreCost(db StateDB, program common.Address, key, value common.Ha
111
111
// The code here is adapted from the following functions with the most recent parameters as of The Merge
112
112
// - operations_acl.go makeCallVariantGasCallEIP2929()
113
113
// - gas_table.go gasCall()
114
- func WasmCallCost (db StateDB , contract common.Address , value * uint256.Int , budget uint64 ) (uint64 , error ) {
115
- total := uint64 ( 0 )
116
- apply := func (amount uint64 ) bool {
117
- total += amount
118
- return total > budget
114
+ func WasmCallCost (db StateDB , contract common.Address , value * uint256.Int , budget uint64 ) (multigas. MultiGas , error ) {
115
+ total := multigas . ZeroGas ( )
116
+ apply := func (resource multigas. ResourceKind , amount uint64 ) bool {
117
+ total . SaturatingIncrementInto ( resource , amount )
118
+ return total . SingleGas () > budget
119
119
}
120
120
121
121
// EIP 2929: the static cost
122
- if apply (params .WarmStorageReadCostEIP2929 ) {
122
+ if apply (multigas . ResourceKindComputation , params .WarmStorageReadCostEIP2929 ) {
123
123
return total , ErrOutOfGas
124
124
}
125
125
@@ -129,7 +129,7 @@ func WasmCallCost(db StateDB, contract common.Address, value *uint256.Int, budge
129
129
if ! warmAccess {
130
130
db .AddAddressToAccessList (contract )
131
131
132
- if apply (coldCost ) {
132
+ if apply (multigas . ResourceKindStorageAccess , coldCost ) {
133
133
return total , ErrOutOfGas
134
134
}
135
135
}
0 commit comments