params: rename 7623 protocol constants to have Tx prefix

This commit is contained in:
lightclient 2025-01-29 16:20:50 -07:00
parent 3ff6bad7dd
commit a5f81355b7
No known key found for this signature in database
GPG key ID: 657913021EF45A6A
2 changed files with 16 additions and 16 deletions

View file

@ -121,14 +121,14 @@ func FloorDataGas(data []byte) (uint64, error) {
var ( var (
z = uint64(bytes.Count(data, []byte{0})) z = uint64(bytes.Count(data, []byte{0}))
nz = uint64(len(data)) - z nz = uint64(len(data)) - z
tokens = nz*params.TokenPerNonZeroByte7623 + z tokens = nz*params.TxTokenPerNonZeroByte + z
) )
// Check for overflow // Check for overflow
if (math.MaxUint64-params.TxGas)/params.CostFloorPerToken7623 < tokens { if (math.MaxUint64-params.TxGas)/params.TxCostFloorPerToken < tokens {
return 0, ErrGasUintOverflow return 0, ErrGasUintOverflow
} }
// Minimum gas required for a transaction based on its data tokens (EIP-7623). // Minimum gas required for a transaction based on its data tokens (EIP-7623).
return params.TxGas + tokens*params.CostFloorPerToken7623, nil return params.TxGas + tokens*params.TxCostFloorPerToken, nil
} }
// toWordSize returns the ceiled word size required for init code payment calculation. // toWordSize returns the ceiled word size required for init code payment calculation.

View file

@ -28,19 +28,17 @@ const (
MaxGasLimit uint64 = 0x7fffffffffffffff // Maximum the gas limit (2^63-1). MaxGasLimit uint64 = 0x7fffffffffffffff // Maximum the gas limit (2^63-1).
GenesisGasLimit uint64 = 4712388 // Gas limit of the Genesis block. GenesisGasLimit uint64 = 4712388 // Gas limit of the Genesis block.
MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis. MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis.
ExpByteGas uint64 = 10 // Times ceil(log256(exponent)) for the EXP instruction. ExpByteGas uint64 = 10 // Times ceil(log256(exponent)) for the EXP instruction.
SloadGas uint64 = 50 // Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added. SloadGas uint64 = 50 // Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added.
CallValueTransferGas uint64 = 9000 // Paid for CALL when the value transfer is non-zero. CallValueTransferGas uint64 = 9000 // Paid for CALL when the value transfer is non-zero.
CallNewAccountGas uint64 = 25000 // Paid for CALL when the destination address didn't exist prior. CallNewAccountGas uint64 = 25000 // Paid for CALL when the destination address didn't exist prior.
TxGas uint64 = 21000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions. TxGas uint64 = 21000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions.
TxGasContractCreation uint64 = 53000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions. TxGasContractCreation uint64 = 53000 // Per transaction that creates a contract. 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. TxDataZeroGas uint64 = 4 // Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions.
TokenPerNonZeroByte7623 uint64 = 4 // Token cost per non-zero byte as specified by EIP-7623. QuadCoeffDiv uint64 = 512 // Divisor for the quadratic particle of the memory cost equation.
CostFloorPerToken7623 uint64 = 10 // Cost floor per byte of data as specified by EIP-7623. LogDataGas uint64 = 8 // Per byte in a LOG* operation's data.
QuadCoeffDiv uint64 = 512 // Divisor for the quadratic particle of the memory cost equation. CallStipend uint64 = 2300 // Free gas given at beginning of call.
LogDataGas uint64 = 8 // Per byte in a LOG* operation's data.
CallStipend uint64 = 2300 // Free gas given at beginning of call.
Keccak256Gas uint64 = 30 // Once per KECCAK256 operation. Keccak256Gas uint64 = 30 // Once per KECCAK256 operation.
Keccak256WordGas uint64 = 6 // Once per word of the KECCAK256 operation's data. Keccak256WordGas uint64 = 6 // Once per word of the KECCAK256 operation's data.
@ -94,6 +92,8 @@ const (
TxDataNonZeroGasFrontier uint64 = 68 // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions. TxDataNonZeroGasFrontier uint64 = 68 // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions.
TxDataNonZeroGasEIP2028 uint64 = 16 // Per byte of non zero data attached to a transaction after EIP 2028 (part in Istanbul) TxDataNonZeroGasEIP2028 uint64 = 16 // Per byte of non zero data attached to a transaction after EIP 2028 (part in Istanbul)
TxTokenPerNonZeroByte uint64 = 4 // Token cost per non-zero byte as specified by EIP-7623.
TxCostFloorPerToken uint64 = 10 // Cost floor per byte of data as specified by EIP-7623.
TxAccessListAddressGas uint64 = 2400 // Per address specified in EIP 2930 access list TxAccessListAddressGas uint64 = 2400 // Per address specified in EIP 2930 access list
TxAccessListStorageKeyGas uint64 = 1900 // Per storage key specified in EIP 2930 access list TxAccessListStorageKeyGas uint64 = 1900 // Per storage key specified in EIP 2930 access list
TxAuthTupleGas uint64 = 12500 // Per auth tuple code specified in EIP-7702 TxAuthTupleGas uint64 = 12500 // Per auth tuple code specified in EIP-7702