@@ -35,6 +35,12 @@ import (
3535// are not able to consume all of the gas in a L2 block as the L1 info deposit is always present.
3636const l1InfoGasOverhead = uint64 (70_000 )
3737
38+ var (
39+ // blobTxMinBlobGasPrice is the big.Int version of the configured protocol
40+ // parameter to avoid constucting a new big integer for every transaction.
41+ blobTxMinBlobGasPrice = big .NewInt (params .BlobTxMinBlobGasprice )
42+ )
43+
3844func EffectiveGasLimit (chainConfig * params.ChainConfig , gasLimit uint64 , effectiveLimit uint64 ) uint64 {
3945 if effectiveLimit != 0 && effectiveLimit < gasLimit {
4046 gasLimit = effectiveLimit
@@ -131,15 +137,17 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
131137 return err
132138 }
133139 if tx .Gas () < intrGas {
134- return fmt .Errorf ("%w: needed %v, allowed %v" , core .ErrIntrinsicGas , intrGas , tx .Gas ())
140+ return fmt .Errorf ("%w: gas %v, minimum needed %v" , core .ErrIntrinsicGas , tx .Gas (), intrGas )
135141 }
136- // Ensure the gasprice is high enough to cover the requirement of the calling
137- // pool and/or block producer
142+ // Ensure the gasprice is high enough to cover the requirement of the calling pool
138143 if tx .GasTipCapIntCmp (opts .MinTip ) < 0 {
139- return fmt .Errorf ("%w: tip needed %v, tip permitted %v" , ErrUnderpriced , opts . MinTip , tx .GasTipCap ())
144+ return fmt .Errorf ("%w: gas tip cap %v, minimum needed %v" , ErrUnderpriced , tx .GasTipCap (), opts . MinTip )
140145 }
141- // Ensure blob transactions have valid commitments
142146 if tx .Type () == types .BlobTxType {
147+ // Ensure the blob fee cap satisfies the minimum blob gas price
148+ if tx .BlobGasFeeCapIntCmp (blobTxMinBlobGasPrice ) < 0 {
149+ return fmt .Errorf ("%w: blob fee cap %v, minimum needed %v" , ErrUnderpriced , tx .BlobGasFeeCap (), blobTxMinBlobGasPrice )
150+ }
143151 sidecar := tx .BlobTxSidecar ()
144152 if sidecar == nil {
145153 return fmt .Errorf ("missing sidecar in blob transaction" )
@@ -153,6 +161,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
153161 if len (hashes ) > params .MaxBlobGasPerBlock / params .BlobTxBlobGasPerBlob {
154162 return fmt .Errorf ("too many blobs in transaction: have %d, permitted %d" , len (hashes ), params .MaxBlobGasPerBlock / params .BlobTxBlobGasPerBlob )
155163 }
164+ // Ensure commitments, proofs and hashes are valid
156165 if err := validateBlobSidecar (hashes , sidecar ); err != nil {
157166 return err
158167 }
0 commit comments