This commit is contained in:
Giulio 2025-06-10 17:16:01 +02:00
parent 23f07d8c93
commit bc9f7c1286
2 changed files with 18 additions and 3 deletions

View file

@ -230,20 +230,32 @@ func makeGasLog(n uint64) gasFunc {
return 0, ErrGasUintOverflow return 0, ErrGasUintOverflow
} }
var (
logGas = params.LogGas
logTopicGas = params.LogTopicGas
logDataGas = params.LogDataGas
)
if evm.chainRules.IsOsaka {
logGas = params.LogGasOsaka
logTopicGas = params.LogTopicGasOsaka
logDataGas = params.LogDataGasOsaka
}
gas, err := memoryGasCost(mem, memorySize) gas, err := memoryGasCost(mem, memorySize)
if err != nil { if err != nil {
return 0, err return 0, err
} }
if gas, overflow = math.SafeAdd(gas, params.LogGas); overflow { if gas, overflow = math.SafeAdd(gas, logGas); overflow {
return 0, ErrGasUintOverflow return 0, ErrGasUintOverflow
} }
if gas, overflow = math.SafeAdd(gas, n*params.LogTopicGas); overflow { if gas, overflow = math.SafeAdd(gas, n*logTopicGas); overflow {
return 0, ErrGasUintOverflow return 0, ErrGasUintOverflow
} }
var memorySizeGas uint64 var memorySizeGas uint64
if memorySizeGas, overflow = math.SafeMul(requestedSize, params.LogDataGas); overflow { if memorySizeGas, overflow = math.SafeMul(requestedSize, logDataGas); overflow {
return 0, ErrGasUintOverflow return 0, ErrGasUintOverflow
} }
if gas, overflow = math.SafeAdd(gas, memorySizeGas); overflow { if gas, overflow = math.SafeAdd(gas, memorySizeGas); overflow {

View file

@ -38,6 +38,7 @@ const (
TxDataZeroGas uint64 = 4 // Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions. TxDataZeroGas uint64 = 4 // Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions.
QuadCoeffDiv uint64 = 512 // Divisor for the quadratic particle of the memory cost equation. QuadCoeffDiv uint64 = 512 // Divisor for the quadratic particle of the memory cost equation.
LogDataGas uint64 = 8 // Per byte in a LOG* operation's data. LogDataGas uint64 = 8 // Per byte in a LOG* operation's data.
LogDataGasOsaka uint64 = 32 // Per byte in a LOG* operation's data in Osaka.
CallStipend uint64 = 2300 // Free gas given at beginning of call. CallStipend uint64 = 2300 // Free gas given at beginning of call.
Keccak256Gas uint64 = 30 // Once per KECCAK256 operation. Keccak256Gas uint64 = 30 // Once per KECCAK256 operation.
@ -80,10 +81,12 @@ const (
CallCreateDepth uint64 = 1024 // Maximum depth of call/create stack. CallCreateDepth uint64 = 1024 // Maximum depth of call/create stack.
ExpGas uint64 = 10 // Once per EXP instruction ExpGas uint64 = 10 // Once per EXP instruction
LogGas uint64 = 375 // Per LOG* operation. LogGas uint64 = 375 // Per LOG* operation.
LogGasOsaka uint64 = 1095 // Per LOG* operation in Osaka.
CopyGas uint64 = 3 // CopyGas uint64 = 3 //
StackLimit uint64 = 1024 // Maximum size of VM stack allowed. StackLimit uint64 = 1024 // Maximum size of VM stack allowed.
TierStepGas uint64 = 0 // Once per operation, for a selection of them. TierStepGas uint64 = 0 // Once per operation, for a selection of them.
LogTopicGas uint64 = 375 // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas. LogTopicGas uint64 = 375 // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas.
LogTopicGasOsaka uint64 = 1095 // Multiplied by the * of the LOG*, per LOG transaction in Osaka. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas.
CreateGas uint64 = 32000 // Once per CREATE operation & contract-creation transaction. CreateGas uint64 = 32000 // Once per CREATE operation & contract-creation transaction.
Create2Gas uint64 = 32000 // Once per CREATE2 operation Create2Gas uint64 = 32000 // Once per CREATE2 operation
CreateNGasEip4762 uint64 = 1000 // Once per CREATEn operations post-verkle CreateNGasEip4762 uint64 = 1000 // Once per CREATEn operations post-verkle