From bbf5ea858a6e3eb23f72560fb72c9d644ea291b5 Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Thu, 2 Nov 2023 23:16:36 +0100 Subject: [PATCH 1/5] feat: ddc-traits module is added for loose coupling between pallets --- Cargo.lock | 344 +++++++++++++++++--------------- pallets/ddc-clusters/Cargo.toml | 3 +- pallets/ddc-clusters/src/lib.rs | 99 ++++----- pallets/ddc-staking/Cargo.toml | 1 + pallets/ddc-staking/src/lib.rs | 100 +++++++++- runtime/cere-dev/src/lib.rs | 2 + traits/Cargo.toml | 11 + traits/src/cluster.rs | 12 ++ traits/src/lib.rs | 4 + traits/src/staking.rs | 16 ++ 10 files changed, 356 insertions(+), 236 deletions(-) create mode 100644 traits/Cargo.toml create mode 100644 traits/src/cluster.rs create mode 100644 traits/src/lib.rs create mode 100644 traits/src/staking.rs diff --git a/Cargo.lock b/Cargo.lock index 3d2141735..143e726d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1633,6 +1633,17 @@ dependencies = [ "sp-runtime", ] +[[package]] +name = "ddc-traits" +version = "0.1.0" +dependencies = [ + "ddc-primitives", + "frame-support", + "frame-system", + "sp-core", + "sp-std", +] + [[package]] name = "der" version = "0.5.1" @@ -2106,7 +2117,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", ] @@ -2123,7 +2134,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "frame-system", @@ -2146,7 +2157,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -2197,7 +2208,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2208,7 +2219,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2224,7 +2235,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "frame-system", @@ -2253,7 +2264,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "bitflags 1.3.2", "frame-metadata", @@ -2285,7 +2296,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "Inflector", "cfg-expr", @@ -2299,7 +2310,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2311,7 +2322,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "proc-macro2", "quote", @@ -2321,7 +2332,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "log", @@ -2339,7 +2350,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -2354,7 +2365,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", "sp-api", @@ -2363,7 +2374,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "parity-scale-codec", @@ -4430,7 +4441,7 @@ dependencies = [ [[package]] name = "node-primitives" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-system", "parity-scale-codec", @@ -4629,7 +4640,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "frame-system", @@ -4645,7 +4656,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "frame-system", @@ -4660,7 +4671,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -4684,7 +4695,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4704,7 +4715,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -4719,7 +4730,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -4770,7 +4781,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -4789,7 +4800,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -4806,7 +4817,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "bitflags 1.3.2", "frame-benchmarking", @@ -4834,7 +4845,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "bitflags 1.3.2", "parity-scale-codec", @@ -4849,7 +4860,7 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "proc-macro2", "quote", @@ -4859,7 +4870,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "jsonrpsee", "pallet-contracts-primitives", @@ -4876,7 +4887,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "pallet-contracts-primitives", "parity-scale-codec", @@ -4891,13 +4902,13 @@ name = "pallet-ddc-clusters" version = "4.8.1" dependencies = [ "ddc-primitives", + "ddc-traits", "frame-benchmarking", "frame-support", "frame-system", "log", "pallet-contracts", "pallet-ddc-nodes", - "pallet-ddc-staking", "parity-scale-codec", "scale-info", "sp-core", @@ -4979,6 +4990,7 @@ name = "pallet-ddc-staking" version = "4.8.1" dependencies = [ "ddc-primitives", + "ddc-traits", "frame-benchmarking", "frame-support", "frame-system", @@ -5035,7 +5047,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5051,7 +5063,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5075,7 +5087,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5088,7 +5100,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5144,7 +5156,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5165,7 +5177,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5188,7 +5200,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5204,7 +5216,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5224,7 +5236,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5241,7 +5253,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5258,7 +5270,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5273,7 +5285,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "frame-system", @@ -5290,7 +5302,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5310,7 +5322,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", "sp-api", @@ -5320,7 +5332,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "frame-system", @@ -5337,7 +5349,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5360,7 +5372,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5375,7 +5387,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "frame-system", @@ -5389,7 +5401,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5404,7 +5416,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5420,7 +5432,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "frame-system", @@ -5441,7 +5453,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5457,7 +5469,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "frame-system", @@ -5471,7 +5483,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5494,7 +5506,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5505,7 +5517,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "frame-system", @@ -5519,7 +5531,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5537,7 +5549,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5556,7 +5568,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "frame-system", @@ -5572,7 +5584,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -5587,7 +5599,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -5598,7 +5610,7 @@ dependencies = [ [[package]] name = "pallet-transaction-storage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-support", "frame-system", @@ -5616,7 +5628,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5633,7 +5645,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -5649,7 +5661,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-benchmarking", "frame-support", @@ -6554,7 +6566,7 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "env_logger 0.9.3", "jsonrpsee", @@ -6827,7 +6839,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "log", "sp-core", @@ -6838,7 +6850,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "async-trait", "futures", @@ -6865,7 +6877,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "futures", "futures-timer", @@ -6888,7 +6900,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -6904,7 +6916,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "impl-trait-for-tuples", "memmap2", @@ -6921,7 +6933,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6932,7 +6944,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -6972,7 +6984,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "fnv", "futures", @@ -7000,7 +7012,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "hash-db", "kvdb", @@ -7025,7 +7037,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "async-trait", "futures", @@ -7049,7 +7061,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "async-trait", "fork-tree", @@ -7091,7 +7103,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "futures", "jsonrpsee", @@ -7113,7 +7125,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "fork-tree", "parity-scale-codec", @@ -7126,7 +7138,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "async-trait", "futures", @@ -7150,7 +7162,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "sc-client-api", "sp-authorship", @@ -7161,7 +7173,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "lazy_static", "lru", @@ -7188,7 +7200,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "environmental", "parity-scale-codec", @@ -7204,7 +7216,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "log", "parity-scale-codec", @@ -7219,7 +7231,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "cfg-if", "libc", @@ -7239,7 +7251,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "ahash", "array-bytes 4.2.0", @@ -7280,7 +7292,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "finality-grandpa", "futures", @@ -7301,7 +7313,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "ansi_term 0.12.1", "futures", @@ -7318,7 +7330,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -7333,7 +7345,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -7380,7 +7392,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "cid", "futures", @@ -7400,7 +7412,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "async-trait", "bitflags 1.3.2", @@ -7426,7 +7438,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "ahash", "futures", @@ -7444,7 +7456,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "array-bytes 4.2.0", "futures", @@ -7465,7 +7477,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "array-bytes 4.2.0", "fork-tree", @@ -7493,7 +7505,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "array-bytes 4.2.0", "futures", @@ -7512,7 +7524,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -7542,7 +7554,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "futures", "libp2p", @@ -7555,7 +7567,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -7564,7 +7576,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "futures", "hash-db", @@ -7594,7 +7606,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "futures", "jsonrpsee", @@ -7617,7 +7629,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "futures", "jsonrpsee", @@ -7630,7 +7642,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "async-trait", "directories", @@ -7700,7 +7712,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "log", "parity-scale-codec", @@ -7714,7 +7726,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -7733,7 +7745,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "futures", "libc", @@ -7752,7 +7764,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "chrono", "futures", @@ -7770,7 +7782,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "ansi_term 0.12.1", "atty", @@ -7801,7 +7813,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7812,7 +7824,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "futures", "futures-timer", @@ -7838,7 +7850,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "futures", "log", @@ -7851,7 +7863,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "futures", "futures-timer", @@ -8264,7 +8276,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "hash-db", "log", @@ -8282,7 +8294,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "blake2", "proc-macro-crate", @@ -8294,7 +8306,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", "scale-info", @@ -8307,7 +8319,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "integer-sqrt", "num-traits", @@ -8322,7 +8334,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", "scale-info", @@ -8335,7 +8347,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "async-trait", "parity-scale-codec", @@ -8347,7 +8359,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", "sp-api", @@ -8359,7 +8371,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "futures", "log", @@ -8377,7 +8389,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "async-trait", "futures", @@ -8396,7 +8408,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "async-trait", "merlin", @@ -8419,7 +8431,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", "scale-info", @@ -8433,7 +8445,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", "scale-info", @@ -8446,7 +8458,7 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "array-bytes 4.2.0", "base58", @@ -8492,7 +8504,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "blake2", "byteorder", @@ -8506,7 +8518,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "proc-macro2", "quote", @@ -8517,7 +8529,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -8526,7 +8538,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "proc-macro2", "quote", @@ -8536,7 +8548,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "environmental", "parity-scale-codec", @@ -8547,7 +8559,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "finality-grandpa", "log", @@ -8565,7 +8577,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -8579,7 +8591,7 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "bytes", "futures", @@ -8605,7 +8617,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "lazy_static", "sp-core", @@ -8616,7 +8628,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "async-trait", "futures", @@ -8633,7 +8645,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "thiserror", "zstd", @@ -8642,7 +8654,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", "scale-info", @@ -8656,7 +8668,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "sp-api", "sp-core", @@ -8666,7 +8678,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "backtrace", "lazy_static", @@ -8676,7 +8688,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "rustc-hash", "serde", @@ -8686,7 +8698,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "either", "hash256-std-hasher", @@ -8709,7 +8721,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -8727,7 +8739,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "Inflector", "proc-macro-crate", @@ -8739,7 +8751,7 @@ dependencies = [ [[package]] name = "sp-sandbox" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "log", "parity-scale-codec", @@ -8753,7 +8765,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", "scale-info", @@ -8767,7 +8779,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", "scale-info", @@ -8778,7 +8790,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "hash-db", "log", @@ -8800,12 +8812,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8818,7 +8830,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "log", "sp-core", @@ -8831,7 +8843,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "async-trait", "futures-timer", @@ -8847,7 +8859,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", "sp-std", @@ -8859,7 +8871,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "sp-api", "sp-runtime", @@ -8868,7 +8880,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "async-trait", "log", @@ -8884,7 +8896,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "ahash", "hash-db", @@ -8907,7 +8919,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8924,7 +8936,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -8935,7 +8947,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "impl-trait-for-tuples", "log", @@ -8948,7 +8960,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -9095,7 +9107,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "platforms 2.0.0", ] @@ -9103,7 +9115,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -9124,7 +9136,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "futures-util", "hyper", @@ -9137,7 +9149,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "jsonrpsee", "log", @@ -9158,7 +9170,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "futures", "substrate-test-utils-derive", @@ -9168,7 +9180,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -9179,7 +9191,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "ansi_term 0.12.1", "build-helper", @@ -9626,7 +9638,7 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" dependencies = [ "clap", "frame-try-runtime", diff --git a/pallets/ddc-clusters/Cargo.toml b/pallets/ddc-clusters/Cargo.toml index a7ed43bdf..62f59dd67 100644 --- a/pallets/ddc-clusters/Cargo.toml +++ b/pallets/ddc-clusters/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } ddc-primitives = { version = "0.1.0", default-features = false, path = "../../primitives" } +ddc-traits = { version = "0.1.0", default-features = false, path = "../../traits" } frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -18,7 +19,6 @@ sp-std = { version = "4.0.0-dev", default-features = false, git = "https://githu sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-ddc-nodes = { version = "4.7.0", default-features = false, path = "../ddc-nodes" } -pallet-ddc-staking = { version = "4.8.1", default-features = false, path = "../ddc-staking" } [dev-dependencies] sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -35,7 +35,6 @@ std = [ "frame-benchmarking/std", "pallet-contracts/std", "pallet-ddc-nodes/std", - "pallet-ddc-staking/std", "scale-info/std", "sp-core/std", "sp-io/std", diff --git a/pallets/ddc-clusters/src/lib.rs b/pallets/ddc-clusters/src/lib.rs index fafa00f9b..32547c464 100644 --- a/pallets/ddc-clusters/src/lib.rs +++ b/pallets/ddc-clusters/src/lib.rs @@ -16,6 +16,10 @@ #![feature(is_some_and)] // ToDo: delete at rustc > 1.70 use ddc_primitives::{ClusterId, NodePubKey}; +use ddc_traits::{ + cluster::{ClusterVisitor, ClusterVisitorError}, + staking::{StakingVisitor, StakingVisitorError}, +}; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; pub use pallet::*; @@ -45,11 +49,10 @@ pub mod pallet { pub struct Pallet(_); #[pallet::config] - pub trait Config: - frame_system::Config + pallet_contracts::Config + pallet_ddc_staking::Config - { + pub trait Config: frame_system::Config + pallet_contracts::Config { type RuntimeEvent: From> + IsType<::RuntimeEvent>; - type NodeRepository: NodeRepository; + type NodeRepository: NodeRepository; // todo: get rid of tight coupling with nodes-pallet + type StakingVisitor: StakingVisitor; } #[pallet::event] @@ -71,15 +74,11 @@ pub mod pallet { NodeIsAlreadyAssigned, NodeIsNotAssigned, OnlyClusterManager, - NotAuthorized, - NoStake, - /// Conditions for fast chill are not met, try the regular `chill` from - /// `pallet-ddc-staking`. - FastChillProhibited, + NodeIsNotAuthorized, + NodeHasNoStake, + NodeStakeIsInvalid, /// Cluster candidate should not plan to chill. - ChillingProhibited, - /// Origin of the call is not a controller of the stake associated with the provided node. - NotNodeController, + NodeChillingIsProhibited, } #[pallet::storage] @@ -129,38 +128,28 @@ pub mod pallet { let cluster = Clusters::::try_get(&cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; ensure!(cluster.manager_id == caller_id, Error::::OnlyClusterManager); + + // Node with this node with this public key exists let mut node = T::NodeRepository::get(node_pub_key.clone()) .map_err(|_| Error::::AttemptToAddNonExistentNode)?; ensure!(node.get_cluster_id().is_none(), Error::::NodeIsAlreadyAssigned); // Sufficient funds are locked at the DDC Staking module. - let node_provider_stash = - >::nodes(&node_pub_key).ok_or(Error::::NoStake)?; - let maybe_edge_in_cluster = - >::edges(&node_provider_stash); - let maybe_storage_in_cluster = - >::storages(&node_provider_stash); - let has_stake = maybe_edge_in_cluster - .or(maybe_storage_in_cluster) - .is_some_and(|staking_cluster| staking_cluster == cluster_id); - ensure!(has_stake, Error::::NoStake); + let has_stake = T::StakingVisitor::node_has_stake(&node_pub_key, &cluster_id) + .map_err(|e| Into::>::into(StakingVisitorError::from(e)))?; + ensure!(has_stake, Error::::NodeHasNoStake); // Candidate is not planning to pause operations any time soon. - let node_provider_controller = - >::bonded(&node_provider_stash) - .ok_or(>::BadState)?; - let chilling = >::ledger(&node_provider_controller) - .ok_or(>::BadState)? - .chilling - .is_some(); - ensure!(!chilling, Error::::ChillingProhibited); + let is_chilling = T::StakingVisitor::node_is_chilling(&node_pub_key) + .map_err(|e| Into::>::into(StakingVisitorError::from(e)))?; + ensure!(!is_chilling, Error::::NodeChillingIsProhibited); // Cluster extension smart contract allows joining. let call_data = { // is_authorized(node_provider: AccountId, node: Vec, node_variant: u8) -> bool - let args: ([u8; 4], T::AccountId, Vec, u8) = ( + let args: ([u8; 4], /* T::AccountId, */ Vec, u8) = ( INK_SELECTOR_IS_AUTHORIZED, - node_provider_stash, + // *node.get_provider_id(), node_pub_key.encode()[1..].to_vec(), // remove the first byte added by SCALE node_pub_key.variant_as_number(), ); @@ -179,7 +168,7 @@ pub mod pallet { .data .first() .is_some_and(|x| *x == 1); - ensure!(is_authorized, Error::::NotAuthorized); + ensure!(is_authorized, Error::::NodeIsNotAuthorized); node.set_cluster_id(Some(cluster_id.clone())); T::NodeRepository::update(node).map_err(|_| Error::::AttemptToAddNonExistentNode)?; @@ -230,36 +219,26 @@ pub mod pallet { Ok(()) } + } - /// Allow cluster node candidate to chill in the next DDC era. - /// - /// The dispatch origin for this call must be _Signed_ by the controller. - #[pallet::weight(10_000)] - pub fn fast_chill(origin: OriginFor, node: NodePubKey) -> DispatchResult { - let controller = ensure_signed(origin)?; - - let stash = >::ledger(&controller) - .ok_or(>::NotController)? - .stash; - let node_stash = >::nodes(&node) - .ok_or(>::BadState)?; - ensure!(stash == node_stash, Error::::NotNodeController); - - let cluster = >::edges(&stash) - .or(>::storages(&stash)) - .ok_or(Error::::NoStake)?; - let is_cluster_node = ClustersNodes::::get(cluster, node); - ensure!(!is_cluster_node, Error::::FastChillProhibited); + impl ClusterVisitor for Pallet { + fn cluster_has_node(cluster_id: &ClusterId, node_pub_key: &NodePubKey) -> bool { + ClustersNodes::::get(cluster_id, node_pub_key) + } - let can_chill_from = >::current_era().unwrap_or(0) + 1; - >::chill_stash_soon( - &stash, - &controller, - cluster, - can_chill_from, - ); + fn ensure_cluster(cluster_id: &ClusterId) -> Result<(), ClusterVisitorError> { + Clusters::::get(&cluster_id) + .map(|_| ()) + .ok_or(ClusterVisitorError::ClusterDoesNotExist) + } + } - Ok(()) + impl From for Error { + fn from(error: StakingVisitorError) -> Self { + match error { + StakingVisitorError::NodeStakeDoesNotExist => Error::::NodeHasNoStake, + StakingVisitorError::NodeStakeIsInBadState => Error::::NodeStakeIsInvalid, + } } } } diff --git a/pallets/ddc-staking/Cargo.toml b/pallets/ddc-staking/Cargo.toml index 572a2fd25..9fbcc154e 100644 --- a/pallets/ddc-staking/Cargo.toml +++ b/pallets/ddc-staking/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } ddc-primitives = { version = "0.1.0", default-features = false, path = "../../primitives" } +ddc-traits = { version = "0.1.0", default-features = false, path = "../../traits" } frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } diff --git a/pallets/ddc-staking/src/lib.rs b/pallets/ddc-staking/src/lib.rs index 6a64ac9b3..55614769b 100644 --- a/pallets/ddc-staking/src/lib.rs +++ b/pallets/ddc-staking/src/lib.rs @@ -13,6 +13,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] +#![feature(is_some_and)] // ToDo: delete at rustc > 1.70 #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; @@ -29,6 +30,11 @@ use crate::weights::WeightInfo; use codec::{Decode, Encode, HasCompact}; pub use ddc_primitives::{ClusterId, NodePubKey}; +use ddc_traits::{ + cluster::{ClusterVisitor, ClusterVisitorError}, + staking::{StakingVisitor, StakingVisitorError}, +}; + use frame_support::{ assert_ok, pallet_prelude::*, @@ -244,6 +250,8 @@ pub mod pallet { /// Time used for computing era index. It is guaranteed to start being called from the first /// `on_finalize`. type UnixTime: UnixTime; + + type ClusterVisitor: ClusterVisitor; } /// Map from all locked "stash" accounts to the controller account. @@ -475,6 +483,12 @@ pub mod pallet { BudgetOverflow, /// Current era not set during runtime DDCEraNotSet, + /// Origin of the call is not a controller of the stake associated with the provided node. + NotNodeController, + /// No stake found associated with the provided node. + NodeHasNoStake, + /// Conditions for fast chill are not met, try the regular `chill` from + FastChillProhibited, } #[pallet::hooks] @@ -678,12 +692,15 @@ pub mod pallet { /// The dispatch origin for this call must be _Signed_ by the controller, not the stash. The /// bond size must be greater than or equal to the `EdgeBondSize`. #[pallet::weight(T::WeightInfo::serve())] - pub fn serve(origin: OriginFor, cluster: ClusterId) -> DispatchResult { + pub fn serve(origin: OriginFor, cluster_id: ClusterId) -> DispatchResult { let controller = ensure_signed(origin)?; + T::ClusterVisitor::ensure_cluster(&cluster_id) + .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + let ledger = Self::ledger(&controller).ok_or(Error::::NotController)?; ensure!( - ledger.active >= Self::settings(cluster).edge_bond_size, + ledger.active >= Self::settings(cluster_id).edge_bond_size, Error::::InsufficientBond ); let stash = &ledger.stash; @@ -694,13 +711,13 @@ pub mod pallet { // Is it an attempt to cancel a previous "chill"? if let Some(current_cluster) = Self::edges(&stash) { // Switching the cluster is prohibited. The user should chill first. - ensure!(current_cluster == cluster, Error::::AlreadyInRole); + ensure!(current_cluster == cluster_id, Error::::AlreadyInRole); // Cancel previous "chill" attempts Self::reset_chilling(&controller); return Ok(()) } - Self::do_add_edge(stash, cluster); + Self::do_add_edge(stash, cluster_id); Ok(()) } @@ -712,12 +729,15 @@ pub mod pallet { /// The dispatch origin for this call must be _Signed_ by the controller, not the stash. The /// bond size must be greater than or equal to the `StorageBondSize`. #[pallet::weight(T::WeightInfo::store())] - pub fn store(origin: OriginFor, cluster: ClusterId) -> DispatchResult { + pub fn store(origin: OriginFor, cluster_id: ClusterId) -> DispatchResult { let controller = ensure_signed(origin)?; + T::ClusterVisitor::ensure_cluster(&cluster_id) + .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + let ledger = Self::ledger(&controller).ok_or(Error::::NotController)?; ensure!( - ledger.active >= Self::settings(cluster).storage_bond_size, + ledger.active >= Self::settings(cluster_id).storage_bond_size, Error::::InsufficientBond ); let stash = &ledger.stash; @@ -728,13 +748,13 @@ pub mod pallet { // Is it an attempt to cancel a previous "chill"? if let Some(current_cluster) = Self::storages(&stash) { // Switching the cluster is prohibited. The user should chill first. - ensure!(current_cluster == cluster, Error::::AlreadyInRole); + ensure!(current_cluster == cluster_id, Error::::AlreadyInRole); // Cancel previous "chill" attempts Self::reset_chilling(&controller); return Ok(()) } - Self::do_add_storage(stash, cluster); + Self::do_add_storage(stash, cluster_id); Ok(()) } @@ -940,6 +960,30 @@ pub mod pallet { Ok(()) } + + /// Allow cluster node candidate to chill in the next DDC era. + /// + /// The dispatch origin for this call must be _Signed_ by the controller. + #[pallet::weight(10_000)] + pub fn fast_chill(origin: OriginFor, node_pub_key: NodePubKey) -> DispatchResult { + let controller = ensure_signed(origin)?; + + let stash = >::get(&controller).ok_or(Error::::NotController)?.stash; + let node_stash = >::get(&node_pub_key).ok_or(Error::::BadState)?; + ensure!(stash == node_stash, Error::::NotNodeController); + + let cluster_id = >::get(&stash) + .or(>::get(&stash)) + .ok_or(Error::::NodeHasNoStake)?; + + let is_cluster_node = T::ClusterVisitor::cluster_has_node(&cluster_id, &node_pub_key); + ensure!(!is_cluster_node, Error::::FastChillProhibited); + + let can_chill_from = Self::current_era().unwrap_or(0) + 1; + Self::chill_stash_soon(&stash, &controller, cluster_id, can_chill_from); + + Ok(()) + } } impl Pallet { @@ -1116,4 +1160,44 @@ pub mod pallet { }); } } + + impl StakingVisitor for Pallet { + fn node_has_stake( + node_pub_key: &NodePubKey, + cluster_id: &ClusterId, + ) -> Result { + let stash = + >::get(&node_pub_key).ok_or(StakingVisitorError::NodeStakeDoesNotExist)?; + let maybe_edge_in_cluster = Edges::::get(&stash); + let maybe_storage_in_cluster = Storages::::get(&stash); + + let has_stake: bool = maybe_edge_in_cluster + .or(maybe_storage_in_cluster) + .is_some_and(|staking_cluster| staking_cluster == *cluster_id); + + Ok(has_stake) + } + + fn node_is_chilling(node_pub_key: &NodePubKey) -> Result { + let stash = + >::get(&node_pub_key).ok_or(StakingVisitorError::NodeStakeDoesNotExist)?; + let controller = + >::get(&stash).ok_or(StakingVisitorError::NodeStakeIsInBadState)?; + + let is_chilling = >::get(&controller) + .ok_or(StakingVisitorError::NodeStakeIsInBadState)? + .chilling + .is_some(); + + Ok(is_chilling) + } + } + + impl From for Error { + fn from(error: ClusterVisitorError) -> Self { + match error { + ClusterVisitorError::ClusterDoesNotExist => Error::::NodeHasNoStake, + } + } + } } diff --git a/runtime/cere-dev/src/lib.rs b/runtime/cere-dev/src/lib.rs index 46ee3b429..0637375e6 100644 --- a/runtime/cere-dev/src/lib.rs +++ b/runtime/cere-dev/src/lib.rs @@ -1334,6 +1334,7 @@ impl pallet_ddc_staking::Config for Runtime { type StakersPayoutSource = DdcCustomersPalletId; type UnixTime = Timestamp; type WeightInfo = pallet_ddc_staking::weights::SubstrateWeight; + type ClusterVisitor = pallet_ddc_clusters::Pallet; } parameter_types! { @@ -1371,6 +1372,7 @@ impl pallet_ddc_nodes::Config for Runtime { impl pallet_ddc_clusters::Config for Runtime { type RuntimeEvent = RuntimeEvent; type NodeRepository = pallet_ddc_nodes::Pallet; + type StakingVisitor = pallet_ddc_staking::Pallet; } construct_runtime!( diff --git a/traits/Cargo.toml b/traits/Cargo.toml new file mode 100644 index 000000000..ef2bb96e9 --- /dev/null +++ b/traits/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "ddc-traits" +version = "0.1.0" +edition = "2021" + +[dependencies] +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +ddc-primitives = { version = "0.1.0", default-features = false, path = "../primitives" } diff --git a/traits/src/cluster.rs b/traits/src/cluster.rs new file mode 100644 index 000000000..a1cae3515 --- /dev/null +++ b/traits/src/cluster.rs @@ -0,0 +1,12 @@ +use ddc_primitives::{ClusterId, NodePubKey}; +use frame_system::Config; + +pub trait ClusterVisitor { + fn cluster_has_node(cluster_id: &ClusterId, node_pub_key: &NodePubKey) -> bool; + + fn ensure_cluster(cluster_id: &ClusterId) -> Result<(), ClusterVisitorError>; +} + +pub enum ClusterVisitorError { + ClusterDoesNotExist, +} diff --git a/traits/src/lib.rs b/traits/src/lib.rs new file mode 100644 index 000000000..f6eb2b0a4 --- /dev/null +++ b/traits/src/lib.rs @@ -0,0 +1,4 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +pub mod cluster; +pub mod staking; diff --git a/traits/src/staking.rs b/traits/src/staking.rs new file mode 100644 index 000000000..5ec1e8bcf --- /dev/null +++ b/traits/src/staking.rs @@ -0,0 +1,16 @@ +use ddc_primitives::{ClusterId, NodePubKey}; +use frame_system::Config; + +pub trait StakingVisitor { + fn node_has_stake( + node_pub_key: &NodePubKey, + cluster_id: &ClusterId, + ) -> Result; + + fn node_is_chilling(node_pub_key: &NodePubKey) -> Result; +} + +pub enum StakingVisitorError { + NodeStakeDoesNotExist, + NodeStakeIsInBadState, +} From 46cbf996073ecf53cbea62f41fb1199182411d99 Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Thu, 2 Nov 2023 23:25:56 +0100 Subject: [PATCH 2/5] fix: mock object for ddc-staking tests is fixed --- pallets/ddc-staking/src/mock.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pallets/ddc-staking/src/mock.rs b/pallets/ddc-staking/src/mock.rs index 48d046fb6..9a03bd114 100644 --- a/pallets/ddc-staking/src/mock.rs +++ b/pallets/ddc-staking/src/mock.rs @@ -4,6 +4,7 @@ use crate::{self as pallet_ddc_staking, *}; use ddc_primitives::{CDNNodePubKey, StorageNodePubKey}; +use ddc_traits::cluster::{ClusterVisitor, ClusterVisitorError}; use frame_support::{ construct_runtime, traits::{ConstU32, ConstU64, Everything, GenesisBuild}, @@ -110,11 +111,20 @@ impl crate::pallet::Config for Test { type UnixTime = Timestamp; type WeightInfo = (); type StakersPayoutSource = DdcAccountsPalletId; + type ClusterVisitor = TestClusterVisitor; } pub(crate) type DdcStakingCall = crate::Call; pub(crate) type TestRuntimeCall = ::RuntimeCall; - +pub struct TestClusterVisitor {} +impl ClusterVisitor for TestClusterVisitor { + fn cluster_has_node(_cluster_id: &ClusterId, _node_pub_key: &NodePubKey) -> bool { + true + } + fn ensure_cluster(_cluster_id: &ClusterId) -> Result<(), ClusterVisitorError> { + Ok(()) + } +} pub struct ExtBuilder { has_edges: bool, has_storages: bool, From b490d954461a0464ea507b888b35400901ec86d0 Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Fri, 3 Nov 2023 01:06:34 +0100 Subject: [PATCH 3/5] feat: trait bounds are added for the node provider type --- pallets/ddc-clusters/src/lib.rs | 13 +++++----- pallets/ddc-nodes/src/cdn_node.rs | 15 ++++++------ pallets/ddc-nodes/src/lib.rs | 19 +++++++-------- pallets/ddc-nodes/src/node.rs | 24 +++++++++---------- pallets/ddc-nodes/src/storage_node.rs | 34 +++++++++++++-------------- primitives/src/lib.rs | 9 ------- 6 files changed, 53 insertions(+), 61 deletions(-) diff --git a/pallets/ddc-clusters/src/lib.rs b/pallets/ddc-clusters/src/lib.rs index 32547c464..6ab995511 100644 --- a/pallets/ddc-clusters/src/lib.rs +++ b/pallets/ddc-clusters/src/lib.rs @@ -95,7 +95,7 @@ pub mod pallet { Blake2_128Concat, NodePubKey, bool, - ValueQuery, + OptionQuery, >; #[pallet::call] @@ -147,11 +147,12 @@ pub mod pallet { // Cluster extension smart contract allows joining. let call_data = { // is_authorized(node_provider: AccountId, node: Vec, node_variant: u8) -> bool - let args: ([u8; 4], /* T::AccountId, */ Vec, u8) = ( + let args: ([u8; 4], T::AccountId, Vec, u8) = ( INK_SELECTOR_IS_AUTHORIZED, - // *node.get_provider_id(), - node_pub_key.encode()[1..].to_vec(), // remove the first byte added by SCALE - node_pub_key.variant_as_number(), + node.get_provider_id().to_owned(), + /* remove the first byte* added by SCALE */ + node.get_pub_key().to_owned().encode()[1..].to_vec(), + node.get_type().into(), ); args.encode() }; @@ -223,7 +224,7 @@ pub mod pallet { impl ClusterVisitor for Pallet { fn cluster_has_node(cluster_id: &ClusterId, node_pub_key: &NodePubKey) -> bool { - ClustersNodes::::get(cluster_id, node_pub_key) + ClustersNodes::::get(cluster_id, node_pub_key).is_some() } fn ensure_cluster(cluster_id: &ClusterId) -> Result<(), ClusterVisitorError> { diff --git a/pallets/ddc-nodes/src/cdn_node.rs b/pallets/ddc-nodes/src/cdn_node.rs index 2bf763e44..aa0392d3c 100644 --- a/pallets/ddc-nodes/src/cdn_node.rs +++ b/pallets/ddc-nodes/src/cdn_node.rs @@ -13,9 +13,10 @@ parameter_types! { } #[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo, PartialEq)] -pub struct CDNNode { +#[scale_info(skip_type_params(T))] +pub struct CDNNode { pub pub_key: CDNNodePubKey, - pub provider_id: AccountId, + pub provider_id: T::AccountId, pub cluster_id: Option, pub props: CDNNodeProps, } @@ -32,11 +33,11 @@ pub struct CDNNodeParams { pub params: Vec, // should be replaced with specific parameters for this type of node } -impl NodeTrait for CDNNode { +impl NodeTrait for CDNNode { fn get_pub_key<'a>(&'a self) -> NodePubKeyRef<'a> { NodePubKeyRef::CDNPubKeyRef(&self.pub_key) } - fn get_provider_id(&self) -> &AccountId { + fn get_provider_id(&self) -> &T::AccountId { &self.provider_id } fn get_props<'a>(&'a self) -> NodePropsRef<'a> { @@ -70,12 +71,12 @@ impl NodeTrait for CDNNode { } fn new( node_pub_key: NodePubKey, - provider_id: AccountId, + provider_id: T::AccountId, node_params: NodeParams, - ) -> Result, NodeError> { + ) -> Result, NodeError> { match node_pub_key { NodePubKey::CDNPubKey(pub_key) => match node_params { - NodeParams::CDNParams(node_params) => Ok(Node::CDN(CDNNode:: { + NodeParams::CDNParams(node_params) => Ok(Node::CDN(CDNNode:: { provider_id, pub_key, cluster_id: None, diff --git a/pallets/ddc-nodes/src/lib.rs b/pallets/ddc-nodes/src/lib.rs index a6ff1b3d4..70efb076f 100644 --- a/pallets/ddc-nodes/src/lib.rs +++ b/pallets/ddc-nodes/src/lib.rs @@ -66,12 +66,11 @@ pub mod pallet { #[pallet::storage] #[pallet::getter(fn storage_nodes)] pub type StorageNodes = - StorageMap<_, Blake2_128Concat, StorageNodePubKey, StorageNode>; + StorageMap<_, Blake2_128Concat, StorageNodePubKey, StorageNode>; #[pallet::storage] #[pallet::getter(fn cdn_nodes)] - pub type CDNNodes = - StorageMap<_, Blake2_128Concat, CDNNodePubKey, CDNNode>; + pub type CDNNodes = StorageMap<_, Blake2_128Concat, CDNNodePubKey, CDNNode>; #[pallet::call] impl Pallet { @@ -82,7 +81,7 @@ pub mod pallet { node_params: NodeParams, ) -> DispatchResult { let caller_id = ensure_signed(origin)?; - let node = Node::::new(node_pub_key.clone(), caller_id, node_params) + let node = Node::::new(node_pub_key.clone(), caller_id, node_params) .map_err(|e| Into::>::into(NodeError::from(e)))?; Self::create(node).map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; Self::deposit_event(Event::::NodeCreated { node_pub_key }); @@ -121,9 +120,9 @@ pub mod pallet { } pub trait NodeRepository { - fn create(node: Node) -> Result<(), NodeRepositoryError>; - fn get(node_pub_key: NodePubKey) -> Result, NodeRepositoryError>; - fn update(node: Node) -> Result<(), NodeRepositoryError>; + fn create(node: Node) -> Result<(), NodeRepositoryError>; + fn get(node_pub_key: NodePubKey) -> Result, NodeRepositoryError>; + fn update(node: Node) -> Result<(), NodeRepositoryError>; fn delete(node_pub_key: NodePubKey) -> Result<(), NodeRepositoryError>; } @@ -146,7 +145,7 @@ pub mod pallet { } impl NodeRepository for Pallet { - fn create(node: Node) -> Result<(), NodeRepositoryError> { + fn create(node: Node) -> Result<(), NodeRepositoryError> { match node { Node::Storage(storage_node) => { if StorageNodes::::contains_key(&storage_node.pub_key) { @@ -165,7 +164,7 @@ pub mod pallet { } } - fn get(node_pub_key: NodePubKey) -> Result, NodeRepositoryError> { + fn get(node_pub_key: NodePubKey) -> Result, NodeRepositoryError> { match node_pub_key { NodePubKey::StoragePubKey(pub_key) => match StorageNodes::::try_get(pub_key) { Ok(storage_node) => Ok(Node::Storage(storage_node)), @@ -178,7 +177,7 @@ pub mod pallet { } } - fn update(node: Node) -> Result<(), NodeRepositoryError> { + fn update(node: Node) -> Result<(), NodeRepositoryError> { match node { Node::Storage(storage_node) => { if !StorageNodes::::contains_key(&storage_node.pub_key) { diff --git a/pallets/ddc-nodes/src/node.rs b/pallets/ddc-nodes/src/node.rs index e571cfe85..abed0b026 100644 --- a/pallets/ddc-nodes/src/node.rs +++ b/pallets/ddc-nodes/src/node.rs @@ -10,9 +10,9 @@ use scale_info::TypeInfo; use sp_runtime::RuntimeDebug; #[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo, PartialEq)] -pub enum Node { - Storage(StorageNode), - CDN(CDNNode), +pub enum Node { + Storage(StorageNode), + CDN(CDNNode), } // Params fields are always coming from extrinsic input @@ -52,9 +52,9 @@ pub enum NodePropsRef<'a> { CDNPropsRef(&'a CDNNodeProps), } -pub trait NodeTrait { +pub trait NodeTrait { fn get_pub_key<'a>(&'a self) -> NodePubKeyRef<'a>; - fn get_provider_id(&self) -> &AccountId; + fn get_provider_id(&self) -> &T::AccountId; fn get_props<'a>(&'a self) -> NodePropsRef<'a>; fn set_props(&mut self, props: NodeProps) -> Result<(), NodeError>; fn set_params(&mut self, props: NodeParams) -> Result<(), NodeError>; @@ -63,19 +63,19 @@ pub trait NodeTrait { fn get_type(&self) -> NodeType; fn new( node_pub_key: NodePubKey, - provider_id: AccountId, + provider_id: T::AccountId, params: NodeParams, - ) -> Result, NodeError>; + ) -> Result, NodeError>; } -impl NodeTrait for Node { +impl NodeTrait for Node { fn get_pub_key<'a>(&'a self) -> NodePubKeyRef<'a> { match &self { Node::Storage(node) => node.get_pub_key(), Node::CDN(node) => node.get_pub_key(), } } - fn get_provider_id(&self) -> &AccountId { + fn get_provider_id(&self) -> &T::AccountId { match &self { Node::Storage(node) => node.get_provider_id(), Node::CDN(node) => node.get_provider_id(), @@ -119,9 +119,9 @@ impl NodeTrait for Node { } fn new( node_pub_key: NodePubKey, - provider_id: AccountId, + provider_id: T::AccountId, node_params: NodeParams, - ) -> Result, NodeError> { + ) -> Result, NodeError> { match node_pub_key { NodePubKey::StoragePubKey(_) => StorageNode::new(node_pub_key, provider_id, node_params), @@ -175,7 +175,7 @@ impl From for Error { NodeError::InvalidStorageNodeParams => Error::::InvalidNodeParams, NodeError::InvalidCDNNodeParams => Error::::InvalidNodeParams, NodeError::StorageNodeParamsExceedsLimit => Error::::NodeParamsExceedsLimit, - NodeError::CDNNodeParamsExceedsLimit => Error::::InvalidNodeParams, + NodeError::CDNNodeParamsExceedsLimit => Error::::NodeParamsExceedsLimit, NodeError::InvalidStorageNodeProps => Error::::InvalidNodeParams, NodeError::InvalidCDNNodeProps => Error::::InvalidNodeParams, } diff --git a/pallets/ddc-nodes/src/storage_node.rs b/pallets/ddc-nodes/src/storage_node.rs index 92b867391..d55088195 100644 --- a/pallets/ddc-nodes/src/storage_node.rs +++ b/pallets/ddc-nodes/src/storage_node.rs @@ -13,9 +13,10 @@ parameter_types! { } #[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo, PartialEq)] -pub struct StorageNode { +#[scale_info(skip_type_params(T))] +pub struct StorageNode { pub pub_key: StorageNodePubKey, - pub provider_id: AccountId, + pub provider_id: T::AccountId, pub cluster_id: Option, pub props: StorageNodeProps, } @@ -32,11 +33,11 @@ pub struct StorageNodeParams { pub params: Vec, // should be replaced with specific parameters for this type of node } -impl NodeTrait for StorageNode { +impl NodeTrait for StorageNode { fn get_pub_key<'a>(&'a self) -> NodePubKeyRef<'a> { NodePubKeyRef::StoragePubKeyRef(&self.pub_key) } - fn get_provider_id(&self) -> &AccountId { + fn get_provider_id(&self) -> &T::AccountId { &self.provider_id } fn get_props<'a>(&'a self) -> NodePropsRef<'a> { @@ -70,23 +71,22 @@ impl NodeTrait for StorageNode { } fn new( node_pub_key: NodePubKey, - provider_id: AccountId, + provider_id: T::AccountId, node_params: NodeParams, - ) -> Result, NodeError> { + ) -> Result, NodeError> { match node_pub_key { NodePubKey::StoragePubKey(pub_key) => match node_params { - NodeParams::StorageParams(node_params) => - Ok(Node::Storage(StorageNode:: { - provider_id, - pub_key, - cluster_id: None, - props: StorageNodeProps { - params: match node_params.params.try_into() { - Ok(vec) => vec, - Err(_) => return Err(NodeError::StorageNodeParamsExceedsLimit), - }, + NodeParams::StorageParams(node_params) => Ok(Node::Storage(StorageNode:: { + provider_id, + pub_key, + cluster_id: None, + props: StorageNodeProps { + params: match node_params.params.try_into() { + Ok(vec) => vec, + Err(_) => return Err(NodeError::StorageNodeParamsExceedsLimit), }, - })), + }, + })), _ => Err(NodeError::InvalidStorageNodeParams), }, _ => Err(NodeError::InvalidStorageNodePubKey), diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 401f5974e..de23aa1fd 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -17,14 +17,5 @@ pub enum NodePubKey { CDNPubKey(CDNNodePubKey), } -impl NodePubKey { - pub fn variant_as_number(&self) -> u8 { - match self { - NodePubKey::CDNPubKey(_) => 0, - NodePubKey::StoragePubKey(_) => 1, - } - } -} - pub type StorageNodePubKey = AccountId32; pub type CDNNodePubKey = AccountId32; From c82f5e38b3c21897b94e33fe0fbdc8c4455579bb Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Fri, 3 Nov 2023 02:36:26 +0100 Subject: [PATCH 4/5] chore: auth contract call is moved to a module --- pallets/ddc-clusters/src/lib.rs | 63 ++++++++--------- .../ddc-clusters/src/node_provider_auth.rs | 69 +++++++++++++++++++ pallets/ddc-nodes/src/cdn_node.rs | 6 +- pallets/ddc-nodes/src/node.rs | 28 +------- pallets/ddc-nodes/src/storage_node.rs | 6 +- primitives/src/lib.rs | 26 +++++++ 6 files changed, 128 insertions(+), 70 deletions(-) create mode 100644 pallets/ddc-clusters/src/node_provider_auth.rs diff --git a/pallets/ddc-clusters/src/lib.rs b/pallets/ddc-clusters/src/lib.rs index 6ab995511..2d389b431 100644 --- a/pallets/ddc-clusters/src/lib.rs +++ b/pallets/ddc-clusters/src/lib.rs @@ -15,6 +15,10 @@ #![recursion_limit = "256"] #![feature(is_some_and)] // ToDo: delete at rustc > 1.70 +use crate::{ + cluster::{Cluster, ClusterError, ClusterParams}, + node_provider_auth::{NodeProviderAuthContract, NodeProviderAuthContractError}, +}; use ddc_primitives::{ClusterId, NodePubKey}; use ddc_traits::{ cluster::{ClusterVisitor, ClusterVisitorError}, @@ -25,18 +29,9 @@ use frame_system::pallet_prelude::*; pub use pallet::*; use pallet_ddc_nodes::{NodeRepository, NodeTrait}; use sp_std::prelude::*; -mod cluster; - -pub use crate::cluster::{Cluster, ClusterError, ClusterParams}; - -/// ink! 4.x selector for the "is_authorized" message, equals to the first four bytes of the -/// blake2("is_authorized"). See also: https://use.ink/basics/selectors#selector-calculation/, -/// https://use.ink/macros-attributes/selector/. -const INK_SELECTOR_IS_AUTHORIZED: [u8; 4] = [0x96, 0xb0, 0x45, 0x3e]; -/// The maximum amount of weight that the cluster extension contract call is allowed to consume. -/// See also https://github.com/paritytech/substrate/blob/a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d/frame/contracts/rpc/src/lib.rs#L63. -const EXTENSION_CALL_GAS_LIMIT: Weight = Weight::from_ref_time(5_000_000_000_000); +mod cluster; +mod node_provider_auth; #[frame_support::pallet] pub mod pallet { @@ -79,6 +74,7 @@ pub mod pallet { NodeStakeIsInvalid, /// Cluster candidate should not plan to chill. NodeChillingIsProhibited, + NodeAuthContractCallFailed, } #[pallet::storage] @@ -129,7 +125,7 @@ pub mod pallet { Clusters::::try_get(&cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; ensure!(cluster.manager_id == caller_id, Error::::OnlyClusterManager); - // Node with this node with this public key exists + // Node with this node with this public key exists. let mut node = T::NodeRepository::get(node_pub_key.clone()) .map_err(|_| Error::::AttemptToAddNonExistentNode)?; ensure!(node.get_cluster_id().is_none(), Error::::NodeIsAlreadyAssigned); @@ -145,32 +141,20 @@ pub mod pallet { ensure!(!is_chilling, Error::::NodeChillingIsProhibited); // Cluster extension smart contract allows joining. - let call_data = { - // is_authorized(node_provider: AccountId, node: Vec, node_variant: u8) -> bool - let args: ([u8; 4], T::AccountId, Vec, u8) = ( - INK_SELECTOR_IS_AUTHORIZED, - node.get_provider_id().to_owned(), - /* remove the first byte* added by SCALE */ - node.get_pub_key().to_owned().encode()[1..].to_vec(), - node.get_type().into(), - ); - args.encode() - }; - let is_authorized = pallet_contracts::Pallet::::bare_call( - caller_id, + let auth_contract = NodeProviderAuthContract::::new( cluster.props.node_provider_auth_contract, - Default::default(), - EXTENSION_CALL_GAS_LIMIT, - None, - call_data, - false, - ) - .result? - .data - .first() - .is_some_and(|x| *x == 1); + caller_id, + ); + let is_authorized = auth_contract + .is_authorized( + node.get_provider_id().to_owned(), + node.get_pub_key().to_owned(), + node.get_type(), + ) + .map_err(|e| Into::>::into(NodeProviderAuthContractError::from(e)))?; ensure!(is_authorized, Error::::NodeIsNotAuthorized); + // Add node to the cluster. node.set_cluster_id(Some(cluster_id.clone())); T::NodeRepository::update(node).map_err(|_| Error::::AttemptToAddNonExistentNode)?; ClustersNodes::::insert(cluster_id.clone(), node_pub_key.clone(), true); @@ -242,4 +226,13 @@ pub mod pallet { } } } + + impl From for Error { + fn from(error: NodeProviderAuthContractError) -> Self { + match error { + NodeProviderAuthContractError::ContractCallFailed => + Error::::NodeAuthContractCallFailed, + } + } + } } diff --git a/pallets/ddc-clusters/src/node_provider_auth.rs b/pallets/ddc-clusters/src/node_provider_auth.rs new file mode 100644 index 000000000..e3f038818 --- /dev/null +++ b/pallets/ddc-clusters/src/node_provider_auth.rs @@ -0,0 +1,69 @@ +use crate::Config; +use codec::Encode; +use ddc_primitives::{NodePubKey, NodeType}; +use frame_support::weights::Weight; +use pallet_contracts::chain_extension::UncheckedFrom; +use sp_std::prelude::Vec; + +/// ink! 4.x selector for the "is_authorized" message, equals to the first four bytes of the +/// blake2("is_authorized"). See also: https://use.ink/basics/selectors#selector-calculation/, +/// https://use.ink/macros-attributes/selector/. +const INK_SELECTOR_IS_AUTHORIZED: [u8; 4] = [0x96, 0xb0, 0x45, 0x3e]; + +/// The maximum amount of weight that the cluster extension contract call is allowed to consume. +/// See also https://github.com/paritytech/substrate/blob/a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d/frame/contracts/rpc/src/lib.rs#L63. +const EXTENSION_CALL_GAS_LIMIT: Weight = Weight::from_ref_time(5_000_000_000_000); + +pub struct NodeProviderAuthContract { + contract_id: T::AccountId, + caller_id: T::AccountId, +} + +impl NodeProviderAuthContract +where + T::AccountId: UncheckedFrom + AsRef<[u8]>, +{ + pub fn is_authorized( + &self, + node_provider_id: T::AccountId, + node_pub_key: NodePubKey, + node_type: NodeType, + ) -> Result { + let call_data = { + // is_authorized(node_provider: AccountId, node: Vec, node_variant: u8) -> bool + let args: ([u8; 4], T::AccountId, Vec, u8) = ( + INK_SELECTOR_IS_AUTHORIZED, + node_provider_id, + /* remove the first byte* added by SCALE */ + node_pub_key.encode()[1..].to_vec(), + node_type.into(), + ); + args.encode() + }; + + let is_authorized = pallet_contracts::Pallet::::bare_call( + self.caller_id.clone(), + self.contract_id.clone(), + Default::default(), + EXTENSION_CALL_GAS_LIMIT, + None, + call_data, + false, + ) + .result + .map_err(|_| NodeProviderAuthContractError::ContractCallFailed)? + .data + .first() + .is_some_and(|x| *x == 1); + + Ok(is_authorized) + } + + pub fn new(contract_id: T::AccountId, caller_id: T::AccountId) -> Self { + Self { contract_id, caller_id } + } +} + +pub enum NodeProviderAuthContractError { + ContractCallFailed, +} diff --git a/pallets/ddc-nodes/src/cdn_node.rs b/pallets/ddc-nodes/src/cdn_node.rs index aa0392d3c..7bec6566b 100644 --- a/pallets/ddc-nodes/src/cdn_node.rs +++ b/pallets/ddc-nodes/src/cdn_node.rs @@ -1,8 +1,6 @@ -use crate::node::{ - Node, NodeError, NodeParams, NodeProps, NodePropsRef, NodePubKeyRef, NodeTrait, NodeType, -}; +use crate::node::{Node, NodeError, NodeParams, NodeProps, NodePropsRef, NodePubKeyRef, NodeTrait}; use codec::{Decode, Encode}; -use ddc_primitives::{CDNNodePubKey, ClusterId, NodePubKey}; +use ddc_primitives::{CDNNodePubKey, ClusterId, NodePubKey, NodeType}; use frame_support::{parameter_types, BoundedVec}; use scale_info::TypeInfo; use sp_runtime::RuntimeDebug; diff --git a/pallets/ddc-nodes/src/node.rs b/pallets/ddc-nodes/src/node.rs index abed0b026..d9431c8b6 100644 --- a/pallets/ddc-nodes/src/node.rs +++ b/pallets/ddc-nodes/src/node.rs @@ -5,7 +5,7 @@ use crate::{ ClusterId, }; use codec::{Decode, Encode}; -use ddc_primitives::{CDNNodePubKey, NodePubKey, StorageNodePubKey}; +use ddc_primitives::{CDNNodePubKey, NodePubKey, NodeType, StorageNodePubKey}; use scale_info::TypeInfo; use sp_runtime::RuntimeDebug; @@ -130,32 +130,6 @@ impl NodeTrait for Node { } } -#[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo, PartialEq)] -pub enum NodeType { - Storage = 1, - CDN = 2, -} - -impl From for u8 { - fn from(node_type: NodeType) -> Self { - match node_type { - NodeType::Storage => 1, - NodeType::CDN => 2, - } - } -} - -impl TryFrom for NodeType { - type Error = (); - fn try_from(value: u8) -> Result { - match value { - 1 => Ok(NodeType::Storage), - 2 => Ok(NodeType::CDN), - _ => Err(()), - } - } -} - pub enum NodeError { InvalidStorageNodePubKey, InvalidCDNNodePubKey, diff --git a/pallets/ddc-nodes/src/storage_node.rs b/pallets/ddc-nodes/src/storage_node.rs index d55088195..f847c119f 100644 --- a/pallets/ddc-nodes/src/storage_node.rs +++ b/pallets/ddc-nodes/src/storage_node.rs @@ -1,8 +1,6 @@ -use crate::node::{ - Node, NodeError, NodeParams, NodeProps, NodePropsRef, NodePubKeyRef, NodeTrait, NodeType, -}; +use crate::node::{Node, NodeError, NodeParams, NodeProps, NodePropsRef, NodePubKeyRef, NodeTrait}; use codec::{Decode, Encode}; -use ddc_primitives::{ClusterId, NodePubKey, StorageNodePubKey}; +use ddc_primitives::{ClusterId, NodePubKey, NodeType, StorageNodePubKey}; use frame_support::{parameter_types, BoundedVec}; use scale_info::TypeInfo; use sp_runtime::RuntimeDebug; diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index de23aa1fd..0f1efd446 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -19,3 +19,29 @@ pub enum NodePubKey { pub type StorageNodePubKey = AccountId32; pub type CDNNodePubKey = AccountId32; + +#[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo, PartialEq)] +pub enum NodeType { + Storage = 1, + CDN = 2, +} + +impl From for u8 { + fn from(node_type: NodeType) -> Self { + match node_type { + NodeType::Storage => 1, + NodeType::CDN => 2, + } + } +} + +impl TryFrom for NodeType { + type Error = (); + fn try_from(value: u8) -> Result { + match value { + 1 => Ok(NodeType::Storage), + 2 => Ok(NodeType::CDN), + _ => Err(()), + } + } +} From 232427aba560a0d5e953e33028f390480e72e1eb Mon Sep 17 00:00:00 2001 From: yahortsaryk Date: Fri, 3 Nov 2023 15:05:15 +0100 Subject: [PATCH 5/5] fix: tests compilation is fixed --- Cargo.lock | 1 + pallets/ddc-staking/src/mock.rs | 2 +- pallets/ddc-validator/Cargo.toml | 1 + pallets/ddc-validator/src/mock.rs | 31 +++++++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 143e726d2..01736ee8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5016,6 +5016,7 @@ dependencies = [ "array-bytes 6.1.0", "base64 0.21.5", "ddc-primitives", + "ddc-traits", "frame-election-provider-support", "frame-support", "frame-system", diff --git a/pallets/ddc-staking/src/mock.rs b/pallets/ddc-staking/src/mock.rs index 9a03bd114..cf55112b7 100644 --- a/pallets/ddc-staking/src/mock.rs +++ b/pallets/ddc-staking/src/mock.rs @@ -116,7 +116,7 @@ impl crate::pallet::Config for Test { pub(crate) type DdcStakingCall = crate::Call; pub(crate) type TestRuntimeCall = ::RuntimeCall; -pub struct TestClusterVisitor {} +pub struct TestClusterVisitor; impl ClusterVisitor for TestClusterVisitor { fn cluster_has_node(_cluster_id: &ClusterId, _node_pub_key: &NodePubKey) -> bool { true diff --git a/pallets/ddc-validator/Cargo.toml b/pallets/ddc-validator/Cargo.toml index 1ea14fd9a..513ab2c1e 100644 --- a/pallets/ddc-validator/Cargo.toml +++ b/pallets/ddc-validator/Cargo.toml @@ -29,6 +29,7 @@ sp-keystore = { version = "0.12.0", default-features = false, git = "https://git sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +ddc-traits = { version = "0.1.0", default-features = false, path = "../../traits" } [dev-dependencies] pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } diff --git a/pallets/ddc-validator/src/mock.rs b/pallets/ddc-validator/src/mock.rs index 2d9568768..6840c7d1d 100644 --- a/pallets/ddc-validator/src/mock.rs +++ b/pallets/ddc-validator/src/mock.rs @@ -1,5 +1,10 @@ use crate::{self as pallet_ddc_validator, *}; use ddc_primitives::{CDNNodePubKey, ClusterId, NodePubKey}; +use ddc_traits::{ + cluster::{ClusterVisitor, ClusterVisitorError}, + staking::{StakingVisitor, StakingVisitorError}, +}; + use frame_election_provider_support::{onchain, SequentialPhragmen}; use frame_support::{ parameter_types, @@ -270,11 +275,37 @@ impl pallet_ddc_staking::Config for Test { type StakersPayoutSource = DdcAccountsPalletId; type UnixTime = Timestamp; type WeightInfo = pallet_ddc_staking::weights::SubstrateWeight; + type ClusterVisitor = TestClusterVisitor; +} + +pub struct TestClusterVisitor; +impl ClusterVisitor for TestClusterVisitor { + fn cluster_has_node(_cluster_id: &ClusterId, _node_pub_key: &NodePubKey) -> bool { + true + } + fn ensure_cluster(_cluster_id: &ClusterId) -> Result<(), ClusterVisitorError> { + Ok(()) + } } impl pallet_ddc_clusters::Config for Test { type RuntimeEvent = RuntimeEvent; type NodeRepository = pallet_ddc_nodes::Pallet; + type StakingVisitor = TestStakingVisitor; +} + +pub struct TestStakingVisitor; +impl StakingVisitor for TestStakingVisitor { + fn node_has_stake( + _node_pub_key: &NodePubKey, + _cluster_id: &ClusterId, + ) -> Result { + Ok(true) + } + + fn node_is_chilling(_node_pub_key: &NodePubKey) -> Result { + Ok(true) + } } impl pallet_ddc_nodes::Config for Test {