@@ -30,6 +30,12 @@ import (
3030 "github.com/ethereum/go-ethereum/params"
3131)
3232
33+ var (
34+ // blobTxMinBlobGasPrice is the big.Int version of the configured protocol
35+ // parameter to avoid constucting a new big integer for every transaction.
36+ blobTxMinBlobGasPrice = big .NewInt (params .BlobTxMinBlobGasprice )
37+ )
38+
3339// ValidationOptions define certain differences between transaction validation
3440// across the different pools without having to duplicate those checks.
3541type ValidationOptions struct {
@@ -101,15 +107,17 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
101107 return err
102108 }
103109 if tx .Gas () < intrGas {
104- return fmt .Errorf ("%w: needed %v, allowed %v" , core .ErrIntrinsicGas , intrGas , tx .Gas ())
110+ return fmt .Errorf ("%w: gas %v, minimum needed %v" , core .ErrIntrinsicGas , tx .Gas (), intrGas )
105111 }
106- // Ensure the gasprice is high enough to cover the requirement of the calling
107- // pool and/or block producer
112+ // Ensure the gasprice is high enough to cover the requirement of the calling pool
108113 if tx .GasTipCapIntCmp (opts .MinTip ) < 0 {
109- return fmt .Errorf ("%w: tip needed %v, tip permitted %v" , ErrUnderpriced , opts . MinTip , tx .GasTipCap ())
114+ return fmt .Errorf ("%w: gas tip cap %v, minimum needed %v" , ErrUnderpriced , tx .GasTipCap (), opts . MinTip )
110115 }
111- // Ensure blob transactions have valid commitments
112116 if tx .Type () == types .BlobTxType {
117+ // Ensure the blob fee cap satisfies the minimum blob gas price
118+ if tx .BlobGasFeeCapIntCmp (blobTxMinBlobGasPrice ) < 0 {
119+ return fmt .Errorf ("%w: blob fee cap %v, minimum needed %v" , ErrUnderpriced , tx .BlobGasFeeCap (), blobTxMinBlobGasPrice )
120+ }
113121 sidecar := tx .BlobTxSidecar ()
114122 if sidecar == nil {
115123 return fmt .Errorf ("missing sidecar in blob transaction" )
@@ -123,6 +131,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
123131 if len (hashes ) > params .MaxBlobGasPerBlock / params .BlobTxBlobGasPerBlob {
124132 return fmt .Errorf ("too many blobs in transaction: have %d, permitted %d" , len (hashes ), params .MaxBlobGasPerBlock / params .BlobTxBlobGasPerBlob )
125133 }
134+ // Ensure commitments, proofs and hashes are valid
126135 if err := validateBlobSidecar (hashes , sidecar ); err != nil {
127136 return err
128137 }
0 commit comments