From 746d691d663ceb744a15d693f12cedead2e7b42d Mon Sep 17 00:00:00 2001 From: Vicky Date: Wed, 18 Mar 2026 02:32:40 +0800 Subject: [PATCH 1/2] internal/ethapi: don't attach empty sidecar when signing blob tx without blobs --- internal/ethapi/api.go | 2 +- internal/ethapi/api_test.go | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index bb0dd042ab..d11d38883b 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1865,7 +1865,7 @@ func (api *TransactionAPI) SignTransaction(ctx context.Context, args Transaction // If the transaction-to-sign was a blob transaction, then the signed one // no longer retains the blobs, only the blob hashes. In this step, we need // to put back the blob(s). - if args.IsEIP4844() { + if args.Blobs != nil { signed = signed.WithBlobTxSidecar(types.NewBlobTxSidecar(sidecarVersion, args.Blobs, args.Commitments, args.Proofs)) } data, err := signed.MarshalBinary() diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index 62e9979d3d..0e655786a8 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -2698,10 +2698,15 @@ func TestSignBlobTransaction(t *testing.T) { t.Fatalf("failed to fill tx defaults: %v\n", err) } - _, err = api.SignTransaction(context.Background(), argsFromTransaction(res.Tx, b.acc.Address)) + result, err := api.SignTransaction(context.Background(), argsFromTransaction(res.Tx, b.acc.Address)) if err != nil { t.Fatalf("should not fail on blob transaction") } + // When no blobs are provided (only blob hashes), the signed transaction + // should not have an empty sidecar attached. + if result.Tx.BlobTxSidecar() != nil { + t.Fatal("signed transaction should not have a sidecar when no blobs were provided") + } } func TestSendBlobTransaction(t *testing.T) { From c9bc896a585e01d3d5254e8c4051ab6b87fb681d Mon Sep 17 00:00:00 2001 From: Vicky Date: Thu, 19 Mar 2026 01:13:32 +0800 Subject: [PATCH 2/2] Removed the whole block. --- internal/ethapi/api.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index d11d38883b..993a480648 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1862,12 +1862,6 @@ func (api *TransactionAPI) SignTransaction(ctx context.Context, args Transaction if err != nil { return nil, err } - // If the transaction-to-sign was a blob transaction, then the signed one - // no longer retains the blobs, only the blob hashes. In this step, we need - // to put back the blob(s). - if args.Blobs != nil { - signed = signed.WithBlobTxSidecar(types.NewBlobTxSidecar(sidecarVersion, args.Blobs, args.Commitments, args.Proofs)) - } data, err := signed.MarshalBinary() if err != nil { return nil, err