diff --git a/core/tx_pool.go b/core/tx_pool.go index 5a4afcb1a4f8..3d49800e0144 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -842,6 +842,11 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { if err != nil { return fmt.Errorf("failed to calculate L1 data fee, err: %w", err) } + // Reject transactions that require the max data fee amount. + // This can only happen if the L1 gas oracle is updated incorrectly. + if l1DataFee.Cmp(fees.MaxL1DataFee()) >= 0 { + return errors.New("invalid transaction: invalid L1 data fee") + } // Transactor should have enough funds to cover the costs // cost == L1 data fee + V + GP * GL if b := pool.currentState.GetBalance(from); b.Cmp(new(big.Int).Add(tx.Cost(), l1DataFee)) < 0 { diff --git a/params/version.go b/params/version.go index 4e4e9f19f35e..01c2565f1582 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 5 // Major version component of the current release VersionMinor = 8 // Minor version component of the current release - VersionPatch = 54 // Patch version component of the current release + VersionPatch = 55 // Patch version component of the current release VersionMeta = "mainnet" // Version metadata to append to the version string ) diff --git a/rollup/fees/rollup_fee.go b/rollup/fees/rollup_fee.go index 2c46aeedbfad..ac5fa9fa81e6 100644 --- a/rollup/fees/rollup_fee.go +++ b/rollup/fees/rollup_fee.go @@ -20,8 +20,15 @@ var ( // to be non-zero. // - tx length prefix: 4 bytes txExtraDataBytes = uint64(4) + + // L1 data fee cap. + l1DataFeeCap = new(big.Int).SetUint64(math.MaxUint64) ) +func MaxL1DataFee() *big.Int { + return new(big.Int).Set(l1DataFeeCap) +} + // Message represents the interface of a message. // It should be a subset of the methods found on // types.Message @@ -248,8 +255,8 @@ func CalculateL1DataFee(tx *types.Transaction, state StateDB, config *params.Cha // ensure l1DataFee fits into uint64 for circuit compatibility // (note: in practice this value should never be this big) - if !l1DataFee.IsUint64() { - l1DataFee.SetUint64(math.MaxUint64) + if l1DataFee.Cmp(l1DataFeeCap) > 0 { + l1DataFee = new(big.Int).Set(l1DataFeeCap) } return l1DataFee, nil