From 1727fc532d505526d99e85a11d4927b7bf32f73c Mon Sep 17 00:00:00 2001 From: maskpp Date: Thu, 14 Mar 2024 15:58:55 +0800 Subject: [PATCH] feat(blob): set min blob fee (#636) --- pkg/rpc/tx_blob.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/rpc/tx_blob.go b/pkg/rpc/tx_blob.go index ad0f29b1c..f0d5696c0 100644 --- a/pkg/rpc/tx_blob.go +++ b/pkg/rpc/tx_blob.go @@ -9,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto/kzg4844" + "github.com/ethereum/go-ethereum/params" "github.com/holiman/uint256" ) @@ -94,6 +95,11 @@ func (c *EthClient) CreateBlobTx( return nil, err } + blobFeeCap := rawTx.BlobGasFeeCap() + if blobFeeCap == nil || blobFeeCap.Uint64() < params.BlobTxMinBlobGasprice { + blobFeeCap = new(big.Int).SetUint64(uint64(params.BlobTxMinBlobGasprice)) + } + return &types.BlobTx{ ChainID: uint256.MustFromBig(rawTx.ChainId()), Nonce: rawTx.Nonce(), @@ -104,7 +110,7 @@ func (c *EthClient) CreateBlobTx( Value: uint256.MustFromBig(rawTx.Value()), Data: rawTx.Data(), AccessList: rawTx.AccessList(), - BlobFeeCap: uint256.MustFromBig(rawTx.BlobGasFeeCap()), + BlobFeeCap: uint256.MustFromBig(blobFeeCap), BlobHashes: sidecar.BlobHashes(), Sidecar: sidecar, }, nil