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

@ -36,8 +36,6 @@ const (
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.
CostFloorPerToken7623 uint64 = 10 // Cost floor per byte of data as specified by EIP-7623.
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.
CallStipend uint64 = 2300 // Free gas given at beginning of call. CallStipend uint64 = 2300 // Free gas given at beginning of call.
@ -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