From fc1153681e6115726b68892268b02c1eb3c920e2 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Wed, 7 Oct 2020 18:32:53 +0200 Subject: [PATCH] XCM: Land XCM Builder (#1793) * Land XCM Builder * Clean up Cargo dependencies Co-authored-by: Gavin Wood --- polkadot/Cargo.lock | 283 +++++++++--------- polkadot/Cargo.toml | 1 + polkadot/parachain/src/primitives.rs | 12 + polkadot/xcm/Cargo.toml | 7 + polkadot/xcm/xcm-builder/Cargo.toml | 33 ++ .../xcm/xcm-builder/src/currency_adapter.rs | 54 ++++ polkadot/xcm/xcm-builder/src/lib.rs | 56 ++++ .../xcm-builder/src/location_conversion.rs | 126 ++++++++ .../xcm/xcm-builder/src/origin_conversion.rs | 150 ++++++++++ 9 files changed, 588 insertions(+), 134 deletions(-) create mode 100644 polkadot/xcm/xcm-builder/Cargo.toml create mode 100644 polkadot/xcm/xcm-builder/src/currency_adapter.rs create mode 100644 polkadot/xcm/xcm-builder/src/lib.rs create mode 100644 polkadot/xcm/xcm-builder/src/location_conversion.rs create mode 100644 polkadot/xcm/xcm-builder/src/origin_conversion.rs diff --git a/polkadot/Cargo.lock b/polkadot/Cargo.lock index c88b4dc89f..976d77b731 100644 --- a/polkadot/Cargo.lock +++ b/polkadot/Cargo.lock @@ -1429,7 +1429,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", ] @@ -1437,7 +1437,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "frame-system", @@ -1455,7 +1455,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "chrono", "frame-benchmarking", @@ -1474,7 +1474,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "frame-system", @@ -1490,7 +1490,7 @@ dependencies = [ [[package]] name = "frame-metadata" version = "12.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "serde", @@ -1501,7 +1501,7 @@ dependencies = [ [[package]] name = "frame-support" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "bitmask", "frame-metadata", @@ -1526,7 +1526,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support-procedural-tools", "proc-macro2 1.0.18", @@ -1537,7 +1537,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -1549,7 +1549,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -1559,7 +1559,7 @@ dependencies = [ [[package]] name = "frame-system" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -1575,7 +1575,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -1589,7 +1589,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "sp-api", @@ -3757,7 +3757,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "frame-system", @@ -3773,7 +3773,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "frame-system", @@ -3788,7 +3788,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -3813,7 +3813,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -3827,7 +3827,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -3843,7 +3843,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -3858,7 +3858,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -3873,7 +3873,7 @@ dependencies = [ [[package]] name = "pallet-finality-tracker" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "frame-system", @@ -3889,7 +3889,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -3911,7 +3911,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "enumflags2", "frame-benchmarking", @@ -3927,7 +3927,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -3947,7 +3947,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -3964,7 +3964,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "frame-system", @@ -3978,7 +3978,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -3994,7 +3994,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "frame-system", @@ -4008,7 +4008,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "frame-system", @@ -4023,7 +4023,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -4044,7 +4044,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -4060,7 +4060,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "frame-system", @@ -4073,7 +4073,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "enumflags2", "frame-support", @@ -4088,7 +4088,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -4103,7 +4103,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "frame-system", @@ -4123,7 +4123,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -4139,7 +4139,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "frame-system", @@ -4153,7 +4153,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -4175,7 +4175,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -4186,7 +4186,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "frame-system", @@ -4200,7 +4200,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -4218,7 +4218,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "frame-system", @@ -4235,7 +4235,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "jsonrpc-core", "jsonrpc-core-client", @@ -4253,7 +4253,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-support", "parity-scale-codec", @@ -4266,7 +4266,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -4281,7 +4281,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-benchmarking", "frame-support", @@ -4297,7 +4297,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "enumflags2", "frame-benchmarking", @@ -6495,7 +6495,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "bytes 0.5.6", "derive_more 0.99.11", @@ -6523,7 +6523,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6547,7 +6547,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -6564,7 +6564,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -6581,7 +6581,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -6592,7 +6592,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "ansi_term 0.12.1", "atty", @@ -6641,7 +6641,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "fnv", @@ -6677,7 +6677,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "blake2-rfc", "hash-db", @@ -6707,7 +6707,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "sc-client-api", "sp-blockchain", @@ -6718,7 +6718,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "fork-tree", @@ -6762,7 +6762,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "futures 0.3.5", @@ -6786,7 +6786,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6799,7 +6799,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -6822,7 +6822,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "log 0.4.11", "sc-client-api", @@ -6836,7 +6836,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "lazy_static", @@ -6864,7 +6864,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "log 0.4.11", @@ -6881,7 +6881,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "log 0.4.11", "parity-scale-codec", @@ -6896,7 +6896,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "log 0.4.11", "parity-scale-codec", @@ -6914,7 +6914,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "finality-grandpa", @@ -6951,7 +6951,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "finality-grandpa", @@ -6975,7 +6975,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "ansi_term 0.12.1", "futures 0.3.5", @@ -6993,7 +6993,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "hex", @@ -7009,7 +7009,7 @@ dependencies = [ [[package]] name = "sc-light" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "hash-db", "lazy_static", @@ -7028,7 +7028,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "async-std", "async-trait", @@ -7082,7 +7082,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -7097,7 +7097,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "bytes 0.5.6", "fnv", @@ -7124,7 +7124,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "futures 0.3.5", "libp2p", @@ -7137,7 +7137,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "log 0.4.11", "substrate-prometheus-endpoint", @@ -7146,7 +7146,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "futures 0.3.5", "hash-db", @@ -7178,7 +7178,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "futures 0.3.5", @@ -7202,7 +7202,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "futures 0.1.29", "jsonrpc-core", @@ -7220,7 +7220,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "directories", @@ -7282,7 +7282,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "log 0.4.11", "parity-scale-codec", @@ -7296,7 +7296,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -7317,7 +7317,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "erased-serde", "log 0.4.11", @@ -7336,7 +7336,7 @@ dependencies = [ [[package]] name = "sc-transaction-graph" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "futures 0.3.5", @@ -7357,7 +7357,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "futures 0.3.5", @@ -7824,7 +7824,7 @@ dependencies = [ [[package]] name = "sp-allocator" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "log 0.4.11", @@ -7836,7 +7836,7 @@ dependencies = [ [[package]] name = "sp-api" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "hash-db", "parity-scale-codec", @@ -7851,7 +7851,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "blake2-rfc", "proc-macro-crate", @@ -7863,7 +7863,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "serde", @@ -7875,7 +7875,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "integer-sqrt", "num-traits 0.2.12", @@ -7888,7 +7888,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "sp-api", @@ -7900,7 +7900,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -7911,7 +7911,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "sp-api", @@ -7923,7 +7923,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "log 0.4.11", @@ -7940,7 +7940,7 @@ dependencies = [ [[package]] name = "sp-chain-spec" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "serde", "serde_json", @@ -7949,7 +7949,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "futures 0.3.5", @@ -7975,7 +7975,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "merlin", "parity-scale-codec", @@ -7994,7 +7994,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -8003,7 +8003,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "schnorrkel", @@ -8015,7 +8015,7 @@ dependencies = [ [[package]] name = "sp-core" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "base58", "blake2-rfc", @@ -8059,7 +8059,7 @@ dependencies = [ [[package]] name = "sp-database" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "kvdb", "parking_lot 0.10.2", @@ -8068,7 +8068,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -8078,7 +8078,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "environmental", "parity-scale-codec", @@ -8089,7 +8089,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "finality-grandpa", "log 0.4.11", @@ -8105,7 +8105,7 @@ dependencies = [ [[package]] name = "sp-finality-tracker" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "sp-inherents", @@ -8115,7 +8115,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "parity-scale-codec", @@ -8127,7 +8127,7 @@ dependencies = [ [[package]] name = "sp-io" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "futures 0.3.5", "hash-db", @@ -8150,7 +8150,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "lazy_static", "sp-core", @@ -8161,7 +8161,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "serde", @@ -8173,7 +8173,7 @@ dependencies = [ [[package]] name = "sp-npos-elections-compact" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.18", @@ -8184,7 +8184,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "sp-api", "sp-core", @@ -8194,7 +8194,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "backtrace", "log 0.4.11", @@ -8203,7 +8203,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "serde", "sp-core", @@ -8212,7 +8212,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "either", "hash256-std-hasher", @@ -8234,7 +8234,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "primitive-types", @@ -8250,7 +8250,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "Inflector", "proc-macro-crate", @@ -8262,7 +8262,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "serde", "serde_json", @@ -8271,7 +8271,7 @@ dependencies = [ [[package]] name = "sp-session" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "sp-api", @@ -8284,7 +8284,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -8294,7 +8294,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "hash-db", "log 0.4.11", @@ -8315,12 +8315,12 @@ dependencies = [ [[package]] name = "sp-std" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" [[package]] name = "sp-storage" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8333,7 +8333,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8347,7 +8347,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "log 0.4.11", "parity-scale-codec", @@ -8360,7 +8360,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "derive_more 0.99.11", "futures 0.3.5", @@ -8375,7 +8375,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "hash-db", "memory-db", @@ -8389,7 +8389,7 @@ dependencies = [ [[package]] name = "sp-utils" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "futures 0.3.5", "futures-core", @@ -8401,7 +8401,7 @@ dependencies = [ [[package]] name = "sp-version" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8413,7 +8413,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -8554,7 +8554,7 @@ dependencies = [ [[package]] name = "substrate-browser-utils" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "chrono", "console_error_panic_hook", @@ -8580,7 +8580,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "platforms", ] @@ -8588,7 +8588,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.5", @@ -8611,7 +8611,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "async-std", "derive_more 0.99.11", @@ -8625,7 +8625,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "futures 0.1.29", "futures 0.3.5", @@ -8651,7 +8651,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "futures 0.3.5", "substrate-test-utils-derive", @@ -8661,7 +8661,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate#7314a78d49d0dc3862c6ef7c8115cb1b3d0c0fd2" +source = "git+https://github.com/paritytech/substrate#81f3e7caf351c27aab518ee3b640c06b1a4392bf" dependencies = [ "proc-macro-crate", "quote 1.0.7", @@ -10037,6 +10037,21 @@ dependencies = [ "parity-scale-codec", ] +[[package]] +name = "xcm-builder" +version = "0.8.22" +dependencies = [ + "frame-support", + "parity-scale-codec", + "polkadot-parachain", + "sp-arithmetic", + "sp-io", + "sp-runtime", + "sp-std", + "xcm", + "xcm-executor", +] + [[package]] name = "xcm-executor" version = "0.8.22" diff --git a/polkadot/Cargo.toml b/polkadot/Cargo.toml index 84876187f9..51e233d220 100644 --- a/polkadot/Cargo.toml +++ b/polkadot/Cargo.toml @@ -41,6 +41,7 @@ members = [ "service", "validation", "xcm", + "xcm/xcm-builder", "xcm/xcm-executor", "node/collation-generation", "node/core/av-store", diff --git a/polkadot/parachain/src/primitives.rs b/polkadot/parachain/src/primitives.rs index 3a1ee81bcd..361ff2eff6 100644 --- a/polkadot/parachain/src/primitives.rs +++ b/polkadot/parachain/src/primitives.rs @@ -124,9 +124,21 @@ impl Id { } /// Returns `true` if this parachain runs with system-level privileges. + /// Use IsSystem instead. + #[deprecated] pub fn is_system(&self) -> bool { self.0 < USER_INDEX_START } } +pub trait IsSystem { + fn is_system(&self) -> bool; +} + +impl IsSystem for Id { + fn is_system(&self) -> bool { + self.0 < USER_INDEX_START + } +} + impl sp_std::ops::Add for Id { type Output = Self; diff --git a/polkadot/xcm/Cargo.toml b/polkadot/xcm/Cargo.toml index 027ebc153a..0587613be6 100644 --- a/polkadot/xcm/Cargo.toml +++ b/polkadot/xcm/Cargo.toml @@ -7,3 +7,10 @@ edition = "2018" [dependencies] codec = { package = "parity-scale-codec", version = "1.3.5", default-features = false, features = [ "derive" ] } + +[features] +default = ["std"] +wasm-api = [] +std = [ + "codec/std", +] diff --git a/polkadot/xcm/xcm-builder/Cargo.toml b/polkadot/xcm/xcm-builder/Cargo.toml new file mode 100644 index 0000000000..bd2ef9ea9c --- /dev/null +++ b/polkadot/xcm/xcm-builder/Cargo.toml @@ -0,0 +1,33 @@ +[package] +authors = ["Parity Technologies "] +edition = "2018" +name = "xcm-builder" +description = "Tools & types for building with XCM and its executor." +version = "0.8.22" + +[dependencies] +codec = { package = "parity-scale-codec", version = "1.3.0", default-features = false, features = ["derive"] } +xcm = { path = "..", default-features = false } +xcm-executor = { path = "../xcm-executor", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-arithmetic = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } + +# Polkadot dependencies +polkadot-parachain = { path = "../../parachain", default-features = false } + +[features] +default = ["std"] +std = [ + "codec/std", + "xcm/std", + "xcm-executor/std", + "sp-std/std", + "sp-arithmetic/std", + "sp-io/std", + "sp-runtime/std", + "frame-support/std", + "polkadot-parachain/std", +] diff --git a/polkadot/xcm/xcm-builder/src/currency_adapter.rs b/polkadot/xcm/xcm-builder/src/currency_adapter.rs new file mode 100644 index 0000000000..0986d5b2e4 --- /dev/null +++ b/polkadot/xcm/xcm-builder/src/currency_adapter.rs @@ -0,0 +1,54 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +use sp_std::{result, convert::TryInto, marker::PhantomData}; +use xcm::v0::{Error, Result, MultiAsset, MultiLocation}; +use sp_arithmetic::traits::SaturatedConversion; +use frame_support::traits::{ExistenceRequirement::AllowDeath, WithdrawReason}; +use xcm_executor::traits::{MatchesFungible, LocationConversion, TransactAsset}; + +pub struct CurrencyAdapter( + PhantomData, + PhantomData, + PhantomData, + PhantomData, +); + +impl< + Matcher: MatchesFungible, + AccountIdConverter: LocationConversion, + Currency: frame_support::traits::Currency, + AccountId, // can't get away without it since Currency is generic over it. +> TransactAsset for CurrencyAdapter { + + fn deposit_asset(what: &MultiAsset, who: &MultiLocation) -> Result { + // Check we handle this asset. + let amount = Matcher::matches_fungible(&what).ok_or(())?.saturated_into(); + let who = AccountIdConverter::from_location(who).ok_or(())?; + let balance_amount = amount.try_into().map_err(|_| ())?; + let _imbalance = Currency::deposit_creating(&who, balance_amount); + Ok(()) + } + + fn withdraw_asset(what: &MultiAsset, who: &MultiLocation) -> result::Result { + // Check we handle this asset. + let amount = Matcher::matches_fungible(&what).ok_or(())?.saturated_into(); + let who = AccountIdConverter::from_location(who).ok_or(())?; + let balance_amount = amount.try_into().map_err(|_| ())?; + Currency::withdraw(&who, balance_amount, WithdrawReason::Transfer.into(), AllowDeath).map_err(|_| ())?; + Ok(what.clone()) + } +} diff --git a/polkadot/xcm/xcm-builder/src/lib.rs b/polkadot/xcm/xcm-builder/src/lib.rs new file mode 100644 index 0000000000..9dd62f8430 --- /dev/null +++ b/polkadot/xcm/xcm-builder/src/lib.rs @@ -0,0 +1,56 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +mod location_conversion; +pub use location_conversion::{ + Account32Hash, ParentIsDefault, ChildParachainConvertsVia, SiblingParachainConvertsVia, AccountId32Aliases +}; + +mod origin_conversion; +pub use origin_conversion::{ + SovereignSignedViaLocation, ParentAsSuperuser, ChildSystemParachainAsSuperuser, SiblingSystemParachainAsSuperuser, + ChildParachainAsNative, SiblingParachainAsNative, RelayChainAsNative, SignedAccountId32AsNative +}; + +mod currency_adapter; +pub use currency_adapter::CurrencyAdapter; + +use sp_std::marker::PhantomData; +use xcm_executor::traits::InvertLocation; +use xcm::v0::{MultiLocation, Junction}; +use frame_support::traits::Get; + +/// Simple location inverter; give it this location's ancestry and it'll +pub struct LocationInverter(PhantomData); + +impl> InvertLocation for LocationInverter { + fn invert_location(location: &MultiLocation) -> MultiLocation { + let mut ancestry = Ancestry::get(); + let mut result = location.clone(); + for (i, j) in location.iter_rev() + .map(|j| match j { + Junction::Parent => ancestry.take_first().unwrap_or(Junction::OnlyChild), + _ => Junction::Parent, + }) + .enumerate() + { + *result.at_mut(i).expect("location and result begin equal; same size; qed") = j; + } + result + } +} diff --git a/polkadot/xcm/xcm-builder/src/location_conversion.rs b/polkadot/xcm/xcm-builder/src/location_conversion.rs new file mode 100644 index 0000000000..54d27dad8e --- /dev/null +++ b/polkadot/xcm/xcm-builder/src/location_conversion.rs @@ -0,0 +1,126 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +use sp_std::marker::PhantomData; +use sp_io::hashing::blake2_256; +use sp_runtime::traits::AccountIdConversion; +use frame_support::traits::Get; +use codec::Encode; +use xcm::v0::{MultiLocation, NetworkId, Junction}; +use xcm_executor::traits::LocationConversion; + +pub struct Account32Hash(PhantomData<(Network, AccountId)>); + +impl< + Network: Get, + AccountId: From<[u8; 32]> + Into<[u8; 32]>, +> LocationConversion for Account32Hash { + fn from_location(location: &MultiLocation) -> Option { + Some(("multiloc", location).using_encoded(blake2_256).into()) + } + + fn try_into_location(who: AccountId) -> Result { + Err(who) + } +} + +pub struct ParentIsDefault(PhantomData); + +impl< + AccountId: Default + Eq, +> LocationConversion for ParentIsDefault { + fn from_location(location: &MultiLocation) -> Option { + if let MultiLocation::X1(Junction::Parent) = location { + Some(AccountId::default()) + } else { + None + } + } + + fn try_into_location(who: AccountId) -> Result { + if who == AccountId::default() { + Ok(Junction::Parent.into()) + } else { + Err(who) + } + } +} + +pub struct ChildParachainConvertsVia(PhantomData<(ParaId, AccountId)>); + +impl< + ParaId: From + Into + AccountIdConversion, + AccountId, +> LocationConversion for ChildParachainConvertsVia { + fn from_location(location: &MultiLocation) -> Option { + if let MultiLocation::X1(Junction::Parachain { id }) = location { + Some(ParaId::from(*id).into_account()) + } else { + None + } + } + + fn try_into_location(who: AccountId) -> Result { + if let Some(id) = ParaId::try_from_account(&who) { + Ok(Junction::Parachain { id: id.into() }.into()) + } else { + Err(who) + } + } +} + +pub struct SiblingParachainConvertsVia(PhantomData<(ParaId, AccountId)>); + +impl< + ParaId: From + Into + AccountIdConversion, + AccountId, +> LocationConversion for SiblingParachainConvertsVia { + fn from_location(location: &MultiLocation) -> Option { + if let MultiLocation::X2(Junction::Parent, Junction::Parachain { id }) = location { + Some(ParaId::from(*id).into_account()) + } else { + None + } + } + + fn try_into_location(who: AccountId) -> Result { + if let Some(id) = ParaId::try_from_account(&who) { + Ok([Junction::Parent, Junction::Parachain { id: id.into() }].into()) + } else { + Err(who) + } + } +} + +pub struct AccountId32Aliases(PhantomData<(Network, AccountId)>); + +impl< + Network: Get, + AccountId: From<[u8; 32]> + Into<[u8; 32]>, +> LocationConversion for AccountId32Aliases { + fn from_location(location: &MultiLocation) -> Option { + if let MultiLocation::X1(Junction::AccountId32 { id, network }) = location { + if matches!(network, NetworkId::Any) || network == &Network::get() { + return Some((*id).into()) + } + } + None + } + + fn try_into_location(who: AccountId) -> Result { + Ok(Junction::AccountId32 { id: who.into(), network: Network::get() }.into()) + } +} diff --git a/polkadot/xcm/xcm-builder/src/origin_conversion.rs b/polkadot/xcm/xcm-builder/src/origin_conversion.rs new file mode 100644 index 0000000000..86b9b26360 --- /dev/null +++ b/polkadot/xcm/xcm-builder/src/origin_conversion.rs @@ -0,0 +1,150 @@ +// Copyright 2020 Parity Technologies (UK) Ltd. +// This file is part of Polkadot. + +// Polkadot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Polkadot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Polkadot. If not, see . + +use sp_std::marker::PhantomData; +use frame_support::traits::{Get, OriginTrait}; +use xcm::v0::{MultiLocation, OriginKind, NetworkId, Junction}; +use xcm_executor::traits::{LocationConversion, ConvertOrigin}; +use polkadot_parachain::primitives::IsSystem; + +/// Sovereign accounts use the system's `Signed` origin with an account ID derived from the +/// `LocationConverter`. +pub struct SovereignSignedViaLocation( + PhantomData<(LocationConverter, Origin)> +); +impl< + LocationConverter: LocationConversion, + Origin: OriginTrait, +> ConvertOrigin for SovereignSignedViaLocation { + fn convert_origin(origin: MultiLocation, kind: OriginKind) -> Result { + if let OriginKind::SovereignAccount = kind { + let location = LocationConverter::from_location(&origin).ok_or(origin)?; + Ok(Origin::signed(location).into()) + } else { + Err(origin) + } + } +} + +pub struct ParentAsSuperuser(PhantomData); +impl< + Origin: OriginTrait, +> ConvertOrigin for ParentAsSuperuser { + fn convert_origin(origin: MultiLocation, kind: OriginKind) -> Result { + match (kind, origin) { + (OriginKind::Superuser, MultiLocation::X1(Junction::Parent)) => + Ok(Origin::root()), + (_, origin) => Err(origin), + } + } +} + +pub struct ChildSystemParachainAsSuperuser(PhantomData<(ParaId, Origin)>); +impl< + ParaId: IsSystem + From, + Origin: OriginTrait, +> ConvertOrigin for ChildSystemParachainAsSuperuser { + fn convert_origin(origin: MultiLocation, kind: OriginKind) -> Result { + match (kind, origin) { + (OriginKind::Superuser, MultiLocation::X1(Junction::Parachain { id })) + if ParaId::from(id).is_system() => + Ok(Origin::root()), + (_, origin) => Err(origin), + } + } +} + +pub struct SiblingSystemParachainAsSuperuser(PhantomData<(ParaId, Origin)>); +impl< + ParaId: IsSystem + From, + Origin: OriginTrait +> ConvertOrigin for SiblingSystemParachainAsSuperuser { + fn convert_origin(origin: MultiLocation, kind: OriginKind) -> Result { + match (kind, origin) { + (OriginKind::Superuser, MultiLocation::X2(Junction::Parent, Junction::Parachain { id })) + if ParaId::from(id).is_system() => + Ok(Origin::root()), + (_, origin) => Err(origin), + } + } +} + +pub struct ChildParachainAsNative( + PhantomData<(ParachainOrigin, Origin)> +); +impl< + ParachainOrigin: From, + Origin: From, +> ConvertOrigin for ChildParachainAsNative { + fn convert_origin(origin: MultiLocation, kind: OriginKind) -> Result { + match (kind, origin) { + (OriginKind::Native, MultiLocation::X1(Junction::Parachain { id })) + => Ok(Origin::from(ParachainOrigin::from(id))), + (_, origin) => Err(origin), + } + } +} + +pub struct SiblingParachainAsNative( + PhantomData<(ParachainOrigin, Origin)> +); +impl< + ParachainOrigin: From, + Origin: From, +> ConvertOrigin for SiblingParachainAsNative { + fn convert_origin(origin: MultiLocation, kind: OriginKind) -> Result { + match (kind, origin) { + (OriginKind::Native, MultiLocation::X2(Junction::Parent, Junction::Parachain { id })) + => Ok(Origin::from(ParachainOrigin::from(id))), + (_, origin) => Err(origin), + } + } +} + +// Our Relay-chain has a native origin given by the `Get`ter. +pub struct RelayChainAsNative( + PhantomData<(RelayOrigin, Origin)> +); +impl< + RelayOrigin: Get, + Origin, +> ConvertOrigin for RelayChainAsNative { + fn convert_origin(origin: MultiLocation, kind: OriginKind) -> Result { + match (kind, origin) { + (OriginKind::Native, MultiLocation::X1(Junction::Parent)) => Ok(RelayOrigin::get()), + (_, origin) => Err(origin), + } + } +} + +pub struct SignedAccountId32AsNative( + PhantomData<(Network, Origin)> +); +impl< + Network: Get, + Origin: OriginTrait, +> ConvertOrigin for SignedAccountId32AsNative where + Origin::AccountId: From<[u8; 32]>, +{ + fn convert_origin(origin: MultiLocation, kind: OriginKind) -> Result { + match (kind, origin) { + (OriginKind::Native, MultiLocation::X1(Junction::AccountId32 { id, network })) + if matches!(network, NetworkId::Any) || network == Network::get() + => Ok(Origin::signed(id.into())), + (_, origin) => Err(origin), + } + } +}