more ParaId::from uses (#5514)

This commit is contained in:
Bernhard Schuster
2022-05-12 16:46:19 +02:00
committed by GitHub
parent 49ed8c6f63
commit 26340b9054
7 changed files with 57 additions and 57 deletions
@@ -146,8 +146,8 @@ fn add_block_entry_works() {
let block_hash_a = Hash::repeat_byte(2);
let block_hash_b = Hash::repeat_byte(69);
let candidate_receipt_a = make_candidate(1.into(), parent_hash);
let candidate_receipt_b = make_candidate(2.into(), parent_hash);
let candidate_receipt_a = make_candidate(ParaId::from(1_u32), parent_hash);
let candidate_receipt_b = make_candidate(ParaId::from(2_u32), parent_hash);
let candidate_hash_a = candidate_receipt_a.hash();
let candidate_hash_b = candidate_receipt_b.hash();
@@ -284,11 +284,11 @@ fn canonicalize_works() {
let block_hash_d1 = Hash::repeat_byte(6);
let block_hash_d2 = Hash::repeat_byte(7);
let candidate_receipt_genesis = make_candidate(1.into(), genesis);
let candidate_receipt_a = make_candidate(2.into(), block_hash_a);
let candidate_receipt_b = make_candidate(3.into(), block_hash_a);
let candidate_receipt_b1 = make_candidate(4.into(), block_hash_b1);
let candidate_receipt_c1 = make_candidate(5.into(), block_hash_c1);
let candidate_receipt_genesis = make_candidate(ParaId::from(1_u32), genesis);
let candidate_receipt_a = make_candidate(ParaId::from(2_u32), block_hash_a);
let candidate_receipt_b = make_candidate(ParaId::from(3_u32), block_hash_a);
let candidate_receipt_b1 = make_candidate(ParaId::from(4_u32), block_hash_b1);
let candidate_receipt_c1 = make_candidate(ParaId::from(5_u32), block_hash_c1);
let cand_hash_1 = candidate_receipt_genesis.hash();
let cand_hash_2 = candidate_receipt_a.hash();
@@ -467,7 +467,7 @@ fn force_approve_works() {
candidate_info.insert(
candidate_hash,
NewCandidateInfo::new(
make_candidate(1.into(), Default::default()),
make_candidate(ParaId::from(1_u32), Default::default()),
GroupIndex(1),
None,
),
@@ -612,7 +612,7 @@ pub(crate) mod tests {
use polkadot_node_subsystem::messages::AllMessages;
use polkadot_node_subsystem_test_helpers::make_subsystem_context;
use polkadot_node_subsystem_util::database::Database;
use polkadot_primitives::v2::{SessionInfo, ValidatorIndex};
use polkadot_primitives::v2::{Id as ParaId, SessionInfo, ValidatorIndex};
pub(crate) use sp_consensus_babe::{
digests::{CompatibleDigestItem, PreDigest, SecondaryVRFPreDigest},
AllowedSlots, BabeEpochConfiguration, Epoch as BabeEpoch,
@@ -1206,8 +1206,8 @@ pub(crate) mod tests {
r
};
let candidates = vec![
(make_candidate(1.into()), CoreIndex(0), GroupIndex(0)),
(make_candidate(2.into()), CoreIndex(1), GroupIndex(1)),
(make_candidate(ParaId::from(1)), CoreIndex(0), GroupIndex(0)),
(make_candidate(ParaId::from(2)), CoreIndex(1), GroupIndex(1)),
];
let inclusion_events = candidates
.iter()
+10 -10
View File
@@ -773,7 +773,7 @@ async fn import_block(
) {
let (new_head, new_header) = &hashes[hashes.len() - 1];
let candidates = config.candidates.clone().unwrap_or(vec![(
make_candidate(0.into(), &new_head),
make_candidate(ParaId::from(0_u32), &new_head),
CoreIndex(0),
GroupIndex(0),
)]);
@@ -1127,7 +1127,7 @@ fn subsystem_rejects_approval_if_no_candidate_entry() {
let candidate_index = 0;
let validator = ValidatorIndex(0);
let candidate_descriptor = make_candidate(1.into(), &block_hash);
let candidate_descriptor = make_candidate(ParaId::from(1_u32), &block_hash);
let candidate_hash = candidate_descriptor.hash();
let head: Hash = ChainBuilder::GENESIS_HASH;
@@ -1233,7 +1233,7 @@ fn subsystem_rejects_approval_before_assignment() {
let candidate_hash = {
let mut candidate_receipt =
dummy_candidate_receipt_bad_sig(block_hash, Some(Default::default()));
candidate_receipt.descriptor.para_id = 0.into();
candidate_receipt.descriptor.para_id = ParaId::from(0_u32);
candidate_receipt.descriptor.relay_parent = block_hash;
candidate_receipt.hash()
};
@@ -1448,7 +1448,7 @@ fn subsystem_accepts_and_imports_approval_after_assignment() {
let candidate_hash = {
let mut candidate_receipt =
dummy_candidate_receipt_bad_sig(block_hash, Some(Default::default()));
candidate_receipt.descriptor.para_id = 0.into();
candidate_receipt.descriptor.para_id = ParaId::from(0_u32);
candidate_receipt.descriptor.relay_parent = block_hash;
candidate_receipt.hash()
};
@@ -1519,7 +1519,7 @@ fn subsystem_second_approval_import_only_schedules_wakeups() {
let candidate_hash = {
let mut candidate_receipt =
dummy_candidate_receipt_bad_sig(block_hash, Some(Default::default()));
candidate_receipt.descriptor.para_id = 0.into();
candidate_receipt.descriptor.para_id = ParaId::from(0_u32);
candidate_receipt.descriptor.relay_parent = block_hash;
candidate_receipt.hash()
};
@@ -1883,7 +1883,7 @@ fn import_checked_approval_updates_entries_and_schedules() {
..session_info(&validators)
};
let candidate_descriptor = make_candidate(1.into(), &block_hash);
let candidate_descriptor = make_candidate(ParaId::from(1_u32), &block_hash);
let candidate_hash = candidate_descriptor.hash();
let head: Hash = ChainBuilder::GENESIS_HASH;
@@ -2009,12 +2009,12 @@ fn subsystem_import_checked_approval_sets_one_block_bit_at_a_time() {
let candidate_receipt1 = {
let mut receipt = dummy_candidate_receipt(block_hash);
receipt.descriptor.para_id = 1.into();
receipt.descriptor.para_id = ParaId::from(1_u32);
receipt
};
let candidate_receipt2 = {
let mut receipt = dummy_candidate_receipt(block_hash);
receipt.descriptor.para_id = 2.into();
receipt.descriptor.para_id = ParaId::from(2_u32);
receipt
};
let candidate_hash1 = candidate_receipt1.hash();
@@ -2867,7 +2867,7 @@ fn pre_covers_dont_stall_approval() {
..session_info(&validators)
};
let candidate_descriptor = make_candidate(1.into(), &block_hash);
let candidate_descriptor = make_candidate(ParaId::from(1_u32), &block_hash);
let candidate_hash = candidate_descriptor.hash();
let head: Hash = ChainBuilder::GENESIS_HASH;
@@ -3046,7 +3046,7 @@ fn waits_until_approving_assignments_are_old_enough() {
..session_info(&validators)
};
let candidate_descriptor = make_candidate(1.into(), &block_hash);
let candidate_descriptor = make_candidate(ParaId::from(1_u32), &block_hash);
let candidate_hash = candidate_descriptor.hash();
let head: Hash = ChainBuilder::GENESIS_HASH;