Skip to content

Commit 62655a2

Browse files
committed
feat: try RLP decoding
1 parent aac8c89 commit 62655a2

File tree

1 file changed

+12
-0
lines changed
  • packages/taiko-client/driver/chain_syncer/blob/blocks_inserter

1 file changed

+12
-0
lines changed

packages/taiko-client/driver/chain_syncer/blob/blocks_inserter/pacaya.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/ethereum/go-ethereum/core/rawdb"
1414
"github.com/ethereum/go-ethereum/core/types"
1515
"github.com/ethereum/go-ethereum/log"
16+
"github.com/ethereum/go-ethereum/rlp"
1617
"github.com/holiman/uint256"
1718

1819
"github.com/taikoxyz/taiko-mono/packages/taiko-client/bindings/encoding"
@@ -302,6 +303,17 @@ func (i *BlocksInserterPacaya) insertPreconfBlockFromExecutionPayload(
302303
if executableData.Transactions[0], err = utils.DecompressPacaya(executableData.Transactions[0]); err != nil {
303304
return nil, fmt.Errorf("failed to decompress transactions list bytes: %w", err)
304305
}
306+
// Try to RLP decode the transaction list bytes, if it fails, we will set the transactions list to empty.
307+
if err := rlp.DecodeBytes(executableData.Transactions[0], new(types.Transactions)); err != nil {
308+
log.Info(
309+
"Failed to RLP decode preconfirmation block transactions list bytes, will set it to empty",
310+
"blockID", executableData.BlockNumber,
311+
"error", err,
312+
)
313+
if executableData.Transactions[0], err = rlp.EncodeToBytes(types.Transactions{}); err != nil {
314+
return nil, fmt.Errorf("failed RLP encode transactions list bytes: %w", err)
315+
}
316+
}
305317

306318
var u256BaseFee = uint256.Int(executableData.BaseFeePerGas)
307319
payload, err := createExecutionPayloadsAndSetHead(

0 commit comments

Comments
 (0)