From 63242de55c884c0cb9f43763b40f3a2bb62101f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 26 Feb 2024 10:42:16 +0200 Subject: [PATCH] core/txpool: some minot nitpick polishes and unified error formats --- core/txpool/validation.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/txpool/validation.go b/core/txpool/validation.go index ac52c3f8de..7677f5692d 100644 --- a/core/txpool/validation.go +++ b/core/txpool/validation.go @@ -101,18 +101,17 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types return err } if tx.Gas() < intrGas { - return fmt.Errorf("%w: needed %v, allowed %v", core.ErrIntrinsicGas, intrGas, tx.Gas()) + return fmt.Errorf("%w: gas %v, minimum needed %v", core.ErrIntrinsicGas, tx.Gas(), intrGas) } - // Ensure the gasprice is high enough to cover the requirement of the calling - // pool and/or block producer + // Ensure the gasprice is high enough to cover the requirement of the calling pool if tx.GasTipCapIntCmp(opts.MinTip) < 0 { - return fmt.Errorf("%w: tip needed %v, tip permitted %v", ErrUnderpriced, opts.MinTip, tx.GasTipCap()) + return fmt.Errorf("%w: gas tip cap %v, minimum needed %v", ErrUnderpriced, tx.GasTipCap(), opts.MinTip) } if tx.Type() == types.BlobTxType { - // Ensure the blob fee cap cap satisfies the minimum blob gas price + // Ensure the blob fee cap satisfies the minimum blob gas price minBlobGasPrice := big.NewInt(params.BlobTxMinBlobGasprice) if tx.BlobGasFeeCapIntCmp(minBlobGasPrice) < 0 { - return fmt.Errorf("%w: blob transaction has too low BlobFeeCap: %v, need: %v", ErrUnderpriced, tx.BlobGasFeeCap(), minBlobGasPrice) + return fmt.Errorf("%w: blob fee cap %v, minimum needed %v", ErrUnderpriced, tx.BlobGasFeeCap(), minBlobGasPrice) } sidecar := tx.BlobTxSidecar() if sidecar == nil { @@ -127,7 +126,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types if len(hashes) > params.MaxBlobGasPerBlock/params.BlobTxBlobGasPerBlob { return fmt.Errorf("too many blobs in transaction: have %d, permitted %d", len(hashes), params.MaxBlobGasPerBlock/params.BlobTxBlobGasPerBlob) } - // Ensure commitments, proofs, & hashes are valid + // Ensure commitments, proofs and hashes are valid if err := validateBlobSidecar(hashes, sidecar); err != nil { return err }