refactor(block producer): log local tip l2 and l1 block info
@@ -81,7 +81,31 @@ impl ChainUpdater {
};
if !self.find_l2block_on_l1(local_tip_committed_info).await? {
self.revert_to_valid_tip_on_l1().await?;
- log::info!("revert to valid tip on l1");
+
+ let (
+ local_tip_block_number,
+ local_tip_block_hash,
+ committed_l1_block_number,
+ committed_l1_block_hash,
+ ) = {
+ let chain = self.chain.lock().await;
+ let local_tip_block = chain.local_state().tip().raw();
+ let local_tip_committed_info = chain.local_state().last_synced();
+ (
+ Unpack::<u64>::unpack(&local_tip_block.number()),
+ Into::<ckb_types::H256>::into(local_tip_block.hash()),
+ Unpack::<u64>::unpack(&local_tip_committed_info.number()),
+ ckb_types::H256(local_tip_committed_info.block_hash().unpack()),
+ )
+ };
+
+ log::warn!(
+ "revert to l2 block number {} hash {} on l1 block number {} hash {}",
+ local_tip_block_number,
+ local_tip_block_hash,
+ committed_l1_block_number,
+ committed_l1_block_hash
+ )
}
self.try_sync().await?;
@@ -120,9 +144,15 @@ impl ChainUpdater {
let valid_tip_l1_block_number = {
let chain = self.chain.lock().await;
let local_tip_block: u64 = chain.local_state().tip().raw().number().unpack();
- log::info!("try sync from l2 block {}", local_tip_block);
+ let local_committed_l1_block: u64 = chain.local_state().last_synced().number().unpack();
+
+ log::info!(
+ "try sync from l2 block {} on l1 block {}",
+ local_tip_block,
+ local_committed_l1_block
+ );
- chain.local_state().last_synced().number().unpack()
+ local_committed_l1_block
};
let search_key = SearchKey {
script: self.rollup_type_script.clone().into(),
