Skip to content

Conversation

@yiweichi
Copy link
Member

@yiweichi yiweichi commented Nov 2, 2025

This PR enhances L2 block reorg handling. When a reorg occurs, we:

  1. Identify all transactions from reverted L2 blocks
  2. Update forkchoice to the new canonical chain
  3. Re-submit the reverted transactions to the transaction pool using send_raw_transaction
    This ensures that reverted but valid transactions are not lost and may be included in future blocks.

Corresponding issue: #352
closes: #320, #352

@yiweichi yiweichi requested a review from frisitano November 2, 2025 20:14
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 2, 2025

CodSpeed Performance Report

Merging #406 will not alter performance

Comparing feat-add-reverted-transactions-to-tx-pool (86b6bba) with main (e7ba7aa)

Summary

✅ 2 untouched

Copy link
Collaborator

@frisitano frisitano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Added some comments inline.

@frisitano
Copy link
Collaborator

Can we also update the logic for the UpdateFcsHead:

ChainOrchestratorCommand::UpdateFcsHead((head, sender)) => {
self.engine.update_fcs(Some(head), None, None).await?;
self.database
.tx_mut(move |tx| async move {
tx.purge_l1_message_to_l2_block_mappings(Some(head.number + 1)).await?;
tx.set_l2_head_block_number(head.number).await
})
.await?;
self.notify(ChainOrchestratorEvent::FcsHeadUpdated(head));
let _ = sender.send(());
}

@yiweichi yiweichi requested a review from frisitano November 3, 2025 12:40
@yiweichi
Copy link
Member Author

yiweichi commented Nov 3, 2025

Can we also update the logic for the UpdateFcsHead:

ChainOrchestratorCommand::UpdateFcsHead((head, sender)) => {
self.engine.update_fcs(Some(head), None, None).await?;
self.database
.tx_mut(move |tx| async move {
tx.purge_l1_message_to_l2_block_mappings(Some(head.number + 1)).await?;
tx.set_l2_head_block_number(head.number).await
})
.await?;
self.notify(ChainOrchestratorEvent::FcsHeadUpdated(head));
let _ = sender.send(());
}

Sure, added in commit 24cad17

Copy link
Collaborator

@frisitano frisitano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Sequencer] sequence on top of older block feature (similar to debug_setHead)

3 participants