From ca5df4373351bb179ccc9232384d748a80327efa Mon Sep 17 00:00:00 2001 From: Mojtaba Date: Tue, 17 Mar 2026 11:14:20 +0000 Subject: [PATCH 1/4] chore(evmrpc): expose eth_blobBaseFee on eth RPC surface --- evmrpc/info.go | 12 ++++++ evmrpc/info_test.go | 24 +++++++++++ x/evm/blobfee/blobfee.go | 19 +++++++++ x/evm/blobfee/blobfee_test.go | 77 +++++++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 x/evm/blobfee/blobfee.go create mode 100644 x/evm/blobfee/blobfee_test.go diff --git a/evmrpc/info.go b/evmrpc/info.go index ca46f86925..8d75bfe634 100644 --- a/evmrpc/info.go +++ b/evmrpc/info.go @@ -16,7 +16,9 @@ import ( sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" rpcclient "github.com/sei-protocol/sei-chain/sei-tendermint/rpc/client" "github.com/sei-protocol/sei-chain/sei-tendermint/rpc/coretypes" + "github.com/sei-protocol/sei-chain/x/evm/blobfee" "github.com/sei-protocol/sei-chain/x/evm/keeper" + "github.com/sei-protocol/sei-chain/x/evm/types" ) const DefaultBlockGasLimit = 10000000 @@ -264,6 +266,16 @@ func (i *InfoAPI) MaxPriorityFeePerGas(ctx context.Context) (fee *hexutil.Big, r return (*hexutil.Big)(feeHist.Reward[0][0].ToInt()), nil } +func (i *InfoAPI) BlobBaseFee(ctx context.Context) (result *hexutil.Big, returnErr error) { + startTime := time.Now() + defer recordMetricsWithError("eth_BlobBaseFee", i.connectionType, startTime, returnErr) + sdkCtx := i.ctxProvider(LatestCtxHeight) + chainConfig := types.DefaultChainConfig().EthereumConfig(i.keeper.ChainID(sdkCtx)) + blockTime := uint64(sdkCtx.BlockTime().Unix()) + fee := blobfee.BlobBaseFeeForNextBlock(chainConfig, blockTime, nil) + return (*hexutil.Big)(fee), nil +} + func (i *InfoAPI) safeGetBaseFee(targetHeight int64) (res *big.Int) { defer func() { if err := recover(); err != nil { diff --git a/evmrpc/info_test.go b/evmrpc/info_test.go index 9007ac4fdf..3bd399436f 100644 --- a/evmrpc/info_test.go +++ b/evmrpc/info_test.go @@ -180,6 +180,30 @@ func TestMaxPriorityFeePerGas(t *testing.T) { assert.Equal(t, "0x3b9aca00", resObj["result"]) } +func TestBlobBaseFee(t *testing.T) { + Ctx = Ctx.WithBlockHeight(1) + resObj := sendRequestGood(t, "blobBaseFee") + _, hasErr := resObj["error"] + require.False(t, hasErr, "blobBaseFee should not return error") + result, ok := resObj["result"].(string) + require.True(t, ok, "result should be string (hex quantity)") + require.Equal(t, "0x1", result, "blob base fee should be 1 wei (canonical hex)") +} + +func TestBlobBaseFee_Direct(t *testing.T) { + ctxProvider := func(height int64) sdk.Context { + if height == evmrpc.LatestCtxHeight { + return Ctx.WithBlockHeight(MockHeight8) + } + return Ctx.WithBlockHeight(height) + } + api := newInfoAPIWithWatermarks(ctxProvider) + fee, err := api.BlobBaseFee(context.Background()) + require.NoError(t, err) + require.NotNil(t, fee) + require.Equal(t, "0x1", fee.String(), "BlobBaseFee should return 1 wei as canonical hex") +} + func TestGasPriceLogic(t *testing.T) { oneGwei := big.NewInt(1000000000) onePointOneGwei := big.NewInt(1100000000) diff --git a/x/evm/blobfee/blobfee.go b/x/evm/blobfee/blobfee.go new file mode 100644 index 0000000000..2474f63f4b --- /dev/null +++ b/x/evm/blobfee/blobfee.go @@ -0,0 +1,19 @@ +package blobfee + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/params" + "github.com/sei-protocol/sei-chain/utils" +) + +// BlobBaseFeeForNextBlock returns the blob base fee for the next block in wei. +// chainConfig and blockTime define the fork and time context; excessBlobGas may be nil (treated as 0). +// Reusable by RPC (eth_blobBaseFee) or execution; when dynamic blob fee is added, extend here. +func BlobBaseFeeForNextBlock(chainConfig *params.ChainConfig, blockTime uint64, excessBlobGas *uint64) *big.Int { + _ = chainConfig + _ = blockTime + _ = excessBlobGas + // Cancun not enabled / no dynamic blob fee: fixed 1 wei (matches execution BlockContext). + return utils.Big1 +} diff --git a/x/evm/blobfee/blobfee_test.go b/x/evm/blobfee/blobfee_test.go new file mode 100644 index 0000000000..81a4cadc06 --- /dev/null +++ b/x/evm/blobfee/blobfee_test.go @@ -0,0 +1,77 @@ +package blobfee_test + +import ( + "math/big" + "testing" + + "github.com/ethereum/go-ethereum/params" + "github.com/sei-protocol/sei-chain/utils" + "github.com/sei-protocol/sei-chain/x/evm/blobfee" + "github.com/stretchr/testify/require" +) + +func TestBlobBaseFeeForNextBlock(t *testing.T) { + oneWei := big.NewInt(1) + + tests := []struct { + name string + chainConfig *params.ChainConfig + blockTime uint64 + excessBlobGas *uint64 + expectedFee *big.Int + expectNonNil bool + }{ + { + name: "nil config nil excess returns 1 wei", + chainConfig: nil, + blockTime: 0, + excessBlobGas: nil, + expectedFee: oneWei, + expectNonNil: true, + }, + { + name: "nil config with excess returns 1 wei", + chainConfig: nil, + blockTime: 1000, + excessBlobGas: ptrUint64(0), + expectedFee: oneWei, + expectNonNil: true, + }, + { + name: "with chain config zero time nil excess", + chainConfig: params.MainnetChainConfig, + blockTime: 0, + excessBlobGas: nil, + expectedFee: oneWei, + expectNonNil: true, + }, + { + name: "with chain config non-zero time and excess", + chainConfig: params.MainnetChainConfig, + blockTime: 1700000000, + excessBlobGas: ptrUint64(393216), + expectedFee: oneWei, + expectNonNil: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := blobfee.BlobBaseFeeForNextBlock(tt.chainConfig, tt.blockTime, tt.excessBlobGas) + if tt.expectNonNil { + require.NotNil(t, got) + } + require.Equal(t, 0, tt.expectedFee.Cmp(got), "fee should equal expected (1 wei)") + require.True(t, got.Cmp(utils.Big1) == 0, "result should match utils.Big1") + }) + } +} + +func TestBlobBaseFeeForNextBlock_ReturnsCanonicalOneWei(t *testing.T) { + // Ensure RPC/execution contract: blob base fee is 1 wei in current implementation. + got := blobfee.BlobBaseFeeForNextBlock(nil, 0, nil) + require.Same(t, utils.Big1, got, "should return utils.Big1 for minimal footprint") +} + +func ptrUint64(u uint64) *uint64 { + return &u +} From aa68f8e30b3affef0f0b2dce131e5b83a8dafb7f Mon Sep 17 00:00:00 2001 From: Mojtaba Date: Tue, 17 Mar 2026 11:32:56 +0000 Subject: [PATCH 2/4] chore: applied security concerns --- x/evm/blobfee/blobfee.go | 3 +-- x/evm/blobfee/blobfee_test.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/x/evm/blobfee/blobfee.go b/x/evm/blobfee/blobfee.go index 2474f63f4b..3196a1f406 100644 --- a/x/evm/blobfee/blobfee.go +++ b/x/evm/blobfee/blobfee.go @@ -4,7 +4,6 @@ import ( "math/big" "github.com/ethereum/go-ethereum/params" - "github.com/sei-protocol/sei-chain/utils" ) // BlobBaseFeeForNextBlock returns the blob base fee for the next block in wei. @@ -15,5 +14,5 @@ func BlobBaseFeeForNextBlock(chainConfig *params.ChainConfig, blockTime uint64, _ = blockTime _ = excessBlobGas // Cancun not enabled / no dynamic blob fee: fixed 1 wei (matches execution BlockContext). - return utils.Big1 + return new(big.Int).SetUint64(1) } diff --git a/x/evm/blobfee/blobfee_test.go b/x/evm/blobfee/blobfee_test.go index 81a4cadc06..8ff344e437 100644 --- a/x/evm/blobfee/blobfee_test.go +++ b/x/evm/blobfee/blobfee_test.go @@ -69,7 +69,7 @@ func TestBlobBaseFeeForNextBlock(t *testing.T) { func TestBlobBaseFeeForNextBlock_ReturnsCanonicalOneWei(t *testing.T) { // Ensure RPC/execution contract: blob base fee is 1 wei in current implementation. got := blobfee.BlobBaseFeeForNextBlock(nil, 0, nil) - require.Same(t, utils.Big1, got, "should return utils.Big1 for minimal footprint") + require.Equal(t, utils.Big1, got, "should return value equal to utils.Big1") } func ptrUint64(u uint64) *uint64 { From 81bf5cf4c76924da948dba1062d5a259ccdebc7f Mon Sep 17 00:00:00 2001 From: Mojtaba Date: Tue, 17 Mar 2026 11:59:52 +0000 Subject: [PATCH 3/4] fix: linter complain --- evmrpc/info.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evmrpc/info.go b/evmrpc/info.go index 8d75bfe634..607e8e8fcc 100644 --- a/evmrpc/info.go +++ b/evmrpc/info.go @@ -271,7 +271,7 @@ func (i *InfoAPI) BlobBaseFee(ctx context.Context) (result *hexutil.Big, returnE defer recordMetricsWithError("eth_BlobBaseFee", i.connectionType, startTime, returnErr) sdkCtx := i.ctxProvider(LatestCtxHeight) chainConfig := types.DefaultChainConfig().EthereumConfig(i.keeper.ChainID(sdkCtx)) - blockTime := uint64(sdkCtx.BlockTime().Unix()) + blockTime := toUint64(sdkCtx.BlockTime().Unix()) fee := blobfee.BlobBaseFeeForNextBlock(chainConfig, blockTime, nil) return (*hexutil.Big)(fee), nil } From 5cd8c1f9a73ea325e99a9ad52bf08609b08934d5 Mon Sep 17 00:00:00 2001 From: Mojtaba Date: Tue, 17 Mar 2026 16:54:09 +0000 Subject: [PATCH 4/4] chore: applied feedback, no suport for blobs --- evmrpc/AGENTS.md | 1 + evmrpc/info.go | 22 ++++-- evmrpc/info_test.go | 18 +++-- .../rpc_io_test/FAILED_TEST_ANALYSIS.md | 4 +- .../evm_module/rpc_io_test/RPC_IO_README.md | 2 +- .../blobs-not-supported-error.iox | 3 + .../eth_blobBaseFee/get-current-blobfee.iox | 3 - x/evm/blobfee/blobfee.go | 18 ----- x/evm/blobfee/blobfee_test.go | 77 ------------------- 9 files changed, 32 insertions(+), 116 deletions(-) create mode 100644 integration_test/evm_module/rpc_io_test/testdata/eth_blobBaseFee/blobs-not-supported-error.iox delete mode 100644 integration_test/evm_module/rpc_io_test/testdata/eth_blobBaseFee/get-current-blobfee.iox delete mode 100644 x/evm/blobfee/blobfee.go delete mode 100644 x/evm/blobfee/blobfee_test.go diff --git a/evmrpc/AGENTS.md b/evmrpc/AGENTS.md index f2d2ca8064..7682cceebb 100644 --- a/evmrpc/AGENTS.md +++ b/evmrpc/AGENTS.md @@ -7,6 +7,7 @@ EVM RPCs prefixed by `eth_` and `debug_` on Sei generally follows [Ethereum's sp - **No Uncle** - Sei does not have the concept of uncle blocks, so any endpoint relevant to uncle is not supported. - **No Trie** - Sei does not store states in a trie, so any endpoint relevant to the trie data structure is not supported. - **No PoW** - Sei has never used proof-of-work, so endpoints like `eth_mining` and `eth_hashrate` are not supported. +- **No Blobs** - Sei does not support EIP-4844 blob transactions. `eth_blobBaseFee` is exposed but returns a JSON-RPC error (code -32000, "blobs not supported on this chain") instead of a fee value. ## `sei_` prefixed endpoints Several `eth_` prefixed endpoints have a `sei_` prefixed counterpart. `eth_` endpoints only have visibility into EVM transactions, whereas `sei_` endpoints have visibility into EVM transactions plus Cosmos transactions that have synthetic EVM receipts. diff --git a/evmrpc/info.go b/evmrpc/info.go index 607e8e8fcc..07db5ad9c6 100644 --- a/evmrpc/info.go +++ b/evmrpc/info.go @@ -16,9 +16,7 @@ import ( sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types" rpcclient "github.com/sei-protocol/sei-chain/sei-tendermint/rpc/client" "github.com/sei-protocol/sei-chain/sei-tendermint/rpc/coretypes" - "github.com/sei-protocol/sei-chain/x/evm/blobfee" "github.com/sei-protocol/sei-chain/x/evm/keeper" - "github.com/sei-protocol/sei-chain/x/evm/types" ) const DefaultBlockGasLimit = 10000000 @@ -266,14 +264,24 @@ func (i *InfoAPI) MaxPriorityFeePerGas(ctx context.Context) (fee *hexutil.Big, r return (*hexutil.Big)(feeHist.Reward[0][0].ToInt()), nil } +// ErrCodeBlobsNotSupported is the JSON-RPC error code (-32000) for blob-not-supported errors. +// Matches go-ethereum rpc errcodeDefault (unexported). +const ErrCodeBlobsNotSupported = -32000 + +type ErrBlobsNotSupported struct{} + +func (e *ErrBlobsNotSupported) Error() string { + return "blobs not supported on this chain" +} + +func (e *ErrBlobsNotSupported) ErrorCode() int { + return ErrCodeBlobsNotSupported +} + func (i *InfoAPI) BlobBaseFee(ctx context.Context) (result *hexutil.Big, returnErr error) { startTime := time.Now() defer recordMetricsWithError("eth_BlobBaseFee", i.connectionType, startTime, returnErr) - sdkCtx := i.ctxProvider(LatestCtxHeight) - chainConfig := types.DefaultChainConfig().EthereumConfig(i.keeper.ChainID(sdkCtx)) - blockTime := toUint64(sdkCtx.BlockTime().Unix()) - fee := blobfee.BlobBaseFeeForNextBlock(chainConfig, blockTime, nil) - return (*hexutil.Big)(fee), nil + return nil, &ErrBlobsNotSupported{} } func (i *InfoAPI) safeGetBaseFee(targetHeight int64) (res *big.Int) { diff --git a/evmrpc/info_test.go b/evmrpc/info_test.go index 3bd399436f..8c5656f124 100644 --- a/evmrpc/info_test.go +++ b/evmrpc/info_test.go @@ -183,11 +183,10 @@ func TestMaxPriorityFeePerGas(t *testing.T) { func TestBlobBaseFee(t *testing.T) { Ctx = Ctx.WithBlockHeight(1) resObj := sendRequestGood(t, "blobBaseFee") - _, hasErr := resObj["error"] - require.False(t, hasErr, "blobBaseFee should not return error") - result, ok := resObj["result"].(string) - require.True(t, ok, "result should be string (hex quantity)") - require.Equal(t, "0x1", result, "blob base fee should be 1 wei (canonical hex)") + require.Contains(t, resObj, "error", "blobBaseFee should return error (blobs not supported)") + errObj := resObj["error"].(map[string]interface{}) + require.Equal(t, float64(evmrpc.ErrCodeBlobsNotSupported), errObj["code"], "error code should be ErrCodeServerError") + require.Equal(t, "blobs not supported on this chain", errObj["message"]) } func TestBlobBaseFee_Direct(t *testing.T) { @@ -199,9 +198,12 @@ func TestBlobBaseFee_Direct(t *testing.T) { } api := newInfoAPIWithWatermarks(ctxProvider) fee, err := api.BlobBaseFee(context.Background()) - require.NoError(t, err) - require.NotNil(t, fee) - require.Equal(t, "0x1", fee.String(), "BlobBaseFee should return 1 wei as canonical hex") + require.Error(t, err) + require.Nil(t, fee) + var errWithCode *evmrpc.ErrBlobsNotSupported + require.True(t, errors.As(err, &errWithCode)) + require.Equal(t, evmrpc.ErrCodeBlobsNotSupported, errWithCode.ErrorCode()) + require.Contains(t, err.Error(), "blobs not supported") } func TestGasPriceLogic(t *testing.T) { diff --git a/integration_test/evm_module/rpc_io_test/FAILED_TEST_ANALYSIS.md b/integration_test/evm_module/rpc_io_test/FAILED_TEST_ANALYSIS.md index 0fbf76fe5e..b0473750ed 100644 --- a/integration_test/evm_module/rpc_io_test/FAILED_TEST_ANALYSIS.md +++ b/integration_test/evm_module/rpc_io_test/FAILED_TEST_ANALYSIS.md @@ -20,7 +20,7 @@ | debug_getRawHeader | 2 | get-block-n.iox, get-genesis.iox | | debug_getRawReceipts | 2 | get-block-n.iox, get-genesis.iox | | debug_getRawTransaction | 1 | get-tx.iox | -| eth_blobBaseFee | 1 | get-current-blobfee.iox | +| eth_blobBaseFee | 1 | blobs-not-supported-error.iox | | eth_call | 1 | call-callenv-options-eip1559.iox (EIP1559 params; Sei returns error) | | eth_createAccessList | 3 | create-al-abi-revert, create-al-contract-eip1559, create-al-contract (insufficient funds / gas fee) | | eth_estimateGas | 2 | estimate-with-eip4844.iox, estimate-with-eip7702.iox (parse error) | @@ -44,7 +44,7 @@ | debug_getRawHeader | get-block-n, get-genesis | No GetRawHeader | | debug_getRawReceipts | get-block-n, get-genesis | No GetRawReceipts | | debug_getRawTransaction | get-tx.iox | No GetRawTransaction | -| eth_blobBaseFee | get-current-blobfee.iox | Not exposed on eth API | +| eth_blobBaseFee | blobs-not-supported-error.iox | Not exposed on eth API | | eth_newPendingTransactionFilter | newPendingTransactionFilter.iox | No NewPendingTransactionFilter in FilterAPI | | eth_syncing | check-syncing.iox | No Syncing on InfoAPI | diff --git a/integration_test/evm_module/rpc_io_test/RPC_IO_README.md b/integration_test/evm_module/rpc_io_test/RPC_IO_README.md index 512df5fd97..0eae0a99ca 100644 --- a/integration_test/evm_module/rpc_io_test/RPC_IO_README.md +++ b/integration_test/evm_module/rpc_io_test/RPC_IO_README.md @@ -261,7 +261,7 @@ So "seed" = a known-good block (and deploy tx) that the script creates and the r | debug_getRawReceipts | get-block-n.iox | FAIL | Sei | Not implemented | error code=-32601 message="the method debug_getRawReceipts does not exist/is not available" | | debug_getRawReceipts | get-genesis.iox | FAIL | Sei | Not implemented | error code=-32601 message="the method debug_getRawReceipts does not exist/is not available" | | debug_getRawTransaction | get-tx.iox | FAIL | Sei | Not implemented | error code=-32601 message="the method debug_getRawTransaction does not exist/is not available" | -| eth_blobBaseFee | get-current-blobfee.iox | FAIL | Sei | Not implemented | error code=-32601 message="the method eth_blobBaseFee does not exist/is not available" | +| eth_blobBaseFee | blobs-not-supported-error.iox | FAIL | Sei | Not implemented | error code=-32601 message="the method eth_blobBaseFee does not exist/is not available" | | eth_call | call-callenv-options-eip1559.iox | FAIL | Sei | Gas fee issue | error code=-32000 message="max fee per gas less than block base fee" | | eth_createAccessList | create-al-abi-revert.iox | FAIL | Sei | Insufficient funds | error code=-32000 message="insufficient funds for gas * price + value" | | eth_createAccessList | create-al-contract-eip1559.iox | FAIL | Sei | Gas fee issue | error code=-32000 message="max fee per gas less than block base fee" | diff --git a/integration_test/evm_module/rpc_io_test/testdata/eth_blobBaseFee/blobs-not-supported-error.iox b/integration_test/evm_module/rpc_io_test/testdata/eth_blobBaseFee/blobs-not-supported-error.iox new file mode 100644 index 0000000000..28470a4e0f --- /dev/null +++ b/integration_test/evm_module/rpc_io_test/testdata/eth_blobBaseFee/blobs-not-supported-error.iox @@ -0,0 +1,3 @@ +// Sei does not support blobs; eth_blobBaseFee returns -32000 with clear message. +>> {"jsonrpc":"2.0","id":1,"method":"eth_blobBaseFee"} +<< {"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"blobs not supported on this chain"}} diff --git a/integration_test/evm_module/rpc_io_test/testdata/eth_blobBaseFee/get-current-blobfee.iox b/integration_test/evm_module/rpc_io_test/testdata/eth_blobBaseFee/get-current-blobfee.iox deleted file mode 100644 index 4b9e8cc7b0..0000000000 --- a/integration_test/evm_module/rpc_io_test/testdata/eth_blobBaseFee/get-current-blobfee.iox +++ /dev/null @@ -1,3 +0,0 @@ -// May return result or error depending on blob support. Spec-only: valid response. ->> {"jsonrpc":"2.0","id":1,"method":"eth_blobBaseFee"} -<< {"jsonrpc":"2.0","id":1,"result":"0x"} diff --git a/x/evm/blobfee/blobfee.go b/x/evm/blobfee/blobfee.go deleted file mode 100644 index 3196a1f406..0000000000 --- a/x/evm/blobfee/blobfee.go +++ /dev/null @@ -1,18 +0,0 @@ -package blobfee - -import ( - "math/big" - - "github.com/ethereum/go-ethereum/params" -) - -// BlobBaseFeeForNextBlock returns the blob base fee for the next block in wei. -// chainConfig and blockTime define the fork and time context; excessBlobGas may be nil (treated as 0). -// Reusable by RPC (eth_blobBaseFee) or execution; when dynamic blob fee is added, extend here. -func BlobBaseFeeForNextBlock(chainConfig *params.ChainConfig, blockTime uint64, excessBlobGas *uint64) *big.Int { - _ = chainConfig - _ = blockTime - _ = excessBlobGas - // Cancun not enabled / no dynamic blob fee: fixed 1 wei (matches execution BlockContext). - return new(big.Int).SetUint64(1) -} diff --git a/x/evm/blobfee/blobfee_test.go b/x/evm/blobfee/blobfee_test.go deleted file mode 100644 index 8ff344e437..0000000000 --- a/x/evm/blobfee/blobfee_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package blobfee_test - -import ( - "math/big" - "testing" - - "github.com/ethereum/go-ethereum/params" - "github.com/sei-protocol/sei-chain/utils" - "github.com/sei-protocol/sei-chain/x/evm/blobfee" - "github.com/stretchr/testify/require" -) - -func TestBlobBaseFeeForNextBlock(t *testing.T) { - oneWei := big.NewInt(1) - - tests := []struct { - name string - chainConfig *params.ChainConfig - blockTime uint64 - excessBlobGas *uint64 - expectedFee *big.Int - expectNonNil bool - }{ - { - name: "nil config nil excess returns 1 wei", - chainConfig: nil, - blockTime: 0, - excessBlobGas: nil, - expectedFee: oneWei, - expectNonNil: true, - }, - { - name: "nil config with excess returns 1 wei", - chainConfig: nil, - blockTime: 1000, - excessBlobGas: ptrUint64(0), - expectedFee: oneWei, - expectNonNil: true, - }, - { - name: "with chain config zero time nil excess", - chainConfig: params.MainnetChainConfig, - blockTime: 0, - excessBlobGas: nil, - expectedFee: oneWei, - expectNonNil: true, - }, - { - name: "with chain config non-zero time and excess", - chainConfig: params.MainnetChainConfig, - blockTime: 1700000000, - excessBlobGas: ptrUint64(393216), - expectedFee: oneWei, - expectNonNil: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got := blobfee.BlobBaseFeeForNextBlock(tt.chainConfig, tt.blockTime, tt.excessBlobGas) - if tt.expectNonNil { - require.NotNil(t, got) - } - require.Equal(t, 0, tt.expectedFee.Cmp(got), "fee should equal expected (1 wei)") - require.True(t, got.Cmp(utils.Big1) == 0, "result should match utils.Big1") - }) - } -} - -func TestBlobBaseFeeForNextBlock_ReturnsCanonicalOneWei(t *testing.T) { - // Ensure RPC/execution contract: blob base fee is 1 wei in current implementation. - got := blobfee.BlobBaseFeeForNextBlock(nil, 0, nil) - require.Equal(t, utils.Big1, got, "should return value equal to utils.Big1") -} - -func ptrUint64(u uint64) *uint64 { - return &u -}