Skip to content

Commit

Permalink
fix(collator): set is_key_block to meta to save key block
Browse files Browse the repository at this point in the history
  • Loading branch information
SmaGMan authored and Rexagon committed Sep 6, 2024
1 parent 23d843e commit c6b3aa0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions collator/src/collator/build_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ impl CollatorStdImpl {
let new_block_id = *new_block.id();
let block_candidate = Box::new(BlockCandidate {
block: new_block,
is_key_block: new_block_info.key_block,
prev_blocks_ids: prev_shard_data.blocks_ids().clone(),
top_shard_blocks_ids: collation_data.top_shard_blocks_ids.clone(),
collated_data,
Expand Down
3 changes: 2 additions & 1 deletion collator/src/collator/do_collate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,10 @@ impl CollatorStdImpl {
.set(collation_data.block_id_short.seqno);

let block_id = *finalized.block_candidate.block.id();
let is_key_block = finalized.block_candidate.is_key_block;
let new_state_stuff = JoinTask::new({
let meta = NewBlockMeta {
is_key_block: false, // TODO: set from collation data
is_key_block,
gen_utime: collation_data.gen_utime,
mc_ref_seqno: None,
};
Expand Down
1 change: 1 addition & 0 deletions collator/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ impl McData {
#[derive(Clone)]
pub struct BlockCandidate {
pub block: BlockStuffAug,
pub is_key_block: bool,
pub prev_blocks_ids: Vec<BlockId>,
pub top_shard_blocks_ids: Vec<BlockId>,
pub collated_data: Vec<u8>,
Expand Down
7 changes: 6 additions & 1 deletion core/src/block_strider/provider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,12 @@ impl ProofChecker {
let block_handles = self.storage.block_handle_storage();
let handle = block_handles
.load_key_block_handle(virt_block_info.prev_key_block_seqno)
.context("failed to load prev key block handle")?;
.ok_or_else(|| {
anyhow::anyhow!(
"failed to load prev key block handle by prev_key_block_seqno {}",
virt_block_info.prev_key_block_seqno
)
})?;

if handle.id().seqno == 0 {
let zerostate = 'zerostate: {
Expand Down

0 comments on commit c6b3aa0

Please sign in to comment.