Skip to content

Commit

Permalink
feat: check index before slicing allTxs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Feb 4, 2025
1 parent 998c79a commit 8552ab4
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ func (i *BlocksInserterPacaya) InsertBlocks(
return fmt.Errorf("failed to create TaikoAnchor.anchorV3 transaction: %w", err)
}

// Get transactions in the block.
txs := types.Transactions{}
if txListCursor+int(blockInfo.NumTransactions) > len(allTxs) {
txs = allTxs[txListCursor : txListCursor+int(blockInfo.NumTransactions)]
}

// Decompress the transactions list and try to insert a new head block to L2 EE.
if lastPayloadData, err = createPayloadAndSetHead(
ctx,
Expand All @@ -207,7 +213,7 @@ func (i *BlocksInserterPacaya) InsertBlocks(
L1BlockHeight: meta.GetRawBlockHeight(),
L1BlockHash: meta.GetRawBlockHash(),
},
Txs: allTxs[txListCursor : txListCursor+int(blockInfo.NumTransactions)],
Txs: txs,
Withdrawals: make([]*types.Withdrawal, 0),
BaseFee: baseFee,
},
Expand Down

0 comments on commit 8552ab4

Please sign in to comment.