From 325070954bfeed9567b21bf888cd9aac0a8ba059 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Wed, 14 Jun 2023 13:28:39 +0200 Subject: [PATCH 1/3] core/types: ensure receipts EncodeIndex writes + support blobtx-receipts --- core/types/receipt.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/types/receipt.go b/core/types/receipt.go index 8fc9ec9894e5e..9988f46c66a4d 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -296,14 +296,17 @@ func (rs Receipts) Len() int { return len(rs) } func (rs Receipts) EncodeIndex(i int, w *bytes.Buffer) { r := rs[i] data := &receiptRLP{r.statusEncoding(), r.CumulativeGasUsed, r.Bloom, r.Logs} - switch r.Type { - case LegacyTxType: + if r.Type == LegacyTxType { rlp.Encode(w, data) + return + } + w.WriteByte(r.Type) + switch r.Type { case AccessListTxType: - w.WriteByte(AccessListTxType) rlp.Encode(w, data) case DynamicFeeTxType: - w.WriteByte(DynamicFeeTxType) + rlp.Encode(w, data) + case BlobTxType: rlp.Encode(w, data) default: // For unsupported types, write nothing. Since this is for From 9d335a8f5849474ce7db4d82c29417709b46f58d Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 14 Jun 2023 19:03:38 +0200 Subject: [PATCH 2/3] Update receipt.go --- core/types/receipt.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/types/receipt.go b/core/types/receipt.go index 9988f46c66a4d..38a5c2d3ed173 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -194,7 +194,7 @@ func (r *Receipt) decodeTyped(b []byte) error { return errShortTypedReceipt } switch b[0] { - case DynamicFeeTxType, AccessListTxType: + case DynamicFeeTxType, AccessListTxType, BlobTxType: var data receiptRLP err := rlp.DecodeBytes(b[1:], &data) if err != nil { From 284fce12deb7a68f9aba2cad6dc2cbe31c1de7d5 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 14 Jun 2023 19:04:42 +0200 Subject: [PATCH 3/3] Update receipt.go --- core/types/receipt.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/types/receipt.go b/core/types/receipt.go index 38a5c2d3ed173..6b4b8972450f7 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -302,11 +302,7 @@ func (rs Receipts) EncodeIndex(i int, w *bytes.Buffer) { } w.WriteByte(r.Type) switch r.Type { - case AccessListTxType: - rlp.Encode(w, data) - case DynamicFeeTxType: - rlp.Encode(w, data) - case BlobTxType: + case AccessListTxType, DynamicFeeTxType, BlobTxType: rlp.Encode(w, data) default: // For unsupported types, write nothing. Since this is for