diff --git a/collator/src/manager/mod.rs b/collator/src/manager/mod.rs index 40cc0e68b..10f058379 100644 --- a/collator/src/manager/mod.rs +++ b/collator/src/manager/mod.rs @@ -1345,7 +1345,6 @@ where self.blocks_cache.reset_top_shard_blocks_additional_info()?; let mc_data = McData::load_from_state(state)?; - let top_processed_to_anchor = mc_data.top_processed_to_anchor; // remove all previous blocks from cache let mut to_block_keys = vec![mc_block_entry.key()]; @@ -1361,10 +1360,10 @@ where self.blocks_cache .remove_next_collated_blocks_from_cache(&to_block_keys); - self.process_mc_state_update(mc_data, true).await?; + self.process_mc_state_update(mc_data.clone(), true).await?; // handle top processed to anchor in mempool - self.notify_top_processed_to_anchor_to_mempool(top_processed_to_anchor)?; + self.notify_top_processed_to_anchor_to_mempool(mc_data.top_processed_to_anchor)?; break; } @@ -1492,16 +1491,10 @@ where .validator_set_cache .get_next_validator_set(&mc_data.config)?; - let mc_processed_to_anchor_id = mc_data - .processed_upto - .externals - .as_ref() - .map_or(0, |upto| upto.processed_to.0); - let cx = StateUpdateContext { mc_block_id: mc_data.block_id, mc_block_chain_time: mc_data.gen_chain_time, - mc_processed_to_anchor_id, + top_processed_to_anchor_id: mc_data.top_processed_to_anchor, consensus_info: mc_data.consensus_info, shuffle_validators: mc_data.config.get_collation_config()?.shuffle_mc_validators, consensus_config: mc_data.config.get_consensus_config()?, diff --git a/collator/src/mempool/impls/std_impl.rs b/collator/src/mempool/impls/std_impl.rs index 2d00a1e61..b351df964 100644 --- a/collator/src/mempool/impls/std_impl.rs +++ b/collator/src/mempool/impls/std_impl.rs @@ -97,7 +97,7 @@ impl MempoolAdapterStdImpl { // Note: mempool is always run from applied mc block self.top_known_anchor - .set_max_raw(last_state_update.mc_processed_to_anchor_id); + .set_max_raw(last_state_update.top_processed_to_anchor_id); let engine = Engine::new( self.key_pair.clone(), @@ -116,7 +116,7 @@ impl MempoolAdapterStdImpl { // actual oldest sync round will be not less than this let estimated_sync_bottom = last_state_update - .mc_processed_to_anchor_id + .top_processed_to_anchor_id .saturating_sub(mempool_config.consensus.reset_rounds()) .max(mempool_config.genesis.start_round); if estimated_sync_bottom >= last_state_update.consensus_info.vset_switch_round { @@ -136,10 +136,10 @@ impl MempoolAdapterStdImpl { "cannot start from outdated peer sets (too short mempool epoch(s)): \ estimated sync bottom {estimated_sync_bottom} \ is older than prev vset switch round {}; \ - start round {}, masterchain processed to anchor {} in block {}", + start round {}, top processed to anchor {} in block {}", last_state_update.consensus_info.prev_vset_switch_round, mempool_config.genesis.start_round, - last_state_update.mc_processed_to_anchor_id, + last_state_update.top_processed_to_anchor_id, last_state_update.mc_block_id, ) }; @@ -292,11 +292,11 @@ impl MempoolAdapter for MempoolAdapterStdImpl { // genesis does not have externals, so only strictly greater time and round // will be saved into next block, so genesis can have values GEQ than in prev block anyhow::ensure!( - genesis.start_round >= new_cx.mc_processed_to_anchor_id + genesis.start_round >= new_cx.top_processed_to_anchor_id && genesis.time_millis >= new_cx.mc_block_chain_time, "new {genesis:?} should be >= \ - master block processed_to_anchor_id {} and gen chain_time {}", - new_cx.mc_processed_to_anchor_id, + top processed_to_anchor_id {} and block gen chain_time {}", + new_cx.top_processed_to_anchor_id, new_cx.mc_block_chain_time, ); diff --git a/collator/src/mempool/state_update_context.rs b/collator/src/mempool/state_update_context.rs index 3f2e26bb0..100c1a74f 100644 --- a/collator/src/mempool/state_update_context.rs +++ b/collator/src/mempool/state_update_context.rs @@ -9,7 +9,7 @@ use super::MempoolAnchorId; pub struct StateUpdateContext { pub mc_block_id: BlockId, pub mc_block_chain_time: u64, - pub mc_processed_to_anchor_id: MempoolAnchorId, + pub top_processed_to_anchor_id: MempoolAnchorId, pub consensus_info: ConsensusInfo, pub consensus_config: ConsensusConfig, pub shuffle_validators: bool, @@ -25,8 +25,8 @@ impl std::fmt::Debug for DebugStateUpdateContext<'_> { .field("mc_block_id", &self.0.mc_block_id.as_short_id()) .field("mc_block_chain_time", &self.0.mc_block_chain_time) .field( - "mc_processed_to_anchor_id", - &self.0.mc_processed_to_anchor_id, + "top_processed_to_anchor_id", + &self.0.top_processed_to_anchor_id, ) .field("consensus_info", &self.0.consensus_info) .field("consensus_config", &self.0.consensus_config)