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
+1 -1
View File
@@ -176,7 +176,7 @@ pub mod mock {
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type RuntimeOrigin = RuntimeOrigin;
type Index = AccountIndex;
type BlockNumber = BlockNumber;
type RuntimeCall = RuntimeCall;
+6 -6
View File
@@ -112,14 +112,14 @@ macro_rules! whitelist {
/// foo {
/// let caller = account::<T>(b"caller", 0, benchmarks_seed);
/// let l in 1 .. MAX_LENGTH => initialize_l(l);
/// }: _(Origin::Signed(caller), vec![0u8; l])
/// }: _(RuntimeOrigin::Signed(caller), vec![0u8; l])
///
/// // second dispatchable: bar; this is a root dispatchable and accepts a `u8` vector of size
/// // `l`.
/// // In this case, we explicitly name the call using `bar` instead of `_`.
/// bar {
/// let l in 1 .. MAX_LENGTH => initialize_l(l);
/// }: bar(Origin::Root, vec![0u8; l])
/// }: bar(RuntimeOrigin::Root, vec![0u8; l])
///
/// // third dispatchable: baz; this is a user dispatchable. It isn't dependent on length like the
/// // other two but has its own complexity `c` that needs setting up. It uses `caller` (in the
@@ -128,20 +128,20 @@ macro_rules! whitelist {
/// baz1 {
/// let caller = account::<T>(b"caller", 0, benchmarks_seed);
/// let c = 0 .. 10 => setup_c(&caller, c);
/// }: baz(Origin::Signed(caller))
/// }: baz(RuntimeOrigin::Signed(caller))
///
/// // this is a second benchmark of the baz dispatchable with a different setup.
/// baz2 {
/// let caller = account::<T>(b"caller", 0, benchmarks_seed);
/// let c = 0 .. 10 => setup_c_in_some_other_way(&caller, c);
/// }: baz(Origin::Signed(caller))
/// }: baz(RuntimeOrigin::Signed(caller))
///
/// // You may optionally specify the origin type if it can't be determined automatically like
/// // this.
/// baz3 {
/// let caller = account::<T>(b"caller", 0, benchmarks_seed);
/// let l in 1 .. MAX_LENGTH => initialize_l(l);
/// }: baz<T::Origin>(Origin::Signed(caller), vec![0u8; l])
/// }: baz<T::RuntimeOrigin>(RuntimeOrigin::Signed(caller), vec![0u8; l])
///
/// // this is benchmarking some code that is not a dispatchable.
/// populate_a_set {
@@ -617,7 +617,7 @@ macro_rules! to_origin {
$origin.into()
};
($origin:expr, $origin_type:ty) => {
<<T as frame_system::Config>::Origin as From<$origin_type>>::from($origin)
<<T as frame_system::Config>::RuntimeOrigin as From<$origin_type>>::from($origin)
};
}
+2 -2
View File
@@ -90,7 +90,7 @@ impl frame_system::Config for Test {
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type RuntimeOrigin = RuntimeOrigin;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
@@ -148,7 +148,7 @@ mod benchmarks {
crate::benchmarks! {
where_clause {
where
crate::tests::Origin: From<RawOrigin<<T as frame_system::Config>::AccountId>>,
crate::tests::RuntimeOrigin: From<RawOrigin<<T as frame_system::Config>::AccountId>>,
}
set_value {
@@ -41,7 +41,7 @@ mod pallet_test {
frame_support::decl_module! {
pub struct Module<T: Config<I>, I: Instance = DefaultInstance> for enum Call where
origin: T::Origin, <T as OtherConfig>::OtherEvent: Into<<T as Config<I>>::RuntimeEvent>
origin: T::RuntimeOrigin, <T as OtherConfig>::OtherEvent: Into<<T as Config<I>>::RuntimeEvent>
{
#[weight = 0]
fn set_value(origin, n: u32) -> frame_support::dispatch::DispatchResult {
@@ -91,7 +91,7 @@ impl frame_system::Config for Test {
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type RuntimeOrigin = RuntimeOrigin;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;