Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions consensus/bor/bor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1071,17 +1071,25 @@ 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
BlockNumber: header.Number,
TransactionIndex: txIndex,
}

stateSyncReceipt.Bloom = types.CreateBloom(stateSyncReceipt)
receipts = append(receipts, stateSyncReceipt)

Expand Down
4 changes: 2 additions & 2 deletions core/types/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Loading