mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
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:
@@ -215,8 +215,8 @@ pub mod pallet {
|
||||
#[pallet::constant]
|
||||
type BlockLength: Get<limits::BlockLength>;
|
||||
|
||||
/// The `Origin` type used by dispatchable calls.
|
||||
type Origin: Into<Result<RawOrigin<Self::AccountId>, Self::Origin>>
|
||||
/// The `RuntimeOrigin` type used by dispatchable calls.
|
||||
type RuntimeOrigin: Into<Result<RawOrigin<Self::AccountId>, Self::RuntimeOrigin>>
|
||||
+ From<RawOrigin<Self::AccountId>>
|
||||
+ Clone
|
||||
+ OriginTrait<Call = Self::RuntimeCall>;
|
||||
@@ -1701,7 +1701,7 @@ pub mod pallet_prelude {
|
||||
pub use crate::{ensure_none, ensure_root, ensure_signed, ensure_signed_or_root};
|
||||
|
||||
/// Type alias for the `Origin` associated type of system config.
|
||||
pub type OriginFor<T> = <T as crate::Config>::Origin;
|
||||
pub type OriginFor<T> = <T as crate::Config>::RuntimeOrigin;
|
||||
|
||||
/// Type alias for the `BlockNumber` associated type of system config.
|
||||
pub type BlockNumberFor<T> = <T as crate::Config>::BlockNumber;
|
||||
|
||||
@@ -93,7 +93,7 @@ impl Config for Test {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type BlockWeights = RuntimeBlockWeights;
|
||||
type BlockLength = RuntimeBlockLength;
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
|
||||
@@ -20,7 +20,7 @@ use frame_support::{
|
||||
assert_noop, assert_ok,
|
||||
dispatch::{Pays, PostDispatchInfo, WithPostDispatchInfo},
|
||||
};
|
||||
use mock::{Origin, *};
|
||||
use mock::{RuntimeOrigin, *};
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
traits::{BlakeTwo256, Header},
|
||||
@@ -29,8 +29,8 @@ use sp_runtime::{
|
||||
|
||||
#[test]
|
||||
fn origin_works() {
|
||||
let o = Origin::from(RawOrigin::<u64>::Signed(1u64));
|
||||
let x: Result<RawOrigin<u64>, Origin> = o.into();
|
||||
let o = RuntimeOrigin::from(RawOrigin::<u64>::Signed(1u64));
|
||||
let x: Result<RawOrigin<u64>, RuntimeOrigin> = o.into();
|
||||
assert_eq!(x.unwrap(), RawOrigin::<u64>::Signed(1u64));
|
||||
}
|
||||
|
||||
@@ -638,16 +638,16 @@ fn ensure_signed_stuff_works() {
|
||||
}
|
||||
}
|
||||
|
||||
let signed_origin = Origin::signed(0u64);
|
||||
let signed_origin = RuntimeOrigin::signed(0u64);
|
||||
assert_ok!(EnsureSigned::try_origin(signed_origin.clone()));
|
||||
assert_ok!(EnsureSignedBy::<Members, _>::try_origin(signed_origin));
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
{
|
||||
let successful_origin: Origin = EnsureSigned::successful_origin();
|
||||
let successful_origin: RuntimeOrigin = EnsureSigned::successful_origin();
|
||||
assert_ok!(EnsureSigned::try_origin(successful_origin));
|
||||
|
||||
let successful_origin: Origin = EnsureSignedBy::<Members, _>::successful_origin();
|
||||
let successful_origin: RuntimeOrigin = EnsureSignedBy::<Members, _>::successful_origin();
|
||||
assert_ok!(EnsureSignedBy::<Members, _>::try_origin(successful_origin));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user