diff --git a/Cargo.dev.toml b/Cargo.dev.toml index d10b60be5..5bb7be7f6 100644 --- a/Cargo.dev.toml +++ b/Cargo.dev.toml @@ -31,65 +31,68 @@ resolver = "2" split-debuginfo = "unpacked" [patch.'https://github.com/paritytech/substrate'] -frame-benchmarking = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -frame-support = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -frame-system = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -pallet-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -pallet-authorship = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -pallet-balances = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -pallet-elections-phragmen = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -pallet-offences = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -pallet-scheduler = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -pallet-session = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -pallet-staking = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -pallet-timestamp = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -pallet-treasury = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -pallet-vesting = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sc-client-api = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sc-client-db = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sc-executor = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sc-executor-common = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sc-executor-wasmi = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-api = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-application-crypto = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-arithmetic = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-authorship = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-blockchain = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-consensus = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-core = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-debug-derive = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-externalities = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-inherents = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-io = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-keystore = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-npos-elections = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-npos-elections-compact = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-panic-handler = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-runtime = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-runtime-interface = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-session = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-staking = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-state-machine = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-std = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-storage = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-tasks = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-timestamp = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-trie = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-version = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-wasm-interface = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } -sp-utils = { git = "https://github.com/paritytech//substrate", rev = "91061a7d925b5bc597804293da283477512ba4ff" } +frame-benchmarking = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +frame-support = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +frame-system = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +pallet-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +pallet-authorship = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +pallet-balances = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +pallet-elections-phragmen = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +pallet-offences = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +pallet-scheduler = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +pallet-session = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +pallet-staking = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +pallet-timestamp = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +pallet-treasury = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +pallet-vesting = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sc-client-api = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sc-client-db = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sc-executor = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sc-executor-common = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sc-executor-wasmi = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-api = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-application-crypto = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-arithmetic = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-authorship = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-blockchain = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-consensus = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-core = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-debug-derive = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-externalities = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-inherents = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-io = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-keystore = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-npos-elections = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-panic-handler = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-runtime = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-runtime-interface = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-session = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-staking = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-state-machine = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-std = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-storage = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-tasks = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-timestamp = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-trie = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-version = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-wasm-interface = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } +sp-utils = { git = "https://github.com/paritytech//substrate", rev = "420db18eaa1a1f5ce9ba40dd6ccb69f7b3dd9bb7" } [patch.'https://github.com/paritytech/cumulus'] -cumulus-primitives-core = { git = "https://github.com/paritytech//cumulus", rev = "fd80849dde5c209c20a996cfcc5aaacd4666dcbe" } -parachain-info = { git = "https://github.com/paritytech//cumulus", rev = "fd80849dde5c209c20a996cfcc5aaacd4666dcbe" } +cumulus-primitives-core = { git = "https://github.com/paritytech//cumulus", rev = "870b214693856e768ba482fe2d3b9a83b24e4540" } +parachain-info = { git = "https://github.com/paritytech//cumulus", rev = "870b214693856e768ba482fe2d3b9a83b24e4540" } +cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "870b214693856e768ba482fe2d3b9a83b24e4540" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech//cumulus", rev = "870b214693856e768ba482fe2d3b9a83b24e4540" } +cumulus-pallet-xcm = { git = "https://github.com/paritytech//cumulus", rev = "870b214693856e768ba482fe2d3b9a83b24e4540" } [patch.'https://github.com/paritytech/polkadot'] -xcm = { git = "https://github.com/paritytech//polkadot", rev = "7a9f624777ad2d2adb3a1e6797a31f9d653c9587" } -xcm-executor = { git = "https://github.com/paritytech//polkadot", rev = "7a9f624777ad2d2adb3a1e6797a31f9d653c9587" } -xcm-builder = { git = "https://github.com/paritytech//polkadot", rev = "7a9f624777ad2d2adb3a1e6797a31f9d653c9587" } -pallet-xcm = { git = "https://github.com/paritytech//polkadot", rev = "7a9f624777ad2d2adb3a1e6797a31f9d653c9587" } -polkadot-core-primitives = { git = "https://github.com/paritytech//polkadot", rev = "7a9f624777ad2d2adb3a1e6797a31f9d653c9587" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech//polkadot", rev = "7a9f624777ad2d2adb3a1e6797a31f9d653c9587" } -polkadot-parachain = { git = "https://github.com/paritytech//polkadot", rev = "7a9f624777ad2d2adb3a1e6797a31f9d653c9587" } -polkadot-primitives = { git = "https://github.com/paritytech//polkadot", rev = "7a9f624777ad2d2adb3a1e6797a31f9d653c9587" } +xcm = { git = "https://github.com/paritytech//polkadot", rev = "aeea9b7bd81919e014f7621f6c4b2eb9709d918f" } +xcm-executor = { git = "https://github.com/paritytech//polkadot", rev = "aeea9b7bd81919e014f7621f6c4b2eb9709d918f" } +xcm-builder = { git = "https://github.com/paritytech//polkadot", rev = "aeea9b7bd81919e014f7621f6c4b2eb9709d918f" } +pallet-xcm = { git = "https://github.com/paritytech//polkadot", rev = "aeea9b7bd81919e014f7621f6c4b2eb9709d918f" } +polkadot-core-primitives = { git = "https://github.com/paritytech//polkadot", rev = "aeea9b7bd81919e014f7621f6c4b2eb9709d918f" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech//polkadot", rev = "aeea9b7bd81919e014f7621f6c4b2eb9709d918f" } +polkadot-parachain = { git = "https://github.com/paritytech//polkadot", rev = "aeea9b7bd81919e014f7621f6c4b2eb9709d918f" } +polkadot-primitives = { git = "https://github.com/paritytech//polkadot", rev = "aeea9b7bd81919e014f7621f6c4b2eb9709d918f" } +xcm-simulator = { git = "https://github.com/paritytech//polkadot", rev = "aeea9b7bd81919e014f7621f6c4b2eb9709d918f" } diff --git a/auction/Cargo.toml b/auction/Cargo.toml index ad4f33d93..0be05b950 100644 --- a/auction/Cargo.toml +++ b/auction/Cargo.toml @@ -10,16 +10,16 @@ edition = "2018" [dependencies] serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } [features] default = ["std"] diff --git a/auction/src/mock.rs b/auction/src/mock.rs index 718c25164..8790e16f8 100644 --- a/auction/src/mock.rs +++ b/auction/src/mock.rs @@ -3,7 +3,7 @@ #![cfg(test)] use super::*; -use frame_support::{construct_runtime, parameter_types}; +use frame_support::{construct_runtime, parameter_types, traits::Everything}; use orml_traits::OnNewBidResult; use sp_core::H256; use sp_runtime::{testing::Header, traits::IdentityLookup}; @@ -39,7 +39,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type DbWeight = (); - type BaseCallFilter = (); + type BaseCallFilter = Everything; type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); diff --git a/authority/Cargo.toml b/authority/Cargo.toml index e76370f6b..34043ee45 100644 --- a/authority/Cargo.toml +++ b/authority/Cargo.toml @@ -10,17 +10,17 @@ edition = "2018" [dependencies] serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } [features] default = ["std"] diff --git a/bencher/Cargo.toml b/bencher/Cargo.toml index 61a46fcde..515773d97 100644 --- a/bencher/Cargo.toml +++ b/bencher/Cargo.toml @@ -21,16 +21,16 @@ linregress = { version = "0.4.0", optional = true } serde = { version = "1.0.119", optional = true, features = ['derive'] } serde_json = {version = "1.0.64", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", features = ["derive"], default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false, optional = true } -sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false, features = ["wasmtime"], optional = true } -sc-executor-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", optional = true } -sc-client-db = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false, features = ["with-kvdb-rocksdb"], optional = true } -sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false, optional = true } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false, optional = true } +sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false, features = ["wasmtime"], optional = true } +sc-executor-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", optional = true } +sc-client-db = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false, features = ["with-kvdb-rocksdb"], optional = true } +sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false, optional = true } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } [features] default = ["std"] diff --git a/benchmarking/Cargo.toml b/benchmarking/Cargo.toml index a2ab8bb09..241197766 100644 --- a/benchmarking/Cargo.toml +++ b/benchmarking/Cargo.toml @@ -11,17 +11,17 @@ edition = "2018" serde = { version = "1.0.124", optional = true } paste = "1.0" codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-storage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-storage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } [dev-dependencies] -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } hex-literal = "0.2.1" [features] diff --git a/currencies/Cargo.toml b/currencies/Cargo.toml index 01f09327f..ad4545d17 100644 --- a/currencies/Cargo.toml +++ b/currencies/Cargo.toml @@ -10,19 +10,19 @@ edition = "2018" [dependencies] serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } orml-utilities = { path = "../utilities", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } orml_tokens = { package = "orml-tokens", path = "../tokens", version = "0.4.1-dev" } [features] diff --git a/currencies/src/mock.rs b/currencies/src/mock.rs index 8ce006786..c19c56ca2 100644 --- a/currencies/src/mock.rs +++ b/currencies/src/mock.rs @@ -3,7 +3,11 @@ #![cfg(test)] use super::*; -use frame_support::{construct_runtime, parameter_types, PalletId}; +use frame_support::{ + construct_runtime, parameter_types, + traits::{Everything, Nothing}, + PalletId, +}; use orml_traits::parameter_type_with_key; use sp_core::H256; use sp_runtime::{ @@ -39,7 +43,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type DbWeight = (); - type BaseCallFilter = (); + type BaseCallFilter = Everything; type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); @@ -84,7 +88,7 @@ impl orml_tokens::Config for Runtime { type ExistentialDeposits = ExistentialDeposits; type OnDust = orml_tokens::TransferDust; type MaxLocks = MaxLocks; - type DustRemovalWhitelist = (); + type DustRemovalWhitelist = Nothing; } pub const NATIVE_CURRENCY_ID: CurrencyId = 1; diff --git a/gradually-update/Cargo.toml b/gradually-update/Cargo.toml index f81d39bc5..0d000edea 100644 --- a/gradually-update/Cargo.toml +++ b/gradually-update/Cargo.toml @@ -10,12 +10,12 @@ edition = "2018" [dependencies] serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["max-encoded-len"] } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } [features] default = ["std"] diff --git a/gradually-update/src/mock.rs b/gradually-update/src/mock.rs index 22242550c..ada202485 100644 --- a/gradually-update/src/mock.rs +++ b/gradually-update/src/mock.rs @@ -3,7 +3,7 @@ #![cfg(test)] use super::*; -use frame_support::{construct_runtime, parameter_types}; +use frame_support::{construct_runtime, parameter_types, traits::Everything}; use sp_core::H256; use sp_runtime::{testing::Header, traits::IdentityLookup}; @@ -36,7 +36,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type DbWeight = (); - type BaseCallFilter = (); + type BaseCallFilter = Everything; type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); diff --git a/nft/Cargo.toml b/nft/Cargo.toml index 0aedd85ac..84f593f99 100644 --- a/nft/Cargo.toml +++ b/nft/Cargo.toml @@ -10,15 +10,15 @@ edition = "2018" [dependencies] serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["max-encoded-len"] } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } [features] default = ["std"] diff --git a/nft/src/mock.rs b/nft/src/mock.rs index e1f708a25..d2906617e 100644 --- a/nft/src/mock.rs +++ b/nft/src/mock.rs @@ -2,7 +2,7 @@ #![cfg(test)] -use frame_support::{construct_runtime, parameter_types}; +use frame_support::{construct_runtime, parameter_types, traits::Everything}; use sp_core::H256; use sp_runtime::{testing::Header, traits::IdentityLookup}; @@ -37,7 +37,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type DbWeight = (); - type BaseCallFilter = (); + type BaseCallFilter = Everything; type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); diff --git a/oracle/Cargo.toml b/oracle/Cargo.toml index 2bfceb55b..c410b13c0 100644 --- a/oracle/Cargo.toml +++ b/oracle/Cargo.toml @@ -10,19 +10,19 @@ edition = "2018" [dependencies] serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } -sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } orml-utilities = { path = "../utilities", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } [features] default = ["std"] diff --git a/oracle/rpc/Cargo.toml b/oracle/rpc/Cargo.toml index c7e156a62..7df7d62c8 100644 --- a/oracle/rpc/Cargo.toml +++ b/oracle/rpc/Cargo.toml @@ -11,8 +11,8 @@ codec = { package = "parity-scale-codec", version = "2.2.0" } jsonrpc-core = "15.0.0" jsonrpc-core-client = "15.0.0" jsonrpc-derive = "15.0.0" -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } orml-oracle-rpc-runtime-api = { path = "runtime-api", version = "0.4.1-dev" } diff --git a/oracle/rpc/runtime-api/Cargo.toml b/oracle/rpc/runtime-api/Cargo.toml index e7f392df8..fec554595 100644 --- a/oracle/rpc/runtime-api/Cargo.toml +++ b/oracle/rpc/runtime-api/Cargo.toml @@ -8,8 +8,8 @@ description = "Runtime API module for orml-oracle-rpc." [dependencies] codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["derive"] } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } [features] default = ["std"] diff --git a/oracle/src/mock.rs b/oracle/src/mock.rs index e804166a1..4eeadfe4f 100644 --- a/oracle/src/mock.rs +++ b/oracle/src/mock.rs @@ -2,7 +2,10 @@ use super::*; -use frame_support::{construct_runtime, parameter_types, traits::SortedMembers}; +use frame_support::{ + construct_runtime, parameter_types, + traits::{Everything, SortedMembers}, +}; use sp_core::H256; use sp_runtime::{ testing::Header, @@ -42,7 +45,7 @@ impl frame_system::Config for Test { type OnNewAccount = (); type OnKilledAccount = (); type DbWeight = (); - type BaseCallFilter = (); + type BaseCallFilter = Everything; type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); diff --git a/rewards/Cargo.toml b/rewards/Cargo.toml index 56a267692..f80ce476f 100644 --- a/rewards/Cargo.toml +++ b/rewards/Cargo.toml @@ -10,14 +10,17 @@ edition = "2018" [dependencies] serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["max-encoded-len"] } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } +[dev-dependencies] +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } + [features] default = ["std"] std = [ diff --git a/rewards/src/mock.rs b/rewards/src/mock.rs index ac644b87e..9ddd9b3bf 100644 --- a/rewards/src/mock.rs +++ b/rewards/src/mock.rs @@ -3,7 +3,7 @@ #![cfg(test)] use super::*; -use frame_support::{construct_runtime, parameter_types, weights::constants::RocksDbWeight}; +use frame_support::{construct_runtime, parameter_types, traits::Everything, weights::constants::RocksDbWeight}; use sp_core::H256; use sp_runtime::{testing::Header, traits::IdentityLookup}; use sp_std::cell::RefCell; @@ -49,7 +49,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type DbWeight = RocksDbWeight; - type BaseCallFilter = (); + type BaseCallFilter = Everything; type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); diff --git a/tokens/Cargo.toml b/tokens/Cargo.toml index 2dc8b7ec2..c13ba01fb 100644 --- a/tokens/Cargo.toml +++ b/tokens/Cargo.toml @@ -10,17 +10,17 @@ edition = "2018" [dependencies] serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["max-encoded-len"] } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } [features] default = ["std"] diff --git a/tokens/src/mock.rs b/tokens/src/mock.rs index 36ed286fe..eeb752497 100644 --- a/tokens/src/mock.rs +++ b/tokens/src/mock.rs @@ -5,7 +5,7 @@ use super::*; use frame_support::{ construct_runtime, parameter_types, - traits::{ChangeMembers, ContainsLengthBound, GenesisBuild, SaturatingCurrencyToVote, SortedMembers}, + traits::{ChangeMembers, ContainsLengthBound, Everything, GenesisBuild, SaturatingCurrencyToVote, SortedMembers}, PalletId, }; use orml_traits::parameter_type_with_key; @@ -59,7 +59,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type DbWeight = (); - type BaseCallFilter = (); + type BaseCallFilter = Everything; type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); diff --git a/traits/Cargo.toml b/traits/Cargo.toml index 0a76ce04f..de064ca9c 100644 --- a/traits/Cargo.toml +++ b/traits/Cargo.toml @@ -10,14 +10,14 @@ edition = "2018" [dependencies] serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } num-traits = { version = "0.2.14", default-features = false } impl-trait-for-tuples = "0.2.1" -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } orml-utilities = { path = "../utilities", version = "0.4.1-dev", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10", default-features = false } [features] default = ["std"] diff --git a/traits/src/lib.rs b/traits/src/lib.rs index ac610bdbb..9eb83c5fc 100644 --- a/traits/src/lib.rs +++ b/traits/src/lib.rs @@ -18,6 +18,7 @@ pub use currency::{ }; pub use data_provider::{DataFeeder, DataProvider, DataProviderExtended}; pub use get_by_key::GetByKey; +pub use multi_asset::ConcreteFungibleAsset; pub use nft::NFT; pub use price::{DefaultPriceProvider, PriceProvider}; pub use rewards::RewardHandler; @@ -29,6 +30,7 @@ pub mod currency; pub mod data_provider; pub mod get_by_key; pub mod location; +pub mod multi_asset; pub mod nft; pub mod price; pub mod rewards; diff --git a/traits/src/location.rs b/traits/src/location.rs index 95620b0ce..b9a1e0072 100644 --- a/traits/src/location.rs +++ b/traits/src/location.rs @@ -1,7 +1,5 @@ -use xcm::v0::{ - Junction::{self, *}, - MultiAsset, MultiLocation, -}; +use sp_std::prelude::*; +use xcm::latest::prelude::*; pub trait Parse { /// Returns the "chain" location part. It could be parent, sibling @@ -12,27 +10,30 @@ pub trait Parse { } fn is_chain_junction(junction: Option<&Junction>) -> bool { - matches!(junction, Some(Parent) | Some(Parachain(_))) + matches!(junction, Some(Parachain(_))) } impl Parse for MultiLocation { fn chain_part(&self) -> Option { - match (self.first(), self.at(1)) { - (Some(Parent), Some(Parachain(id))) => Some((Parent, Parachain(*id)).into()), - (Some(Parent), _) => Some(Parent.into()), - (Some(Parachain(id)), _) => Some(Parachain(*id).into()), + match (self.parents, self.first_interior()) { + // sibling parachain + (1, Some(Parachain(id))) => Some(MultiLocation::new(1, X1(Parachain(*id)))), + // parent + (1, _) => Some(MultiLocation::parent()), + // children parachain + (0, Some(Parachain(id))) => Some(MultiLocation::new(0, X1(Parachain(*id)))), _ => None, } } fn non_chain_part(&self) -> Option { - let mut location = self.clone(); - while is_chain_junction(location.first()) { - let _ = location.take_first(); + let mut junctions = self.interior().clone(); + while is_chain_junction(junctions.first()) { + let _ = junctions.take_first(); } - if location != MultiLocation::Null { - Some(location) + if junctions != Here { + Some(MultiLocation::new(0, junctions)) } else { None } @@ -46,45 +47,55 @@ pub trait Reserve { impl Reserve for MultiAsset { fn reserve(&self) -> Option { - if let MultiAsset::ConcreteFungible { id, .. } = self { - id.chain_part() + if let Concrete(location) = &self.id { + location.chain_part() } else { None } } } +pub trait RelativeLocations { + fn sibling_parachain_general_key(para_id: u32, general_key: Vec) -> MultiLocation; +} + +impl RelativeLocations for MultiLocation { + fn sibling_parachain_general_key(para_id: u32, general_key: Vec) -> MultiLocation { + MultiLocation::new(1, X2(Parachain(para_id), GeneralKey(general_key))) + } +} + #[cfg(test)] mod tests { use super::*; const PARACHAIN: Junction = Parachain(1); - const GENERAL_INDEX: Junction = GeneralIndex { id: 1 }; + const GENERAL_INDEX: Junction = GeneralIndex(1); fn concrete_fungible(id: MultiLocation) -> MultiAsset { - MultiAsset::ConcreteFungible { id, amount: 1 } + (id, 1).into() } #[test] fn parent_as_reserve_chain() { assert_eq!( - concrete_fungible(MultiLocation::X2(Parent, GENERAL_INDEX)).reserve(), - Some(Parent.into()) + concrete_fungible(MultiLocation::new(1, X1(GENERAL_INDEX))).reserve(), + Some(MultiLocation::parent()) ); } #[test] fn sibling_parachain_as_reserve_chain() { assert_eq!( - concrete_fungible(MultiLocation::X3(Parent, PARACHAIN, GENERAL_INDEX)).reserve(), - Some((Parent, PARACHAIN).into()) + concrete_fungible(MultiLocation::new(1, X2(PARACHAIN, GENERAL_INDEX))).reserve(), + Some(MultiLocation::new(1, X1(PARACHAIN))) ); } #[test] fn child_parachain_as_reserve_chain() { assert_eq!( - concrete_fungible(MultiLocation::X2(PARACHAIN, GENERAL_INDEX)).reserve(), + concrete_fungible(MultiLocation::new(0, X2(PARACHAIN, GENERAL_INDEX))).reserve(), Some(PARACHAIN.into()) ); } @@ -92,31 +103,31 @@ mod tests { #[test] fn no_reserve_chain() { assert_eq!( - concrete_fungible(MultiLocation::X1(GeneralKey("DOT".into()))).reserve(), + concrete_fungible(MultiLocation::new(0, X1(GeneralKey("DOT".into())))).reserve(), None ); } #[test] fn non_chain_part_works() { - assert_eq!(MultiLocation::X1(Parent).non_chain_part(), None); - assert_eq!(MultiLocation::X2(Parent, PARACHAIN).non_chain_part(), None); - assert_eq!(MultiLocation::X1(PARACHAIN).non_chain_part(), None); + assert_eq!(MultiLocation::parent().non_chain_part(), None); + assert_eq!(MultiLocation::new(1, X1(PARACHAIN)).non_chain_part(), None); + assert_eq!(MultiLocation::new(0, X1(PARACHAIN)).non_chain_part(), None); assert_eq!( - MultiLocation::X2(Parent, GENERAL_INDEX).non_chain_part(), + MultiLocation::new(1, X1(GENERAL_INDEX)).non_chain_part(), Some(GENERAL_INDEX.into()) ); assert_eq!( - MultiLocation::X3(Parent, GENERAL_INDEX, GENERAL_INDEX).non_chain_part(), + MultiLocation::new(1, X2(GENERAL_INDEX, GENERAL_INDEX)).non_chain_part(), Some((GENERAL_INDEX, GENERAL_INDEX).into()) ); assert_eq!( - MultiLocation::X3(Parent, PARACHAIN, GENERAL_INDEX).non_chain_part(), + MultiLocation::new(1, X2(PARACHAIN, GENERAL_INDEX)).non_chain_part(), Some(GENERAL_INDEX.into()) ); assert_eq!( - MultiLocation::X2(PARACHAIN, GENERAL_INDEX).non_chain_part(), + MultiLocation::new(0, X2(PARACHAIN, GENERAL_INDEX)).non_chain_part(), Some(GENERAL_INDEX.into()) ); } diff --git a/traits/src/multi_asset.rs b/traits/src/multi_asset.rs new file mode 100644 index 000000000..a4a10d636 --- /dev/null +++ b/traits/src/multi_asset.rs @@ -0,0 +1,23 @@ +use sp_std::prelude::*; +use xcm::latest::prelude::*; + +use crate::location::RelativeLocations; + +pub trait ConcreteFungibleAsset { + fn sibling_parachain_asset(para_id: u32, general_key: Vec, amount: u128) -> MultiAsset; + fn parent_asset(amount: u128) -> MultiAsset; +} + +impl ConcreteFungibleAsset for MultiAsset { + fn sibling_parachain_asset(para_id: u32, general_key: Vec, amount: u128) -> MultiAsset { + ( + MultiLocation::sibling_parachain_general_key(para_id, general_key), + amount, + ) + .into() + } + + fn parent_asset(amount: u128) -> MultiAsset { + (MultiLocation::parent(), amount).into() + } +} diff --git a/traits/src/xcm_transfer.rs b/traits/src/xcm_transfer.rs index ae08ef1cf..18913cb00 100644 --- a/traits/src/xcm_transfer.rs +++ b/traits/src/xcm_transfer.rs @@ -1,6 +1,6 @@ use frame_support::dispatch::DispatchResult; use frame_support::weights::Weight; -use xcm::opaque::v0::{MultiAsset, MultiLocation}; +use xcm::latest::prelude::*; /// Abstraction over cross-chain token transfers. pub trait XcmTransfer { diff --git a/unknown-tokens/Cargo.toml b/unknown-tokens/Cargo.toml index 35186b40f..faa88a1e0 100644 --- a/unknown-tokens/Cargo.toml +++ b/unknown-tokens/Cargo.toml @@ -10,18 +10,18 @@ edition = "2018" [dependencies] serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10", default-features = false } orml-xcm-support = { path = "../xcm-support", default-features = false } [dev-dependencies] -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } [features] default = ["std"] diff --git a/unknown-tokens/src/lib.rs b/unknown-tokens/src/lib.rs index e048ba370..da0a04d32 100644 --- a/unknown-tokens/src/lib.rs +++ b/unknown-tokens/src/lib.rs @@ -3,7 +3,7 @@ use frame_support::pallet_prelude::*; use sp_std::vec::Vec; -use xcm::v0::{MultiAsset, MultiLocation}; +use xcm::latest::prelude::*; use orml_xcm_support::UnknownAsset; @@ -71,18 +71,20 @@ pub mod module { impl UnknownAsset for Pallet { fn deposit(asset: &MultiAsset, to: &MultiLocation) -> DispatchResult { match asset { - MultiAsset::ConcreteFungible { id, amount } => { - ConcreteFungibleBalances::::try_mutate(to, id, |b| -> DispatchResult { - *b = b.checked_add(*amount).ok_or(Error::::BalanceOverflow)?; - Ok(()) - }) - } - MultiAsset::AbstractFungible { id, amount } => { - AbstractFungibleBalances::::try_mutate(to, id, |b| -> DispatchResult { - *b = b.checked_add(*amount).ok_or(Error::::BalanceOverflow)?; - Ok(()) - }) - } + MultiAsset { + fun: Fungible(amount), + id: Concrete(location), + } => ConcreteFungibleBalances::::try_mutate(to, location, |b| -> DispatchResult { + *b = b.checked_add(*amount).ok_or(Error::::BalanceOverflow)?; + Ok(()) + }), + MultiAsset { + fun: Fungible(amount), + id: Abstract(key), + } => AbstractFungibleBalances::::try_mutate(to, key, |b| -> DispatchResult { + *b = b.checked_add(*amount).ok_or(Error::::BalanceOverflow)?; + Ok(()) + }), _ => Err(Error::::UnhandledAsset.into()), }?; @@ -93,18 +95,20 @@ impl UnknownAsset for Pallet { fn withdraw(asset: &MultiAsset, from: &MultiLocation) -> DispatchResult { match asset { - MultiAsset::ConcreteFungible { id, amount } => { - ConcreteFungibleBalances::::try_mutate(from, id, |b| -> DispatchResult { - *b = b.checked_sub(*amount).ok_or(Error::::BalanceTooLow)?; - Ok(()) - }) - } - MultiAsset::AbstractFungible { id, amount } => { - AbstractFungibleBalances::::try_mutate(from, id, |b| -> DispatchResult { - *b = b.checked_sub(*amount).ok_or(Error::::BalanceTooLow)?; - Ok(()) - }) - } + MultiAsset { + fun: Fungible(amount), + id: Concrete(location), + } => ConcreteFungibleBalances::::try_mutate(from, location, |b| -> DispatchResult { + *b = b.checked_sub(*amount).ok_or(Error::::BalanceTooLow)?; + Ok(()) + }), + MultiAsset { + fun: Fungible(amount), + id: Abstract(key), + } => AbstractFungibleBalances::::try_mutate(from, key, |b| -> DispatchResult { + *b = b.checked_sub(*amount).ok_or(Error::::BalanceTooLow)?; + Ok(()) + }), _ => Err(Error::::UnhandledAsset.into()), }?; diff --git a/unknown-tokens/src/mock.rs b/unknown-tokens/src/mock.rs index b8e297a15..efcd52dfe 100644 --- a/unknown-tokens/src/mock.rs +++ b/unknown-tokens/src/mock.rs @@ -5,7 +5,7 @@ use super::*; use crate as unknown_tokens; -use frame_support::{construct_runtime, parameter_types}; +use frame_support::{construct_runtime, parameter_types, traits::Everything}; use sp_core::H256; use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32}; @@ -35,7 +35,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type DbWeight = (); - type BaseCallFilter = (); + type BaseCallFilter = Everything; type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); diff --git a/unknown-tokens/src/tests.rs b/unknown-tokens/src/tests.rs index d17abf55d..a5d3704db 100644 --- a/unknown-tokens/src/tests.rs +++ b/unknown-tokens/src/tests.rs @@ -6,27 +6,20 @@ use super::*; use mock::{Event, *}; use frame_support::{assert_err, assert_ok}; -use xcm::v0::Junction; -const MOCK_RECIPIENT: MultiLocation = MultiLocation::X1(Junction::Parent); -const MOCK_CONCRETE_FUNGIBLE_ID: MultiLocation = MultiLocation::X1(Junction::Parent); +const MOCK_RECIPIENT: MultiLocation = MultiLocation::parent(); +const MOCK_CONCRETE_FUNGIBLE_ID: MultiLocation = MultiLocation::parent(); fn mock_abstract_fungible_id() -> Vec { vec![1] } fn concrete_fungible(amount: u128) -> MultiAsset { - MultiAsset::ConcreteFungible { - id: MOCK_CONCRETE_FUNGIBLE_ID, - amount, - } + (MOCK_CONCRETE_FUNGIBLE_ID, amount).into() } fn abstract_fungible(amount: u128) -> MultiAsset { - MultiAsset::AbstractFungible { - id: mock_abstract_fungible_id(), - amount, - } + (mock_abstract_fungible_id(), amount).into() } #[test] @@ -77,7 +70,13 @@ fn deposit_abstract_fungible_asset() { fn deposit_unhandled_asset_should_fail() { ExtBuilder.build().execute_with(|| { assert_err!( - UnknownTokens::deposit(&MultiAsset::All, &MOCK_RECIPIENT), + UnknownTokens::deposit( + &MultiAsset { + fun: NonFungible(Undefined), + id: Concrete(MultiLocation::parent()) + }, + &MOCK_RECIPIENT + ), Error::::UnhandledAsset ); }); @@ -135,7 +134,13 @@ fn withdraw_abstract_fungible_asset_works() { fn withdraw_unhandled_asset_should_fail() { ExtBuilder.build().execute_with(|| { assert_err!( - UnknownTokens::withdraw(&MultiAsset::All, &MOCK_RECIPIENT), + UnknownTokens::withdraw( + &MultiAsset { + fun: NonFungible(Undefined), + id: Concrete(MultiLocation::parent()) + }, + &MOCK_RECIPIENT + ), Error::::UnhandledAsset ); }); diff --git a/utilities/Cargo.toml b/utilities/Cargo.toml index 42c47ae7f..074f89d8e 100644 --- a/utilities/Cargo.toml +++ b/utilities/Cargo.toml @@ -10,14 +10,14 @@ edition = "2018" [dependencies] serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } [dev-dependencies] serde_json = "1.0.64" -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } [features] default = ["std"] diff --git a/vesting/Cargo.toml b/vesting/Cargo.toml index 4f816d43d..266518955 100644 --- a/vesting/Cargo.toml +++ b/vesting/Cargo.toml @@ -10,16 +10,16 @@ edition = "2018" [dependencies] serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false, features = ["max-encoded-len"] } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } [features] default = ["std"] diff --git a/vesting/src/mock.rs b/vesting/src/mock.rs index e35ee5abf..3999ba915 100644 --- a/vesting/src/mock.rs +++ b/vesting/src/mock.rs @@ -3,7 +3,10 @@ #![cfg(test)] use super::*; -use frame_support::{construct_runtime, parameter_types, traits::EnsureOrigin}; +use frame_support::{ + construct_runtime, parameter_types, + traits::{EnsureOrigin, Everything}, +}; use frame_system::RawOrigin; use sp_core::H256; use sp_runtime::{testing::Header, traits::IdentityLookup}; @@ -35,7 +38,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type DbWeight = (); - type BaseCallFilter = (); + type BaseCallFilter = Everything; type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); diff --git a/weight-meter/Cargo.toml b/weight-meter/Cargo.toml index 7b1d45e5d..9aeefee16 100644 --- a/weight-meter/Cargo.toml +++ b/weight-meter/Cargo.toml @@ -10,20 +10,20 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] spin = "0.7.1" -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } weight-meter-procedural = { path = "weight-meter-procedural", default-features = false } orml-bencher = { path = "../bencher", default-features = false, optional = true } [dev-dependencies] serde = { version = "1.0.124" } codec = { package = "parity-scale-codec", version = "2.2.0" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9"} -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10"} +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } [features] default = ["std"] diff --git a/weight-meter/src/mock.rs b/weight-meter/src/mock.rs index 654913ef5..96642adf4 100644 --- a/weight-meter/src/mock.rs +++ b/weight-meter/src/mock.rs @@ -130,6 +130,7 @@ pub mod test_module { } use frame_support::sp_runtime::traits::IdentityLookup; +use frame_support::traits::Everything; use sp_runtime::testing::{Header, H256}; pub type BlockNumber = u64; @@ -162,7 +163,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type DbWeight = (); - type BaseCallFilter = (); + type BaseCallFilter = Everything; type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); diff --git a/xcm-support/Cargo.toml b/xcm-support/Cargo.toml index 2077accb1..7aef7d1f2 100644 --- a/xcm-support/Cargo.toml +++ b/xcm-support/Cargo.toml @@ -10,13 +10,13 @@ edition = "2018" [dependencies] codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9", default-features = false } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10", default-features = false } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10", default-features = false } orml-traits = { path = "../traits", version = "0.4.1-dev", default-features = false } diff --git a/xcm-support/src/currency_adapter.rs b/xcm-support/src/currency_adapter.rs index 202f170e8..0db047811 100644 --- a/xcm-support/src/currency_adapter.rs +++ b/xcm-support/src/currency_adapter.rs @@ -8,7 +8,7 @@ use sp_std::{ result, }; -use xcm::v0::{Error as XcmError, MultiAsset, MultiLocation, Result}; +use xcm::latest::{Error as XcmError, MultiAsset, MultiLocation, Result}; use xcm_executor::{ traits::{Convert as MoreConvert, MatchesFungible, TransactAsset}, Assets, diff --git a/xcm-support/src/lib.rs b/xcm-support/src/lib.rs index 4ad1c3eb6..2a68197e5 100644 --- a/xcm-support/src/lib.rs +++ b/xcm-support/src/lib.rs @@ -13,7 +13,7 @@ use frame_support::dispatch::{DispatchError, DispatchResult}; use sp_runtime::traits::{CheckedConversion, Convert}; use sp_std::{convert::TryFrom, marker::PhantomData, prelude::*}; -use xcm::v0::{MultiAsset, MultiLocation}; +use xcm::latest::prelude::*; use xcm_executor::traits::{FilterAssetLocation, MatchesFungible}; use orml_traits::location::Reserve; @@ -33,8 +33,8 @@ where Amount: TryFrom, { fn matches_fungible(a: &MultiAsset) -> Option { - if let MultiAsset::ConcreteFungible { id, amount } = a { - if CurrencyIdConvert::convert(id.clone()).is_some() { + if let (Fungible(ref amount), Concrete(ref location)) = (&a.fun, &a.id) { + if CurrencyIdConvert::convert(location.clone()).is_some() { return CheckedConversion::checked_from(*amount); } } diff --git a/xcm-support/src/tests.rs b/xcm-support/src/tests.rs index a05082603..c47469c41 100644 --- a/xcm-support/src/tests.rs +++ b/xcm-support/src/tests.rs @@ -4,7 +4,7 @@ use super::*; -use xcm::v0::{Junction::*, MultiAsset::ConcreteFungible, MultiLocation::*}; +use orml_traits::{location::RelativeLocations, ConcreteFungibleAsset}; #[derive(Debug, PartialEq, Eq)] pub enum TestCurrencyId { @@ -19,12 +19,17 @@ impl Convert> for CurrencyIdConvert { use TestCurrencyId::*; let token_a: Vec = "TokenA".into(); let token_b: Vec = "TokenB".into(); - match l { - X1(Parent) => Some(RelayChainToken), - X3(Parent, Parachain(1), GeneralKey(k)) if k == token_a => Some(TokenA), - X3(Parent, Parachain(2), GeneralKey(k)) if k == token_b => Some(TokenB), - _ => None, + + if l == MultiLocation::parent() { + return Some(RelayChainToken); + } + if l == MultiLocation::sibling_parachain_general_key(1, token_a) { + return Some(TokenA); + } + if l == MultiLocation::sibling_parachain_general_key(2, token_b) { + return Some(TokenB); } + None } } @@ -33,24 +38,17 @@ type MatchesCurrencyId = IsNativeConcrete; #[test] fn is_native_concrete_matches_native_currencies() { assert_eq!( - MatchesCurrencyId::matches_fungible(&ConcreteFungible { - id: X1(Parent), - amount: 100 - }), + MatchesCurrencyId::matches_fungible(&MultiAsset::parent_asset(100)), Some(100), ); + assert_eq!( - MatchesCurrencyId::matches_fungible(&ConcreteFungible { - id: X3(Parent, Parachain(1), GeneralKey("TokenA".into())), - amount: 100 - }), + MatchesCurrencyId::matches_fungible(&MultiAsset::sibling_parachain_asset(1, "TokenA".into(), 100)), Some(100), ); + assert_eq!( - MatchesCurrencyId::matches_fungible(&ConcreteFungible { - id: X3(Parent, Parachain(2), GeneralKey("TokenB".into())), - amount: 100 - }), + MatchesCurrencyId::matches_fungible(&MultiAsset::sibling_parachain_asset(2, "TokenB".into(), 100)), Some(100), ); } @@ -58,23 +56,25 @@ fn is_native_concrete_matches_native_currencies() { #[test] fn is_native_concrete_does_not_matches_non_native_currencies() { assert!( - >::matches_fungible(&ConcreteFungible { - id: X3(Parent, Parachain(2), GeneralKey("TokenC".into())), - amount: 100 - }) + >::matches_fungible(&MultiAsset::sibling_parachain_asset( + 2, + "TokenC".into(), + 100 + )) .is_none() ); assert!( - >::matches_fungible(&ConcreteFungible { - id: X3(Parent, Parachain(1), GeneralKey("TokenB".into())), - amount: 100 - }) + >::matches_fungible(&MultiAsset::sibling_parachain_asset( + 1, + "TokenB".into(), + 100 + )) .is_none() ); assert!( - >::matches_fungible(&ConcreteFungible { - id: X1(GeneralKey("TokenB".into())), - amount: 100 + >::matches_fungible(&MultiAsset { + fun: Fungible(100), + id: Concrete(MultiLocation::new(1, X1(GeneralKey("TokenB".into())))), }) .is_none() ); @@ -83,24 +83,18 @@ fn is_native_concrete_does_not_matches_non_native_currencies() { #[test] fn multi_native_asset() { assert!(MultiNativeAsset::filter_asset_location( - &ConcreteFungible { - id: Parent.into(), - amount: 10, + &MultiAsset { + fun: Fungible(10), + id: Concrete(MultiLocation::parent()) }, &Parent.into() )); assert!(MultiNativeAsset::filter_asset_location( - &ConcreteFungible { - id: X3(Parent, Parachain(1), GeneralKey("TokenA".into())), - amount: 10, - }, - &X2(Parent, Parachain(1)), + &MultiAsset::sibling_parachain_asset(1, "TokenA".into(), 100), + &MultiLocation::new(1, X1(Parachain(1))), )); assert!(!MultiNativeAsset::filter_asset_location( - &ConcreteFungible { - id: X3(Parent, Parachain(1), GeneralKey("TokenA".into())), - amount: 10, - }, - &X1(Parent), + &MultiAsset::sibling_parachain_asset(1, "TokenA".into(), 100), + &MultiLocation::parent(), )); } diff --git a/xcm/Cargo.toml b/xcm/Cargo.toml index 55b728c10..be4029670 100644 --- a/xcm/Cargo.toml +++ b/xcm/Cargo.toml @@ -9,13 +9,13 @@ edition = "2018" [dependencies] codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9", default-features = false } -pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10", default-features = false } +pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10", default-features = false } [features] default = ["std"] diff --git a/xcm/src/lib.rs b/xcm/src/lib.rs index 72f80bd15..11c5dd69c 100644 --- a/xcm/src/lib.rs +++ b/xcm/src/lib.rs @@ -7,7 +7,7 @@ use frame_support::{pallet_prelude::*, traits::EnsureOrigin}; use frame_system::pallet_prelude::*; use sp_std::boxed::Box; -use xcm::v0::prelude::*; +use xcm::latest::prelude::*; pub use module::*; @@ -31,8 +31,8 @@ pub mod module { #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - /// XCM message sent. \[from, to, message\] - Sent(MultiLocation, MultiLocation, Xcm<()>), + /// XCM message sent. \[to, message\] + Sent(MultiLocation, Xcm<()>), } #[pallet::error] @@ -55,13 +55,11 @@ pub mod module { message: Box>, ) -> DispatchResult { let _ = T::SovereignOrigin::ensure_origin(origin)?; - pallet_xcm::Pallet::::send_xcm(MultiLocation::Null, *dest.clone(), *message.clone()).map_err( - |e| match e { - XcmError::CannotReachDestination(..) => Error::::Unreachable, - _ => Error::::SendFailure, - }, - )?; - Self::deposit_event(Event::Sent(MultiLocation::Null, *dest, *message)); + pallet_xcm::Pallet::::send_xcm(Here, *dest.clone(), *message.clone()).map_err(|e| match e { + XcmError::CannotReachDestination(..) => Error::::Unreachable, + _ => Error::::SendFailure, + })?; + Self::deposit_event(Event::Sent(*dest, *message)); Ok(()) } } diff --git a/xtokens/Cargo.toml b/xtokens/Cargo.toml index 23f9dac58..16c1df537 100644 --- a/xtokens/Cargo.toml +++ b/xtokens/Cargo.toml @@ -10,43 +10,43 @@ edition = "2018" [dependencies] serde = { version = "1.0.124", optional = true } codec = { package = "parity-scale-codec", version = "2.2.0", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } -frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10", default-features = false } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.9", default-features = false } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.10", default-features = false } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9", default-features = false } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9", default-features = false } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10", default-features = false } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10", default-features = false } orml-xcm-support = { path = "../xcm-support", default-features = false } orml-traits = { path = "../traits", default-features = false} [dev-dependencies] -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.9" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.10" } # cumulus -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.9" } -cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.9" } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.9" } -cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.9" } -parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.9" } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.10" } +cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.10" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.10" } +cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.10" } +parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.10" } # polkadot -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9" } -xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9" } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9" } -xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9" } -pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9" } +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10" } +xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10" } +xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10" } +pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10" } +xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.10"} orml-tokens = { path = "../tokens" } orml-xcm = { path = "../xcm" } -xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9"} [features] default = ["std"] diff --git a/xtokens/src/lib.rs b/xtokens/src/lib.rs index 983fa31df..98ae48920 100644 --- a/xtokens/src/lib.rs +++ b/xtokens/src/lib.rs @@ -28,10 +28,10 @@ use sp_runtime::{ traits::{AtLeast32BitUnsigned, Convert, MaybeSerializeDeserialize, Member, Zero}, DispatchError, }; -use sp_std::prelude::*; +use sp_std::{prelude::*, result::Result}; -use xcm::v0::prelude::*; -use xcm_executor::traits::WeightBounds; +use xcm::latest::prelude::*; +use xcm_executor::traits::{InvertLocation, WeightBounds}; pub use module::*; use orml_traits::{ @@ -94,6 +94,9 @@ pub mod module { /// T::Weigher::weight(&msg)`. #[pallet::constant] type BaseXcmWeight: Get; + + /// Means of inverting a location. + type LocationInverter: InvertLocation; } #[pallet::event] @@ -120,6 +123,13 @@ pub mod module { UnweighableMessage, /// XCM execution failed. XcmExecutionFailed, + /// Could not re-anchor the assets to declare the fees for the + /// destination chain. + CannotReanchor, + /// Could not get ancestry of asset reserve location. + InvalidAncestry, + /// Not fungible asset. + NotFungible, } #[pallet::hooks] @@ -188,13 +198,10 @@ pub mod module { dest: MultiLocation, dest_weight: Weight, ) -> DispatchResult { - let id: MultiLocation = T::CurrencyIdConvert::convert(currency_id.clone()) + let location: MultiLocation = T::CurrencyIdConvert::convert(currency_id.clone()) .ok_or(Error::::NotCrossChainTransferableCurrency)?; - let asset = MultiAsset::ConcreteFungible { - id, - amount: amount.into(), - }; + let asset = (location, amount.into()).into(); Self::do_transfer_multiasset(who.clone(), asset, dest.clone(), dest_weight, false)?; Self::deposit_event(Event::::Transferred(who, currency_id, amount, dest)); @@ -208,26 +215,22 @@ pub mod module { dest_weight: Weight, deposit_event: bool, ) -> DispatchResult { - if Self::is_zero_amount(&asset) { + if !asset.is_fungible(None) { + return Err(Error::::NotFungible.into()); + } + + if fungible_amount(&asset).is_zero() { return Ok(()); } let (transfer_kind, dest, reserve, recipient) = Self::transfer_kind(&asset, &dest)?; - let buy_order = BuyExecution { - fees: All, - // Zero weight for additional XCM (since there are none to execute) - weight: 0, - debt: dest_weight, - halt_on_error: false, - xcm: vec![], - }; let mut msg = match transfer_kind { SelfReserveAsset => { - Self::transfer_self_reserve_asset(asset.clone(), dest.clone(), recipient, buy_order) + Self::transfer_self_reserve_asset(asset.clone(), dest.clone(), recipient, dest_weight)? } - ToReserve => Self::transfer_to_reserve(asset.clone(), dest.clone(), recipient, buy_order), + ToReserve => Self::transfer_to_reserve(asset.clone(), dest.clone(), recipient, dest_weight)?, ToNonReserve => { - Self::transfer_to_non_reserve(asset.clone(), reserve, dest.clone(), recipient, buy_order) + Self::transfer_to_non_reserve(asset.clone(), reserve, dest.clone(), recipient, dest_weight)? } }; @@ -248,32 +251,37 @@ pub mod module { asset: MultiAsset, dest: MultiLocation, recipient: MultiLocation, - buy_order: Order<()>, - ) -> Xcm { - WithdrawAsset { - assets: vec![asset], + dest_weight: Weight, + ) -> Result, DispatchError> { + let buy_execution = Self::buy_execution(asset.clone(), &dest, dest_weight)?; + Ok(WithdrawAsset { + assets: asset.into(), effects: vec![DepositReserveAsset { - assets: vec![MultiAsset::All], + assets: All.into(), dest, - effects: vec![buy_order, Self::deposit_asset(recipient)], + effects: vec![buy_execution, Self::deposit_asset(recipient)], + max_assets: u32::max_value(), }], - } + }) } fn transfer_to_reserve( asset: MultiAsset, reserve: MultiLocation, recipient: MultiLocation, - buy_order: Order<()>, - ) -> Xcm { - WithdrawAsset { - assets: vec![asset], + dest_weight: Weight, + ) -> Result, DispatchError> { + Ok(WithdrawAsset { + assets: asset.clone().into(), effects: vec![InitiateReserveWithdraw { - assets: vec![MultiAsset::All], - reserve, - effects: vec![buy_order, Self::deposit_asset(recipient)], + assets: All.into(), + reserve: reserve.clone(), + effects: vec![ + Self::buy_execution(asset, &reserve, dest_weight)?, + Self::deposit_asset(recipient), + ], }], - } + }) } fn transfer_to_non_reserve( @@ -281,59 +289,63 @@ pub mod module { reserve: MultiLocation, dest: MultiLocation, recipient: MultiLocation, - buy_order: Order<()>, - ) -> Xcm { + dest_weight: Weight, + ) -> Result, DispatchError> { let mut reanchored_dest = dest.clone(); - if reserve == Parent.into() { - if let MultiLocation::X2(Parent, Parachain(id)) = dest { - reanchored_dest = Parachain(id).into(); + if reserve == MultiLocation::parent() { + match dest { + MultiLocation { + parents, + interior: X1(Parachain(id)), + } if parents == 1 => { + reanchored_dest = Parachain(id).into(); + } + _ => {} } } - WithdrawAsset { - assets: vec![asset], + let reserve_buy_execution = Self::buy_execution(half(&asset), &reserve, dest_weight)?; + let dest_buy_execution = Self::buy_execution(half(&asset), &dest, dest_weight)?; + Ok(WithdrawAsset { + assets: asset.into(), effects: vec![InitiateReserveWithdraw { - assets: vec![MultiAsset::All], + assets: All.into(), reserve, effects: vec![ - buy_order.clone(), + reserve_buy_execution, DepositReserveAsset { - assets: vec![MultiAsset::All], + assets: All.into(), dest: reanchored_dest, - effects: vec![buy_order, Self::deposit_asset(recipient)], + effects: vec![dest_buy_execution, Self::deposit_asset(recipient)], + max_assets: u32::max_value(), }, ], }], - } + }) } fn deposit_asset(recipient: MultiLocation) -> Order<()> { DepositAsset { - assets: vec![MultiAsset::All], - dest: recipient, + assets: All.into(), + max_assets: u32::max_value(), + beneficiary: recipient, } } - fn is_zero_amount(asset: &MultiAsset) -> bool { - if let MultiAsset::ConcreteFungible { id: _, amount } = asset { - if amount.is_zero() { - return true; - } - } - - if let MultiAsset::AbstractFungible { id: _, amount } = asset { - if amount.is_zero() { - return true; - } - } - - false + fn buy_execution(asset: MultiAsset, at: &MultiLocation, weight: Weight) -> Result, DispatchError> { + let inv_at = T::LocationInverter::invert_location(at); + let fees = asset.reanchored(&inv_at).map_err(|_| Error::::CannotReanchor)?; + Ok(BuyExecution { + fees, + weight: 0, + debt: weight, + halt_on_error: false, + instructions: vec![], + }) } /// Ensure has the `dest` has chain part and recipient part. - fn ensure_valid_dest( - dest: &MultiLocation, - ) -> sp_std::result::Result<(MultiLocation, MultiLocation), DispatchError> { + fn ensure_valid_dest(dest: &MultiLocation) -> Result<(MultiLocation, MultiLocation), DispatchError> { if let (Some(dest), Some(recipient)) = (dest.chain_part(), dest.non_chain_part()) { Ok((dest, recipient)) } else { @@ -352,7 +364,7 @@ pub mod module { fn transfer_kind( asset: &MultiAsset, dest: &MultiLocation, - ) -> sp_std::result::Result<(TransferKind, MultiLocation, MultiLocation, MultiLocation), DispatchError> { + ) -> Result<(TransferKind, MultiLocation, MultiLocation, MultiLocation), DispatchError> { let (dest, recipient) = Self::ensure_valid_dest(dest)?; let self_location = T::SelfLocation::get(); @@ -377,18 +389,19 @@ pub mod module { if let Ok((transfer_kind, dest, _, reserve)) = Self::transfer_kind(asset, dest) { let mut msg = match transfer_kind { SelfReserveAsset => WithdrawAsset { - assets: vec![asset.clone()], + assets: MultiAssets::from(asset.clone()), effects: vec![DepositReserveAsset { - assets: vec![All], + assets: All.into(), dest, effects: vec![], + max_assets: u32::max_value(), }], }, ToReserve | ToNonReserve => { WithdrawAsset { - assets: vec![asset.clone()], + assets: MultiAssets::from(asset.clone()), effects: vec![InitiateReserveWithdraw { - assets: vec![All], + assets: All.into(), // `dest` is always (equal to) `reserve` in both cases reserve, effects: vec![], @@ -404,11 +417,8 @@ pub mod module { /// Returns weight of `transfer` call. fn weight_of_transfer(currency_id: T::CurrencyId, amount: T::Balance, dest: &MultiLocation) -> Weight { - if let Some(id) = T::CurrencyIdConvert::convert(currency_id) { - let asset = MultiAsset::ConcreteFungible { - id, - amount: amount.into(), - }; + if let Some(location) = T::CurrencyIdConvert::convert(currency_id) { + let asset = (location, amount.into()).into(); Self::weight_of_transfer_multiasset(&asset, dest) } else { 0 @@ -439,3 +449,22 @@ pub mod module { } } } + +/// Returns amount if `asset` is fungible, or zero. +fn fungible_amount(asset: &MultiAsset) -> u128 { + if let Fungible(amount) = &asset.fun { + *amount + } else { + Zero::zero() + } +} + +fn half(asset: &MultiAsset) -> MultiAsset { + let half_amount = fungible_amount(asset) + .checked_div(2) + .expect("div 2 can't overflow; qed"); + MultiAsset { + fun: Fungible(half_amount), + id: asset.id.clone(), + } +} diff --git a/xtokens/src/mock/mod.rs b/xtokens/src/mock/mod.rs index 11ab0810d..cc0545888 100644 --- a/xtokens/src/mock/mod.rs +++ b/xtokens/src/mock/mod.rs @@ -7,7 +7,6 @@ use serde::{Deserialize, Serialize}; use sp_io::TestExternalities; use sp_runtime::AccountId32; -use xcm::v0::{Junction, MultiLocation}; use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain}; pub mod para; @@ -31,23 +30,9 @@ pub struct CurrencyIdConvert; impl Convert> for CurrencyIdConvert { fn convert(id: CurrencyId) -> Option { match id { - CurrencyId::R => Some(Junction::Parent.into()), - CurrencyId::A => Some( - ( - Junction::Parent, - Junction::Parachain(1), - Junction::GeneralKey("A".into()), - ) - .into(), - ), - CurrencyId::B => Some( - ( - Junction::Parent, - Junction::Parachain(2), - Junction::GeneralKey("B".into()), - ) - .into(), - ), + CurrencyId::R => Some(Parent.into()), + CurrencyId::A => Some((Parent, Parachain(1), GeneralKey("A".into())).into()), + CurrencyId::B => Some((Parent, Parachain(2), GeneralKey("B".into())).into()), } } } @@ -55,17 +40,26 @@ impl Convert> for CurrencyIdConvert { fn convert(l: MultiLocation) -> Option { let a: Vec = "A".into(); let b: Vec = "B".into(); + if l == MultiLocation::parent() { + return Some(CurrencyId::R); + } match l { - X1(Parent) => Some(CurrencyId::R), - X3(Junction::Parent, Junction::Parachain(1), Junction::GeneralKey(k)) if k == a => Some(CurrencyId::A), - X3(Junction::Parent, Junction::Parachain(2), Junction::GeneralKey(k)) if k == b => Some(CurrencyId::B), - _ => Option::None, + MultiLocation { parents, interior } if parents == 1 => match interior { + X2(Parachain(1), GeneralKey(k)) if k == a => Some(CurrencyId::A), + X2(Parachain(2), GeneralKey(k)) if k == b => Some(CurrencyId::B), + _ => None, + }, + _ => None, } } } impl Convert> for CurrencyIdConvert { fn convert(a: MultiAsset) -> Option { - if let MultiAsset::ConcreteFungible { id, amount: _ } = a { + if let MultiAsset { + fun: Fungible(_), + id: Concrete(id), + } = a + { Self::convert(id) } else { Option::None diff --git a/xtokens/src/mock/para.rs b/xtokens/src/mock/para.rs index 6e782079d..1b238ebe6 100644 --- a/xtokens/src/mock/para.rs +++ b/xtokens/src/mock/para.rs @@ -1,29 +1,23 @@ -use super::{Amount, Balance, CurrencyId, CurrencyIdConvert, ParachainXcmRouter, ALICE}; +use super::{Amount, Balance, CurrencyId, CurrencyIdConvert, ParachainXcmRouter}; use crate as orml_xtokens; use frame_support::{ construct_runtime, parameter_types, - traits::{Everything, Get}, + traits::{Everything, Get, Nothing}, weights::{constants::WEIGHT_PER_SECOND, Weight}, }; use frame_system::EnsureRoot; use sp_core::H256; use sp_runtime::{ testing::Header, - traits::{Convert, IdentityLookup}, + traits::{Convert, IdentityLookup, Zero}, AccountId32, }; use cumulus_primitives_core::{ChannelStatus, GetChannelInfo, ParaId}; use pallet_xcm::XcmPassthrough; use polkadot_parachain::primitives::Sibling; -use xcm::v0::{ - Error as XcmError, - Junction::{self, Parachain, Parent}, - MultiAsset, - MultiLocation::{self, X1, X2}, - NetworkId, -}; +use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedWeightBounds, LocationInverter, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, @@ -60,7 +54,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type DbWeight = (); - type BaseCallFilter = (); + type BaseCallFilter = Everything; type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); @@ -99,7 +93,7 @@ impl orml_tokens::Config for Runtime { type ExistentialDeposits = ExistentialDeposits; type OnDust = (); type MaxLocks = MaxLocks; - type DustRemovalWhitelist = (); + type DustRemovalWhitelist = Everything; } parameter_types! { @@ -110,7 +104,7 @@ parameter_types! { impl parachain_info::Config for Runtime {} parameter_types! { - pub const RelayLocation: MultiLocation = MultiLocation::X1(Parent); + pub const RelayLocation: MultiLocation = MultiLocation::parent(); pub const RelayNetwork: NetworkId = NetworkId::Kusama; pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into(); pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); @@ -154,7 +148,7 @@ pub type Barrier = (TakeWeightCredit, AllowTopLevelPaidExecutionFrom pub struct AllTokensAreCreatedEqualToWeight(MultiLocation); impl WeightTrader for AllTokensAreCreatedEqualToWeight { fn new() -> Self { - Self(MultiLocation::Null) + Self(MultiLocation::parent()) } fn buy_weight(&mut self, weight: Weight, payment: Assets) -> Result { @@ -164,20 +158,28 @@ impl WeightTrader for AllTokensAreCreatedEqualToWeight { .next() .expect("Payment must be something; qed") .0; - let required = asset_id.clone().into_fungible_multiasset(weight as u128); - - if let MultiAsset::ConcreteFungible { ref id, amount: _ } = required { + let required = MultiAsset { + id: asset_id.clone(), + fun: Fungible(weight as u128), + }; + + if let MultiAsset { + fun: _, + id: Concrete(ref id), + } = &required + { self.0 = id.clone(); } - let (unused, _) = payment.less(required).map_err(|_| XcmError::TooExpensive)?; + let unused = payment.checked_sub(required).map_err(|_| XcmError::TooExpensive)?; Ok(unused) } - fn refund_weight(&mut self, weight: Weight) -> MultiAsset { - MultiAsset::ConcreteFungible { - id: self.0.clone(), - amount: weight as u128, + fn refund_weight(&mut self, weight: Weight) -> Option { + if weight.is_zero() { + None + } else { + Some((self.0.clone(), weight as u128).into()) } } } @@ -195,6 +197,7 @@ impl Config for XcmConfig { type Weigher = FixedWeightBounds; type Trader = AllTokensAreCreatedEqualToWeight; type ResponseHandler = (); + type SubscriptionService = PolkadotXcm; } pub struct ChannelInfo; @@ -211,6 +214,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type Event = Event; type XcmExecutor = XcmExecutor; type ChannelInfo = ChannelInfo; + type VersionWrapper = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { @@ -233,7 +237,7 @@ impl pallet_xcm::Config for Runtime { type ExecuteXcmOrigin = EnsureXcmOrigin; type XcmExecuteFilter = Everything; type XcmExecutor = XcmExecutor; - type XcmTeleportFilter = (); + type XcmTeleportFilter = Nothing; type XcmReserveTransferFilter = Everything; type Weigher = FixedWeightBounds; type LocationInverter = LocationInverter; @@ -246,11 +250,12 @@ impl Convert for AccountIdToMultiLocation { network: NetworkId::Any, id: account.into(), }) + .into() } } parameter_types! { - pub SelfLocation: MultiLocation = X2(Parent, Parachain(ParachainInfo::get().into())); + pub SelfLocation: MultiLocation = MultiLocation::new(1, X1(Parachain(ParachainInfo::get().into()))); pub const BaseXcmWeight: Weight = 100_000_000; } @@ -264,6 +269,7 @@ impl orml_xtokens::Config for Runtime { type XcmExecutor = XcmExecutor; type Weigher = FixedWeightBounds; type BaseXcmWeight = BaseXcmWeight; + type LocationInverter = LocationInverter; } impl orml_xcm::Config for Runtime { diff --git a/xtokens/src/mock/relay.rs b/xtokens/src/mock/relay.rs index daec3ca9c..e239f46f3 100644 --- a/xtokens/src/mock/relay.rs +++ b/xtokens/src/mock/relay.rs @@ -3,12 +3,13 @@ use frame_support::{ traits::Everything, weights::{IdentityFee, Weight}, }; +use frame_system::EnsureRoot; use sp_core::H256; use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32}; use cumulus_primitives_core::ParaId; use polkadot_runtime_parachains::{configuration, origin, shared, ump}; -use xcm::v0::{MultiLocation, NetworkId}; +use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative, ChildParachainConvertsVia, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsConcrete, LocationInverter, SignedAccountId32AsNative, @@ -43,7 +44,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type DbWeight = (); - type BaseCallFilter = (); + type BaseCallFilter = Everything; type SystemWeightInfo = (); type SS58Prefix = (); type OnSetCode = (); @@ -72,9 +73,9 @@ impl shared::Config for Runtime {} impl configuration::Config for Runtime {} parameter_types! { - pub const KsmLocation: MultiLocation = MultiLocation::Null; + pub const KsmLocation: MultiLocation = Here.into(); pub const KusamaNetwork: NetworkId = NetworkId::Kusama; - pub Ancestry: MultiLocation = MultiLocation::Null; + pub Ancestry: MultiLocation = Here.into(); pub UnitWeightCost: Weight = 1; } @@ -112,6 +113,7 @@ impl Config for XcmConfig { type Weigher = FixedWeightBounds; type Trader = UsingComponents, KsmLocation, AccountId, Balances, ()>; type ResponseHandler = (); + type SubscriptionService = XcmPallet; } pub type LocalOriginToLocation = SignedToAccountId32; @@ -122,7 +124,7 @@ impl pallet_xcm::Config for Runtime { type XcmRouter = XcmRouter; // Anyone can execute XCM messages locally... type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin; - type XcmExecuteFilter = (); + type XcmExecuteFilter = Everything; type XcmExecutor = XcmExecutor; type XcmTeleportFilter = Everything; type XcmReserveTransferFilter = Everything; @@ -138,6 +140,7 @@ impl ump::Config for Runtime { type Event = Event; type UmpSink = ump::XcmSink, Runtime>; type FirstMessageFactorPercent = FirstMessageFactorPercent; + type ExecuteOverweightOrigin = EnsureRoot; } impl origin::Config for Runtime {} diff --git a/xtokens/src/tests.rs b/xtokens/src/tests.rs index 693d35b09..a6f577e13 100644 --- a/xtokens/src/tests.rs +++ b/xtokens/src/tests.rs @@ -5,10 +5,9 @@ use codec::Encode; use cumulus_primitives_core::ParaId; use frame_support::{assert_err, assert_noop, assert_ok, traits::Currency}; use mock::*; -use orml_traits::MultiCurrency; +use orml_traits::{ConcreteFungibleAsset, MultiCurrency}; use polkadot_parachain::primitives::{AccountIdConversion, Sibling}; use sp_runtime::AccountId32; -use xcm::v0::{Junction, NetworkId, Order}; use xcm_simulator::TestExt; fn para_a_account() -> AccountId32 { @@ -34,6 +33,16 @@ fn sibling_c_account() -> AccountId32 { Sibling::from(3).into_account() } +// Not used in any unit tests, but it's super helpful for debugging. Let's +// keep it here. +#[allow(dead_code)] +fn print_events(name: &'static str) { + println!("------ {:?} events -------", name); + frame_system::Pallet::::events() + .iter() + .for_each(|r| println!("> {:?}", r.event)); +} + #[test] fn send_relay_chain_asset_to_relay_chain() { TestNet::reset(); @@ -47,16 +56,13 @@ fn send_relay_chain_asset_to_relay_chain() { Some(ALICE).into(), CurrencyId::R, 500, - Box::new( - ( - Parent, - Junction::AccountId32 { - network: NetworkId::Kusama, - id: BOB.into(), - }, - ) - .into() - ), + Box::new(MultiLocation::new( + 1, + X1(Junction::AccountId32 { + network: NetworkId::Any, + id: BOB.into(), + }) + )), 30, )); assert_eq!(ParaTokens::free_balance(CurrencyId::R, &ALICE), 500); @@ -112,17 +118,16 @@ fn send_relay_chain_asset_to_sibling() { Some(ALICE).into(), CurrencyId::R, 500, - Box::new( - ( - Parent, + Box::new(MultiLocation::new( + 1, + X2( Parachain(2), Junction::AccountId32 { network: NetworkId::Any, id: BOB.into(), - }, + } ) - .into() - ), + )), 30, )); assert_eq!(ParaTokens::free_balance(CurrencyId::R, &ALICE), 500); @@ -195,17 +200,16 @@ fn send_sibling_asset_to_non_reserve_sibling() { Some(ALICE).into(), CurrencyId::B, 500, - Box::new( - ( - Parent, + Box::new(MultiLocation::new( + 1, + X2( Parachain(3), Junction::AccountId32 { network: NetworkId::Any, id: BOB.into(), - }, + } ) - .into() - ), + ),), 30 )); assert_eq!(ParaTokens::free_balance(CurrencyId::B, &ALICE), 500); @@ -233,17 +237,16 @@ fn send_self_parachain_asset_to_sibling() { Some(ALICE).into(), CurrencyId::A, 500, - Box::new( - ( - Parent, + Box::new(MultiLocation::new( + 1, + X2( Parachain(2), Junction::AccountId32 { network: NetworkId::Any, id: BOB.into(), - }, + } ) - .into() - ), + )), 30, )); @@ -264,10 +267,7 @@ fn transfer_no_reserve_assets_fails() { assert_noop!( ParaXTokens::transfer_multiasset( Some(ALICE).into(), - Box::new(MultiAsset::ConcreteFungible { - id: GeneralKey("B".into()).into(), - amount: 100 - }), + Box::new((X1(GeneralKey("B".into())).into(), 100).into()), Box::new( ( Parent, @@ -294,21 +294,17 @@ fn transfer_to_self_chain_fails() { assert_noop!( ParaXTokens::transfer_multiasset( Some(ALICE).into(), - Box::new(MultiAsset::ConcreteFungible { - id: (Parent, Parachain(1), GeneralKey("A".into())).into(), - amount: 100 - }), - Box::new( - ( - Parent, + Box::new(MultiAsset::sibling_parachain_asset(1, "A".into(), 100)), + Box::new(MultiLocation::new( + 1, + X2( Parachain(1), Junction::AccountId32 { network: NetworkId::Any, id: BOB.into() } ) - .into() - ), + )), 50, ), Error::::NotCrossChainTransfer @@ -324,17 +320,14 @@ fn transfer_to_invalid_dest_fails() { assert_noop!( ParaXTokens::transfer_multiasset( Some(ALICE).into(), - Box::new(MultiAsset::ConcreteFungible { - id: (Parent, Parachain(1), GeneralKey("A".into())).into(), - amount: 100, - }), - Box::new( - (Junction::AccountId32 { + Box::new(MultiAsset::sibling_parachain_asset(1, "A".into(), 100)), + Box::new(MultiLocation::new( + 0, + X1(Junction::AccountId32 { network: NetworkId::Any, id: BOB.into() }) - .into() - ), + )), 50, ), Error::::InvalidDest @@ -351,23 +344,21 @@ fn send_as_sovereign() { }); ParaA::execute_with(|| { - use xcm::v0::OriginKind::SovereignAccount; + use xcm::latest::OriginKind::SovereignAccount; let call = relay::Call::System(frame_system::Call::::remark_with_event(vec![1, 1, 1])); + let assets: MultiAsset = (Here, 1_000_000_000_000).into(); assert_ok!(para::OrmlXcm::send_as_sovereign( para::Origin::root(), - Box::new(Junction::Parent.into()), + Box::new(MultiLocation::parent()), Box::new(WithdrawAsset { - assets: vec![MultiAsset::ConcreteFungible { - id: MultiLocation::Null, - amount: 1_000_000_000_000 - }], + assets: assets.clone().into(), effects: vec![Order::BuyExecution { - fees: MultiAsset::All, + fees: assets, weight: 10_000_000, debt: 10_000_000, halt_on_error: true, - xcm: vec![Transact { + instructions: vec![Transact { origin_type: SovereignAccount, require_weight_at_most: 1_000_000_000, call: call.encode().into(), @@ -396,24 +387,22 @@ fn send_as_sovereign_fails_if_bad_origin() { }); ParaA::execute_with(|| { - use xcm::v0::OriginKind::SovereignAccount; + use xcm::latest::OriginKind::SovereignAccount; let call = relay::Call::System(frame_system::Call::::remark_with_event(vec![1, 1, 1])); + let assets: MultiAsset = (Here, 1_000_000_000_000).into(); assert_err!( para::OrmlXcm::send_as_sovereign( para::Origin::signed(ALICE), - Box::new(Junction::Parent.into()), + Box::new(MultiLocation::parent()), Box::new(WithdrawAsset { - assets: vec![MultiAsset::ConcreteFungible { - id: MultiLocation::Null, - amount: 1_000_000_000_000 - }], + assets: assets.clone().into(), effects: vec![Order::BuyExecution { - fees: MultiAsset::All, + fees: assets, weight: 10_000_000, debt: 10_000_000, halt_on_error: true, - xcm: vec![Transact { + instructions: vec![Transact { origin_type: SovereignAccount, require_weight_at_most: 1_000_000_000, call: call.encode().into(),