Skip to content

Commit

Permalink
Merge pull request #25 from mangata-finance/mangata-dev-v0.9.31
Browse files Browse the repository at this point in the history
Mangata dev v0.9.31
  • Loading branch information
devdanco authored Dec 31, 2022
2 parents 371ae69 + 9c951e9 commit ba84c87
Show file tree
Hide file tree
Showing 92 changed files with 2,675 additions and 1,286 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@ jobs:
- name: Cancel Previous Runs
# Only cancel non-master branch runs
if: ${{ github.ref != 'refs/heads/master' }}
uses: styfle/cancel-workflow-action@0.9.0
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- name: Clean
run: |
df -h
curl -s https://raw.githubusercontent.com/apache/flink/master/tools/azure-pipelines/free_disk_space.sh | bash
- name: Checkout repository
uses: actions/checkout@v3
with:
Expand All @@ -39,7 +35,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-05-15
toolchain: nightly-2022-08-05
components: rustfmt
target: wasm32-unknown-unknown
default: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/master.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-05-15
toolchain: nightly-2022-08-05
override: true
default: true
- name: Install cargo-unleash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Cancel Previous Runs
# Only cancel non-master branch runs
if: ${{ github.ref != 'refs/heads/master' }}
uses: styfle/cancel-workflow-action@0.9.0
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
build:
Expand All @@ -33,7 +33,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-05-15
toolchain: nightly-2022-08-05
components: rustfmt
target: wasm32-unknown-unknown
override: true
Expand Down
1 change: 1 addition & 0 deletions Cargo.dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ split-debuginfo = "unpacked"

[patch.'https://github.com/paritytech/substrate']
pallet-authorship = { git = "https://github.com/mangata-finance//substrate", branch = "mangata-dev" }
sp-weights = { git = "https://github.com/mangata-finance//substrate", branch = "mangata-dev" }
pallet-bags-list = { git = "https://github.com/mangata-finance//substrate", branch = "mangata-dev" }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/mangata-finance//substrate", branch = "mangata-dev" }
pallet-transaction-payment-rpc = { git = "https://github.com/mangata-finance//substrate", branch = "mangata-dev" }
Expand Down
40 changes: 20 additions & 20 deletions asset-registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ 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" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29", default-features = false , optional = true }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.31" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.31" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.31" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.31" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31", default-features = false , optional = true }

# 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.31" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.31" }
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.31" }
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false , branch = "release-v0.9.31" }

# orml
orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false }
Expand All @@ -34,21 +34,21 @@ mangata-types = { git = "https://github.com/mangata-finance/substrate", default-

[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.31" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.31" }

# 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.31" }
cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.31" }
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.31" }
cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.31" }
parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.31" }

# 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.31" }
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.31" }
xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.31" }

# 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 @@ -35,7 +35,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 @@ -44,7 +44,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
2 changes: 2 additions & 0 deletions asset-registry/src/mock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub mod relay;

pub const ALICE: AccountId32 = AccountId32::new([0u8; 32]);
pub const BOB: AccountId32 = AccountId32::new([1u8; 32]);
pub const CHARLIE: AccountId32 = AccountId32::new([2u8; 32]);

pub type CurrencyId = u32;

Expand All @@ -29,6 +30,7 @@ impl Convert<MultiLocation, Option<CurrencyId>> for CurrencyIdConvert {
if l == MultiLocation::parent() {
return Some(0);
}

if let Some(asset_id) = AssetRegistry::location_to_asset_id(&l) {
return Some(asset_id);
}
Expand Down
67 changes: 37 additions & 30 deletions asset-registry/src/mock/para.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,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 @@ -70,7 +70,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,15 +86,22 @@ 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;
type WeightInfo = ();
type ExistentialDeposits = ExistentialDeposits;
type OnDust = ();
type OnSlash = ();
type OnDeposit = ();
type OnTransfer = ();
type ReserveIdentifier = [u8; 8];
type MaxReserves = ();
type MaxLocks = ConstU32<50>;
type DustRemovalWhitelist = Nothing;
type OnNewTokenAccount = ();
type OnKilledTokenAccount = ();
}

#[derive(scale_info::TypeInfo, Encode, Decode, Clone, Eq, PartialEq, Debug)]
Expand All @@ -109,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 @@ -125,7 +132,7 @@ 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!()
}
}
Expand Down Expand Up @@ -157,7 +164,7 @@ impl<T: orml_asset_registry::Config> AssetProcessor<CurrencyId, AssetMetadataOf>
}

impl orml_asset_registry::Config for Runtime {
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type Balance = Balance;
type AssetId = u32;
type AuthorityOrigin = AssetAuthority;
Expand All @@ -176,7 +183,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 @@ -187,11 +194,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 @@ -240,15 +247,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 @@ -267,7 +274,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 @@ -278,31 +285,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 @@ -346,7 +353,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 @@ -355,15 +362,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
Loading

0 comments on commit ba84c87

Please sign in to comment.