Rename Origin (#6020)

* Rename Origin

* fmt

* fixes

* more fixes

* fix

* more fixing

* small fixes

* last touches

* update lockfile for {"substrate"}

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: parity-processbot <>
This commit is contained in:
Sergej Sakac
2022-09-21 00:53:12 +02:00
committed by GitHub
parent 8d8bd99582
commit 937c4e76ae
46 changed files with 1176 additions and 910 deletions
@@ -54,7 +54,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;
@@ -60,7 +60,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;
@@ -103,7 +103,7 @@ impl xcm_executor::Config for XcmConfig {
type RuntimeCall = RuntimeCall;
type XcmSender = DevNull;
type AssetTransactor = NoAssetTransactor;
type OriginConverter = AlwaysSignedByDefault<Origin>;
type OriginConverter = AlwaysSignedByDefault<RuntimeOrigin>;
type IsReserve = AllAssetLocationsPass;
type IsTeleporter = ();
type LocationInverter = xcm_builder::LocationInverter<Ancestry>;
@@ -159,18 +159,18 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
t.into()
}
pub struct AlwaysSignedByDefault<Origin>(core::marker::PhantomData<Origin>);
impl<Origin> ConvertOrigin<Origin> for AlwaysSignedByDefault<Origin>
pub struct AlwaysSignedByDefault<RuntimeOrigin>(core::marker::PhantomData<RuntimeOrigin>);
impl<RuntimeOrigin> ConvertOrigin<RuntimeOrigin> for AlwaysSignedByDefault<RuntimeOrigin>
where
Origin: OriginTrait,
<Origin as OriginTrait>::AccountId: Decode,
RuntimeOrigin: OriginTrait,
<RuntimeOrigin as OriginTrait>::AccountId: Decode,
{
fn convert_origin(
_origin: impl Into<MultiLocation>,
_kind: OriginKind,
) -> Result<Origin, MultiLocation> {
Ok(Origin::signed(
<Origin as OriginTrait>::AccountId::decode(&mut TrailingZeroInput::zeroes())
) -> Result<RuntimeOrigin, MultiLocation> {
Ok(RuntimeOrigin::signed(
<RuntimeOrigin as OriginTrait>::AccountId::decode(&mut TrailingZeroInput::zeroes())
.expect("infinite length input; no invalid inputs for type; qed"),
))
}
@@ -15,7 +15,7 @@ pub mod pallet {
#[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config + crate::Config {
type RuntimeCall: Dispatchable<Origin = Self::Origin>
type RuntimeCall: Dispatchable<RuntimeOrigin = Self::RuntimeOrigin>
+ GetDispatchInfo
+ From<frame_system::Call<Self>>
+ Encode;