Extract MAX_FINALITY_LAG constant from relay_chain_selection (#5159)

* Fix for Issue #4788

* Updated fix. Moved constant to node primitives

* cargo fmt

* Update node/primitives/src/lib.rs

Co-authored-by: Andronik <write@reusable.software>

* Update node/core/dispute-coordinator/src/real/initialized.rs

Co-authored-by: Andronik <write@reusable.software>
This commit is contained in:
Boluwatife Bakre
2022-03-23 15:34:41 +01:00
committed by GitHub
parent 1656c4cd02
commit 91e07d53ad
4 changed files with 17 additions and 10 deletions
@@ -29,8 +29,9 @@
//! We maintain a rolling window of session indices. This starts as empty
use polkadot_node_jaeger as jaeger;
use polkadot_node_primitives::approval::{
self as approval_types, BlockApprovalMeta, RelayVRFStory,
use polkadot_node_primitives::{
approval::{self as approval_types, BlockApprovalMeta, RelayVRFStory},
MAX_FINALITY_LAG,
};
use polkadot_node_subsystem::{
messages::{
@@ -299,7 +300,7 @@ pub(crate) async fn handle_new_head(
head: Hash,
finalized_number: &Option<BlockNumber>,
) -> SubsystemResult<Vec<BlockImportedCandidates>> {
const MAX_HEADS_LOOK_BACK: BlockNumber = 500;
const MAX_HEADS_LOOK_BACK: BlockNumber = MAX_FINALITY_LAG;
let mut span = jaeger::Span::new(head, "approval-checking-import");
@@ -31,7 +31,7 @@ use sc_keystore::LocalKeystore;
use polkadot_node_primitives::{
CandidateVotes, DisputeMessage, DisputeMessageCheckError, SignedDisputeStatement,
DISPUTE_WINDOW,
DISPUTE_WINDOW, MAX_FINALITY_LAG,
};
use polkadot_node_subsystem::{
messages::{
@@ -69,9 +69,9 @@ use super::{
};
// The capacity and scrape depth are equal to the maximum allowed unfinalized depth.
const LRU_SCRAPED_BLOCKS_CAPACITY: usize = 500;
// This is in sync with `MAX_FINALITY_LAG` in relay chain selection.
const MAX_BATCH_SCRAPE_ANCESTORS: u32 = 500;
const LRU_SCRAPED_BLOCKS_CAPACITY: usize = MAX_FINALITY_LAG as usize;
// This is in sync with `MAX_FINALITY_LAG` in relay chain selection & node primitives.
const MAX_BATCH_SCRAPE_ANCESTORS: u32 = MAX_FINALITY_LAG;
/// After the first active leaves update we transition to `Initialized` state.
///