From a1d38281404d4c0d4257791cdd1c9aa4414ceacc Mon Sep 17 00:00:00 2001 From: kamuikatsurgi Date: Fri, 17 Oct 2025 12:37:04 +0530 Subject: [PATCH 1/3] ssTxs: fix receiptsHash mismatch --- consensus/bor/bor.go | 19 ++++++++++++++----- core/types/receipt.go | 4 ++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index d6cdcbb08b..d59485f07f 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -1071,17 +1071,26 @@ func insertStateSyncTransactionAndCalculateReceipt(stateSyncData []*types.StateS logsFromReceiptCount := countLogsFromReceipts(receipts) stateSyncLogs := allLogs[logsFromReceiptCount:] + txIndex := uint(len(body.Transactions) - 1) + for _, l := range stateSyncLogs { + l.TxIndex = txIndex + } + stateSyncReceipt := &types.Receipt{ + // Consensus fields Type: types.StateSyncTxType, - PostState: header.Root.Bytes(), Status: types.ReceiptStatusSuccessful, CumulativeGasUsed: header.GasUsed, - TxHash: stateSyncTx.Hash(), Logs: stateSyncLogs, - BlockNumber: header.Number, - TransactionIndex: uint(len(body.Transactions)), // we already appended state sync tx on body - EffectiveGasPrice: big.NewInt(0), + // Implementation fields + TxHash: stateSyncTx.Hash(), + GasUsed: 0, + // Inclusion information + BlockHash: header.Hash(), + BlockNumber: header.Number, + TransactionIndex: txIndex, } + stateSyncReceipt.Bloom = types.CreateBloom(stateSyncReceipt) receipts = append(receipts, stateSyncReceipt) diff --git a/core/types/receipt.go b/core/types/receipt.go index 931170bf5e..f22cb5c184 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -218,7 +218,7 @@ func (r *Receipt) decodeTyped(b []byte) error { } switch b[0] { - case DynamicFeeTxType, AccessListTxType, BlobTxType, SetCodeTxType: + case DynamicFeeTxType, AccessListTxType, BlobTxType, SetCodeTxType, StateSyncTxType: var data receiptRLP err := rlp.DecodeBytes(b[1:], &data) @@ -394,7 +394,7 @@ func (rs Receipts) EncodeIndex(i int, w *bytes.Buffer) { } w.WriteByte(r.Type) switch r.Type { - case AccessListTxType, DynamicFeeTxType, BlobTxType, SetCodeTxType: + case AccessListTxType, DynamicFeeTxType, BlobTxType, SetCodeTxType, StateSyncTxType: rlp.Encode(w, data) default: // For unsupported types, write nothing. Since this is for From 83647882d1b8c90a4da21040f998bc850687ec43 Mon Sep 17 00:00:00 2001 From: kamuikatsurgi Date: Fri, 17 Oct 2025 14:17:10 +0530 Subject: [PATCH 2/3] chore: remove block hash and number --- consensus/bor/bor.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index d59485f07f..94da45c91c 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -1086,8 +1086,6 @@ func insertStateSyncTransactionAndCalculateReceipt(stateSyncData []*types.StateS TxHash: stateSyncTx.Hash(), GasUsed: 0, // Inclusion information - BlockHash: header.Hash(), - BlockNumber: header.Number, TransactionIndex: txIndex, } From 936acf9aeea3c7c7e2e3d0ca70a46e5ccef5c1b2 Mon Sep 17 00:00:00 2001 From: kamuikatsurgi Date: Fri, 17 Oct 2025 14:31:11 +0530 Subject: [PATCH 3/3] revert: add block number --- consensus/bor/bor.go | 1 + 1 file changed, 1 insertion(+) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index 94da45c91c..54fe693d94 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -1086,6 +1086,7 @@ func insertStateSyncTransactionAndCalculateReceipt(stateSyncData []*types.StateS TxHash: stateSyncTx.Hash(), GasUsed: 0, // Inclusion information + BlockNumber: header.Number, TransactionIndex: txIndex, }