mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 00:31:07 +00:00
Avoid an excessive amount of unrelated errors on prior rustc error
`1.into()` -> `ParaId::from(1_u32)` (#5500)
This commit is contained in:
committed by
GitHub
parent
718380119a
commit
b67b7fa355
@@ -738,7 +738,7 @@ mod tests {
|
||||
run_to_block(1);
|
||||
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1),),
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1_u32),),
|
||||
Error::<Test>::ParaDoesntExist
|
||||
);
|
||||
});
|
||||
@@ -750,7 +750,7 @@ mod tests {
|
||||
run_to_block(1);
|
||||
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::signed(1), ParaId::from(1),),
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::signed(1), ParaId::from(1_u32),),
|
||||
BadOrigin
|
||||
);
|
||||
});
|
||||
@@ -763,14 +763,14 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
assert_ok!(TestRegistrar::<Test>::make_parachain(ParaId::from(1)));
|
||||
assert_ok!(TestRegistrar::<Test>::make_parachain(ParaId::from(1_u32)));
|
||||
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1),),
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1_u32),),
|
||||
Error::<Test>::NotParathread
|
||||
);
|
||||
});
|
||||
@@ -783,16 +783,16 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
// Register lease in current lease period
|
||||
assert_ok!(Slots::lease_out(ParaId::from(1), &1, 1, 1, 1));
|
||||
assert_ok!(Slots::lease_out(ParaId::from(1_u32), &1, 1, 1, 1));
|
||||
// Try to assign a perm slot in current period fails
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1),),
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1_u32),),
|
||||
Error::<Test>::OngoingLeaseExists
|
||||
);
|
||||
|
||||
@@ -800,10 +800,10 @@ mod tests {
|
||||
assert_ok!(Slots::clear_all_leases(Origin::root(), 1.into()));
|
||||
|
||||
// Register lease for next lease period
|
||||
assert_ok!(Slots::lease_out(ParaId::from(1), &1, 1, 2, 1));
|
||||
assert_ok!(Slots::lease_out(ParaId::from(1_u32), &1, 1, 2, 1));
|
||||
// Should be detected and also fail
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1),),
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1_u32),),
|
||||
Error::<Test>::OngoingLeaseExists
|
||||
);
|
||||
});
|
||||
@@ -816,31 +816,37 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
2,
|
||||
ParaId::from(2),
|
||||
ParaId::from(2_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
3,
|
||||
ParaId::from(3),
|
||||
ParaId::from(3_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_ok!(AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1),));
|
||||
assert_ok!(AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(2),));
|
||||
assert_ok!(AssignedSlots::assign_perm_parachain_slot(
|
||||
Origin::root(),
|
||||
ParaId::from(1_u32),
|
||||
));
|
||||
assert_ok!(AssignedSlots::assign_perm_parachain_slot(
|
||||
Origin::root(),
|
||||
ParaId::from(2_u32),
|
||||
));
|
||||
assert_eq!(AssignedSlots::permanent_slot_count(), 2);
|
||||
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(3),),
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(3_u32),),
|
||||
Error::<Test>::MaxPermanentSlotsExceeded
|
||||
);
|
||||
});
|
||||
@@ -853,35 +859,38 @@ mod tests {
|
||||
run_to_block(block);
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_eq!(AssignedSlots::permanent_slot_count(), 0);
|
||||
assert_eq!(AssignedSlots::permanent_slots(ParaId::from(1)), None);
|
||||
assert_eq!(AssignedSlots::permanent_slots(ParaId::from(1_u32)), None);
|
||||
|
||||
assert_ok!(AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1),));
|
||||
assert_ok!(AssignedSlots::assign_perm_parachain_slot(
|
||||
Origin::root(),
|
||||
ParaId::from(1_u32),
|
||||
));
|
||||
|
||||
// Para is a parachain for PermanentSlotLeasePeriodLength * LeasePeriod blocks
|
||||
while block < 9 {
|
||||
println!("block #{}", block);
|
||||
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1_u32)), true);
|
||||
|
||||
assert_eq!(AssignedSlots::permanent_slot_count(), 1);
|
||||
assert_eq!(AssignedSlots::has_permanent_slot(ParaId::from(1)), true);
|
||||
assert_eq!(AssignedSlots::permanent_slots(ParaId::from(1)), Some((0, 3)));
|
||||
assert_eq!(AssignedSlots::has_permanent_slot(ParaId::from(1_u32)), true);
|
||||
assert_eq!(AssignedSlots::permanent_slots(ParaId::from(1_u32)), Some((0, 3)));
|
||||
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1), 0, 2), true);
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1_u32), 0, 2), true);
|
||||
|
||||
block += 1;
|
||||
run_to_block(block);
|
||||
}
|
||||
|
||||
// Para lease ended, downgraded back to parathread
|
||||
assert_eq!(TestRegistrar::<Test>::is_parathread(ParaId::from(1)), true);
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1), 0, 5), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parathread(ParaId::from(1_u32)), true);
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1_u32), 0, 5), false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -893,7 +902,7 @@ mod tests {
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_temp_parachain_slot(
|
||||
Origin::root(),
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
SlotLeasePeriodStart::Current
|
||||
),
|
||||
Error::<Test>::ParaDoesntExist
|
||||
@@ -909,7 +918,7 @@ mod tests {
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_temp_parachain_slot(
|
||||
Origin::signed(1),
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
SlotLeasePeriodStart::Current
|
||||
),
|
||||
BadOrigin
|
||||
@@ -924,16 +933,16 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
assert_ok!(TestRegistrar::<Test>::make_parachain(ParaId::from(1)));
|
||||
assert_ok!(TestRegistrar::<Test>::make_parachain(ParaId::from(1_u32)));
|
||||
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_temp_parachain_slot(
|
||||
Origin::root(),
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
SlotLeasePeriodStart::Current
|
||||
),
|
||||
Error::<Test>::NotParathread
|
||||
@@ -948,18 +957,18 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
// Register lease in current lease period
|
||||
assert_ok!(Slots::lease_out(ParaId::from(1), &1, 1, 1, 1));
|
||||
assert_ok!(Slots::lease_out(ParaId::from(1_u32), &1, 1, 1, 1));
|
||||
// Try to assign a perm slot in current period fails
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_temp_parachain_slot(
|
||||
Origin::root(),
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
SlotLeasePeriodStart::Current
|
||||
),
|
||||
Error::<Test>::OngoingLeaseExists
|
||||
@@ -969,12 +978,12 @@ mod tests {
|
||||
assert_ok!(Slots::clear_all_leases(Origin::root(), 1.into()));
|
||||
|
||||
// Register lease for next lease period
|
||||
assert_ok!(Slots::lease_out(ParaId::from(1), &1, 1, 2, 1));
|
||||
assert_ok!(Slots::lease_out(ParaId::from(1_u32), &1, 1, 2, 1));
|
||||
// Should be detected and also fail
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_temp_parachain_slot(
|
||||
Origin::root(),
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
SlotLeasePeriodStart::Current
|
||||
),
|
||||
Error::<Test>::OngoingLeaseExists
|
||||
@@ -1008,14 +1017,14 @@ mod tests {
|
||||
// Attempt to assign one more temp slot
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
7,
|
||||
ParaId::from(7),
|
||||
ParaId::from(7_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_temp_parachain_slot(
|
||||
Origin::root(),
|
||||
ParaId::from(7),
|
||||
ParaId::from(7_u32),
|
||||
SlotLeasePeriodStart::Current
|
||||
),
|
||||
Error::<Test>::MaxTemporarySlotsExceeded
|
||||
@@ -1030,16 +1039,16 @@ mod tests {
|
||||
run_to_block(block);
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_eq!(AssignedSlots::temporary_slots(ParaId::from(1)), None);
|
||||
assert_eq!(AssignedSlots::temporary_slots(ParaId::from(1_u32)), None);
|
||||
|
||||
assert_ok!(AssignedSlots::assign_temp_parachain_slot(
|
||||
Origin::root(),
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
SlotLeasePeriodStart::Current
|
||||
));
|
||||
assert_eq!(AssignedSlots::temporary_slot_count(), 1);
|
||||
@@ -1050,14 +1059,14 @@ mod tests {
|
||||
while block < 6 {
|
||||
println!("block #{}", block);
|
||||
println!("lease period #{}", AssignedSlots::current_lease_period_index());
|
||||
println!("lease {:?}", Slots::lease(ParaId::from(1)));
|
||||
println!("lease {:?}", Slots::lease(ParaId::from(1_u32)));
|
||||
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1_u32)), true);
|
||||
|
||||
assert_eq!(AssignedSlots::has_temporary_slot(ParaId::from(1)), true);
|
||||
assert_eq!(AssignedSlots::has_temporary_slot(ParaId::from(1_u32)), true);
|
||||
assert_eq!(AssignedSlots::active_temporary_slot_count(), 1);
|
||||
assert_eq!(
|
||||
AssignedSlots::temporary_slots(ParaId::from(1)),
|
||||
AssignedSlots::temporary_slots(ParaId::from(1_u32)),
|
||||
Some(ParachainTemporarySlot {
|
||||
manager: 1,
|
||||
period_begin: 0,
|
||||
@@ -1067,7 +1076,7 @@ mod tests {
|
||||
})
|
||||
);
|
||||
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1), 0, 1), true);
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1_u32), 0, 1), true);
|
||||
|
||||
block += 1;
|
||||
run_to_block(block);
|
||||
@@ -1076,11 +1085,11 @@ mod tests {
|
||||
// Block 6
|
||||
println!("block #{}", block);
|
||||
println!("lease period #{}", AssignedSlots::current_lease_period_index());
|
||||
println!("lease {:?}", Slots::lease(ParaId::from(1)));
|
||||
println!("lease {:?}", Slots::lease(ParaId::from(1_u32)));
|
||||
|
||||
// Para lease ended, downgraded back to parathread
|
||||
assert_eq!(TestRegistrar::<Test>::is_parathread(ParaId::from(1)), true);
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1), 0, 3), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parathread(ParaId::from(1_u32)), true);
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1_u32), 0, 3), false);
|
||||
assert_eq!(AssignedSlots::active_temporary_slot_count(), 0);
|
||||
|
||||
// Block 12
|
||||
@@ -1088,10 +1097,10 @@ mod tests {
|
||||
run_to_block(12);
|
||||
println!("block #{}", block);
|
||||
println!("lease period #{}", AssignedSlots::current_lease_period_index());
|
||||
println!("lease {:?}", Slots::lease(ParaId::from(1)));
|
||||
println!("lease {:?}", Slots::lease(ParaId::from(1_u32)));
|
||||
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1)), true);
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1), 4, 5), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1_u32)), true);
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1_u32), 4, 5), true);
|
||||
assert_eq!(AssignedSlots::active_temporary_slot_count(), 1);
|
||||
});
|
||||
}
|
||||
@@ -1129,11 +1138,11 @@ mod tests {
|
||||
run_to_block(n);
|
||||
}
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(0)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(2)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(3)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(4)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(5)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(2_u32)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(3_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(4_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(5_u32)), false);
|
||||
assert_eq!(AssignedSlots::active_temporary_slot_count(), 2);
|
||||
}
|
||||
|
||||
@@ -1141,11 +1150,11 @@ mod tests {
|
||||
for n in 6..=11 {
|
||||
run_to_block(n);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(0)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(2)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(3)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(4)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(5)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1_u32)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(2_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(3_u32)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(4_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(5_u32)), false);
|
||||
assert_eq!(AssignedSlots::active_temporary_slot_count(), 2);
|
||||
}
|
||||
|
||||
@@ -1153,11 +1162,11 @@ mod tests {
|
||||
for n in 12..=17 {
|
||||
run_to_block(n);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(0)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(2)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(3)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(4)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(5)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(2_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(3_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(4_u32)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(5_u32)), true);
|
||||
assert_eq!(AssignedSlots::active_temporary_slot_count(), 2);
|
||||
}
|
||||
|
||||
@@ -1165,11 +1174,11 @@ mod tests {
|
||||
for n in 18..=23 {
|
||||
run_to_block(n);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(0)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(2)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(3)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(4)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(5)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(2_u32)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(3_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(4_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(5_u32)), false);
|
||||
assert_eq!(AssignedSlots::active_temporary_slot_count(), 2);
|
||||
}
|
||||
|
||||
@@ -1177,11 +1186,11 @@ mod tests {
|
||||
for n in 24..=29 {
|
||||
run_to_block(n);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(0)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(2)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(3)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(4)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(5)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1_u32)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(2_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(3_u32)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(4_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(5_u32)), false);
|
||||
assert_eq!(AssignedSlots::active_temporary_slot_count(), 2);
|
||||
}
|
||||
|
||||
@@ -1189,11 +1198,11 @@ mod tests {
|
||||
for n in 30..=35 {
|
||||
run_to_block(n);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(0)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(2)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(3)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(4)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(5)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(2_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(3_u32)), false);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(4_u32)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(5_u32)), true);
|
||||
assert_eq!(AssignedSlots::active_temporary_slot_count(), 2);
|
||||
}
|
||||
});
|
||||
@@ -1205,7 +1214,7 @@ mod tests {
|
||||
run_to_block(1);
|
||||
|
||||
assert_noop!(
|
||||
AssignedSlots::unassign_parachain_slot(Origin::root(), ParaId::from(1),),
|
||||
AssignedSlots::unassign_parachain_slot(Origin::root(), ParaId::from(1_u32),),
|
||||
Error::<Test>::SlotNotAssigned
|
||||
);
|
||||
});
|
||||
@@ -1217,7 +1226,7 @@ mod tests {
|
||||
run_to_block(1);
|
||||
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::signed(1), ParaId::from(1),),
|
||||
AssignedSlots::assign_perm_parachain_slot(Origin::signed(1), ParaId::from(1_u32),),
|
||||
BadOrigin
|
||||
);
|
||||
});
|
||||
@@ -1230,22 +1239,27 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_ok!(AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1),));
|
||||
assert_ok!(AssignedSlots::assign_perm_parachain_slot(
|
||||
Origin::root(),
|
||||
ParaId::from(1_u32),
|
||||
));
|
||||
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1_u32)), true);
|
||||
|
||||
assert_ok!(AssignedSlots::unassign_parachain_slot(Origin::root(), ParaId::from(1),));
|
||||
assert_ok!(
|
||||
AssignedSlots::unassign_parachain_slot(Origin::root(), ParaId::from(1_u32),)
|
||||
);
|
||||
|
||||
assert_eq!(AssignedSlots::permanent_slot_count(), 0);
|
||||
assert_eq!(AssignedSlots::has_permanent_slot(ParaId::from(1)), false);
|
||||
assert_eq!(AssignedSlots::permanent_slots(ParaId::from(1)), None);
|
||||
assert_eq!(AssignedSlots::has_permanent_slot(ParaId::from(1_u32)), false);
|
||||
assert_eq!(AssignedSlots::permanent_slots(ParaId::from(1_u32)), None);
|
||||
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1), 0, 2), false);
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1_u32), 0, 2), false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1256,27 +1270,29 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_ok!(AssignedSlots::assign_temp_parachain_slot(
|
||||
Origin::root(),
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
SlotLeasePeriodStart::Current
|
||||
));
|
||||
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1)), true);
|
||||
assert_eq!(TestRegistrar::<Test>::is_parachain(ParaId::from(1_u32)), true);
|
||||
|
||||
assert_ok!(AssignedSlots::unassign_parachain_slot(Origin::root(), ParaId::from(1),));
|
||||
assert_ok!(
|
||||
AssignedSlots::unassign_parachain_slot(Origin::root(), ParaId::from(1_u32),)
|
||||
);
|
||||
|
||||
assert_eq!(AssignedSlots::temporary_slot_count(), 0);
|
||||
assert_eq!(AssignedSlots::active_temporary_slot_count(), 0);
|
||||
assert_eq!(AssignedSlots::has_temporary_slot(ParaId::from(1)), false);
|
||||
assert_eq!(AssignedSlots::temporary_slots(ParaId::from(1)), None);
|
||||
assert_eq!(AssignedSlots::has_temporary_slot(ParaId::from(1_u32)), false);
|
||||
assert_eq!(AssignedSlots::temporary_slots(ParaId::from(1_u32)), None);
|
||||
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1), 0, 1), false);
|
||||
assert_eq!(Slots::already_leased(ParaId::from(1_u32), 0, 1), false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1383,8 +1383,8 @@ mod tests {
|
||||
new_test_ext().execute_with(|| {
|
||||
run_to_block(1);
|
||||
assert_ok!(Auctions::new_auction(Origin::signed(6), 1, 1));
|
||||
let para_1 = ParaId::from(1);
|
||||
let para_2 = ParaId::from(2);
|
||||
let para_1 = ParaId::from(1_u32);
|
||||
let para_2 = ParaId::from(2_u32);
|
||||
|
||||
// Make a bid and reserve a balance
|
||||
assert_ok!(Auctions::bid(Origin::signed(1), para_1, 1, 1, 4, 10));
|
||||
@@ -1407,9 +1407,9 @@ mod tests {
|
||||
new_test_ext().execute_with(|| {
|
||||
run_to_block(1);
|
||||
assert_ok!(Auctions::new_auction(Origin::signed(6), 9, 1));
|
||||
let para_1 = ParaId::from(1);
|
||||
let para_2 = ParaId::from(2);
|
||||
let para_3 = ParaId::from(3);
|
||||
let para_1 = ParaId::from(1_u32);
|
||||
let para_2 = ParaId::from(2_u32);
|
||||
let para_3 = ParaId::from(3_u32);
|
||||
|
||||
// Make bids
|
||||
assert_ok!(Auctions::bid(Origin::signed(1), para_1, 1, 1, 4, 10));
|
||||
@@ -1522,9 +1522,9 @@ mod tests {
|
||||
|
||||
run_to_block(1);
|
||||
assert_ok!(Auctions::new_auction(Origin::signed(6), 9, 11));
|
||||
let para_1 = ParaId::from(1);
|
||||
let para_2 = ParaId::from(2);
|
||||
let para_3 = ParaId::from(3);
|
||||
let para_1 = ParaId::from(1_u32);
|
||||
let para_2 = ParaId::from(2_u32);
|
||||
let para_3 = ParaId::from(3_u32);
|
||||
|
||||
// Make bids
|
||||
assert_ok!(Auctions::bid(Origin::signed(1), para_1, 1, 11, 14, 10));
|
||||
@@ -1782,7 +1782,7 @@ mod benchmarking {
|
||||
Auctions::<T>::new_auction(RawOrigin::Root.into(), duration, lease_period_index)?;
|
||||
|
||||
let para = ParaId::from(0);
|
||||
let new_para = ParaId::from(1);
|
||||
let new_para = ParaId::from(1_u32);
|
||||
|
||||
// Register the paras
|
||||
let owner = account("owner", 0, 0);
|
||||
|
||||
@@ -1964,7 +1964,7 @@ mod benchmarking {
|
||||
|
||||
benchmarks! {
|
||||
create {
|
||||
let para_id = ParaId::from(1);
|
||||
let para_id = ParaId::from(1_u32);
|
||||
let cap = BalanceOf::<T>::max_value();
|
||||
let first_period = 0u32.into();
|
||||
let last_period = 3u32.into();
|
||||
@@ -2052,7 +2052,7 @@ mod benchmarking {
|
||||
}
|
||||
|
||||
edit {
|
||||
let para_id = ParaId::from(1);
|
||||
let para_id = ParaId::from(1_u32);
|
||||
let cap = BalanceOf::<T>::max_value();
|
||||
let first_period = 0u32.into();
|
||||
let last_period = 3u32.into();
|
||||
|
||||
@@ -631,7 +631,7 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
@@ -662,7 +662,7 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
@@ -705,7 +705,7 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
@@ -755,7 +755,7 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
@@ -790,7 +790,7 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
@@ -833,7 +833,7 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
@@ -858,7 +858,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// Leases is empty.
|
||||
assert!(Leases::<Test>::get(ParaId::from(1)).is_empty());
|
||||
assert!(Leases::<Test>::get(ParaId::from(1_u32)).is_empty());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -869,13 +869,13 @@ mod tests {
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(2),
|
||||
ParaId::from(2_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
@@ -900,19 +900,19 @@ mod tests {
|
||||
run_to_block(1);
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
ParaId::from(1_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(2),
|
||||
ParaId::from(2_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(3),
|
||||
ParaId::from(3_u32),
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
@@ -920,9 +920,9 @@ mod tests {
|
||||
// We will directly manipulate leases to emulate some kind of failure in the system.
|
||||
// Para 1 will have no leases
|
||||
// Para 2 will have a lease period in the current index
|
||||
Leases::<Test>::insert(ParaId::from(2), vec![Some((0, 0))]);
|
||||
Leases::<Test>::insert(ParaId::from(2_u32), vec![Some((0, 0))]);
|
||||
// Para 3 will have a lease period in a future index
|
||||
Leases::<Test>::insert(ParaId::from(3), vec![None, None, Some((0, 0))]);
|
||||
Leases::<Test>::insert(ParaId::from(3_u32), vec![None, None, Some((0, 0))]);
|
||||
|
||||
// Para 1 should fail cause they don't have any leases
|
||||
assert_noop!(
|
||||
|
||||
Reference in New Issue
Block a user