From 87f25b9b125c7c7e3e6a3fb9cc403b0b5567e9bd Mon Sep 17 00:00:00 2001 From: islishude Date: Mon, 27 Oct 2025 20:23:52 +0800 Subject: [PATCH] core/types: enhance BlobTx decode to validate blob sidecar version --- core/types/tx_blob.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/types/tx_blob.go b/core/types/tx_blob.go index bbfd3c98db3..040c3ae780a 100644 --- a/core/types/tx_blob.go +++ b/core/types/tx_blob.go @@ -402,12 +402,14 @@ func (tx *BlobTx) decode(input []byte) error { return err } var payload blobTxWithBlobs + var notV0 bool if secondElemKind == rlp.List { // No version byte: blob sidecar v0. payload = new(blobTxWithBlobsV0) } else { // It has a version byte. Decode as v1, version is checked by assign() payload = new(blobTxWithBlobsV1) + notV0 = true } if err := rlp.DecodeBytes(input, payload); err != nil { return err @@ -416,6 +418,9 @@ func (tx *BlobTx) decode(input []byte) error { if err := payload.assign(sc); err != nil { return err } + if notV0 && sc.Version == BlobSidecarVersion0 { + return errors.New("invalid blob encoding structure for version 0") + } *tx = *payload.tx() tx.Sidecar = sc return nil