mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 05:11:09 +00:00
remove Default from CandidateDescriptor (#4484)
* remove Default from CandidateHash * Apply suggestions from code review Co-authored-by: Andronik Ordian <write@reusable.software> * chore: fmt * remove backed candidate default * Partial migration away from CandidateReceipt::default * Remove more CandidateReceipt defaults * fmt * Mostly remove CommittedCandidateReceipt default usage * Remove CommittedCandidateReceipt * Remove more Defaults from polakdot primitives v1 + fmt * Remove more Default from polkadot primites v1 * WIP trying to get overseer example + tests to compile * feat: add primitives test helpers * reduce deps of helper * update primitive helpers * make candidate validation compile * fixup cargo lock * make av-store compile * fixup disputes coordinator tests * test: fixup backing * test: fixup approval voting * fixup bitfield signing * test: fixup runtime-api * test: fixup availability dist * foxi[ pverseer test] * remove some Defaults, remove bounds from `dummy` All `fn dummy` in primitives need to be removed anyways. This aids in the transition. * it's a test helper, so always use std * test: fixup parachains runtime tests Excluding benches. * fix keyring * fix paras runtime properly, no more default * Remove fn dummy() usage from approval voting * Move TestCandidateBuilder out of av store to test helpers * Make candidate validation tests pass * Make most dispute coirdinator tests pass * Make provisioner tests work * Make availability recovery tests work with test helpers * Update polkadot-collator-protocol tests * Update statement distribution tests * Update polkadot overseer examples and tests * Derive default for validation code so we don't break unrelated things * Make para runtime test pass (no bench) * Some more work * chore: cargo fmt * cargo fix * avoid some Default::default * fixup dispute coordinator test * remove unused crate deps * remove Default::default wherever possible, replace by dummy_* for the most part * chore: cargo fmt * Remove some warnings * Remove CommittedCandidateReceipt dummy * Remove CandidateReceipt dummy * Remove CandidateDescriptor dummy * Remove commented out code * Fix para runtime tests * chore: nightly * Some updates to the builder * Dynamically adjust mock head data size * Make dispute cooridinator tests work * Fix test candidate_backing_reorders_votes work * +nightly-2021-10-29 fmt * Spelling and remove a default use in builder * Various clean up * More small updates * fmt * More small updates * Doc comments for test helpers * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras_inherent --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_paras_inherent.rs * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=polkadot-dev --steps=50 --repeat=20 --pallet=runtime_parachains::paras_inherent --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/polkadot/src/weights/runtime_parachains_paras_inherent.rs * Update lib.rs * review comments * fix warnings * fix test by using correct candidate receipt relay parent Co-authored-by: Andronik Ordian <write@reusable.software> Co-authored-by: emostov <32168567+emostov@users.noreply.github.com> Co-authored-by: Parity Bot <admin@parity.io> Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
committed by
GitHub
parent
916497e5db
commit
0f1a9fb1eb
@@ -543,6 +543,7 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::{assigned_slots, mock::TestRegistrar, slots};
|
||||
use ::test_helpers::{dummy_head_data, dummy_validation_code};
|
||||
use frame_support::{assert_noop, assert_ok, parameter_types};
|
||||
use frame_system::EnsureRoot;
|
||||
use pallet_balances;
|
||||
@@ -749,8 +750,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
assert_ok!(TestRegistrar::<Test>::make_parachain(ParaId::from(1)));
|
||||
|
||||
@@ -769,8 +770,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
// Register lease in current lease period
|
||||
@@ -802,22 +803,22 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
2,
|
||||
ParaId::from(2),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
3,
|
||||
ParaId::from(3),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_ok!(AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1),));
|
||||
@@ -839,8 +840,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_eq!(AssignedSlots::permanent_slot_count(), 0);
|
||||
@@ -910,8 +911,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
assert_ok!(TestRegistrar::<Test>::make_parachain(ParaId::from(1)));
|
||||
|
||||
@@ -934,8 +935,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
// Register lease in current lease period
|
||||
@@ -977,8 +978,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
n,
|
||||
ParaId::from(n as u32),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
|
||||
assert_ok!(AssignedSlots::assign_temp_parachain_slot(
|
||||
@@ -994,8 +995,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
7,
|
||||
ParaId::from(7),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
assert_noop!(
|
||||
AssignedSlots::assign_temp_parachain_slot(
|
||||
@@ -1016,8 +1017,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_eq!(AssignedSlots::temporary_slots(ParaId::from(1)), None);
|
||||
@@ -1093,8 +1094,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
n,
|
||||
ParaId::from(n as u32),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
|
||||
assert_ok!(AssignedSlots::assign_temp_parachain_slot(
|
||||
@@ -1216,8 +1217,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_ok!(AssignedSlots::assign_perm_parachain_slot(Origin::root(), ParaId::from(1),));
|
||||
@@ -1242,8 +1243,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code(),
|
||||
));
|
||||
|
||||
assert_ok!(AssignedSlots::assign_temp_parachain_slot(
|
||||
|
||||
@@ -655,6 +655,7 @@ impl<T: Config> Pallet<T> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{auctions, mock::TestRegistrar};
|
||||
use ::test_helpers::{dummy_hash, dummy_head_data, dummy_validation_code};
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok, assert_storage_noop,
|
||||
dispatch::DispatchError::BadOrigin,
|
||||
@@ -874,26 +875,26 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
0.into(),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
1.into(),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
2.into(),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
3.into(),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
});
|
||||
ext
|
||||
@@ -1472,8 +1473,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
1337.into(),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
assert_ok!(Auctions::bid(Origin::signed(1), 1337.into(), 1, 1, 4, 1));
|
||||
});
|
||||
@@ -1603,7 +1604,7 @@ mod tests {
|
||||
new_test_ext().execute_with(|| {
|
||||
EndingPeriod::set(30);
|
||||
SampleLength::set(10);
|
||||
set_last_random(Default::default(), 0);
|
||||
set_last_random(dummy_hash(), 0);
|
||||
|
||||
assert_eq!(
|
||||
Auctions::auction_status(System::block_number()),
|
||||
@@ -1673,7 +1674,7 @@ mod tests {
|
||||
AuctionStatus::<u32>::VrfDelay(4)
|
||||
);
|
||||
|
||||
set_last_random(Default::default(), 45);
|
||||
set_last_random(dummy_hash(), 45);
|
||||
run_to_block(45);
|
||||
assert_eq!(
|
||||
Auctions::auction_status(System::block_number()),
|
||||
|
||||
@@ -828,6 +828,7 @@ mod tests {
|
||||
mock::TestRegistrar,
|
||||
traits::{AuctionStatus, OnSwap},
|
||||
};
|
||||
use ::test_helpers::{dummy_head_data, dummy_validation_code};
|
||||
use sp_keystore::{testing::KeyStore, KeystoreExt};
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
@@ -1077,8 +1078,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
para,
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
return para
|
||||
}
|
||||
@@ -1220,8 +1221,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1337,
|
||||
ParaId::from(1234),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
let e = BalancesError::<Test, _>::InsufficientBalance;
|
||||
assert_noop!(
|
||||
|
||||
@@ -497,6 +497,7 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::{mock::TestRegistrar, slots};
|
||||
use ::test_helpers::{dummy_head_data, dummy_validation_code};
|
||||
use frame_support::{assert_noop, assert_ok, parameter_types};
|
||||
use frame_system::EnsureRoot;
|
||||
use pallet_balances;
|
||||
@@ -628,8 +629,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
|
||||
assert_ok!(Slots::lease_out(1.into(), &1, 1, 1, 1));
|
||||
@@ -659,8 +660,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
|
||||
assert_ok!(Slots::lease_out(1.into(), &1, 6, 1, 1));
|
||||
@@ -702,8 +703,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
|
||||
assert!(Slots::lease_out(1.into(), &1, 6, 1, 1).is_ok());
|
||||
@@ -752,8 +753,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
|
||||
assert!(Slots::lease_out(1.into(), &1, 4, 1, 1).is_ok());
|
||||
@@ -787,8 +788,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
|
||||
assert!(Slots::lease_out(1.into(), &1, 6, 1, 1).is_ok());
|
||||
@@ -830,8 +831,8 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
|
||||
let max_num = 5u32;
|
||||
@@ -866,14 +867,14 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(2),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
|
||||
run_to_block(20);
|
||||
@@ -897,20 +898,20 @@ mod tests {
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(1),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(2),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
assert_ok!(TestRegistrar::<Test>::register(
|
||||
1,
|
||||
ParaId::from(3),
|
||||
Default::default(),
|
||||
Default::default()
|
||||
dummy_head_data(),
|
||||
dummy_validation_code()
|
||||
));
|
||||
|
||||
// We will directly manipulate leases to emulate some kind of failure in the system.
|
||||
|
||||
Reference in New Issue
Block a user