BREAKING: Rename Origin (#12258)

* BREAKING: Rename Origin

* more renaming

* a bit more renaming

* fix

* more fixing

* fix in frame_support

* even more fixes

* fix

* small fix

* ...

* update .stderr

* docs

* update docs

* update docs

* docs
This commit is contained in:
Sergej Sakac
2022-09-21 00:13:09 +02:00
committed by GitHub
parent 986d20b352
commit e4b6f4a66d
221 changed files with 5233 additions and 4200 deletions
+6 -2
View File
@@ -953,7 +953,7 @@ benchmarks! {
#[cfg(test)]
mod tests {
use super::*;
use crate::mock::{Balances, ExtBuilder, Origin, Staking, Test};
use crate::mock::{Balances, ExtBuilder, RuntimeOrigin, Staking, Test};
use frame_support::assert_ok;
#[test]
@@ -1000,7 +1000,11 @@ mod tests {
let current_era = CurrentEra::<Test>::get().unwrap();
let original_free_balance = Balances::free_balance(&validator_stash);
assert_ok!(Staking::payout_stakers(Origin::signed(1337), validator_stash, current_era));
assert_ok!(Staking::payout_stakers(
RuntimeOrigin::signed(1337),
validator_stash,
current_era
));
let new_free_balance = Balances::free_balance(&validator_stash);
assert!(original_free_balance < new_free_balance);
+15 -6
View File
@@ -131,7 +131,7 @@ impl frame_system::Config for Test {
type BlockWeights = ();
type BlockLength = ();
type DbWeight = RocksDbWeight;
type Origin = Origin;
type RuntimeOrigin = RuntimeOrigin;
type Index = AccountIndex;
type BlockNumber = BlockNumber;
type RuntimeCall = RuntimeCall;
@@ -660,13 +660,22 @@ pub(crate) fn current_era() -> EraIndex {
pub(crate) fn bond(stash: AccountId, ctrl: AccountId, val: Balance) {
let _ = Balances::make_free_balance_be(&stash, val);
let _ = Balances::make_free_balance_be(&ctrl, val);
assert_ok!(Staking::bond(Origin::signed(stash), ctrl, val, RewardDestination::Controller));
assert_ok!(Staking::bond(
RuntimeOrigin::signed(stash),
ctrl,
val,
RewardDestination::Controller
));
}
pub(crate) fn bond_validator(stash: AccountId, ctrl: AccountId, val: Balance) {
bond(stash, ctrl, val);
assert_ok!(Staking::validate(Origin::signed(ctrl), ValidatorPrefs::default()));
assert_ok!(Session::set_keys(Origin::signed(ctrl), SessionKeys { other: ctrl.into() }, vec![]));
assert_ok!(Staking::validate(RuntimeOrigin::signed(ctrl), ValidatorPrefs::default()));
assert_ok!(Session::set_keys(
RuntimeOrigin::signed(ctrl),
SessionKeys { other: ctrl.into() },
vec![]
));
}
pub(crate) fn bond_nominator(
@@ -676,7 +685,7 @@ pub(crate) fn bond_nominator(
target: Vec<AccountId>,
) {
bond(stash, ctrl, val);
assert_ok!(Staking::nominate(Origin::signed(ctrl), target));
assert_ok!(Staking::nominate(RuntimeOrigin::signed(ctrl), target));
}
/// Progress to the given block, triggering session and era changes as we progress.
@@ -846,7 +855,7 @@ pub(crate) fn make_all_reward_payment(era: EraIndex) {
// reward validators
for validator_controller in validators_with_reward.iter().filter_map(Staking::bonded) {
let ledger = <Ledger<Test>>::get(&validator_controller).unwrap();
assert_ok!(Staking::payout_stakers(Origin::signed(1337), ledger.stash, era));
assert_ok!(Staking::payout_stakers(RuntimeOrigin::signed(1337), ledger.stash, era));
}
}
+6 -6
View File
@@ -155,7 +155,7 @@ pub mod pallet {
type SlashDeferDuration: Get<EraIndex>;
/// The origin which can cancel a deferred slash. Root can always do this.
type SlashCancelOrigin: EnsureOrigin<Self::Origin>;
type SlashCancelOrigin: EnsureOrigin<Self::RuntimeOrigin>;
/// Interface for interacting with a session pallet.
type SessionInterface: SessionInterface<Self::AccountId>;
@@ -608,18 +608,18 @@ pub mod pallet {
"Stash does not have enough balance to bond."
);
frame_support::assert_ok!(<Pallet<T>>::bond(
T::Origin::from(Some(stash.clone()).into()),
T::RuntimeOrigin::from(Some(stash.clone()).into()),
T::Lookup::unlookup(controller.clone()),
balance,
RewardDestination::Staked,
));
frame_support::assert_ok!(match status {
crate::StakerStatus::Validator => <Pallet<T>>::validate(
T::Origin::from(Some(controller.clone()).into()),
T::RuntimeOrigin::from(Some(controller.clone()).into()),
Default::default(),
),
crate::StakerStatus::Nominator(votes) => <Pallet<T>>::nominate(
T::Origin::from(Some(controller.clone()).into()),
T::RuntimeOrigin::from(Some(controller.clone()).into()),
votes.iter().map(|l| T::Lookup::unlookup(l.clone())).collect(),
),
_ => Ok(()),
@@ -1476,7 +1476,7 @@ pub mod pallet {
/// Needed to report an accurate weight for the dispatch. Trusted by `Root` to report an
/// accurate number.
///
/// Origin must be root.
/// RuntimeOrigin must be root.
///
/// # <weight>
/// - E: Number of history depths removed, i.e. 10 -> 7 = 3
@@ -1593,7 +1593,7 @@ pub mod pallet {
/// * `min_commission`: The minimum amount of commission that each validators must maintain.
/// This is checked only upon calling `validate`. Existing validators are not affected.
///
/// Origin must be Root to call this function.
/// RuntimeOrigin must be Root to call this function.
///
/// NOTE: Existing nominators and validators will not be affected by this update.
/// to kick people under the new limits, `chill_other` should be called.
File diff suppressed because it is too large Load Diff