mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
Rename Origin (#1628)
* Rename Origin
* more renaming
* fixes
* fix errors
* last fix?
* rename
* Update mock.rs
* update lockfile for {"polkadot", "substrate"}
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -117,7 +117,7 @@ pub mod pallet {
|
||||
type Currency: ReservableCurrency<Self::AccountId>;
|
||||
|
||||
/// Origin that can dictate updating parameters of this pallet.
|
||||
type UpdateOrigin: EnsureOrigin<Self::Origin>;
|
||||
type UpdateOrigin: EnsureOrigin<Self::RuntimeOrigin>;
|
||||
|
||||
/// Account Identifier from which the internal Pot is generated.
|
||||
type PotId: Get<PalletId>;
|
||||
|
||||
@@ -59,7 +59,7 @@ impl system::Config for Test {
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
type DbWeight = ();
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
|
||||
@@ -38,14 +38,14 @@ fn it_should_set_invulnerables() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let new_set = vec![1, 2, 3, 4];
|
||||
assert_ok!(CollatorSelection::set_invulnerables(
|
||||
Origin::signed(RootAccount::get()),
|
||||
RuntimeOrigin::signed(RootAccount::get()),
|
||||
new_set.clone()
|
||||
));
|
||||
assert_eq!(CollatorSelection::invulnerables(), new_set);
|
||||
|
||||
// cannot set with non-root.
|
||||
assert_noop!(
|
||||
CollatorSelection::set_invulnerables(Origin::signed(1), new_set.clone()),
|
||||
CollatorSelection::set_invulnerables(RuntimeOrigin::signed(1), new_set.clone()),
|
||||
BadOrigin
|
||||
);
|
||||
|
||||
@@ -53,7 +53,7 @@ fn it_should_set_invulnerables() {
|
||||
let invulnerables = vec![7];
|
||||
assert_noop!(
|
||||
CollatorSelection::set_invulnerables(
|
||||
Origin::signed(RootAccount::get()),
|
||||
RuntimeOrigin::signed(RootAccount::get()),
|
||||
invulnerables.clone()
|
||||
),
|
||||
Error::<Test>::ValidatorNotRegistered
|
||||
@@ -69,13 +69,16 @@ fn set_desired_candidates_works() {
|
||||
|
||||
// can set
|
||||
assert_ok!(CollatorSelection::set_desired_candidates(
|
||||
Origin::signed(RootAccount::get()),
|
||||
RuntimeOrigin::signed(RootAccount::get()),
|
||||
7
|
||||
));
|
||||
assert_eq!(CollatorSelection::desired_candidates(), 7);
|
||||
|
||||
// rejects bad origin
|
||||
assert_noop!(CollatorSelection::set_desired_candidates(Origin::signed(1), 8), BadOrigin);
|
||||
assert_noop!(
|
||||
CollatorSelection::set_desired_candidates(RuntimeOrigin::signed(1), 8),
|
||||
BadOrigin
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -86,11 +89,14 @@ fn set_candidacy_bond() {
|
||||
assert_eq!(CollatorSelection::candidacy_bond(), 10);
|
||||
|
||||
// can set
|
||||
assert_ok!(CollatorSelection::set_candidacy_bond(Origin::signed(RootAccount::get()), 7));
|
||||
assert_ok!(CollatorSelection::set_candidacy_bond(
|
||||
RuntimeOrigin::signed(RootAccount::get()),
|
||||
7
|
||||
));
|
||||
assert_eq!(CollatorSelection::candidacy_bond(), 7);
|
||||
|
||||
// rejects bad origin.
|
||||
assert_noop!(CollatorSelection::set_candidacy_bond(Origin::signed(1), 8), BadOrigin);
|
||||
assert_noop!(CollatorSelection::set_candidacy_bond(RuntimeOrigin::signed(1), 8), BadOrigin);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -102,17 +108,17 @@ fn cannot_register_candidate_if_too_many() {
|
||||
|
||||
// can't accept anyone anymore.
|
||||
assert_noop!(
|
||||
CollatorSelection::register_as_candidate(Origin::signed(3)),
|
||||
CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3)),
|
||||
Error::<Test>::TooManyCandidates,
|
||||
);
|
||||
|
||||
// reset desired candidates:
|
||||
<crate::DesiredCandidates<Test>>::put(1);
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(4)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(4)));
|
||||
|
||||
// but no more
|
||||
assert_noop!(
|
||||
CollatorSelection::register_as_candidate(Origin::signed(5)),
|
||||
CollatorSelection::register_as_candidate(RuntimeOrigin::signed(5)),
|
||||
Error::<Test>::TooManyCandidates,
|
||||
);
|
||||
})
|
||||
@@ -123,11 +129,11 @@ fn cannot_unregister_candidate_if_too_few() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// reset desired candidates:
|
||||
<crate::DesiredCandidates<Test>>::put(1);
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(4)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(4)));
|
||||
|
||||
// can not remove too few
|
||||
assert_noop!(
|
||||
CollatorSelection::leave_intent(Origin::signed(4)),
|
||||
CollatorSelection::leave_intent(RuntimeOrigin::signed(4)),
|
||||
Error::<Test>::TooFewCandidates,
|
||||
);
|
||||
})
|
||||
@@ -140,7 +146,7 @@ fn cannot_register_as_candidate_if_invulnerable() {
|
||||
|
||||
// can't 1 because it is invulnerable.
|
||||
assert_noop!(
|
||||
CollatorSelection::register_as_candidate(Origin::signed(1)),
|
||||
CollatorSelection::register_as_candidate(RuntimeOrigin::signed(1)),
|
||||
Error::<Test>::AlreadyInvulnerable,
|
||||
);
|
||||
})
|
||||
@@ -151,7 +157,7 @@ fn cannot_register_as_candidate_if_keys_not_registered() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// can't 7 because keys not registered.
|
||||
assert_noop!(
|
||||
CollatorSelection::register_as_candidate(Origin::signed(7)),
|
||||
CollatorSelection::register_as_candidate(RuntimeOrigin::signed(7)),
|
||||
Error::<Test>::ValidatorNotRegistered
|
||||
);
|
||||
})
|
||||
@@ -161,7 +167,7 @@ fn cannot_register_as_candidate_if_keys_not_registered() {
|
||||
fn cannot_register_dupe_candidate() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// can add 3 as candidate
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(3)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3)));
|
||||
let addition = CandidateInfo { who: 3, deposit: 10 };
|
||||
assert_eq!(CollatorSelection::candidates(), vec![addition]);
|
||||
assert_eq!(CollatorSelection::last_authored_block(3), 10);
|
||||
@@ -169,7 +175,7 @@ fn cannot_register_dupe_candidate() {
|
||||
|
||||
// but no more
|
||||
assert_noop!(
|
||||
CollatorSelection::register_as_candidate(Origin::signed(3)),
|
||||
CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3)),
|
||||
Error::<Test>::AlreadyCandidate,
|
||||
);
|
||||
})
|
||||
@@ -182,11 +188,11 @@ fn cannot_register_as_candidate_if_poor() {
|
||||
assert_eq!(Balances::free_balance(&33), 0);
|
||||
|
||||
// works
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(3)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3)));
|
||||
|
||||
// poor
|
||||
assert_noop!(
|
||||
CollatorSelection::register_as_candidate(Origin::signed(33)),
|
||||
CollatorSelection::register_as_candidate(RuntimeOrigin::signed(33)),
|
||||
BalancesError::<Test>::InsufficientBalance,
|
||||
);
|
||||
});
|
||||
@@ -205,8 +211,8 @@ fn register_as_candidate_works() {
|
||||
assert_eq!(Balances::free_balance(&3), 100);
|
||||
assert_eq!(Balances::free_balance(&4), 100);
|
||||
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(3)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(4)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(4)));
|
||||
|
||||
assert_eq!(Balances::free_balance(&3), 90);
|
||||
assert_eq!(Balances::free_balance(&4), 90);
|
||||
@@ -219,21 +225,21 @@ fn register_as_candidate_works() {
|
||||
fn leave_intent() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// register a candidate.
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(3)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3)));
|
||||
assert_eq!(Balances::free_balance(3), 90);
|
||||
|
||||
// register too so can leave above min candidates
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(5)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(5)));
|
||||
assert_eq!(Balances::free_balance(5), 90);
|
||||
|
||||
// cannot leave if not candidate.
|
||||
assert_noop!(
|
||||
CollatorSelection::leave_intent(Origin::signed(4)),
|
||||
CollatorSelection::leave_intent(RuntimeOrigin::signed(4)),
|
||||
Error::<Test>::NotCandidate
|
||||
);
|
||||
|
||||
// bond is returned
|
||||
assert_ok!(CollatorSelection::leave_intent(Origin::signed(3)));
|
||||
assert_ok!(CollatorSelection::leave_intent(RuntimeOrigin::signed(3)));
|
||||
assert_eq!(Balances::free_balance(3), 100);
|
||||
assert_eq!(CollatorSelection::last_authored_block(3), 0);
|
||||
});
|
||||
@@ -247,7 +253,7 @@ fn authorship_event_handler() {
|
||||
|
||||
// 4 is the default author.
|
||||
assert_eq!(Balances::free_balance(4), 100);
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(4)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(4)));
|
||||
// triggers `note_author`
|
||||
Authorship::on_initialize(1);
|
||||
|
||||
@@ -272,7 +278,7 @@ fn fees_edgecases() {
|
||||
Balances::make_free_balance_be(&CollatorSelection::account_id(), 5);
|
||||
// 4 is the default author.
|
||||
assert_eq!(Balances::free_balance(4), 100);
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(4)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(4)));
|
||||
// triggers `note_author`
|
||||
Authorship::on_initialize(1);
|
||||
|
||||
@@ -301,7 +307,7 @@ fn session_management_works() {
|
||||
assert_eq!(SessionHandlerCollators::get(), vec![1, 2]);
|
||||
|
||||
// add a new collator
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(3)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3)));
|
||||
|
||||
// session won't see this.
|
||||
assert_eq!(SessionHandlerCollators::get(), vec![1, 2]);
|
||||
@@ -328,8 +334,8 @@ fn session_management_works() {
|
||||
fn kick_mechanism() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// add a new collator
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(3)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(4)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(4)));
|
||||
initialize_to_block(10);
|
||||
assert_eq!(CollatorSelection::candidates().len(), 2);
|
||||
initialize_to_block(20);
|
||||
@@ -353,8 +359,8 @@ fn kick_mechanism() {
|
||||
fn should_not_kick_mechanism_too_few() {
|
||||
new_test_ext().execute_with(|| {
|
||||
// add a new collator
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(3)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(Origin::signed(5)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3)));
|
||||
assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(5)));
|
||||
initialize_to_block(10);
|
||||
assert_eq!(CollatorSelection::candidates().len(), 2);
|
||||
initialize_to_block(20);
|
||||
|
||||
@@ -90,7 +90,7 @@ pub mod pallet {
|
||||
type XcmExecutor: ExecuteXcm<Self::RuntimeCall>;
|
||||
|
||||
/// Origin which is allowed to execute overweight messages.
|
||||
type ExecuteOverweightOrigin: EnsureOrigin<Self::Origin>;
|
||||
type ExecuteOverweightOrigin: EnsureOrigin<Self::RuntimeOrigin>;
|
||||
}
|
||||
|
||||
/// The configuration.
|
||||
@@ -387,7 +387,7 @@ mod tests {
|
||||
type AccountId = u64;
|
||||
|
||||
impl frame_system::Config for Test {
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
@@ -744,15 +744,23 @@ mod tests {
|
||||
assert_eq!(overweights(), vec![0]);
|
||||
|
||||
assert_noop!(
|
||||
DmpQueue::service_overweight(Origin::signed(1), 0, Weight::from_ref_time(20000)),
|
||||
DmpQueue::service_overweight(
|
||||
RuntimeOrigin::signed(1),
|
||||
0,
|
||||
Weight::from_ref_time(20000)
|
||||
),
|
||||
BadOrigin
|
||||
);
|
||||
assert_noop!(
|
||||
DmpQueue::service_overweight(Origin::root(), 1, Weight::from_ref_time(20000)),
|
||||
DmpQueue::service_overweight(
|
||||
RuntimeOrigin::root(),
|
||||
1,
|
||||
Weight::from_ref_time(20000)
|
||||
),
|
||||
Error::<Test>::Unknown
|
||||
);
|
||||
assert_noop!(
|
||||
DmpQueue::service_overweight(Origin::root(), 0, Weight::from_ref_time(9999)),
|
||||
DmpQueue::service_overweight(RuntimeOrigin::root(), 0, Weight::from_ref_time(9999)),
|
||||
Error::<Test>::OverLimit
|
||||
);
|
||||
assert_eq!(take_trace(), vec![msg_limit_reached(10000)]);
|
||||
@@ -762,16 +770,23 @@ mod tests {
|
||||
.get_dispatch_info()
|
||||
.weight;
|
||||
use frame_support::dispatch::GetDispatchInfo;
|
||||
let info =
|
||||
DmpQueue::service_overweight(Origin::root(), 0, Weight::from_ref_time(20000))
|
||||
.unwrap();
|
||||
let info = DmpQueue::service_overweight(
|
||||
RuntimeOrigin::root(),
|
||||
0,
|
||||
Weight::from_ref_time(20000),
|
||||
)
|
||||
.unwrap();
|
||||
let actual_weight = info.actual_weight.unwrap();
|
||||
assert_eq!(actual_weight, base_weight + Weight::from_ref_time(10000));
|
||||
assert_eq!(take_trace(), vec![msg_complete(10000)]);
|
||||
assert!(overweights().is_empty());
|
||||
|
||||
assert_noop!(
|
||||
DmpQueue::service_overweight(Origin::root(), 0, Weight::from_ref_time(20000)),
|
||||
DmpQueue::service_overweight(
|
||||
RuntimeOrigin::root(),
|
||||
0,
|
||||
Weight::from_ref_time(20000)
|
||||
),
|
||||
Error::<Test>::Unknown
|
||||
);
|
||||
});
|
||||
|
||||
@@ -73,7 +73,7 @@ parameter_types! {
|
||||
pub const ReservedDmpWeight: Weight = Weight::zero();
|
||||
}
|
||||
impl frame_system::Config for Test {
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
|
||||
@@ -90,14 +90,14 @@ pub mod pallet {
|
||||
type VersionWrapper: WrapVersion;
|
||||
|
||||
/// The origin that is allowed to execute overweight messages.
|
||||
type ExecuteOverweightOrigin: EnsureOrigin<Self::Origin>;
|
||||
type ExecuteOverweightOrigin: EnsureOrigin<Self::RuntimeOrigin>;
|
||||
|
||||
/// The origin that is allowed to resume or suspend the XCMP queue.
|
||||
type ControllerOrigin: EnsureOrigin<Self::Origin>;
|
||||
type ControllerOrigin: EnsureOrigin<Self::RuntimeOrigin>;
|
||||
|
||||
/// The conversion function used to attempt to convert an XCM `MultiLocation` origin to a
|
||||
/// superuser origin.
|
||||
type ControllerOriginConverter: ConvertOrigin<Self::Origin>;
|
||||
type ControllerOriginConverter: ConvertOrigin<Self::RuntimeOrigin>;
|
||||
|
||||
/// The weight information of this pallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
|
||||
@@ -62,7 +62,7 @@ impl frame_system::Config for Test {
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
type DbWeight = ();
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
@@ -160,12 +160,14 @@ pub type XcmRouter = (
|
||||
XcmpQueue,
|
||||
);
|
||||
|
||||
pub struct SystemParachainAsSuperuser<Origin>(PhantomData<Origin>);
|
||||
impl<Origin: OriginTrait> ConvertOrigin<Origin> for SystemParachainAsSuperuser<Origin> {
|
||||
pub struct SystemParachainAsSuperuser<RuntimeOrigin>(PhantomData<RuntimeOrigin>);
|
||||
impl<RuntimeOrigin: OriginTrait> ConvertOrigin<RuntimeOrigin>
|
||||
for SystemParachainAsSuperuser<RuntimeOrigin>
|
||||
{
|
||||
fn convert_origin(
|
||||
origin: impl Into<MultiLocation>,
|
||||
kind: OriginKind,
|
||||
) -> Result<Origin, MultiLocation> {
|
||||
) -> Result<RuntimeOrigin, MultiLocation> {
|
||||
let origin = origin.into();
|
||||
if kind == OriginKind::Superuser &&
|
||||
matches!(
|
||||
@@ -175,7 +177,7 @@ impl<Origin: OriginTrait> ConvertOrigin<Origin> for SystemParachainAsSuperuser<O
|
||||
interior: X1(Parachain(id)),
|
||||
} if ParaId::from(id).is_system(),
|
||||
) {
|
||||
Ok(Origin::root())
|
||||
Ok(RuntimeOrigin::root())
|
||||
} else {
|
||||
Err(origin)
|
||||
}
|
||||
@@ -189,7 +191,7 @@ impl Config for Test {
|
||||
type VersionWrapper = ();
|
||||
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
|
||||
type ControllerOrigin = EnsureRoot<AccountId>;
|
||||
type ControllerOriginConverter = SystemParachainAsSuperuser<Origin>;
|
||||
type ControllerOriginConverter = SystemParachainAsSuperuser<RuntimeOrigin>;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
use super::*;
|
||||
use cumulus_primitives_core::XcmpMessageHandler;
|
||||
use frame_support::{assert_noop, assert_ok};
|
||||
use mock::{new_test_ext, Origin, RuntimeCall, Test, XcmpQueue};
|
||||
use mock::{new_test_ext, RuntimeCall, RuntimeOrigin, Test, XcmpQueue};
|
||||
use sp_runtime::traits::BadOrigin;
|
||||
|
||||
#[test]
|
||||
@@ -96,7 +96,7 @@ fn handle_invalid_data() {
|
||||
fn service_overweight_unknown() {
|
||||
new_test_ext().execute_with(|| {
|
||||
assert_noop!(
|
||||
XcmpQueue::service_overweight(Origin::root(), 0, Weight::from_ref_time(1000)),
|
||||
XcmpQueue::service_overweight(RuntimeOrigin::root(), 0, Weight::from_ref_time(1000)),
|
||||
Error::<Test>::BadOverweightIndex,
|
||||
);
|
||||
});
|
||||
@@ -109,7 +109,7 @@ fn service_overweight_bad_xcm_format() {
|
||||
Overweight::<Test>::insert(0, (ParaId::from(1000), 0, bad_xcm));
|
||||
|
||||
assert_noop!(
|
||||
XcmpQueue::service_overweight(Origin::root(), 0, Weight::from_ref_time(1000)),
|
||||
XcmpQueue::service_overweight(RuntimeOrigin::root(), 0, Weight::from_ref_time(1000)),
|
||||
Error::<Test>::BadXcm
|
||||
);
|
||||
});
|
||||
@@ -148,8 +148,8 @@ fn update_suspend_threshold_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||
assert_eq!(data.suspend_threshold, 2);
|
||||
assert_ok!(XcmpQueue::update_suspend_threshold(Origin::root(), 3));
|
||||
assert_noop!(XcmpQueue::update_suspend_threshold(Origin::signed(2), 5), BadOrigin);
|
||||
assert_ok!(XcmpQueue::update_suspend_threshold(RuntimeOrigin::root(), 3));
|
||||
assert_noop!(XcmpQueue::update_suspend_threshold(RuntimeOrigin::signed(2), 5), BadOrigin);
|
||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||
|
||||
assert_eq!(data.suspend_threshold, 3);
|
||||
@@ -161,8 +161,8 @@ fn update_drop_threshold_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||
assert_eq!(data.drop_threshold, 5);
|
||||
assert_ok!(XcmpQueue::update_drop_threshold(Origin::root(), 6));
|
||||
assert_noop!(XcmpQueue::update_drop_threshold(Origin::signed(2), 7), BadOrigin);
|
||||
assert_ok!(XcmpQueue::update_drop_threshold(RuntimeOrigin::root(), 6));
|
||||
assert_noop!(XcmpQueue::update_drop_threshold(RuntimeOrigin::signed(2), 7), BadOrigin);
|
||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||
|
||||
assert_eq!(data.drop_threshold, 6);
|
||||
@@ -174,8 +174,8 @@ fn update_resume_threshold_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||
assert_eq!(data.resume_threshold, 1);
|
||||
assert_ok!(XcmpQueue::update_resume_threshold(Origin::root(), 2));
|
||||
assert_noop!(XcmpQueue::update_resume_threshold(Origin::signed(7), 3), BadOrigin);
|
||||
assert_ok!(XcmpQueue::update_resume_threshold(RuntimeOrigin::root(), 2));
|
||||
assert_noop!(XcmpQueue::update_resume_threshold(RuntimeOrigin::signed(7), 3), BadOrigin);
|
||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||
|
||||
assert_eq!(data.resume_threshold, 2);
|
||||
@@ -188,12 +188,12 @@ fn update_threshold_weight_works() {
|
||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||
assert_eq!(data.threshold_weight, Weight::from_ref_time(100_000));
|
||||
assert_ok!(XcmpQueue::update_threshold_weight(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
Weight::from_ref_time(10_000)
|
||||
));
|
||||
assert_noop!(
|
||||
XcmpQueue::update_threshold_weight(
|
||||
Origin::signed(5),
|
||||
RuntimeOrigin::signed(5),
|
||||
Weight::from_ref_time(10_000_000)
|
||||
),
|
||||
BadOrigin
|
||||
@@ -210,11 +210,14 @@ fn update_weight_restrict_decay_works() {
|
||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||
assert_eq!(data.weight_restrict_decay, Weight::from_ref_time(2));
|
||||
assert_ok!(XcmpQueue::update_weight_restrict_decay(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
Weight::from_ref_time(5)
|
||||
));
|
||||
assert_noop!(
|
||||
XcmpQueue::update_weight_restrict_decay(Origin::signed(6), Weight::from_ref_time(4)),
|
||||
XcmpQueue::update_weight_restrict_decay(
|
||||
RuntimeOrigin::signed(6),
|
||||
Weight::from_ref_time(4)
|
||||
),
|
||||
BadOrigin
|
||||
);
|
||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||
@@ -229,12 +232,12 @@ fn update_xcmp_max_individual_weight() {
|
||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||
assert_eq!(data.xcmp_max_individual_weight, 20u64 * WEIGHT_PER_MILLIS);
|
||||
assert_ok!(XcmpQueue::update_xcmp_max_individual_weight(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
30u64 * WEIGHT_PER_MILLIS
|
||||
));
|
||||
assert_noop!(
|
||||
XcmpQueue::update_xcmp_max_individual_weight(
|
||||
Origin::signed(3),
|
||||
RuntimeOrigin::signed(3),
|
||||
10u64 * WEIGHT_PER_MILLIS
|
||||
),
|
||||
BadOrigin
|
||||
|
||||
Reference in New Issue
Block a user