mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 06:57:58 +00:00
Fast sync child trie support. (#9239)
* state machine proofs. * initial implementation * Remove todo. * Extend test and fix import. * fix no proof, with proof ko. * fix start at logic. * Restore response size. * Rework comments. * Add explicit ref * Use compact proof. * ref change * elaborato on empty change set condition. * KeyValueState renaming. * Do not add two time child trie with same root to sync reply. * rust format * Fix merge. * fix warnings and fmt * fmt * update protocol id to V2
This commit is contained in:
@@ -1110,11 +1110,44 @@ fn syncs_state() {
|
||||
sp_tracing::try_init_simple();
|
||||
for skip_proofs in &[false, true] {
|
||||
let mut net = TestNet::new(0);
|
||||
net.add_full_peer_with_config(Default::default());
|
||||
net.add_full_peer_with_config(FullPeerConfig {
|
||||
sync_mode: SyncMode::Fast { skip_proofs: *skip_proofs, storage_chain_mode: false },
|
||||
..Default::default()
|
||||
});
|
||||
let mut genesis_storage: sp_core::storage::Storage = Default::default();
|
||||
genesis_storage.top.insert(b"additional_key".to_vec(), vec![1]);
|
||||
let mut child_data: std::collections::BTreeMap<Vec<u8>, Vec<u8>> = Default::default();
|
||||
for i in 0u8..16 {
|
||||
child_data.insert(vec![i; 5], vec![i; 33]);
|
||||
}
|
||||
let child1 = sp_core::storage::StorageChild {
|
||||
data: child_data.clone(),
|
||||
child_info: sp_core::storage::ChildInfo::new_default(b"child1"),
|
||||
};
|
||||
let child3 = sp_core::storage::StorageChild {
|
||||
data: child_data.clone(),
|
||||
child_info: sp_core::storage::ChildInfo::new_default(b"child3"),
|
||||
};
|
||||
for i in 22u8..33 {
|
||||
child_data.insert(vec![i; 5], vec![i; 33]);
|
||||
}
|
||||
let child2 = sp_core::storage::StorageChild {
|
||||
data: child_data.clone(),
|
||||
child_info: sp_core::storage::ChildInfo::new_default(b"child2"),
|
||||
};
|
||||
genesis_storage
|
||||
.children_default
|
||||
.insert(child1.child_info.storage_key().to_vec(), child1);
|
||||
genesis_storage
|
||||
.children_default
|
||||
.insert(child2.child_info.storage_key().to_vec(), child2);
|
||||
genesis_storage
|
||||
.children_default
|
||||
.insert(child3.child_info.storage_key().to_vec(), child3);
|
||||
let mut config_one = FullPeerConfig::default();
|
||||
config_one.extra_storage = Some(genesis_storage.clone());
|
||||
net.add_full_peer_with_config(config_one);
|
||||
let mut config_two = FullPeerConfig::default();
|
||||
config_two.extra_storage = Some(genesis_storage);
|
||||
config_two.sync_mode =
|
||||
SyncMode::Fast { skip_proofs: *skip_proofs, storage_chain_mode: false };
|
||||
net.add_full_peer_with_config(config_two);
|
||||
net.peer(0).push_blocks(64, false);
|
||||
// Wait for peer 1 to sync header chain.
|
||||
net.block_until_sync();
|
||||
|
||||
Reference in New Issue
Block a user