Skip to content

Commit

Permalink
Upgrade to polkadot-v0.9.30 (#827)
Browse files Browse the repository at this point in the history
* build: upgrade to polkadot-v0.9.30

Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>

* fix

* fix

Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
Co-authored-by: Yaroslav Bolyukin <iam@lach.pw>
  • Loading branch information
xlc and CertainLach authored Oct 31, 2022
1 parent 2c48b62 commit 02b1462
Show file tree
Hide file tree
Showing 75 changed files with 1,113 additions and 930 deletions.
130 changes: 65 additions & 65 deletions Cargo.dev.toml

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions asset-registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@ serde = { version = "1.0.136", optional = true }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["max-encoded-len"] }

# substrate
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" }

# polkadot
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.29" }
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.30" }

# orml
orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false }

[dev-dependencies]
# substrate
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }

# cumulus
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" }
cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" }
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" }
cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" }
parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.29" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" }
cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" }
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" }
cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" }
parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.30" }

# polkadot
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" }
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" }
xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" }
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" }
xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.30" }

# orml
orml-tokens = { path = "../tokens" }
Expand Down
4 changes: 2 additions & 2 deletions asset-registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub mod module {

#[pallet::config]
pub trait Config: frame_system::Config {
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

/// Additional non-standard metadata to store for each asset
type CustomMetadata: Parameter + Member + TypeInfo;
Expand All @@ -43,7 +43,7 @@ pub mod module {
type AssetId: Parameter + Member + Default + TypeInfo + MaybeSerializeDeserialize;

/// Checks that an origin has the authority to register/update an asset
type AuthorityOrigin: EnsureOriginWithArg<Self::Origin, Option<Self::AssetId>>;
type AuthorityOrigin: EnsureOriginWithArg<Self::RuntimeOrigin, Option<Self::AssetId>>;

/// A filter ran upon metadata registration that assigns an is and
/// potentially modifies the supplied metadata.
Expand Down
60 changes: 30 additions & 30 deletions asset-registry/src/mock/para.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ use xcm_executor::{Config, XcmExecutor};
pub type AccountId = AccountId32;

impl frame_system::Config for Runtime {
type Origin = Origin;
type Call = Call;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type BlockWeights = ();
type BlockLength = ();
Expand All @@ -66,7 +66,7 @@ impl frame_system::Config for Runtime {
impl pallet_balances::Config for Runtime {
type MaxLocks = ConstU32<50>;
type Balance = Balance;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU128<1>;
type AccountStore = System;
Expand All @@ -86,7 +86,7 @@ parameter_type_with_key! {
}

impl orml_tokens::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type Amount = Amount;
type CurrencyId = CurrencyId;
Expand Down Expand Up @@ -116,10 +116,10 @@ ord_parameter_types! {
}

pub struct AssetAuthority;
impl EnsureOriginWithArg<Origin, Option<u32>> for AssetAuthority {
impl EnsureOriginWithArg<RuntimeOrigin, Option<u32>> for AssetAuthority {
type Success = ();

fn try_origin(origin: Origin, asset_id: &Option<u32>) -> Result<Self::Success, Origin> {
fn try_origin(origin: RuntimeOrigin, asset_id: &Option<u32>) -> Result<Self::Success, RuntimeOrigin> {
match asset_id {
// We mock an edge case where the asset_id 2 requires a special origin check.
Some(2) => EnsureSignedBy::<AdminAssetTwo, AccountId32>::try_origin(origin.clone())
Expand All @@ -132,13 +132,13 @@ impl EnsureOriginWithArg<Origin, Option<u32>> for AssetAuthority {
}

#[cfg(feature = "runtime-benchmarks")]
fn successful_origin(_asset_id: &Option<u32>) -> Origin {
fn successful_origin(_asset_id: &Option<u32>) -> RuntimeOrigin {
unimplemented!()
}
}

impl orml_asset_registry::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type AssetId = u32;
type AuthorityOrigin = AssetAuthority;
Expand All @@ -157,7 +157,7 @@ impl parachain_info::Config for Runtime {}
parameter_types! {
pub const RelayLocation: MultiLocation = MultiLocation::parent();
pub const RelayNetwork: NetworkId = NetworkId::Kusama;
pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
}

Expand All @@ -168,11 +168,11 @@ pub type LocationToAccountId = (
);

pub type XcmOriginToCallOrigin = (
SovereignSignedViaLocation<LocationToAccountId, Origin>,
RelayChainAsNative<RelayChainOrigin, Origin>,
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, Origin>,
SignedAccountId32AsNative<RelayNetwork, Origin>,
XcmPassthrough<Origin>,
SovereignSignedViaLocation<LocationToAccountId, RuntimeOrigin>,
RelayChainAsNative<RelayChainOrigin, RuntimeOrigin>,
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, RuntimeOrigin>,
SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,
XcmPassthrough<RuntimeOrigin>,
);

pub type LocalAssetTransactor = MultiCurrencyAdapter<
Expand Down Expand Up @@ -221,15 +221,15 @@ impl FixedConversionRateProvider for MyFixedConversionRateProvider {

pub struct XcmConfig;
impl Config for XcmConfig {
type Call = Call;
type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter;
type AssetTransactor = LocalAssetTransactor;
type OriginConverter = XcmOriginToCallOrigin;
type IsReserve = MultiNativeAsset<AbsoluteReserveProvider>;
type IsTeleporter = ();
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<ConstU64<10>, Call, ConstU32<100>>;
type Weigher = FixedWeightBounds<ConstU64<10>, RuntimeCall, ConstU32<100>>;
type Trader = AssetRegistryWeightTrader;
type ResponseHandler = ();
type AssetTrap = PolkadotXcm;
Expand All @@ -248,7 +248,7 @@ impl GetChannelInfo for ChannelInfo {
}

impl cumulus_pallet_xcmp_queue::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>;
type ChannelInfo = ChannelInfo;
type VersionWrapper = ();
Expand All @@ -259,31 +259,31 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
}

impl cumulus_pallet_dmp_queue::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
}

impl cumulus_pallet_xcm::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>;
}

pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, RelayNetwork>;
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;

impl pallet_xcm::Config for Runtime {
type Event = Event;
type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type RuntimeEvent = RuntimeEvent;
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type XcmRouter = XcmRouter;
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Nothing;
type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<ConstU64<10>, Call, ConstU32<100>>;
type Weigher = FixedWeightBounds<ConstU64<10>, RuntimeCall, ConstU32<100>>;
type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin;
type Call = Call;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
}
Expand Down Expand Up @@ -327,7 +327,7 @@ parameter_type_with_key! {
}

impl orml_xtokens::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type CurrencyId = CurrencyId;
type CurrencyIdConvert = CurrencyIdConvert;
Expand All @@ -336,15 +336,15 @@ impl orml_xtokens::Config for Runtime {
type MultiLocationsFilter = ParentOrParachains;
type MinXcmFee = ParachainMinFee;
type XcmExecutor = XcmExecutor<XcmConfig>;
type Weigher = FixedWeightBounds<ConstU64<10>, Call, ConstU32<100>>;
type Weigher = FixedWeightBounds<ConstU64<10>, RuntimeCall, ConstU32<100>>;
type BaseXcmWeight = ConstU64<100_000_000>;
type LocationInverter = LocationInverter<Ancestry>;
type MaxAssetsForTransfer = MaxAssetsForTransfer;
type ReserveProvider = RelativeReserveProvider;
}

impl orml_xcm::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type SovereignOrigin = EnsureRoot<AccountId>;
}

Expand Down
34 changes: 17 additions & 17 deletions asset-registry/src/mock/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ pub type AccountId = AccountId32;
pub type Balance = u128;

impl frame_system::Config for Runtime {
type Origin = Origin;
type Call = Call;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = ConstU64<250>;
type BlockWeights = ();
type BlockLength = ();
Expand All @@ -49,7 +49,7 @@ impl frame_system::Config for Runtime {
impl pallet_balances::Config for Runtime {
type MaxLocks = ConstU32<50>;
type Balance = Balance;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ConstU128<1>;
type AccountStore = System;
Expand Down Expand Up @@ -79,54 +79,54 @@ pub type LocalAssetTransactor =
XcmCurrencyAdapter<Balances, IsConcrete<KsmLocation>, SovereignAccountOf, AccountId, ()>;

type LocalOriginConverter = (
SovereignSignedViaLocation<SovereignAccountOf, Origin>,
ChildParachainAsNative<origin::Origin, Origin>,
SignedAccountId32AsNative<KusamaNetwork, Origin>,
SovereignSignedViaLocation<SovereignAccountOf, RuntimeOrigin>,
ChildParachainAsNative<origin::Origin, RuntimeOrigin>,
SignedAccountId32AsNative<KusamaNetwork, RuntimeOrigin>,
);

pub type XcmRouter = super::RelayChainXcmRouter;
pub type Barrier = (TakeWeightCredit, AllowTopLevelPaidExecutionFrom<Everything>);

pub struct XcmConfig;
impl Config for XcmConfig {
type Call = Call;
type RuntimeCall = RuntimeCall;
type XcmSender = XcmRouter;
type AssetTransactor = LocalAssetTransactor;
type OriginConverter = LocalOriginConverter;
type IsReserve = ();
type IsTeleporter = ();
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<ConstU64<10>, Call, ConstU32<100>>;
type Weigher = FixedWeightBounds<ConstU64<10>, RuntimeCall, ConstU32<100>>;
type Trader = UsingComponents<IdentityFee<Balance>, KsmLocation, AccountId, Balances, ()>;
type ResponseHandler = ();
type AssetTrap = ();
type AssetClaims = ();
type SubscriptionService = XcmPallet;
}

pub type LocalOriginToLocation = SignedToAccountId32<Origin, AccountId, KusamaNetwork>;
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, KusamaNetwork>;

impl pallet_xcm::Config for Runtime {
type Event = Event;
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type RuntimeEvent = RuntimeEvent;
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type XcmRouter = XcmRouter;
// Anyone can execute XCM messages locally...
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Everything;
type Weigher = FixedWeightBounds<ConstU64<10>, Call, ConstU32<100>>;
type Weigher = FixedWeightBounds<ConstU64<10>, RuntimeCall, ConstU32<100>>;
type LocationInverter = LocationInverter<Ancestry>;
type Origin = Origin;
type Call = Call;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
}

impl ump::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type UmpSink = ump::XcmSink<XcmExecutor<XcmConfig>, Runtime>;
type FirstMessageFactorPercent = ConstU64<100>;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
Expand Down
Loading

0 comments on commit 02b1462

Please sign in to comment.