Skip to content

Commit

Permalink
block_producer.rs comment
Browse files Browse the repository at this point in the history
  • Loading branch information
keroro520 committed Nov 6, 2022
1 parent cba5aef commit 643273b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion crates/benches/benches/benchmarks/smt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ impl BenchExecutionEnvironment {
Vec::new(),
Default::default(),
Vec::new(),
Default::default(),
)
.unwrap();

Expand Down
5 changes: 5 additions & 0 deletions crates/block-producer/src/block_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ impl BlockProducer {
// header_deps, used for obtaining l1 time in the state-validator-script
let block_number = block.raw().number().unpack();
if 2 <= rollup_context.determine_global_state_version(block_number) {
// Recover the l1_confirmed_header based on l1_confimed_timestamp.
// The l1_confirmed_header is referenced when producing l2block and GlobalState.
//
// The block producer would reference confirmed headers to avoid L1 reorg issue.
let finality_as_duration = rollup_context.rollup_config.finality_as_duration();
let last_finalized_timestamp = match Timepoint::from_full_value(
global_state.last_finalized_block_number().unpack(),
Expand All @@ -277,6 +281,7 @@ impl BlockProducer {
l1_confirmed_timestamp, block_number
)
});

tx_skeleton
.header_deps_mut()
.push(ckb_types::prelude::Unpack::unpack(&l1_confirmed_header.hash()).pack());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::time::Duration;

use crate::testing_tool::chain::{
build_sync_tx, construct_block, construct_block_with_timestamp, into_deposit_info_cell,
produce_empty_block, restart_chain, setup_chain, DEFAULT_FINALITY_BLOCKS, TEST_CHAIN_ID,
restart_chain, setup_chain, DEFAULT_FINALITY_BLOCKS, TEST_CHAIN_ID,
};
use crate::testing_tool::common::random_always_success_script;
use crate::testing_tool::mem_pool_provider::DummyMemPoolProvider;
Expand Down

0 comments on commit 643273b

Please sign in to comment.