@@ -172,7 +172,7 @@ object OpCode {
172
172
* @param delta number of words to be popped from stack
173
173
* @param alpha number of words to be pushed to stack
174
174
*/
175
- abstract class OpCode (val code : Byte , val delta : Int , val alpha : Int , val constGasFn : FeeSchedule => BigInt )
175
+ abstract class OpCode (val code : Byte , val delta : Int , val alpha : Int , val baseGasFn : FeeSchedule => BigInt )
176
176
extends Product
177
177
with Serializable {
178
178
def this (code : Int , pop : Int , push : Int , constGasFn : FeeSchedule => BigInt ) = this (code.toByte, pop, push, constGasFn)
@@ -193,9 +193,9 @@ abstract class OpCode(val code: Byte, val delta: Int, val alpha: Int, val constG
193
193
}
194
194
195
195
protected def calcGas [W <: WorldStateProxy [W , S ], S <: Storage [S ]](state : ProgramState [W , S ]): BigInt =
196
- constGas (state) + varGas(state)
196
+ baseGas (state) + varGas(state)
197
197
198
- protected def constGas [W <: WorldStateProxy [W , S ], S <: Storage [S ]](state : ProgramState [W , S ]): BigInt = constGasFn (
198
+ protected def baseGas [W <: WorldStateProxy [W , S ], S <: Storage [S ]](state : ProgramState [W , S ]): BigInt = baseGasFn (
199
199
state.config.feeSchedule
200
200
)
201
201
@@ -213,7 +213,7 @@ trait AddrAccessGas { self: OpCode =>
213
213
private def coldGasFn : FeeSchedule => BigInt = _.G_cold_account_access
214
214
private def warmGasFn : FeeSchedule => BigInt = _.G_warm_storage_read
215
215
216
- override protected def constGas [W <: WorldStateProxy [W , S ], S <: Storage [S ]](state : ProgramState [W , S ]): BigInt = {
216
+ override protected def baseGas [W <: WorldStateProxy [W , S ], S <: Storage [S ]](state : ProgramState [W , S ]): BigInt = {
217
217
val currentBlockNumber = state.env.blockHeader.number
218
218
val etcFork = state.config.blockchainConfig.etcForkForBlockNumber(currentBlockNumber)
219
219
val eip2929Enabled = isEip2929Enabled(etcFork)
@@ -224,7 +224,7 @@ trait AddrAccessGas { self: OpCode =>
224
224
else
225
225
coldGasFn(state.config.feeSchedule)
226
226
} else
227
- constGasFn (state.config.feeSchedule)
227
+ baseGasFn (state.config.feeSchedule)
228
228
}
229
229
230
230
protected def address [W <: WorldStateProxy [W , S ], S <: Storage [S ]](state : ProgramState [W , S ]): Address
@@ -240,8 +240,8 @@ case object STOP extends OpCode(0x00, 0, 0, _.G_zero) with ConstGas {
240
240
state.withReturnData(ByteString .empty).halt
241
241
}
242
242
243
- sealed abstract class UnaryOp (code : Int , constGasFn : FeeSchedule => BigInt )(val f : UInt256 => UInt256 )
244
- extends OpCode (code, 1 , 1 , constGasFn )
243
+ sealed abstract class UnaryOp (code : Int , baseGasFn : FeeSchedule => BigInt )(val f : UInt256 => UInt256 )
244
+ extends OpCode (code, 1 , 1 , baseGasFn )
245
245
with ConstGas {
246
246
247
247
protected def exec [W <: WorldStateProxy [W , S ], S <: Storage [S ]](state : ProgramState [W , S ]): ProgramState [W , S ] = {
@@ -252,8 +252,8 @@ sealed abstract class UnaryOp(code: Int, constGasFn: FeeSchedule => BigInt)(val
252
252
}
253
253
}
254
254
255
- sealed abstract class BinaryOp (code : Int , constGasFn : FeeSchedule => BigInt )(val f : (UInt256 , UInt256 ) => UInt256 )
256
- extends OpCode (code.toByte, 2 , 1 , constGasFn ) {
255
+ sealed abstract class BinaryOp (code : Int , baseGasFn : FeeSchedule => BigInt )(val f : (UInt256 , UInt256 ) => UInt256 )
256
+ extends OpCode (code.toByte, 2 , 1 , baseGasFn ) {
257
257
258
258
protected def exec [W <: WorldStateProxy [W , S ], S <: Storage [S ]](state : ProgramState [W , S ]): ProgramState [W , S ] = {
259
259
val (Seq (a, b), stack1) = state.stack.pop(2 )
@@ -263,9 +263,9 @@ sealed abstract class BinaryOp(code: Int, constGasFn: FeeSchedule => BigInt)(val
263
263
}
264
264
}
265
265
266
- sealed abstract class TernaryOp (code : Int , constGasFn : FeeSchedule => BigInt )(
266
+ sealed abstract class TernaryOp (code : Int , baseGasFn : FeeSchedule => BigInt )(
267
267
val f : (UInt256 , UInt256 , UInt256 ) => UInt256
268
- ) extends OpCode (code.toByte, 3 , 1 , constGasFn ) {
268
+ ) extends OpCode (code.toByte, 3 , 1 , baseGasFn ) {
269
269
270
270
protected def exec [W <: WorldStateProxy [W , S ], S <: Storage [S ]](state : ProgramState [W , S ]): ProgramState [W , S ] = {
271
271
val (Seq (a, b, c), stack1) = state.stack.pop(3 )
@@ -894,7 +894,7 @@ abstract class CreateOp(code: Int, delta: Int) extends OpCode(code, delta, 1, _.
894
894
895
895
// FIXME: to avoid calculating this twice, we could adjust state.gas prior to execution in OpCode#execute
896
896
// not sure how this would affect other opcodes [EC-243]
897
- val availableGas = state.gas - (constGasFn (state.config.feeSchedule) + varGas(state))
897
+ val availableGas = state.gas - (baseGasFn (state.config.feeSchedule) + varGas(state))
898
898
val startGas = state.config.gasCap(availableGas)
899
899
val (initCode, memory1) = state.memory.load(inOffset, inSize)
900
900
val world1 = state.world.increaseNonce(state.ownAddress)
0 commit comments