Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes after the latest code update. #17

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
apis: RUNTIME_API_VERSIONS,
transaction_version: 24,
state_version: 1,
extrinsic_state_version: 0,
};

/// The BABE epoch configuration at genesis.
Expand Down Expand Up @@ -1182,6 +1183,7 @@ impl pallet_mmr::Config for Runtime {
type OnNewRoot = pallet_beefy_mmr::DepositBeefyDigest<Runtime>;
type WeightInfo = ();
type LeafData = pallet_beefy_mmr::Pallet<Runtime>;
type BlockHashProvider = pallet_mmr::DefaultBlockHashProvider<Runtime>;
}

parameter_types! {
Expand Down
117 changes: 90 additions & 27 deletions substrate/client/network/sync/src/strategy/chain_sync/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,16 @@ fn processes_empty_response_on_justification_request_for_unknown_block() {
let client = Arc::new(TestClientBuilder::new().build());
let peer_id = PeerId::random();

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 1, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
1,
64,
None,
std::iter::empty(),
)
.unwrap();

let (a1_hash, a1_number) = {
let a1 = BlockBuilderBuilder::new(&*client)
Expand Down Expand Up @@ -95,9 +102,16 @@ fn restart_doesnt_affect_peers_downloading_finality_data() {

// we request max 8 blocks to always initiate block requests to both peers for the test to be
// deterministic
let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 1, 8, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
1,
8,
None,
std::iter::empty(),
)
.unwrap();

let peer_id1 = PeerId::random();
let peer_id2 = PeerId::random();
Expand Down Expand Up @@ -292,9 +306,16 @@ fn do_ancestor_search_when_common_block_to_best_queued_gap_is_to_big() {
let mut client = Arc::new(TestClientBuilder::new().build());
let info = client.info();

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 5, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
5,
64,
None,
std::iter::empty(),
)
.unwrap();

let peer_id1 = PeerId::random();
let peer_id2 = PeerId::random();
Expand Down Expand Up @@ -440,9 +461,16 @@ fn can_sync_huge_fork() {

let info = client.info();

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 5, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
5,
64,
None,
std::iter::empty(),
)
.unwrap();

let finalized_block = blocks[MAX_BLOCKS_TO_LOOK_BACKWARDS as usize * 2 - 1].clone();
let just = (*b"TEST", Vec::new());
Expand Down Expand Up @@ -575,9 +603,16 @@ fn syncs_fork_without_duplicate_requests() {

let info = client.info();

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 5, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
5,
64,
None,
std::iter::empty(),
)
.unwrap();

let finalized_block = blocks[MAX_BLOCKS_TO_LOOK_BACKWARDS as usize * 2 - 1].clone();
let just = (*b"TEST", Vec::new());
Expand Down Expand Up @@ -712,9 +747,16 @@ fn removes_target_fork_on_disconnect() {
let mut client = Arc::new(TestClientBuilder::new().build());
let blocks = (0..3).map(|_| build_block(&mut client, None, false)).collect::<Vec<_>>();

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 1, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
1,
64,
None,
std::iter::empty(),
)
.unwrap();

let peer_id1 = PeerId::random();
let common_block = blocks[1].clone();
Expand All @@ -739,9 +781,16 @@ fn can_import_response_with_missing_blocks() {

let empty_client = Arc::new(TestClientBuilder::new().build());

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), empty_client.clone(), 1, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
empty_client.clone(),
1,
64,
None,
std::iter::empty(),
)
.unwrap();

let peer_id1 = PeerId::random();
let best_block = blocks[3].clone();
Expand Down Expand Up @@ -772,9 +821,16 @@ fn ancestor_search_repeat() {
#[test]
fn sync_restart_removes_block_but_not_justification_requests() {
let mut client = Arc::new(TestClientBuilder::new().build());
let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 1, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
1,
64,
None,
std::iter::empty(),
)
.unwrap();

let peers = vec![PeerId::random(), PeerId::random()];

Expand Down Expand Up @@ -916,9 +972,16 @@ fn request_across_forks() {
fork_blocks
};

let mut sync =
ChainSync::new(ChainSyncMode::Full, Default::default(), client.clone(), 5, 64, None, std::iter::empty())
.unwrap();
let mut sync = ChainSync::new(
ChainSyncMode::Full,
Default::default(),
client.clone(),
5,
64,
None,
std::iter::empty(),
)
.unwrap();

// Add the peers, all at the common ancestor 100.
let common_block = blocks.last().unwrap();
Expand Down
Loading