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
+3 -3
View File
@@ -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;
+1 -1
View File
@@ -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;
+6 -6
View File
@@ -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));
}
}