BlockId removal: refactor: Finalizer (#12528)

* BlockId removal: refactor: Finalizer

It changes the arguments of methods of `Finalizer` trait from:
block: `BlockId<Block>` to: hash: `&Block::Hash`

This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)

* minor corrections

* failing test corrected

* minor rework
This commit is contained in:
Michal Kucharczyk
2022-10-20 08:44:04 +02:00
committed by GitHub
parent 7aadc2aa3c
commit 749bcd1949
16 changed files with 113 additions and 118 deletions
+5 -5
View File
@@ -820,7 +820,7 @@ fn revert_not_allowed_for_finalized() {
let canon = propose_and_import_blocks_wrap(BlockId::Number(0), 3);
// Finalize best block
client.finalize_block(BlockId::Hash(canon[2]), None, false).unwrap();
client.finalize_block(&canon[2], None, false).unwrap();
// Revert canon chain to last finalized block
revert(client.clone(), backend, 100).expect("revert should work for baked test scenario");
@@ -882,7 +882,7 @@ fn importing_epoch_change_block_prunes_tree() {
// We finalize block #13 from the canon chain, so on the next epoch
// change the tree should be pruned, to not contain F (#7).
client.finalize_block(BlockId::Hash(canon_hashes[12]), None, false).unwrap();
client.finalize_block(&canon_hashes[12], None, false).unwrap();
propose_and_import_blocks_wrap(BlockId::Hash(client.chain_info().best_hash), 7);
// at this point no hashes from the first fork must exist on the tree
@@ -909,7 +909,7 @@ fn importing_epoch_change_block_prunes_tree() {
.any(|h| fork_3.contains(h)),);
// finalizing block #25 from the canon chain should prune out the second fork
client.finalize_block(BlockId::Hash(canon_hashes[24]), None, false).unwrap();
client.finalize_block(&canon_hashes[24], None, false).unwrap();
propose_and_import_blocks_wrap(BlockId::Hash(client.chain_info().best_hash), 8);
// at this point no hashes from the second fork must exist on the tree
@@ -1049,7 +1049,7 @@ fn obsolete_blocks_aux_data_cleanup() {
assert!(aux_data_check(&fork3_hashes, true));
// Finalize A3
client.finalize_block(BlockId::Number(3), None, true).unwrap();
client.finalize_block(&fork1_hashes[2], None, true).unwrap();
// Wiped: A1, A2
assert!(aux_data_check(&fork1_hashes[..2], false));
@@ -1060,7 +1060,7 @@ fn obsolete_blocks_aux_data_cleanup() {
// Present C4, C5
assert!(aux_data_check(&fork3_hashes, true));
client.finalize_block(BlockId::Number(4), None, true).unwrap();
client.finalize_block(&fork1_hashes[3], None, true).unwrap();
// Wiped: A3
assert!(aux_data_check(&fork1_hashes[2..3], false));