mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
Fix transaction DA cost under-estimation (#332)
* fix tx DA cost under-estimation * bump version --------- Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
This commit is contained in:
parent
060815e901
commit
31b754e14b
2 changed files with 14 additions and 5 deletions
|
|
@ -22,10 +22,10 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
VersionMajor = 3 // Major version component of the current release
|
||||
VersionMinor = 3 // Minor version component of the current release
|
||||
VersionPatch = 1 // Patch version component of the current release
|
||||
VersionMeta = "alpha" // Version metadata to append to the version string
|
||||
VersionMajor = 4 // Major version component of the current release
|
||||
VersionMinor = 0 // Minor version component of the current release
|
||||
VersionPatch = 0 // Patch version component of the current release
|
||||
VersionMeta = "sepolia" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
// Version holds the textual version string.
|
||||
|
|
|
|||
|
|
@ -17,6 +17,15 @@ var (
|
|||
// transaction to the L1 fee calculation routine. The signature is accounted
|
||||
// for externally
|
||||
errTransactionSigned = errors.New("transaction is signed")
|
||||
|
||||
// txExtraDataBytes is the number of bytes that we commit to L1 in addition
|
||||
// to the RLP-encoded unsigned transaction. Note that these are all assumed
|
||||
// to be non-zero.
|
||||
// - tx length prefix: 4 bytes
|
||||
// - sig.r: 32 bytes + 1 byte rlp prefix
|
||||
// - sig.s: 32 bytes + 1 byte rlp prefix
|
||||
// - sig.v: 3 bytes + 1 byte rlp prefix
|
||||
txExtraDataBytes = uint64(74)
|
||||
)
|
||||
|
||||
// Message represents the interface of a message.
|
||||
|
|
@ -115,7 +124,7 @@ func CalculateL1Fee(data []byte, overhead, l1GasPrice *big.Int, scalar *big.Int)
|
|||
func CalculateL1GasUsed(data []byte, overhead *big.Int) *big.Int {
|
||||
zeroes, ones := zeroesAndOnes(data)
|
||||
zeroesGas := zeroes * params.TxDataZeroGas
|
||||
onesGas := (ones + 68) * params.TxDataNonZeroGasEIP2028
|
||||
onesGas := (ones + txExtraDataBytes) * params.TxDataNonZeroGasEIP2028
|
||||
l1Gas := new(big.Int).SetUint64(zeroesGas + onesGas)
|
||||
return new(big.Int).Add(l1Gas, overhead)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue