diff --git a/Cargo.lock b/Cargo.lock index 3d2141735..1f147bd9f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -834,7 +834,6 @@ dependencies = [ "pallet-ddc-metrics-offchain-worker", "pallet-ddc-nodes", "pallet-ddc-staking", - "pallet-ddc-validator", "pallet-democracy", "pallet-election-provider-multi-phase", "pallet-election-provider-support-benchmarking", @@ -2106,7 +2105,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 +2122,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 +2145,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 +2196,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 +2207,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 +2223,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 +2252,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 +2284,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 +2298,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 +2310,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 +2320,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 +2338,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 +2353,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 +2362,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 +4429,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 +4628,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 +4644,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 +4659,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 +4683,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 +4703,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 +4718,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 +4769,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 +4788,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 +4805,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 +4833,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 +4848,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 +4858,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 +4875,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", @@ -4996,46 +4995,10 @@ dependencies = [ "substrate-test-utils", ] -[[package]] -name = "pallet-ddc-validator" -version = "0.1.0" -dependencies = [ - "alt_serde", - "array-bytes 6.1.0", - "base64 0.21.5", - "ddc-primitives", - "frame-election-provider-support", - "frame-support", - "frame-system", - "lite-json", - "log", - "pallet-balances", - "pallet-contracts", - "pallet-ddc-clusters", - "pallet-ddc-customers", - "pallet-ddc-nodes", - "pallet-ddc-staking", - "pallet-randomness-collective-flip", - "pallet-session", - "pallet-staking", - "pallet-staking-reward-curve", - "pallet-timestamp", - "parity-scale-codec", - "scale-info", - "serde", - "serde_json 1.0.44", - "sp-core", - "sp-io", - "sp-keystore", - "sp-runtime", - "sp-staking", - "sp-std", -] - [[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 +5014,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 +5038,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 +5051,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 +5107,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 +5128,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 +5151,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 +5167,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 +5187,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 +5204,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 +5221,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 +5236,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 +5253,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 +5273,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 +5283,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 +5300,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 +5323,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 +5338,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 +5352,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 +5367,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 +5383,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 +5404,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 +5420,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 +5434,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 +5457,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 +5468,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 +5482,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 +5500,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 +5519,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 +5535,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 +5550,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 +5561,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 +5579,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 +5596,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 +5612,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 +6517,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 +6790,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 +6801,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 +6828,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 +6851,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 +6867,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 +6884,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 +6895,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 +6935,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 +6963,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 +6988,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 +7012,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 +7054,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 +7076,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 +7089,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 +7113,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 +7124,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 +7151,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 +7167,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 +7182,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 +7202,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 +7243,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 +7264,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 +7281,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 +7296,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 +7343,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 +7363,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 +7389,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 +7407,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 +7428,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 +7456,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 +7475,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 +7505,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 +7518,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 +7527,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 +7557,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 +7580,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 +7593,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 +7663,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 +7677,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 +7696,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 +7715,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 +7733,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 +7764,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 +7775,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 +7801,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 +7814,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 +8227,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 +8245,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 +8257,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 +8270,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 +8285,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 +8298,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 +8310,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 +8322,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 +8340,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 +8359,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 +8382,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 +8396,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 +8409,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 +8455,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 +8469,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 +8480,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 +8489,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 +8499,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 +8510,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 +8528,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 +8542,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 +8568,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 +8579,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 +8596,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 +8605,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 +8619,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 +8629,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 +8639,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 +8649,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 +8672,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 +8690,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 +8702,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 +8716,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 +8730,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 +8741,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 +8763,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 +8781,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 +8794,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 +8810,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 +8822,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 +8831,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 +8847,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 +8870,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 +8887,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 +8898,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 +8911,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 +9058,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 +9066,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 +9087,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 +9100,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 +9121,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 +9131,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 +9142,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 +9589,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/Cargo.toml b/Cargo.toml index 0cf3246b8..3d7599231 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,6 @@ members = [ "pallets/erc721", "pallets/erc20", "pallets/ddc-metrics-offchain-worker", - "pallets/ddc-validator", "pallets/ddc-customers", "pallets/ddc-nodes", "pallets/ddc-clusters", diff --git a/pallets/ddc-validator/Cargo.toml b/pallets/ddc-validator/Cargo.toml deleted file mode 100644 index 1ea14fd9a..000000000 --- a/pallets/ddc-validator/Cargo.toml +++ /dev/null @@ -1,63 +0,0 @@ -[package] -name = "pallet-ddc-validator" -version = "0.1.0" -edition = "2021" - -[dependencies] -alt_serde = { version = "1", default-features = false, features = ["derive"] } -array-bytes = "6.0.0" -base64 = { version = "0.21.0", default-features = false } -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -frame-election-provider-support = { version = "4.0.0-dev", 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" } -lite-json = { version = "0.2.0", default-features = false } -log = { version = "0.4.17", 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-customers = { version = "0.1.0", default-features = false, path = "../ddc-customers" } -pallet-ddc-staking = { version = "4.7.0", default-features = false, path = "../ddc-staking" } -pallet-ddc-clusters = { version = "4.7.0", default-features = false, path = "../ddc-clusters" } -pallet-ddc-nodes = { version = "4.7.0", default-features = false, path = "../ddc-nodes" } -pallet-session = { version = "4.0.0-dev", features = [ "historical" ], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } -pallet-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } -serde = { version = "1.0.101", optional = true } -serde_json = { version = "1", default-features = false, git = "https://github.com/Cerebellum-Network/json", branch = "no-std-cere", features = ["alloc"] } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-keystore = { version = "0.12.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -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" } - -[dev-dependencies] -pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-randomness-collective-flip = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-staking-reward-curve = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -ddc-primitives = { version = "0.1.0", path = "../../primitives" } - -[features] -default = ["std"] -std = [ - "codec/std", - "frame-election-provider-support/std", - "frame-support/std", - "frame-system/std", - "lite-json/std", - "pallet-contracts/std", - "pallet-ddc-customers/std", - "pallet-ddc-staking/std", - "pallet-ddc-clusters/std", - "pallet-ddc-nodes/std", - "pallet-session/std", - "pallet-staking/std", - "scale-info/std", - "serde", - "sp-core/std", - "sp-io/std", - "sp-keystore", - "sp-runtime/std", - "sp-staking/std", - "sp-std/std", -] diff --git a/pallets/ddc-validator/README.md b/pallets/ddc-validator/README.md deleted file mode 100644 index ba9427397..000000000 --- a/pallets/ddc-validator/README.md +++ /dev/null @@ -1 +0,0 @@ -# DDC Validator \ No newline at end of file diff --git a/pallets/ddc-validator/src/dac.rs b/pallets/ddc-validator/src/dac.rs deleted file mode 100644 index c23b98588..000000000 --- a/pallets/ddc-validator/src/dac.rs +++ /dev/null @@ -1,414 +0,0 @@ -//! A module with Data Activity Capture (DAC) interaction. - -use crate::{utils, DacTotalAggregates, OpCode, ValidationDecision}; -use alloc::string::String; // ToDo: remove String usage -use alt_serde::{de::DeserializeOwned, Deserialize, Serialize}; -use codec::{Decode, Encode}; -use sp_runtime::offchain::{http, Duration}; -use sp_staking::EraIndex; -pub use sp_std::{ - collections::{btree_map::BTreeMap, btree_set::BTreeSet}, - prelude::*, -}; - -pub type TimestampInSec = u64; -pub const HTTP_TIMEOUT_MS: u64 = 30_000; -pub const FAILED_CONTENT_CONSUMER_THRESHOLD: TimestampInSec = 100; - -#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(crate = "alt_serde")] -#[serde(rename_all = "camelCase")] -pub struct RedisFtAggregate { - #[serde(rename = "FT.AGGREGATE")] - pub ft_aggregate: Vec, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(crate = "alt_serde")] -#[serde(untagged)] -pub enum FtAggregate { - Length(u32), - Node(Vec), -} - -#[derive(Clone, Debug, Encode, Decode, scale_info::TypeInfo, PartialEq)] -pub struct BytesSent { - pub node_public_key: String, - pub era: EraIndex, - pub sum: u32, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(crate = "alt_serde")] -#[serde(rename_all = "camelCase")] -pub struct FileRequestWrapper { - #[serde(rename = "JSON.GET")] - json: String, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(crate = "alt_serde")] -#[serde(rename_all = "camelCase")] -pub struct CDNNodeAggregates { - aggregate: Vec, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(crate = "alt_serde")] -#[serde(rename_all = "camelCase")] -pub struct CDNNodeAggregate { - total_bytes_sent: u64, - total_queries: u64, - total_reads: u64, - total_reads_acked: u64, - total_queries_acked: u64, - average_response_time_ms: f64, - total_bytes_received: u64, - pub request_ids: Vec, - total_writes_acked: u64, - average_response_time_ms_samples: u64, - total_writes: u64, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(crate = "alt_serde")] -#[serde(rename_all = "camelCase")] -pub struct FileRequests { - requests: Requests, -} - -pub type Requests = BTreeMap; - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(crate = "alt_serde")] -#[serde(rename_all = "camelCase")] -pub struct FileRequest { - pub file_request_id: String, - file_info: FileInfo, - bucket_id: u128, - timestamp: u64, - chunks: BTreeMap, - user_public_key: String, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(crate = "alt_serde")] -#[serde(rename_all = "camelCase")] -pub struct Chunk { - log: Log, - cid: String, - ack: Option, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(crate = "alt_serde")] -#[serde(rename_all = "camelCase")] -pub struct Ack { - user_timestamp: u64, - nonce: String, - signature: Option, - aggregated: u64, - user_public_key: String, - bytes_received: u64, - requested_chunk_cids: Vec, - node_public_key: String, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(crate = "alt_serde")] -#[serde(rename_all = "camelCase")] -pub struct Log { - #[serde(rename = "type")] - log_type: u64, - signature: Option, - aggregated: u64, - user_public_key: String, - era: u64, - bucket_id: u128, - user_address: String, - bytes_sent: u64, - timestamp: u64, - node_public_key: String, - session_id: String, -} - -#[derive(Serialize, Deserialize, Debug, Clone)] -#[serde(crate = "alt_serde")] -#[serde(rename_all = "camelCase")] -pub struct FileInfo { - #[serde(rename = "chunkCids", skip_deserializing)] - chunk_cids: Option>, - - #[serde(rename = "requestedChunkCids")] - requested_chunk_cids: Vec, -} - -type EdgeId = String; -type ValidatorId = String; - -#[derive(Debug, Deserialize, Serialize)] -#[serde(crate = "alt_serde")] -pub(crate) struct EdgesToResults(BTreeMap>); - -#[derive(Debug, Deserialize, Serialize)] -#[serde(crate = "alt_serde")] -pub(crate) struct Wrapper { - #[serde(rename = "HGET")] - decisions: String, -} - -#[derive(Debug, Deserialize, Serialize, Clone)] -#[serde(crate = "alt_serde")] -pub(crate) struct ValidationResult { - validator_id: ValidatorId, - edge_id: EdgeId, - result: bool, - received: u64, - sent: u64, - era: EraIndex, -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(crate = "alt_serde")] -pub(crate) struct FinalDecision { - result: bool, - edge_id: EdgeId, - era: EraIndex, - received: u64, - sent: u64, - results_logs: Vec, -} - -#[derive(Debug, Deserialize, Serialize)] -#[serde(crate = "alt_serde")] -pub(crate) struct FinalDecisions(BTreeMap); - -#[derive(Clone, Debug, Encode, Decode, scale_info::TypeInfo, PartialEq)] -pub struct BytesReceived { - pub node_public_key: String, - pub era: EraIndex, - pub sum: u32, -} - -fn get_timestamps_with_ack(file_requests: &Requests) -> Vec { - let mut timestamps: Vec = Vec::new(); - - for (_, file_request) in file_requests { - for (_, chunk) in &file_request.chunks { - if let Some(_ack) = &chunk.ack { - timestamps.push(chunk.log.timestamp); - } - } - } - - timestamps.sort(); - - timestamps -} - -pub fn get_acknowledged_bytes_bucket<'a>( - file_requests: &'a Requests, - acknowledged_bytes_by_bucket: &'a mut Vec<(u128, u64)>, -) -> &'a Vec<(u128, u64)> { - let ack_timestamps = get_timestamps_with_ack(file_requests); - - for (_, file_request) in file_requests { - let mut total_bytes_received = 0u64; - let bucket_id = file_request.bucket_id; - for (_, chunk) in &file_request.chunks { - // Only check reads - match chunk.log.log_type.try_into() { - Ok(OpCode::Read) => - if let Some(ack) = &chunk.ack { - total_bytes_received += ack.bytes_received; - } else { - total_bytes_received += get_proved_delivered_bytes(chunk, &ack_timestamps); - }, - _ => (), - } - } - acknowledged_bytes_by_bucket.push((bucket_id, total_bytes_received)); - } - - acknowledged_bytes_by_bucket -} - -pub fn get_served_bytes_sum(file_requests: &Requests) -> (u64, u64) { - let ack_timestamps = get_timestamps_with_ack(file_requests); - let mut total_bytes_received = 0u64; - let mut total_bytes_sent = 0u64; - - for (_, file_request) in file_requests { - for (_, chunk) in &file_request.chunks { - match chunk.log.log_type.try_into() { - Ok(OpCode::Read) => { - total_bytes_sent += chunk.log.bytes_sent; - - if let Some(ack) = &chunk.ack { - total_bytes_received += ack.bytes_received; - } else { - total_bytes_received += get_proved_delivered_bytes(chunk, &ack_timestamps); - } - }, - _ => (), - } - } - } - - (total_bytes_sent, total_bytes_received) -} - -fn get_proved_delivered_bytes(chunk: &Chunk, ack_timestamps: &Vec) -> u64 { - let log_timestamp = chunk.log.timestamp; - let neighbors = get_closer_neighbors(log_timestamp, &ack_timestamps); - let is_proved = - is_lies_within_threshold(log_timestamp, neighbors, FAILED_CONTENT_CONSUMER_THRESHOLD); - - if is_proved { - return chunk.log.bytes_sent - } else { - 0 - } -} - -fn get_closer_neighbors( - timestamp: TimestampInSec, - timestamps: &Vec, -) -> (TimestampInSec, TimestampInSec) { - let mut before = 0; - let mut after = TimestampInSec::MAX; - for ts in timestamps { - if ts < ×tamp { - before = before.max(*ts); - } else if ts > ×tamp { - after = after.min(*ts); - } - } - - (before, after) -} - -fn is_lies_within_threshold( - timestamp: TimestampInSec, - borders: (TimestampInSec, TimestampInSec), - threshold: TimestampInSec, -) -> bool { - let left_distance = timestamp - borders.0; - let right_distance = borders.1 - timestamp; - - if left_distance < threshold || right_distance < threshold { - return true - } - - false -} - -pub(crate) fn fetch_cdn_node_aggregates_request(url: &String) -> Vec { - log::debug!("fetch_file_request | url: {:?}", url); - let response: FileRequestWrapper = http_get_json(&url).unwrap(); - log::debug!("response.json: {:?}", response.json); - let map: Vec = serde_json::from_str(response.json.as_str()).unwrap(); - // log::debug!("response.json: {:?}", response.json); - - map -} - -pub(crate) fn fetch_file_request(url: &String) -> FileRequest { - log::debug!("fetch_file_request | url: {:?}", url); - let response: FileRequestWrapper = http_get_json(&url).unwrap(); - log::debug!("response.json: {:?}", response.json); - - let map: FileRequest = serde_json::from_str(response.json.as_str()).unwrap(); - - map -} - -pub(crate) fn http_get_json(url: &str) -> crate::ResultStr { - let body = http_get_request(url).map_err(|err| { - log::error!("[DAC Validator] Error while getting {}: {:?}", url, err); - "HTTP GET error" - })?; - - let parsed = serde_json::from_slice(&body).map_err(|err| { - log::warn!("[DAC Validator] Error while parsing JSON from {}: {:?}", url, err); - "HTTP JSON parse error" - }); - - parsed -} - -fn http_get_request(http_url: &str) -> Result, http::Error> { - // log::debug!("[DAC Validator] Sending request to: {:?}", http_url); - - // Initiate an external HTTP GET request. This is using high-level wrappers from - // `sp_runtime`. - let request = http::Request::get(http_url); - - let deadline = sp_io::offchain::timestamp().add(Duration::from_millis(HTTP_TIMEOUT_MS)); - - let pending = request.deadline(deadline).send().map_err(|_| http::Error::IoError)?; - - let response = pending.try_wait(deadline).map_err(|_| http::Error::DeadlineReached)??; - - if response.code != 200 { - log::warn!("[DAC Validator] http_get_request unexpected status code: {}", response.code); - return Err(http::Error::Unknown) - } - - // Next we fully read the response body and collect it to a vector of bytes. - Ok(response.body().collect::>()) -} - -pub(crate) fn get_final_decision(decisions: Vec) -> ValidationDecision { - let common_decisions = find_largest_group(decisions).unwrap(); - let decision_example = common_decisions.get(0).unwrap(); - - let serialized_decisions = serde_json::to_string(&common_decisions).unwrap(); - - let final_decision = ValidationDecision { - edge: decision_example.edge.clone(), - result: decision_example.result, - payload: utils::hash(&serialized_decisions), - totals: DacTotalAggregates { - received: decision_example.totals.received, - sent: decision_example.totals.sent, - failed_by_client: 0, - failure_rate: 0, - }, - }; - - final_decision -} - -fn find_largest_group(decisions: Vec) -> Option> { - let mut groups: Vec> = Vec::new(); - let half = decisions.len() / 2; - - for decision in decisions { - let mut found_group = false; - - for group in &mut groups { - if group.iter().all(|x| { - x.result == decision.result && - x.totals.received == decision.totals.received && - x.totals.sent == decision.totals.sent - }) { - group.push(decision.clone()); - found_group = true; - break - } - } - - if !found_group { - groups.push(vec![decision]); - } - } - - let largest_group = groups.into_iter().max_by_key(|group| group.len()).unwrap_or(Vec::new()); - - if largest_group.len() > half { - Some(largest_group) - } else { - None - } -} diff --git a/pallets/ddc-validator/src/lib.rs b/pallets/ddc-validator/src/lib.rs deleted file mode 100644 index fc6d1109c..000000000 --- a/pallets/ddc-validator/src/lib.rs +++ /dev/null @@ -1,1015 +0,0 @@ -//! # DDC Validator pallet -//! -//! The DDC Validator pallet defines storage item to store validation results and implements OCW -//! (off-chain worker) to produce these results using the data from Data Activity Capture (DAC). -//! -//! - [`Config`] -//! - [`Call`] -//! - [`Pallet`] -//! - [`Hooks`] -//! -//! ## Notes -//! -//! - Era definition in this pallet is different than in the `pallet-staking`. Check DAC -//! documentation for `era` definition used in this pallet. - -#![cfg_attr(not(feature = "std"), no_std)] - -mod dac; -mod payments; -mod shm; -mod utils; -mod validation; - -#[cfg(test)] -mod mock; - -#[cfg(test)] -mod tests; - -pub use alloc::{format, string::String}; -pub use alt_serde::{de::DeserializeOwned, Deserialize, Serialize}; -pub use codec::{Decode, Encode, HasCompact, MaxEncodedLen}; -pub use core::fmt::Debug; -pub use frame_support::{ - decl_event, decl_module, decl_storage, defensive, - dispatch::DispatchResult, - pallet_prelude::*, - parameter_types, storage, - traits::{Currency, Randomness, UnixTime}, - weights::Weight, - BoundedVec, RuntimeDebug, -}; -pub use frame_system::{ - ensure_signed, - offchain::{AppCrypto, CreateSignedTransaction, SendSignedTransaction, Signer, SigningTypes}, - pallet_prelude::*, -}; -pub use lite_json::json::JsonValue; -pub use pallet::*; -pub use pallet_ddc_customers::{self as ddc_customers, BucketsDetails}; -pub use pallet_ddc_staking::{self as ddc_staking}; -pub use pallet_session as session; -pub use pallet_staking::{self as staking}; -pub use scale_info::TypeInfo; -pub use serde_json::Value; -pub use sp_core::crypto::{AccountId32, KeyTypeId, UncheckedFrom}; -pub use sp_io::{crypto::sr25519_public_keys, offchain_index}; -pub use sp_runtime::offchain::{ - http, storage::StorageValueRef, storage_lock, storage_lock::StorageLock, Duration, Timestamp, -}; -pub use sp_staking::EraIndex; -pub use sp_std::{collections::btree_map::BTreeMap, prelude::*}; - -extern crate alloc; - -/// The balance type of this pallet. -type BalanceOf = <::Currency as Currency< - ::AccountId, ->>::Balance; - -type ResultStr = Result; - -/// Offchain local storage key that holds the last era in which the validator completed its -/// assignment. -const LAST_VALIDATED_ERA_KEY: &[u8; 40] = b"pallet-ddc-validator::last_validated_era"; -/// Offchain local storage that holds the validation lock -const VALIDATION_LOCK: &[u8; 37] = b"pallet-ddc-validator::validation_lock"; - -/// Local storage key that holds the flag to enable DDC validation. Set it to true (0x01) to enable -/// DDC validation, set it to false (0x00) or delete the key to disable it. -const ENABLE_DDC_VALIDATION_KEY: &[u8; 21] = b"enable-ddc-validation"; - -pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"dacv"); - -/// Webdis in experimental cluster connected to Redis in dev. -pub const DEFAULT_DATA_PROVIDER_URL: &str = "http://webdis:7379"; -// pub const DEFAULT_DATA_PROVIDER_URL: &str = "http://161.35.140.182:7379"; -pub const DATA_PROVIDER_URL_KEY: &[u8; 7] = b"dac-url"; -pub const QUORUM_SIZE: usize = 1; - -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] -pub enum OpCode { - Read = 1, - Write = 2, - Search = 3, -} - -impl TryFrom for OpCode { - type Error = &'static str; - - fn try_from(v: u64) -> Result { - match v { - x if x == OpCode::Write as u64 => Ok(OpCode::Write), - x if x == OpCode::Read as u64 => Ok(OpCode::Read), - x if x == OpCode::Search as u64 => Ok(OpCode::Search), - _ => Err("Invalid value to for log type"), - } - } -} - -#[derive(Debug)] -pub enum AssignmentError { - NoValidators, - NotEnoughValidators { requested_quorum: usize, available_validators: usize }, - DefensiveEmptyQuorumsCycle, -} - -/// Aggregated values from DAC that describe CDN node's activity during a certain era. -#[derive( - PartialEq, - Eq, - Clone, - Encode, - Decode, - RuntimeDebug, - TypeInfo, - MaxEncodedLen, - Serialize, - Deserialize, -)] -#[serde(crate = "alt_serde")] -pub struct DacTotalAggregates { - /// Total bytes received by the client. - pub received: u64, - /// Total bytes sent by the CDN node. - pub sent: u64, - /// Total bytes sent by the CDN node to the client which interrupts the connection. - pub failed_by_client: u64, - /// ToDo: explain. - pub failure_rate: u64, -} - -/// Final DAC Validation decision. -#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, Serialize, Deserialize)] -#[serde(crate = "alt_serde")] -pub struct ValidationDecision { - /// CDN node public key. - pub edge: String, - /// Validation result. - pub result: bool, - /// A hash of the data used to produce validation result. - pub payload: [u8; 32], - /// Values aggregated from the payload. - pub totals: DacTotalAggregates, -} - -pub mod crypto { - use super::KEY_TYPE; - use frame_system::offchain::AppCrypto; - use sp_core::sr25519::Signature as Sr25519Signature; - use sp_runtime::{ - app_crypto::{app_crypto, sr25519}, - traits::Verify, - }; - app_crypto!(sr25519, KEY_TYPE); - - use sp_runtime::{MultiSignature, MultiSigner}; - - pub struct TestAuthId; - - impl AppCrypto<::Signer, Sr25519Signature> for TestAuthId { - type RuntimeAppPublic = Public; - type GenericSignature = sp_core::sr25519::Signature; - type GenericPublic = sp_core::sr25519::Public; - } - - impl AppCrypto for TestAuthId { - type RuntimeAppPublic = Public; - type GenericSignature = sp_core::sr25519::Signature; - type GenericPublic = sp_core::sr25519::Public; - } -} - -#[frame_support::pallet] -pub mod pallet { - use super::*; - - #[pallet::pallet] - #[pallet::without_storage_info] - #[pallet::generate_store(pub(super) trait Store)] - pub struct Pallet(_); - - #[pallet::config] - pub trait Config: - frame_system::Config - + pallet_contracts::Config - + pallet_session::Config::AccountId> - + pallet_staking::Config - + ddc_customers::Config - + ddc_staking::Config - + CreateSignedTransaction> - where - ::AccountId: AsRef<[u8]> + UncheckedFrom, - as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, - { - /// The overarching event type. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - - /// Something that provides randomness in the runtime. Required by the tasks assignment - /// procedure. - type Randomness: Randomness; - - /// A dispatchable call. - type RuntimeCall: From>; - - type AuthorityId: AppCrypto; - - /// Number of validators expected to produce an individual validation decision to form a - /// consensus. Tasks assignment procedure use this value to determine the number of - /// validators are getting the same task. Must be an odd number. - #[pallet::constant] - type DdcValidatorsQuorumSize: Get; - - type ValidatorsMax: Get; - - /// Proof-of-Delivery parameter specifies an allowed deviation between bytes sent and bytes - /// received. The deviation is expressed as a percentage. For example, if the value is 10, - /// then the difference between bytes sent and bytes received is allowed to be up to 10%. - /// The value must be in range [0, 100]. - #[pallet::constant] - type ValidationThreshold: Get; - } - - /// The map from the era and validator stash key to the list of CDN nodes to validate. - #[pallet::storage] - #[pallet::getter(fn assignments)] - pub(super) type Assignments = - StorageDoubleMap<_, Twox64Concat, EraIndex, Identity, T::AccountId, Vec>; - - /// Map to from era and account ID to bool indicateing that a particular content owner was - /// charged for the era - #[pallet::storage] - #[pallet::getter(fn content_owners_charged)] - pub(super) type EraContentOwnersCharged = - StorageDoubleMap<_, Twox64Concat, EraIndex, Identity, T::AccountId, bool, ValueQuery>; - - /// A signal to start a process on all the validators. - #[pallet::storage] - #[pallet::getter(fn signal)] - pub(super) type Signal = StorageValue<_, bool>; - - /// The map from the era and CDN participant stash key to the validation decision related. - #[pallet::storage] - #[pallet::getter(fn validation_decisions)] - pub type ValidationDecisions = - StorageDoubleMap<_, Twox64Concat, EraIndex, Identity, T::AccountId, ValidationDecision>; - - // Map to check if validation decision was performed for the era - #[pallet::storage] - #[pallet::getter(fn validation_decision_set_for_node)] - pub(super) type ValidationDecisionSetForNode = - StorageDoubleMap<_, Twox64Concat, EraIndex, Identity, T::AccountId, bool, ValueQuery>; - - // Map to check if reward points were set for the era - #[pallet::storage] - #[pallet::getter(fn reward_points_set_for_node)] - pub(super) type RewardPointsSetForNode = - StorageDoubleMap<_, Twox64Concat, EraIndex, Identity, T::AccountId, bool, ValueQuery>; - - /// The last era for which the tasks assignment produced. - #[pallet::storage] - #[pallet::getter(fn last_managed_era)] - pub type LastManagedEra = StorageValue<_, EraIndex>; - - /// The mapping of ddc validator keys to validator stash keys - /// - /// Keys registered by validators are mapped to validator stash accounts. - /// The mapping is formed in the way that facilitates fast checking that storage contains key. - /// Similarly the validator stash is checked if he is still in the list of validators. - #[pallet::storage] - #[pallet::getter(fn get_stash_for_ddc_validator)] - pub type DDCValidatorToStashKeys = - StorageMap<_, Identity, T::AccountId, T::AccountId>; - - #[pallet::error] - pub enum Error { - /// Caller is not controller of validator node - NotController, - /// Checked stash is not an active validator - NotValidatorStash, - /// OCW key has not been registered by validator - DDCValidatorKeyNotRegistered, - /// Attempt to charge content owners twice - ContentOwnersDoubleSpend, - /// Validation decision has been already set for CDN node for some era - ValidationDecisionAlreadySet, - /// Node is not participating in the network - NodeNotActive, - /// Pricing has not been set by sudo - PricingNotSet, - /// Current era not set during runtime - DDCEraNotSet, - } - - #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] - pub enum Event - where - ::AccountId: AsRef<[u8]> + UncheckedFrom, - as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, - { - // Validator submits decision for an era - ValidationDecision(EraIndex, T::AccountId, ValidationDecision), - // Set era reward points - EraRewardPoints(EraIndex, Vec<(T::AccountId, u64)>), - } - - #[pallet::hooks] - impl Hooks> for Pallet - where - ::AccountId: AsRef<[u8]> + UncheckedFrom, - as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, - { - fn on_initialize(block_number: T::BlockNumber) -> Weight { - if block_number <= 1u32.into() { - return Weight::from_ref_time(0) - } - - Signal::::set(Some(false)); - - let current_ddc_era = match ddc_staking::pallet::Pallet::::current_era() { - Some(era) => era, - None => { - log::debug!("DDC era not set."); - return Weight::from_ref_time(0) - }, - }; - log::debug!("Current DDC era: {:?}.", current_ddc_era); - - // Skip assignment if already exists for current era - match Self::last_managed_era() { - Some(last_managed_era) if current_ddc_era < last_managed_era => - return Weight::from_ref_time(0), - _ => (), - } - - match Self::assign(3usize, current_ddc_era + 1) { - Ok(_) => >::put(current_ddc_era + 1), - Err(e) => log::debug!("DDC validation assignment error: {:?}.", e), - } - - Weight::from_ref_time(0) - } - - fn offchain_worker(_block_number: T::BlockNumber) { - // Skip if not a validator. - if !sp_io::offchain::is_validator() { - return - } - - // Skip if DDC validation is not enabled. - match StorageValueRef::persistent(ENABLE_DDC_VALIDATION_KEY).get::() { - Ok(Some(enabled)) if enabled == true => (), - _ => return, - } - - let mut should_validate_because_new_era = true; - - let mut validation_lock = StorageLock::::new(VALIDATION_LOCK); - - // Skip if the validation is already in progress. - if validation_lock.try_lock().is_err() { - should_validate_because_new_era = false; - } - - let last_validated_era_storage = StorageValueRef::persistent(LAST_VALIDATED_ERA_KEY); - let last_validated_era = match last_validated_era_storage.get::() { - Ok(Some(last_validated_era)) => last_validated_era, - _ => 0, // let's consider an absent or undecodable data as we never did a validation - }; - - let current_ddc_era = match ddc_staking::pallet::Pallet::::current_era() { - Some(era) => era, - None => { - defensive!("DDC era not set"); - return - }, - }; - - // Skip if the validation is already complete for the era. - if current_ddc_era <= last_validated_era { - should_validate_because_new_era = false; - } - - // Validation start forced externally? - let should_validate_because_signal = Signal::::get().unwrap_or(false); - - if !should_validate_because_new_era && !should_validate_because_signal { - return - } - - if let Err(e) = Self::validate_edges() { - log::warn!("🔎 DDC validation failed. {}", e); - return - } - last_validated_era_storage.set(¤t_ddc_era); - log::info!("🔎 DDC validation complete for {} era.", current_ddc_era); - } - } - - #[pallet::call] - impl Pallet - where - ::AccountId: AsRef<[u8]> + UncheckedFrom, - as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, - { - /// Run a process at the same time on all the validators. - #[pallet::weight(10_000)] - pub fn send_signal(origin: OriginFor) -> DispatchResult { - ensure_signed(origin)?; - - Signal::::set(Some(true)); - - Ok(()) - } - - /// Set validation decision for a given CDN node in an era. - /// - /// Only registered validator keys can call this exstrinsic. - /// Validation decision can be set only once per era per CDN node. - /// CDN node should be active. - #[pallet::weight(10_000)] - pub fn set_validation_decision( - origin: OriginFor, - era: EraIndex, - cdn_node: T::AccountId, - validation_decision: ValidationDecision, - ) -> DispatchResult { - let ddc_valitor_key = ensure_signed(origin)?; - - ensure!( - DDCValidatorToStashKeys::::contains_key(&ddc_valitor_key), - Error::::DDCValidatorKeyNotRegistered - ); - - ensure!( - staking::Validators::::contains_key( - Self::get_stash_for_ddc_validator(&ddc_valitor_key).unwrap() - ), - Error::::NotValidatorStash - ); - - ensure!( - !Self::validation_decision_set_for_node(era, &cdn_node), - Error::::ValidationDecisionAlreadySet - ); - - ensure!( - >::contains_key(&cdn_node), - Error::::NodeNotActive - ); - - ValidationDecisions::::insert(era, cdn_node.clone(), validation_decision.clone()); - - ValidationDecisionSetForNode::::insert(era, cdn_node.clone(), true); - - Self::deposit_event(Event::::ValidationDecision(era, cdn_node, validation_decision)); - - Ok(()) - } - - /// Set reward points for CDN participants at the given era. - /// - /// Only registered validator keys can call this exstrinsic. - /// Reward points can be set only once per era per CDN node. - /// CDN node should be active. - /// - /// `stakers_points` is a vector of (stash account ID, reward points) pairs. The rewards - /// distribution will be based on total reward points, with each CDN participant receiving a - /// proportionate reward based on their individual reward points. - #[pallet::weight(100_000)] - pub fn set_era_reward_points( - origin: OriginFor, - era: EraIndex, - stakers_points: Vec<(T::AccountId, u64)>, - ) -> DispatchResult { - let ddc_valitor_key = ensure_signed(origin)?; - - ensure!( - DDCValidatorToStashKeys::::contains_key(&ddc_valitor_key), - Error::::DDCValidatorKeyNotRegistered - ); - - ensure!( - staking::Validators::::contains_key( - Self::get_stash_for_ddc_validator(&ddc_valitor_key).unwrap() - ), - Error::::NotValidatorStash - ); - - let mut rewards_counter = 0; - - >::mutate(era, |era_rewards| { - for (staker, points) in stakers_points.clone().into_iter() { - if !Self::reward_points_set_for_node(era, &staker) { - // ToDo deal with edge case when node is chilling - if >::contains_key(&staker) { - *era_rewards.individual.entry(staker.clone()).or_default() += points; - era_rewards.total += points; - >::mutate( - &staker, - |current_reward_points| { - let rewards: ddc_staking::EraRewardPointsPerNode = - ddc_staking::EraRewardPointsPerNode { era, points }; - current_reward_points.push(rewards); - }, - ); - RewardPointsSetForNode::::insert(era, staker, true); - rewards_counter += 1; - } - } - } - }); - - if rewards_counter > 0 { - Self::deposit_event(Event::::EraRewardPoints(era, stakers_points)); - } - - Ok(()) - } - - /// Exstrinsic deducts balances of content owners - /// - /// Only registered validator keys can call this exstrinsic. - /// Reward points can be set only once per era per validator. - #[pallet::weight(100_000)] - pub fn charge_payments_content_owners( - origin: OriginFor, - paying_accounts: Vec>>, /* ToDo check if - * bounded vec - * should be used */ - ) -> DispatchResult { - let ddc_valitor_key = ensure_signed(origin)?; - log::debug!("validator is {:?}", &ddc_valitor_key); - - let current_era = - ddc_staking::pallet::Pallet::::current_era().ok_or(Error::::DDCEraNotSet)?; - - ensure!( - DDCValidatorToStashKeys::::contains_key(&ddc_valitor_key), - Error::::DDCValidatorKeyNotRegistered - ); - - ensure!( - staking::Validators::::contains_key( - Self::get_stash_for_ddc_validator(&ddc_valitor_key).unwrap() - ), - Error::::NotValidatorStash - ); - - ensure!( - !Self::content_owners_charged(current_era, &ddc_valitor_key), - Error::::ContentOwnersDoubleSpend - ); - - let pricing: u128 = - >::pricing().ok_or(Error::::PricingNotSet)?; - EraContentOwnersCharged::::insert(current_era, ddc_valitor_key, true); - - >::charge_content_owners(paying_accounts, pricing) - } - - /// Exstrinsic registers a ddc validator key for future use - /// - /// Only controller of validator can call this exstrinsic - /// Validator has to be in the active set - #[pallet::weight(100_000)] - pub fn set_validator_key( - origin: OriginFor, - ddc_validator_pub: T::AccountId, - ) -> DispatchResult { - let controller = ensure_signed(origin)?; - let ledger = staking::Ledger::::get(&controller).ok_or(Error::::NotController)?; - - ensure!( - staking::Validators::::contains_key(&ledger.stash), - Error::::NotValidatorStash - ); - - DDCValidatorToStashKeys::::insert(ddc_validator_pub, &ledger.stash); - Ok(()) - } - } - - impl Pallet - where - ::AccountId: AsRef<[u8]> + UncheckedFrom, - as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, - { - fn get_data_provider_url() -> String { - let url_ref = sp_io::offchain::local_storage_get( - sp_core::offchain::StorageKind::PERSISTENT, - DATA_PROVIDER_URL_KEY, - ); - - match url_ref { - Some(url) => - String::from_utf8(url).expect("Data provider URL should be valid UTF-8 string"), - None => String::from(DEFAULT_DATA_PROVIDER_URL), - } - } - - fn get_data_url() -> String { - let data_url = Self::get_data_provider_url(); - let json_getter = "/JSON.GET/"; - let url = format!("{}{}", data_url, json_getter); - - url - } - - fn get_signer() -> ResultStr> { - let signer = Signer::<_, _>::any_account(); - if !signer.can_sign() { - return Err("[DAC Validator] No local accounts available. Consider adding one via `author_insertKey` RPC."); - } - - Ok(signer) - } - - fn is_valid(bytes_sent: u64, bytes_received: u64) -> bool { - if bytes_sent == bytes_received { - return true - } - - let percentage_difference = 1f32 - (bytes_received as f32 / bytes_sent as f32); - - return if percentage_difference >= 0.0 && - (T::ValidationThreshold::get() as f32 - percentage_difference) > 0.0 - { - true - } else { - false - } - } - - /// Shuffle the `list` swapping it's random elements `list.len()` times. - fn shuffle(mut list: Vec) -> Vec { - let len = list.len(); - for i in 1..len { - let random_index = Self::choose(len as u32).unwrap() as usize; - list.swap(i, random_index) - } - - list - } - - /// Split the `list` to several chunks `segment_len` length each. - /// - /// The very last chunk will be shorter than `segment_len` if `list.len()` is not divisible - /// by `segment_len`. - fn split(list: Vec, segment_len: usize) -> Vec> { - let mut result: Vec> = Vec::new(); - - if segment_len == 0 { - return result - } - - for i in (0..list.len()).step_by(segment_len) { - let end = usize::min(i + segment_len, list.len()); - let chunk = list[i..end].to_vec(); - result.push(chunk); - } - - result - } - - fn assign(quorum_size: usize, era: EraIndex) -> Result<(), AssignmentError> { - let validators: Vec = DDCValidatorToStashKeys::::iter_keys().collect(); - log::debug!("Current validators: {:?}.", validators); - - if validators.len() == 0 { - return Err(AssignmentError::NoValidators) - } - - if validators.len() < quorum_size { - return Err(AssignmentError::NotEnoughValidators { - requested_quorum: quorum_size, - available_validators: validators.len(), - }) - } - - let edges: Vec = >::iter_keys().collect(); - log::debug!("Current edges: {:?}.", edges); - - if edges.len() == 0 { - return Ok(()) - } - - let shuffled_validators = Self::shuffle(validators); - let shuffled_edges = Self::shuffle(edges); - - let validators_keys: Vec = shuffled_validators - .iter() - .map(|v| utils::account_to_string::(v.clone())) - .collect(); - - // Create several groups of validators `quorum_size` length each. - let quorums = Self::split(validators_keys, quorum_size); - - // Write an assignment to each validator in each quorum. The difference between the - // number of edges assigned to each validator is not higher then 1. If the number of - // edges is less then the number of quorums, some quorums will not have any edges - // assigned. - let mut quorums_cycle = quorums.iter().cycle(); - for edge in shuffled_edges { - let Some(quorum_validators) = quorums_cycle.next() else { - return Err(AssignmentError::DefensiveEmptyQuorumsCycle); - }; - quorum_validators.iter().for_each(|validator| { - Assignments::::append( - era, - utils::string_to_account::(validator.clone()), - edge.clone(), - ); - }); - } - - return Ok(()) - } - - /// Randomly choose a number in range `[0, total)`. - /// Returns `None` for zero input. - /// Modification of `choose_ticket` from `pallet-lottery` version `4.0.0-dev`. - fn choose(total: u32) -> Option { - if total == 0 { - return None - } - let mut random_number = Self::generate_random_number(0); - - // Best effort attempt to remove bias from modulus operator. - for i in 1..128 { - if random_number < u32::MAX - u32::MAX % total { - break - } - - random_number = Self::generate_random_number(i); - } - - Some(random_number % total) - } - - /// Generate a random number from a given seed. - /// Note that there is potential bias introduced by using modulus operator. - /// You should call this function with different seed values until the random - /// number lies within `u32::MAX - u32::MAX % n`. - /// Modification of `generate_random_number` from `pallet-lottery` version `4.0.0-dev`. - fn generate_random_number(seed: u32) -> u32 { - let (random_seed, _) = - ::Randomness::random(&(b"ddc-validator", seed).encode()); - let random_number = ::decode(&mut random_seed.as_ref()) - .expect("secure hashes should always be bigger than u32; qed"); - - random_number - } - - fn find_validators_from_quorum(validator_id: &T::AccountId, era: &EraIndex) -> Vec { - let validator_edges = Self::assignments(era, &validator_id).unwrap(); - let mut quorum_members: Vec = Vec::new(); - - >::iter_prefix(era).for_each(|(candidate_id, edges)| { - if validator_edges == edges { - let candidate_id_str = utils::account_to_string::(candidate_id); - quorum_members.push(candidate_id_str); - } - }); - - quorum_members - } - - fn get_public_key() -> Option { - match sr25519_public_keys(KEY_TYPE).first() { - Some(pubkey) => Some(T::AccountId::decode(&mut &pubkey.encode()[..]).unwrap()), - None => None, - } - } - - fn validate_edges() -> Result<(), &'static str> { - let current_ddc_era = - ddc_staking::pallet::Pallet::::current_era().ok_or("DDC era not set")?; - let data_url = Self::get_data_url(); - let data_provider_url = Self::get_data_provider_url(); - log::debug!("[DAC Validator] Data provider URL: {:?}", &data_provider_url); - - let validator = match Self::get_public_key() { - Some(key) => key, - None => return Err("No validator public key found."), - }; - - log::debug!("validator: {:?}", validator); - - let assigned_edges = match Self::assignments(current_ddc_era - 1, validator.clone()) { - Some(edges) => edges, - None => return Err("No assignments for the previous era."), - }; - - log::debug!("assigned_edges: {:?}", assigned_edges); - - // Calculate CDN nodes reward points from validation decision aggregates - let mut cdn_nodes_reward_points: Vec<(T::AccountId, u64)> = vec![]; - - for assigned_edge in assigned_edges.iter() { - log::debug!("assigned edge: {:?}", assigned_edge); - - let Some((node, _)) = >::iter().find(|(_, s)| assigned_edge == s) else { - log::debug!("no known node for: {:?}", assigned_edge); - continue; - }; - - log::debug!("assigned edge node: {:?}", assigned_edge); - - // form url for each node - let edge_url = format!( - "{}{}{}/$.{}", - data_url, - "ddc:dac:aggregation:nodes:", - current_ddc_era - 1, - array_bytes::bytes2hex("", node.encode()), - ); - log::debug!("edge url: {:?}", edge_url); - - let node_aggregates = dac::fetch_cdn_node_aggregates_request(&edge_url); - log::debug!("node aggregates: {:?}", node_aggregates); - - // No data for node - if node_aggregates.len() == 0 { - continue - } - - let request_ids = &node_aggregates[0].request_ids; - log::debug!("request_ids: {:?}", request_ids); - - // Store bucket payments - let payments_per_bucket = &mut Vec::new(); - let requests = &mut dac::Requests::new(); - for request_id in request_ids.iter() { - let request_id_url = - format!("{}{}{}", data_url, "ddc:dac:data:file:", request_id.clone()); - let file_request = dac::fetch_file_request(&request_id_url); - requests.insert(file_request.file_request_id.clone(), file_request.clone()); - } - dac::get_acknowledged_bytes_bucket(&requests, payments_per_bucket); - let (bytes_sent, bytes_received) = dac::get_served_bytes_sum(&requests); - let is_valid = Self::is_valid(bytes_sent, bytes_received); - - log::debug!("bytes_sent, bytes_received: {:?}, {:?}", bytes_sent, bytes_received); - - let payload = serde_json::to_string(&requests).unwrap(); - let decision = ValidationDecision { - edge: utils::account_to_string::(assigned_edge.clone()), - result: is_valid, - payload: utils::hash(&payload), - totals: DacTotalAggregates { - received: bytes_received, - sent: bytes_sent, - failed_by_client: 0, - failure_rate: 0, - }, - }; - - log::debug!("decision to be encoded: {:?}", decision); - - let serialized_decision = serde_json::to_string(&decision).unwrap(); - let encoded_decision = - shm::base64_encode(&serialized_decision.as_bytes().to_vec()).unwrap(); - log::debug!("encoded decision: {:?}", encoded_decision); - - let validator_str = utils::account_to_string::(validator.clone()); - let edge_str = utils::account_to_string::(assigned_edge.clone()); - - let encoded_decision_str = encoded_decision.iter().cloned().collect::(); - - let response = shm::share_intermediate_validation_result( - &data_provider_url, - current_ddc_era - 1, - &validator_str, - &edge_str, - is_valid, - &encoded_decision_str, - ); - - if let Err(res) = response.clone() { - log::error!("share_intermediate_validation_result request failed: {:?}", res); - } - - if let Ok(res) = response.clone() { - log::debug!("shm res: {:?}", res.to_string()); - } - - if let Ok(_res) = response { - let edge = utils::account_to_string::(assigned_edge.clone()); - let prev_era = (current_ddc_era - 1) as EraIndex; - let quorum = Self::find_validators_from_quorum(&validator, &prev_era); - let validations_res = shm::get_intermediate_decisions( - &data_provider_url, - &edge_str, - &prev_era, - quorum, - ); - - log::debug!("get_intermediate_decisions result: {:?}", validations_res); - - if validations_res.len() == QUORUM_SIZE { - log::debug!("payments per bucket: {:?}", payments_per_bucket); - - let mut payments: BTreeMap< - u128, - BucketsDetails>, - > = BTreeMap::new(); - for bucket in payments_per_bucket.into_iter() { - let cere_payment = bucket.1 as u32; - if payments.contains_key(&bucket.0) { - payments.entry(bucket.0).and_modify(|bucket_info| { - bucket_info.amount += cere_payment.into() - }); - } else { - let bucket_info = BucketsDetails { - bucket_id: bucket.0, - amount: cere_payment.into(), - }; - payments.insert(bucket.0, bucket_info); - } - } - let mut final_payments = vec![]; - for (_, bucket_info) in payments { - final_payments.push(bucket_info); - } - log::debug!("final payments: {:?}", final_payments); - - // Store CDN node reward points on-chain - let signer: Signer = Signer::<_, _>::any_account(); - if !signer.can_sign() { - log::warn!("No local accounts available to charge payments for CDN. Consider adding one via `author_insertKey` RPC."); - return Err("signing key not set") - } - // ToDo: replace local call by a call from `ddc-staking` pallet - let tx_res: Option<(frame_system::offchain::Account, Result<(), ()>)> = - signer.send_signed_transaction(|_account| { - Call::charge_payments_content_owners { - paying_accounts: final_payments.clone(), - } - }); - - match tx_res { - Some((acc, Ok(()))) => - log::debug!("[{:?}]: submit transaction success.", acc.id), - Some((acc, Err(e))) => log::debug!( - "[{:?}]: submit transaction failure. Reason: {:?}", - acc.id, - e - ), - None => log::debug!("submit transaction failure."), - } - - let final_res = dac::get_final_decision(validations_res); - - let signer = Self::get_signer().unwrap(); - - let tx_res = - signer.send_signed_transaction(|_acct| Call::set_validation_decision { - era: current_ddc_era - 1, - cdn_node: utils::string_to_account::(edge.clone()), - validation_decision: final_res.clone(), - }); - - match tx_res { - Some((acc, Ok(()))) => - log::debug!("[{:?}]: submit transaction success.", acc.id), - Some((acc, Err(e))) => log::debug!( - "[{:?}]: submit transaction failure. Reason: {:?}", - acc.id, - e - ), - None => log::debug!("submit transaction failure."), - } - - cdn_nodes_reward_points.push(( - utils::string_to_account::(final_res.edge), - final_res.totals.sent, - )); - } - } - } - let signer = Self::get_signer().unwrap(); - - // ToDo: replace local call by a call from `ddc-staking` pallet - if cdn_nodes_reward_points.len() > 0 { - let tx_res = - signer.send_signed_transaction(|_account| Call::set_era_reward_points { - era: current_ddc_era - 1, - stakers_points: cdn_nodes_reward_points.clone(), - }); - - match tx_res { - Some((acc, Ok(()))) => - log::debug!("[{:?}]: submit transaction success.", acc.id), - Some((acc, Err(e))) => - log::debug!("[{:?}]: submit transaction failure. Reason: {:?}", acc.id, e), - None => log::debug!("submit transaction failure."), - } - } - - Ok(()) - } - } -} diff --git a/pallets/ddc-validator/src/mock-data/set-1/aggregated-node-data-for-era.json b/pallets/ddc-validator/src/mock-data/set-1/aggregated-node-data-for-era.json deleted file mode 100644 index 37b3242fe..000000000 --- a/pallets/ddc-validator/src/mock-data/set-1/aggregated-node-data-for-era.json +++ /dev/null @@ -1 +0,0 @@ -{"JSON.GET":"[{\"totalBytesSent\":600,\"totalQueries\":0,\"totalReads\":3,\"totalReadsAcked\":3,\"totalQueriesAcked\":0,\"averageResponseTimeMs\":1.8852459016393444,\"totalBytesReceived\":600,\"requestIds\":[\"84640a53-fc1f-4ac5-921c-6695056840bc\",\"d0a55c8b-fcb9-41b5-aa9a-8b40e9c4edf7\",\"80a62530-fd76-40b5-bc53-dd82365e89ce\"],\"totalWritesAcked\":3,\"averageResponseTimeMsSamples\":61,\"totalWrites\":3}]"} \ No newline at end of file diff --git a/pallets/ddc-validator/src/mock-data/set-1/file-request1.json b/pallets/ddc-validator/src/mock-data/set-1/file-request1.json deleted file mode 100644 index 5a29a982b..000000000 --- a/pallets/ddc-validator/src/mock-data/set-1/file-request1.json +++ /dev/null @@ -1 +0,0 @@ -{"JSON.GET":"{\"fileRequestId\":\"84640a53-fc1f-4ac5-921c-6695056840bc\",\"fileInfo\":{\"chunkCids\":[\"bafk2bzaceds3kr47j7imur2krbwhydosbocto73kx3erhmknjelpk6doltcb2\"],\"requestedChunkCids\":[\"bafk2bzaceds3kr47j7imur2krbwhydosbocto73kx3erhmknjelpk6doltcb2\"]},\"bucketId\":5,\"timestamp\":1688473909701,\"chunks\":{\"84640a53-fc1f-4ac5-921c-6695056840bc:bafk2bzaceds3kr47j7imur2krbwhydosbocto73kx3erhmknjelpk6doltcb2\":{\"log\":{\"type\":1,\"signature\":null,\"aggregated\":1,\"userPublicKey\":\"knW4sRsf5iyoE+bP+duWD8KEYiRddtPDQ7Hpx1KLyEM=\",\"era\":3,\"bucketId\":5,\"userAddress\":\"172.18.0.1:49690\",\"bytesSent\":100,\"timestamp\":1688473909701,\"nodePublicKey\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"sessionId\":\"6afL1/kz+7NInOaHjwfUWZuoBwSZ2qX9JDOuSULCENk=\"},\"cid\":\"bafk2bzaceds3kr47j7imur2krbwhydosbocto73kx3erhmknjelpk6doltcb2\",\"ack\":{\"userTimestamp\":1688473909709,\"nonce\":\"Gt7AFrznCPzgI/5q+tynLy2BKUooSGAkUCaGsF6AOMs=\",\"signature\":\"Gll6xIftbtP4JPB6miy3DLKMBDrKz05QSIBNJ3RqYi0Fg1wNJRFoSIqhOJDXDUB4NlrLQdl+HWrYRL20Hsx6iA==\",\"aggregated\":1,\"userPublicKey\":\"knW4sRsf5iyoE+bP+duWD8KEYiRddtPDQ7Hpx1KLyEM=\",\"bytesReceived\":100,\"requestedChunkCids\":[\"bafk2bzaceds3kr47j7imur2krbwhydosbocto73kx3erhmknjelpk6doltcb2\"],\"nodePublicKey\":\"0101010101010101010101010101010101010101010101010101010101010101\"}}},\"userPublicKey\":\"knW4sRsf5iyoE+bP+duWD8KEYiRddtPDQ7Hpx1KLyEM=\"}"} \ No newline at end of file diff --git a/pallets/ddc-validator/src/mock-data/set-1/file-request2.json b/pallets/ddc-validator/src/mock-data/set-1/file-request2.json deleted file mode 100644 index b0e3fdc19..000000000 --- a/pallets/ddc-validator/src/mock-data/set-1/file-request2.json +++ /dev/null @@ -1 +0,0 @@ -{"JSON.GET":"{\"fileRequestId\":\"d0a55c8b-fcb9-41b5-aa9a-8b40e9c4edf7\",\"fileInfo\":{\"chunkCids\":[\"bafk2bzaceds3kr47j7imur2krbwhydosbocto73kx3erhmknjelpk6doltcd2\"],\"requestedChunkCids\":[\"bafk2bzaceds3kr47j7imur2krbwhydosbocto73kx3erhmknjelpk6doltcd2\"]},\"bucketId\":5,\"timestamp\":1688473909723,\"chunks\":{\"d0a55c8b-fcb9-41b5-aa9a-8b40e9c4edf7:bafk2bzaceds3kr47j7imur2krbwhydosbocto73kx3erhmknjelpk6doltcd2\":{\"log\":{\"type\":2,\"signature\":null,\"aggregated\":1,\"userPublicKey\":\"knW4sRsf5iyoE+bP+duWD8KEYiRddtPDQ7Hpx1KLyEM=\",\"era\":3,\"bucketId\":5,\"userAddress\":\"172.18.0.1:49714\",\"bytesSent\":200,\"timestamp\":1688473909723,\"nodePublicKey\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"sessionId\":\"6afL1/kz+7NInOaHjwfUWZuoBwSZ2qX9JDOuSULCENk=\"},\"cid\":\"bafk2bzaceds3kr47j7imur2krbwhydosbocto73kx3erhmknjelpk6doltcd2\",\"ack\":{\"userTimestamp\":1688473909726,\"nonce\":\"2mdA3QVq02ME77vnqGjBNQqTRhM5gHjVAWcroNd5IZA=\",\"signature\":\"6PIWJXyEyHfWZrX6HKFNj3fRm5LbBsBX54zmVZpo+nMqqTV26xaQbEsRTfuhm4k+XGxci3VSuofPWFEpRuOmhg==\",\"aggregated\":1,\"userPublicKey\":\"knW4sRsf5iyoE+bP+duWD8KEYiRddtPDQ7Hpx1KLyEM=\",\"bytesReceived\":200,\"requestedChunkCids\":[\"bafk2bzaceds3kr47j7imur2krbwhydosbocto73kx3erhmknjelpk6doltcd2\"],\"nodePublicKey\":\"0101010101010101010101010101010101010101010101010101010101010101\"}}},\"userPublicKey\":\"knW4sRsf5iyoE+bP+duWD8KEYiRddtPDQ7Hpx1KLyEM=\"}"} \ No newline at end of file diff --git a/pallets/ddc-validator/src/mock-data/set-1/file-request3.json b/pallets/ddc-validator/src/mock-data/set-1/file-request3.json deleted file mode 100644 index 047c057e6..000000000 --- a/pallets/ddc-validator/src/mock-data/set-1/file-request3.json +++ /dev/null @@ -1 +0,0 @@ -{"JSON.GET":"{\"fileRequestId\":\"80a62530-fd76-40b5-bc53-dd82365e89ce\",\"fileInfo\":{\"chunkCids\":[\"bafk2bzaced573lhaxdjlztd5xawkeakiz7j7dayrqbzrx5shjobordrrrlio4\"],\"requestedChunkCids\":[\"bafk2bzaced573lhaxdjlztd5xawkeakiz7j7dayrqbzrx5shjobordrrrlio4\"]},\"bucketId\":5,\"timestamp\":1688473910041,\"chunks\":{\"80a62530-fd76-40b5-bc53-dd82365e89ce:bafk2bzaced573lhaxdjlztd5xawkeakiz7j7dayrqbzrx5shjobordrrrlio4\":{\"log\":{\"type\":1,\"signature\":null,\"aggregated\":1,\"userPublicKey\":\"knW4sRsf5iyoE+bP+duWD8KEYiRddtPDQ7Hpx1KLyEM=\",\"era\":3,\"bucketId\":5,\"userAddress\":\"172.18.0.1:49736\",\"bytesSent\":300,\"timestamp\":1688473910041,\"nodePublicKey\":\"0101010101010101010101010101010101010101010101010101010101010101\",\"sessionId\":\"6afL1/kz+7NInOaHjwfUWZuoBwSZ2qX9JDOuSULCENk=\"},\"cid\":\"bafk2bzaced573lhaxdjlztd5xawkeakiz7j7dayrqbzrx5shjobordrrrlio4\",\"ack\":{\"userTimestamp\":1688473910043,\"nonce\":\"VU1XCPjQxA4y6TnrOAy44QabS7nmmxAU8vyduqoLt9U=\",\"signature\":\"Us7//t0+y00oHhthPSjqphHJYwE1qgPQtBSdy5hZxUInKdQXTBX58VLQekoKMHtptQQggR1gPf9Pyy1enmXziQ==\",\"aggregated\":1,\"userPublicKey\":\"knW4sRsf5iyoE+bP+duWD8KEYiRddtPDQ7Hpx1KLyEM=\",\"bytesReceived\":300,\"requestedChunkCids\":[\"bafk2bzaced573lhaxdjlztd5xawkeakiz7j7dayrqbzrx5shjobordrrrlio4\"],\"nodePublicKey\":\"0101010101010101010101010101010101010101010101010101010101010101\"}}},\"userPublicKey\":\"knW4sRsf5iyoE+bP+duWD8KEYiRddtPDQ7Hpx1KLyEM=\"}"} \ No newline at end of file diff --git a/pallets/ddc-validator/src/mock-data/set-1/final-validation-decision.json b/pallets/ddc-validator/src/mock-data/set-1/final-validation-decision.json deleted file mode 100644 index b63b98c6c..000000000 --- a/pallets/ddc-validator/src/mock-data/set-1/final-validation-decision.json +++ /dev/null @@ -1 +0,0 @@ -{"edge":"0101010101010101010101010101010101010101010101010101010101010101","result":true,"payload":[242,221,51,34,29,242,150,119,6,131,41,15,161,173,121,43,221,22,150,173,180,224,179,58,72,4,96,188,17,164,177,109],"totals":{"received":600,"sent":600,"failed_by_client":0,"failure_rate":0}} \ No newline at end of file diff --git a/pallets/ddc-validator/src/mock-data/set-1/save-validation-decision-result.json b/pallets/ddc-validator/src/mock-data/set-1/save-validation-decision-result.json deleted file mode 100644 index 5fa9734a3..000000000 --- a/pallets/ddc-validator/src/mock-data/set-1/save-validation-decision-result.json +++ /dev/null @@ -1 +0,0 @@ -{"JSON.GET":null} \ No newline at end of file diff --git a/pallets/ddc-validator/src/mock-data/set-1/shared-validation-decisions-for-era.json b/pallets/ddc-validator/src/mock-data/set-1/shared-validation-decisions-for-era.json deleted file mode 100644 index da4aa921a..000000000 --- a/pallets/ddc-validator/src/mock-data/set-1/shared-validation-decisions-for-era.json +++ /dev/null @@ -1 +0,0 @@ -{"JSON.GET":"{\"0101010101010101010101010101010101010101010101010101010101010101\":{\"d2bf4b844dfefd6772a8843e669f943408966a977e3ae2af1dd78e0f55f4df67\":{\"result\":true,\"data\":\"eyJlZGdlIjoiMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMSIsInJlc3VsdCI6dHJ1ZSwicGF5bG9hZCI6WzI0MiwgMjIxLCA1MSwgMzQsIDI5LCAyNDIsIDE1MCwgMTE5LCA2LCAxMzEsIDQxLCAxNSwgMTYxLCAxNzMsIDEyMSwgNDMsIDIyMSwgMjIsIDE1MCwgMTczLCAxODAsIDIyNCwgMTc5LCA1OCwgNzIsIDQsIDk2LCAxODgsIDE3LCAxNjQsIDE3NywgMTA5XSwidG90YWxzIjp7InJlY2VpdmVkIjo2MDAsInNlbnQiOjYwMCwiZmFpbGVkX2J5X2NsaWVudCI6MCwiZmFpbHVyZV9yYXRlIjowfX0=\"}},\"1c4a1b081af8dd09096ebb6e7ad61dd549ac2931cdb2b1216589094ad71ca90b\":{\"d2bf4b844dfefd6772a8843e669f943408966a977e3ae2af1dd78e0f55f4df67\":{\"result\":false,\"data\":\"eyJlZGdlIjoiMWM0YTFiMDgxYWY4ZGQwOTA5NmViYjZlN2FkNjFkZDU0OWFjMjkzMWNkYjJiMTIxNjU4OTA5NGFkNzFjYTkwYiIsInJlc3VsdCI6ZmFsc2UsInBheWxvYWQiOlsxMDQsMjM4LDczLDczLDIwNCwxNzIsMjU0LDE4MSw3NywxMTYsMTM2LDE4OSwyNDYsOTAsMTY0LDE1NCwxNjcsMywxNTUsMjUzLDgwLDMzLDI1MSwxNCw3OCwyMzYsMTY3LDEzNCwxNjEsNjQsMjIyLDE4MV0sInRvdGFscyI6eyJyZWNlaXZlZCI6OTAwLCJzZW50Ijo1NDQsImZhaWxlZF9ieV9jbGllbnQiOjAsImZhaWx1cmVfcmF0ZSI6MH19\"}}}"} \ No newline at end of file diff --git a/pallets/ddc-validator/src/mock-data/set-1/validation-decision.json b/pallets/ddc-validator/src/mock-data/set-1/validation-decision.json deleted file mode 100644 index de8eec3a7..000000000 --- a/pallets/ddc-validator/src/mock-data/set-1/validation-decision.json +++ /dev/null @@ -1 +0,0 @@ -{"edge":"0101010101010101010101010101010101010101010101010101010101010101","result":true,"payload":[56, 47, 100, 81, 135, 215, 168, 111, 55, 82, 203, 118, 238, 69, 174, 209, 232, 241, 187, 128, 231, 237, 139, 193, 162, 162, 91, 11, 169, 209, 27, 55],"totals":{"received":400,"sent":400,"failed_by_client":0,"failure_rate":0}} \ No newline at end of file diff --git a/pallets/ddc-validator/src/mock.rs b/pallets/ddc-validator/src/mock.rs deleted file mode 100644 index 2d9568768..000000000 --- a/pallets/ddc-validator/src/mock.rs +++ /dev/null @@ -1,415 +0,0 @@ -use crate::{self as pallet_ddc_validator, *}; -use ddc_primitives::{CDNNodePubKey, ClusterId, NodePubKey}; -use frame_election_provider_support::{onchain, SequentialPhragmen}; -use frame_support::{ - parameter_types, - traits::{Everything, Nothing, U128CurrencyToVote}, - weights::Weight, - PalletId, -}; -use frame_system::offchain::SendTransactionTypes; -use pallet_contracts as contracts; -use pallet_session::ShouldEndSession; -use sp_core::H256; -use sp_io::TestExternalities; -use sp_runtime::{ - curve::PiecewiseLinear, - generic, impl_opaque_keys, - testing::{TestXt, UintAuthorityId}, - traits::{ - BlakeTwo256, Convert, Extrinsic as ExtrinsicT, IdentifyAccount, IdentityLookup, Verify, - }, - MultiSignature, Perbill, -}; -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; -type Block = frame_system::mocking::MockBlock; -type Balance = u128; -pub type Signature = MultiSignature; -pub type AccountId = <::Signer as IdentifyAccount>::AccountId; -pub type BlockNumber = u32; -pub type Moment = u64; - -frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, - { - System: frame_system, - Balances: pallet_balances, - Contracts: contracts, - Timestamp: pallet_timestamp, - Session: pallet_session, - Staking: pallet_staking, - DdcAccounts: pallet_ddc_customers, - DdcStaking: pallet_ddc_staking, - RandomnessCollectiveFlip: pallet_randomness_collective_flip, - DdcValidator: pallet_ddc_validator, - DdcClusters: pallet_ddc_clusters, - DdcNodes: pallet_ddc_nodes, - } -); - -parameter_types! { - pub const BlockHashCount: BlockNumber = 250; - pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); - pub const MaximumBlockLength: u32 = 2 * 1024; - pub const AvailableBlockRatio: Perbill = Perbill::one(); -} - -impl frame_system::Config for Test { - type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); - type RuntimeOrigin = RuntimeOrigin; - type Index = u64; - type BlockNumber = BlockNumber; - type Hash = H256; - type RuntimeCall = RuntimeCall; - type Hashing = BlakeTwo256; - type AccountId = AccountId; - // u64; // sp_core::sr25519::Public; - type Lookup = IdentityLookup; - type Header = generic::Header; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type DbWeight = (); - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); - type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; -} - -parameter_types! { - pub const SignedClaimHandicap: BlockNumber = 2; - pub const TombstoneDeposit: Balance = 16; - pub const StorageSizeOffset: u32 = 8; - pub const RentByteFee: Balance = 4; - pub const RentDepositOffset: Balance = 10_000; - pub const SurchargeReward: Balance = 150; - pub const MaxDepth: u32 = 100; - pub const MaxValueSize: u32 = 16_384; - pub Schedule: pallet_contracts::Schedule = Default::default(); -} - -pub struct TestWeightToFee; -impl Convert for TestWeightToFee { - fn convert(weight: u64) -> u128 { - weight as u128 - } -} - -impl contracts::Config for Test { - type AddressGenerator = pallet_contracts::DefaultAddressGenerator; - type RuntimeCall = RuntimeCall; - type CallFilter = Nothing; - type CallStack = [pallet_contracts::Frame; 31]; - type ChainExtension = (); - type ContractAccessWeight = (); - type Currency = Balances; - type DeletionQueueDepth = (); - type DeletionWeightLimit = (); - type DepositPerByte = DepositPerByte; - type DepositPerItem = DepositPerItem; - type RuntimeEvent = RuntimeEvent; - type MaxCodeLen = ConstU32<{ 128 * 1024 }>; - type MaxStorageKeyLen = ConstU32<128>; - type Randomness = RandomnessCollectiveFlip; - type Schedule = Schedule; - type Time = Timestamp; - type WeightInfo = (); - type WeightPrice = (); -} - -parameter_types! { - pub const TransactionByteFee: u64 = 0; - pub const DepositPerItem: Balance = 0; - pub const DepositPerByte: Balance = 0; -} - -parameter_types! { - pub const MinimumPeriod: u64 = 1; -} - -impl pallet_timestamp::Config for Test { - type Moment = Moment; - type OnTimestampSet = (); - type MinimumPeriod = MinimumPeriod; - type WeightInfo = (); -} - -impl pallet_randomness_collective_flip::Config for Test {} - -pub struct TestShouldEndSession; -impl ShouldEndSession for TestShouldEndSession { - fn should_end_session(now: u32) -> bool { - now % 10 == 0 // every 10 blocks - } -} - -impl_opaque_keys! { - pub struct MockSessionKeys { - pub dummy: UintAuthorityId, - } -} - -impl From for MockSessionKeys { - fn from(dummy: UintAuthorityId) -> Self { - Self { dummy } - } -} - -impl pallet_session::Config for Test { - type RuntimeEvent = RuntimeEvent; - type ValidatorId = AccountId; - type ValidatorIdOf = (); - type ShouldEndSession = TestShouldEndSession; - type NextSessionRotation = (); - type SessionManager = (); - type SessionHandler = pallet_session::TestSessionHandler; - type Keys = MockSessionKeys; - type WeightInfo = (); -} - -impl pallet_session::historical::Config for Test { - type FullIdentification = pallet_staking::Exposure; - type FullIdentificationOf = pallet_staking::ExposureOf; -} - -pallet_staking_reward_curve::build! { - const REWARD_CURVE: PiecewiseLinear<'static> = curve!( - min_inflation: 0_000_100, - max_inflation: 0_050_000, - ideal_stake: 0_200_000, - falloff: 0_050_000, - max_piece_count: 100, - test_precision: 0_050_000, - ); -} - -pub struct OnChainSeqPhragmen; -impl onchain::Config for OnChainSeqPhragmen { - type System = Test; - type Solver = SequentialPhragmen; - type DataProvider = Staking; - type WeightInfo = frame_election_provider_support::weights::SubstrateWeight; -} - -parameter_types! { - pub const SessionsPerEra: sp_staking::SessionIndex = 6; - pub const BondingDuration: sp_staking::EraIndex = 3; - pub const SlashDeferDuration: sp_staking::EraIndex = 2; - pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; - pub const MaxNominatorRewardedPerValidator: u32 = 256; - pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); - pub OffchainRepeat: BlockNumber = 5; -} - -impl pallet_staking::Config for Test { - type MaxNominations = ConstU32<16>; - type Currency = Balances; - type UnixTime = Timestamp; - type CurrencyToVote = U128CurrencyToVote; - type RewardRemainder = (); - type RuntimeEvent = RuntimeEvent; - type Slash = (); // send the slashed funds to the treasury. - type Reward = (); // rewards are minted from the void - type SessionsPerEra = SessionsPerEra; - type BondingDuration = BondingDuration; - type SlashDeferDuration = SlashDeferDuration; - type SlashCancelOrigin = frame_system::EnsureRoot; - type SessionInterface = Self; - type EraPayout = pallet_staking::ConvertCurve; - type NextNewSession = Session; - type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; - type OffendingValidatorsThreshold = OffendingValidatorsThreshold; - type ElectionProvider = onchain::UnboundedExecution; - type GenesisElectionProvider = Self::ElectionProvider; - type VoterList = pallet_staking::UseNominatorsAndValidatorsMap; - type MaxUnlockingChunks = ConstU32<32>; - type WeightInfo = pallet_staking::weights::SubstrateWeight; - type BenchmarkingConfig = pallet_staking::TestBenchmarkingConfig; - type CurrencyBalance = Balance; - type OnStakerSlash = (); - type HistoryDepth = ConstU32<84>; - type TargetList = pallet_staking::UseValidatorsMap; -} - -parameter_types! { - pub const DdcAccountsPalletId: PalletId = PalletId(*b"accounts"); - pub const LockingDuration: sp_staking::EraIndex = 30 * 24; -} - -impl pallet_ddc_customers::Config for Test { - type LockingDuration = LockingDuration; - type Currency = Balances; - type RuntimeEvent = RuntimeEvent; - type PalletId = DdcAccountsPalletId; -} - -parameter_types! { - pub const DefaultEdgeBondSize: Balance = 100; - pub const DefaultEdgeChillDelay: EraIndex = 2; - pub const DefaultStorageBondSize: Balance = 100; - pub const DefaultStorageChillDelay: EraIndex = 2; -} - -impl pallet_ddc_staking::Config for Test { - type BondingDuration = BondingDuration; - type Currency = Balances; - type DefaultEdgeBondSize = DefaultEdgeBondSize; - type DefaultEdgeChillDelay = DefaultEdgeChillDelay; - type DefaultStorageBondSize = DefaultStorageBondSize; - type DefaultStorageChillDelay = DefaultStorageChillDelay; - type RuntimeEvent = RuntimeEvent; - type StakersPayoutSource = DdcAccountsPalletId; - type UnixTime = Timestamp; - type WeightInfo = pallet_ddc_staking::weights::SubstrateWeight; -} - -impl pallet_ddc_clusters::Config for Test { - type RuntimeEvent = RuntimeEvent; - type NodeRepository = pallet_ddc_nodes::Pallet; -} - -impl pallet_ddc_nodes::Config for Test { - type RuntimeEvent = RuntimeEvent; -} - -parameter_types! { - pub const DdcValidatorsQuorumSize: u32 = 3; - pub const ValidationThreshold: u32 = 5; -} - -impl pallet_ddc_validator::Config for Test { - type DdcValidatorsQuorumSize = DdcValidatorsQuorumSize; - type RuntimeEvent = RuntimeEvent; - type Randomness = RandomnessCollectiveFlip; - type RuntimeCall = RuntimeCall; - type AuthorityId = pallet_ddc_validator::crypto::TestAuthId; - type ValidationThreshold = ValidationThreshold; - type ValidatorsMax = (); -} - -impl SendTransactionTypes for Test -where - RuntimeCall: From, -{ - type OverarchingCall = RuntimeCall; - type Extrinsic = Extrinsic; -} - -parameter_types! { - pub const ExistentialDeposit: u64 = 1; - pub const MaxLocks: u32 = 10; -} - -impl pallet_balances::Config for Test { - type Balance = Balance; - type DustRemoval = (); - type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = (); - type MaxLocks = (); - type MaxReserves = (); - type ReserveIdentifier = (); -} - -// Build genesis storage according to the mock runtime. -pub fn new_test_ext() -> sp_io::TestExternalities { - let mut storage = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - let balances = vec![ - // edge stash - (AccountId::from([0x1; 32]), 1000), - // edge controller - (AccountId::from([0x11; 32]), 1000), - // validator1 stash; has to be equal to the OCW key in the current implementation - ( - AccountId::from([ - 0xd2, 0xbf, 0x4b, 0x84, 0x4d, 0xfe, 0xfd, 0x67, 0x72, 0xa8, 0x84, 0x3e, 0x66, 0x9f, - 0x94, 0x34, 0x08, 0x96, 0x6a, 0x97, 0x7e, 0x3a, 0xe2, 0xaf, 0x1d, 0xd7, 0x8e, 0x0f, - 0x55, 0xf4, 0xdf, 0x67, - ]), - 10000, - ), - // validator1 controller - (AccountId::from([0xaa; 32]), 10000), - // validator2 stash - (AccountId::from([0xb; 32]), 10000), - // validator2 controller - (AccountId::from([0xbb; 32]), 10000), - // validator3 stash - (AccountId::from([0xc; 32]), 10000), - // validator3 controller - (AccountId::from([0xcc; 32]), 10000), - ]; - let _ = pallet_balances::GenesisConfig:: { balances }.assimilate_storage(&mut storage); - - let stakers = vec![ - ( - AccountId::from([ - 0xd2, 0xbf, 0x4b, 0x84, 0x4d, 0xfe, 0xfd, 0x67, 0x72, 0xa8, 0x84, 0x3e, 0x66, 0x9f, - 0x94, 0x34, 0x08, 0x96, 0x6a, 0x97, 0x7e, 0x3a, 0xe2, 0xaf, 0x1d, 0xd7, 0x8e, 0x0f, - 0x55, 0xf4, 0xdf, 0x67, - ]), - AccountId::from([0xaa; 32]), - 1000, - pallet_staking::StakerStatus::Validator, - ), - ( - AccountId::from([0xb; 32]), - AccountId::from([0xbb; 32]), - 1000, - pallet_staking::StakerStatus::Validator, - ), - ( - AccountId::from([0xc; 32]), - AccountId::from([0xcc; 32]), - 1000, - pallet_staking::StakerStatus::Validator, - ), - ]; - let _ = pallet_staking::GenesisConfig:: { stakers, ..Default::default() } - .assimilate_storage(&mut storage); - - let edges = vec![( - AccountId::from([0x1; 32]), - AccountId::from([0x11; 32]), - NodePubKey::CDNPubKey(CDNNodePubKey::new([0x21; 32])), - 100, - ClusterId::from([1; 20]), - )]; - let storages = vec![]; - let _ = pallet_ddc_staking::GenesisConfig:: { edges, storages, ..Default::default() } - .assimilate_storage(&mut storage); - - TestExternalities::new(storage) -} - -pub type Extrinsic = TestXt; - -impl SigningTypes for Test { - type Public = ::Signer; - type Signature = Signature; -} - -impl CreateSignedTransaction for Test -where - RuntimeCall: From, -{ - fn create_transaction>( - call: RuntimeCall, - _public: ::Signer, - _account: AccountId, - nonce: u64, - ) -> Option<(RuntimeCall, ::SignaturePayload)> { - Some((call, (nonce, ()))) - } -} diff --git a/pallets/ddc-validator/src/payments.rs b/pallets/ddc-validator/src/payments.rs deleted file mode 100644 index a1a26ade5..000000000 --- a/pallets/ddc-validator/src/payments.rs +++ /dev/null @@ -1 +0,0 @@ -//! Payments module to calculate and store a withdrawal per content owner and a payout per CDN node. diff --git a/pallets/ddc-validator/src/shm.rs b/pallets/ddc-validator/src/shm.rs deleted file mode 100644 index 6989e148f..000000000 --- a/pallets/ddc-validator/src/shm.rs +++ /dev/null @@ -1,162 +0,0 @@ -//! Validators' "shared memory" module. -//! -//! It implements a step of the DAC and Validation sequence when validators share their intermediate -//! validation results with each other. The design of the "shared memory" is expected to become like -//! transactions pool or peers list in the future, but for now it works on the centralized Redis -//! server which we maintain for DAC DataModel. - -use alloc::{format, string::String}; -pub use sp_std::collections::btree_map::BTreeMap; -// ToDo: remove String usage -use crate::{dac, utils, ValidationDecision}; -use alt_serde::{Deserialize, Serialize}; -use base64::prelude::*; -use lite_json::json::JsonValue; -use sp_runtime::offchain::{http, Duration}; -use sp_staking::EraIndex; -use sp_std::prelude::*; - -const HTTP_TIMEOUT_MS: u64 = 30_000; - -#[derive(Serialize, Deserialize, Debug)] -#[serde(crate = "alt_serde")] -#[serde(rename_all = "camelCase")] -pub struct IntermediateDecisionsWrapper { - #[serde(rename = "JSON.GET")] - json: String, -} - -#[derive(Debug, Deserialize, Serialize, Clone)] -#[serde(crate = "alt_serde")] -pub(crate) struct IntermediateDecisions { - validators_to_decisions: BTreeMap, -} - -#[derive(Debug, Deserialize, Serialize, Clone)] -#[serde(crate = "alt_serde")] -struct IntermediateDecision { - result: bool, - data: String, -} - -pub fn base64_decode(input: &String) -> Result, ()> { - let mut buf = Vec::with_capacity(1000); // ToDo: calculate capacity - buf.resize(1000, 0); - BASE64_STANDARD.decode_slice(input, &mut buf).map_err(|_| ())?; - Ok(buf.iter().map(|&char| char as u8).collect()) -} - -/// Encodes a vector of bytes into a vector of characters using base64 encoding. -pub fn base64_encode(input: &Vec) -> Result, ()> { - let mut buf = Vec::with_capacity(1000); // ToDo: calculate capacity - buf.resize(1000, 0); - BASE64_STANDARD.encode_slice(input, &mut buf).map_err(|_| ())?; - Ok(buf.iter().map(|&byte| byte as char).collect()) -} - -/// Publish intermediate validation result to redis. -pub fn share_intermediate_validation_result( - shared_memory_webdis_url: &String, - era: EraIndex, - validator: &String, - cdn_node: &String, - validation_result: bool, - validation_decision_encoded: &String, -) -> Result { - let deadline = sp_io::offchain::timestamp().add(Duration::from_millis(HTTP_TIMEOUT_MS)); - let validation_decision_string = String::from(validation_decision_encoded); - let json = serde_json::json!({ - "result": validation_result, - "data": validation_decision_string, - }); - let json_str = serde_json::to_string(&json).unwrap(); - let unescaped_json = utils::unescape(&json_str); - let url_encoded_json = utils::url_encode(&unescaped_json); - - log::debug!("json_str: {:?}", json_str); - - let url = format!( - "{}/FCALL/save_validation_result_by_node/1/{}:{}:{}/{}", - shared_memory_webdis_url, validator, cdn_node, era, url_encoded_json, - ); - - log::debug!("share_intermediate_validation_result url: {:?}", url); - let request = http::Request::get(url.as_str()); - let pending = request.deadline(deadline).send().map_err(|_| http::Error::IoError)?; - let response = pending.try_wait(deadline).map_err(|_| http::Error::DeadlineReached)??; - if response.code != 200 { - log::warn!("Unexpected status code: {}", response.code); - return Err(http::Error::Unknown) - } - let body = response.body().collect::>(); - let body_str = sp_std::str::from_utf8(&body).map_err(|_| { - log::warn!("No UTF-8 body"); - http::Error::Unknown - })?; - - log::debug!("body_str: {:?}", body_str); - - let json = lite_json::parse_json(body_str).map_err(|_| { - log::warn!("No JSON body"); - http::Error::Unknown - })?; - Ok(json) -} - -pub(crate) fn get_intermediate_decisions( - data_provider_url: &String, - edge: &str, - era: &EraIndex, - quorum: Vec, -) -> Vec { - let url = format!("{}/JSON.GET/ddc:dac:shared:nodes:{}", data_provider_url, era); - - let response: IntermediateDecisionsWrapper = dac::http_get_json(url.as_str()).unwrap(); - let mut edges_to_validators_decisions: BTreeMap< - String, - BTreeMap, - > = serde_json::from_str(&response.json).unwrap(); - let decisions_for_edge = IntermediateDecisions { - validators_to_decisions: edges_to_validators_decisions.remove(edge).unwrap(), - }; - - let quorum_decisions = find_quorum_decisions(decisions_for_edge, quorum); - let decoded_decisions = decode_intermediate_decisions(quorum_decisions); - - decoded_decisions -} - -pub(crate) fn decode_intermediate_decisions( - decisions: IntermediateDecisions, -) -> Vec { - let mut decoded_decisions: Vec = Vec::new(); - - for (_, decision) in decisions.validators_to_decisions.iter() { - let data = base64_decode(&decision.data).unwrap(); - - let data_str = String::from_utf8_lossy(&data); - let data_trimmed = data_str.trim_end_matches('\0'); - - log::debug!("data_str: {:?}", data_trimmed); - - let decoded_decision: ValidationDecision = serde_json::from_str(&data_trimmed).unwrap(); - - decoded_decisions.push(decoded_decision); - } - - decoded_decisions -} - -pub(crate) fn find_quorum_decisions( - all_decisions: IntermediateDecisions, - quorum: Vec, -) -> IntermediateDecisions { - let mut quorum_decisions: BTreeMap = BTreeMap::new(); - for (validator_id, decision) in all_decisions.validators_to_decisions.iter() { - if quorum.contains(validator_id) { - quorum_decisions.insert(validator_id.clone(), decision.clone()); - } - } - - IntermediateDecisions { validators_to_decisions: quorum_decisions } -} diff --git a/pallets/ddc-validator/src/tests.rs b/pallets/ddc-validator/src/tests.rs deleted file mode 100644 index 9493f2771..000000000 --- a/pallets/ddc-validator/src/tests.rs +++ /dev/null @@ -1,606 +0,0 @@ -#![cfg(test)] - -use super::*; -use crate::{ - mock::{Timestamp, *}, - Error as ValidatorError, -}; -use codec::Decode; -use ddc_primitives::{CDNNodePubKey, NodePubKey}; -use frame_support::{assert_noop, assert_ok}; -use pallet_ddc_customers::{BucketsDetails, Error as AccountsError}; -use pallet_ddc_staking::{DDC_ERA_DURATION_MS, DDC_ERA_START_MS}; -use sp_core::offchain::{testing, OffchainDbExt, OffchainWorkerExt, TransactionPoolExt}; -use sp_keystore::{testing::KeyStore, KeystoreExt, SyncCryptoStore}; -use sp_runtime::offchain::storage::StorageValueRef; -use std::sync::Arc; - -const OCW_PUB_KEY_STR: &str = "d2bf4b844dfefd6772a8843e669f943408966a977e3ae2af1dd78e0f55f4df67"; -const OCW_SEED: &str = - "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; - -fn last_event() -> RuntimeEvent { - System::events().pop().expect("Event expected").event.into() -} - -#[test] -fn it_sets_validation_decision_with_one_validator_in_quorum() { - let mut t = new_test_ext(); - - let (offchain, offchain_state) = testing::TestOffchainExt::new(); - t.register_extension(OffchainDbExt::new(offchain.clone())); - t.register_extension(OffchainWorkerExt::new(offchain)); - - let keystore = KeyStore::new(); - keystore.sr25519_generate_new(KEY_TYPE, Some(OCW_SEED)).unwrap(); - t.register_extension(KeystoreExt(Arc::new(keystore))); - - let (pool, pool_state) = testing::TestTransactionPoolExt::new(); - t.register_extension(TransactionPoolExt::new(pool)); - - let era_to_validate: EraIndex = 3; - let edge_stash_to_validate = AccountId::from([0x1; 32]); - let edge_stash_to_validate_str = - utils::account_to_string::(edge_stash_to_validate.clone()); - let edge_node_to_validate = NodePubKey::CDNPubKey(CDNNodePubKey::new([0x21; 32])); - let edge_node_to_validate_str = array_bytes::bytes2hex("", edge_node_to_validate.encode()); - let validator_1_stash = AccountId::from([ - 0xd2, 0xbf, 0x4b, 0x84, 0x4d, 0xfe, 0xfd, 0x67, 0x72, 0xa8, 0x84, 0x3e, 0x66, 0x9f, 0x94, - 0x34, 0x08, 0x96, 0x6a, 0x97, 0x7e, 0x3a, 0xe2, 0xaf, 0x1d, 0xd7, 0x8e, 0x0f, 0x55, 0xf4, - 0xdf, 0x67, - ]); - let validator_1_controller = AccountId::from([0xaa; 32]); - let validator_2_stash = AccountId::from([0xb; 32]); - let validator_2_controller = AccountId::from([0xbb; 32]); - let validator_3_stash = AccountId::from([0xc; 32]); - let validator_3_controller = AccountId::from([0xcc; 32]); - - { - let mut state = offchain_state.write(); - - let mut expect_request = |url: &str, response: &[u8]| { - state.expect_request(testing::PendingRequest { - method: "GET".into(), - uri: url.to_string(), - response: Some(response.to_vec()), - sent: true, - ..Default::default() - }); - }; - - expect_request( - &format!( - "{}/JSON.GET/ddc:dac:aggregation:nodes:{}/$.{}", - DEFAULT_DATA_PROVIDER_URL, era_to_validate, edge_node_to_validate_str - ), - include_bytes!("./mock-data/set-1/aggregated-node-data-for-era.json"), - ); - - expect_request( - &format!( - "{}/JSON.GET/ddc:dac:data:file:84640a53-fc1f-4ac5-921c-6695056840bc", - DEFAULT_DATA_PROVIDER_URL - ), - include_bytes!("./mock-data/set-1/file-request1.json"), - ); - - expect_request( - &format!( - "{}/JSON.GET/ddc:dac:data:file:d0a55c8b-fcb9-41b5-aa9a-8b40e9c4edf7", - DEFAULT_DATA_PROVIDER_URL - ), - include_bytes!("./mock-data/set-1/file-request2.json"), - ); - - expect_request( - &format!( - "{}/JSON.GET/ddc:dac:data:file:80a62530-fd76-40b5-bc53-dd82365e89ce", - DEFAULT_DATA_PROVIDER_URL - ), - include_bytes!("./mock-data/set-1/file-request3.json"), - ); - - let decision: ValidationDecision = - serde_json::from_slice(include_bytes!("./mock-data/set-1/validation-decision.json")) - .unwrap(); - let serialized_decision = serde_json::to_string(&decision).unwrap(); - let encoded_decision_vec = - shm::base64_encode(&serialized_decision.as_bytes().to_vec()).unwrap(); - let encoded_decision_str = encoded_decision_vec.iter().cloned().collect::(); - let result_json = serde_json::json!({ - "result": decision.result, - "data": encoded_decision_str, - }); - let result_json_str = serde_json::to_string(&result_json).unwrap(); - let unescaped_result_json = utils::unescape(&result_json_str); - let url_encoded_result_json = utils::url_encode(&unescaped_result_json); - - expect_request( - &format!( - "{}/FCALL/save_validation_result_by_node/1/{}:{}:{}/{}", - DEFAULT_DATA_PROVIDER_URL, - OCW_PUB_KEY_STR, - edge_stash_to_validate_str, - era_to_validate, - url_encoded_result_json, - ), - include_bytes!("./mock-data/set-1/save-validation-decision-result.json"), - ); - - expect_request( - &format!( - "{}/JSON.GET/ddc:dac:shared:nodes:{}", - DEFAULT_DATA_PROVIDER_URL, era_to_validate - ), - include_bytes!("./mock-data/set-1/shared-validation-decisions-for-era.json"), - ); - } - - t.execute_with(|| { - let era_block_number = 20 as u32 * era_to_validate; - System::set_block_number(era_block_number); // required for randomness - assert_ok!(DdcValidator::set_validator_key( - // register validator 1 - RuntimeOrigin::signed(validator_1_controller), - validator_1_stash, - )); - assert_ok!(DdcValidator::set_validator_key( - // register validator 2 - RuntimeOrigin::signed(validator_2_controller), - validator_2_stash, - )); - assert_ok!(DdcValidator::set_validator_key( - // register validator 3 - RuntimeOrigin::signed(validator_3_controller), - validator_3_stash, - )); - Timestamp::set_timestamp( - (DDC_ERA_START_MS + DDC_ERA_DURATION_MS * (era_to_validate as u128 - 1)) as u64, - ); - DdcStaking::on_finalize(era_block_number - 1); // set DDC era counter - DdcValidator::on_initialize(era_block_number - 1); // make assignments - - Timestamp::set_timestamp( - (DDC_ERA_START_MS + DDC_ERA_DURATION_MS * (era_to_validate as u128 + 1)) as u64, - ); - DdcStaking::on_finalize(era_block_number + 1); // inc DDC era counter - StorageValueRef::persistent(ENABLE_DDC_VALIDATION_KEY).set(&true); // enable validation - DdcValidator::offchain_worker(era_block_number + 1); // execute assignments - - let mut transactions = pool_state.read().transactions.clone(); - transactions.reverse(); - assert_eq!(transactions.len(), 3); - - let tx = transactions.pop().unwrap(); - let tx = Extrinsic::decode(&mut &*tx).unwrap(); - assert!(tx.signature.is_some()); - - let bucket_info = BucketsDetails { bucket_id: 5, amount: 400u128 }; - - assert_eq!( - tx.call, - crate::mock::RuntimeCall::DdcValidator(crate::Call::charge_payments_content_owners { - paying_accounts: vec![bucket_info] - }) - ); - - let tx = transactions.pop().unwrap(); - let tx = Extrinsic::decode(&mut &*tx).unwrap(); - assert!(tx.signature.is_some()); - - let common_decision: ValidationDecision = serde_json::from_slice(include_bytes!( - "./mock-data/set-1/final-validation-decision.json" - )) - .unwrap(); - let common_decisions = vec![common_decision.clone()]; - let serialized_decisions = serde_json::to_string(&common_decisions).unwrap(); - - assert_eq!( - tx.call, - crate::mock::RuntimeCall::DdcValidator(crate::Call::set_validation_decision { - era: era_to_validate, - cdn_node: edge_stash_to_validate.clone(), - validation_decision: ValidationDecision { - edge: edge_stash_to_validate_str, - result: true, - payload: utils::hash(&serialized_decisions), - totals: DacTotalAggregates { - received: common_decision.totals.received, - sent: common_decision.totals.sent, - failed_by_client: common_decision.totals.failed_by_client, - failure_rate: common_decision.totals.failure_rate, - } - } - }) - ); - - let tx = transactions.pop().unwrap(); - let tx = Extrinsic::decode(&mut &*tx).unwrap(); - - let stakers_points = vec![(edge_stash_to_validate, common_decision.totals.sent)]; - - assert!(tx.signature.is_some()); - assert_eq!( - tx.call, - crate::mock::RuntimeCall::DdcValidator(crate::Call::set_era_reward_points { - era: era_to_validate, - stakers_points, - }) - ); - }) -} - -#[test] -fn send_signal_works_as_expected() { - let mut t = new_test_ext(); - - let validator_controller = AccountId::from([0xaa; 32]); - - t.execute_with(|| { - assert_eq!(DdcValidator::signal(), None); - assert_ok!(DdcValidator::send_signal(RuntimeOrigin::signed(validator_controller))); - assert_eq!(DdcValidator::signal(), Some(true)); - DdcValidator::on_initialize(2); - System::set_block_number(2); - assert_eq!(DdcValidator::signal(), Some(false)); - }) -} - -#[test] -fn set_validation_decision_works_as_expected() { - let mut t = new_test_ext(); - - let era_to_validate: EraIndex = 3; - let cdn_node_to_validate = AccountId::from([0x1; 32]); - let not_a_cdn_node = AccountId::from([0x2; 32]); - let validator_1_stash = AccountId::from([ - 0xd2, 0xbf, 0x4b, 0x84, 0x4d, 0xfe, 0xfd, 0x67, 0x72, 0xa8, 0x84, 0x3e, 0x66, 0x9f, 0x94, - 0x34, 0x08, 0x96, 0x6a, 0x97, 0x7e, 0x3a, 0xe2, 0xaf, 0x1d, 0xd7, 0x8e, 0x0f, 0x55, 0xf4, - 0xdf, 0x67, - ]); - let validator_1_controller = AccountId::from([0xaa; 32]); - let validator_1_not_controller = AccountId::from([0xdd; 32]); - - let decision: ValidationDecision = - serde_json::from_slice(include_bytes!("./mock-data/set-1/validation-decision.json")) - .unwrap(); - - t.execute_with(|| { - System::set_block_number(1); - - assert_noop!( - DdcValidator::set_validation_decision( - RuntimeOrigin::signed(validator_1_controller.clone()), - era_to_validate, - cdn_node_to_validate.clone(), - decision.clone(), - ), - ValidatorError::::DDCValidatorKeyNotRegistered - ); - - // Set a mapping from stash to not a validator - DDCValidatorToStashKeys::::insert( - validator_1_stash.clone(), - validator_1_not_controller.clone(), - ); - - assert_noop!( - DdcValidator::set_validation_decision( - RuntimeOrigin::signed(validator_1_stash.clone()), - era_to_validate, - cdn_node_to_validate.clone(), - decision.clone() - ), - ValidatorError::::NotValidatorStash - ); - - assert_ok!(DdcValidator::set_validator_key( - // register validator 1 - RuntimeOrigin::signed(validator_1_controller.clone()), - validator_1_stash.clone(), - )); - - assert_noop!( - DdcValidator::set_validation_decision( - RuntimeOrigin::signed(validator_1_stash.clone()), - era_to_validate, - not_a_cdn_node.clone(), - decision.clone() - ), - ValidatorError::::NodeNotActive - ); - - assert_ok!(DdcValidator::set_validation_decision( - RuntimeOrigin::signed(validator_1_stash.clone()), - era_to_validate, - cdn_node_to_validate.clone(), - decision.clone() - )); - - assert_noop!( - DdcValidator::set_validation_decision( - RuntimeOrigin::signed(validator_1_stash), - era_to_validate, - cdn_node_to_validate.clone(), - decision.clone() - ), - ValidatorError::::ValidationDecisionAlreadySet - ); - - let evt = last_event(); - - assert_eq!( - evt, - crate::Event::ValidationDecision(era_to_validate, cdn_node_to_validate, decision) - .into() - ); - }) -} - -#[test] -fn set_era_reward_points_works_as_expected() { - let mut t = new_test_ext(); - - let era_to_validate: EraIndex = 3; - let cdn_node_to_validate = AccountId::from([0x1; 32]); - let not_a_cdn_node = AccountId::from([0x2; 32]); - let validator_1_stash = AccountId::from([ - 0xd2, 0xbf, 0x4b, 0x84, 0x4d, 0xfe, 0xfd, 0x67, 0x72, 0xa8, 0x84, 0x3e, 0x66, 0x9f, 0x94, - 0x34, 0x08, 0x96, 0x6a, 0x97, 0x7e, 0x3a, 0xe2, 0xaf, 0x1d, 0xd7, 0x8e, 0x0f, 0x55, 0xf4, - 0xdf, 0x67, - ]); - let validator_1_controller = AccountId::from([0xaa; 32]); - let validator_1_not_controller = AccountId::from([0xdd; 32]); - - let decision: ValidationDecision = - serde_json::from_slice(include_bytes!("./mock-data/set-1/validation-decision.json")) - .unwrap(); - - let stakers_points = vec![(cdn_node_to_validate.clone(), decision.totals.sent)]; - let fake_stakers_points = vec![(not_a_cdn_node.clone(), decision.totals.sent)]; - - t.execute_with(|| { - System::set_block_number(1); - - assert_noop!( - DdcValidator::set_era_reward_points( - RuntimeOrigin::signed(validator_1_controller.clone()), - era_to_validate, - stakers_points.clone(), - ), - ValidatorError::::DDCValidatorKeyNotRegistered - ); - - // Set a mapping from stash to not a validator - DDCValidatorToStashKeys::::insert( - validator_1_stash.clone(), - validator_1_not_controller.clone(), - ); - - assert_noop!( - DdcValidator::set_era_reward_points( - RuntimeOrigin::signed(validator_1_stash.clone()), - era_to_validate, - stakers_points.clone() - ), - ValidatorError::::NotValidatorStash - ); - - assert_ok!(DdcValidator::set_validator_key( - // register validator 1 - RuntimeOrigin::signed(validator_1_controller), - validator_1_stash.clone(), - )); - - // attempting to set era reward points for account, which is not an active CDN node - assert_ok!(DdcValidator::set_era_reward_points( - RuntimeOrigin::signed(validator_1_stash.clone()), - era_to_validate, - fake_stakers_points.clone() - )); - - // rewards points should not be set - assert_eq!( - DdcValidator::reward_points_set_for_node(era_to_validate, not_a_cdn_node), - false - ); - - assert_ok!(DdcValidator::set_era_reward_points( - RuntimeOrigin::signed(validator_1_stash.clone()), - era_to_validate, - stakers_points.clone() - )); - - let reward_points = ddc_staking::pallet::ErasEdgesRewardPointsPerNode::::get( - cdn_node_to_validate.clone(), - ); - - assert_eq!(reward_points.len(), 1); - - // Second run will still pass, but state will not change, as for specified node era points - // were set already - assert_ok!(DdcValidator::set_era_reward_points( - RuntimeOrigin::signed(validator_1_stash.clone()), - era_to_validate, - stakers_points.clone() - )); - - let reward_points_update_attempt = - ddc_staking::pallet::ErasEdgesRewardPointsPerNode::::get( - cdn_node_to_validate.clone(), - ); - - assert_eq!(reward_points_update_attempt.len(), 1); - - assert_eq!( - DdcValidator::reward_points_set_for_node(era_to_validate, cdn_node_to_validate), - true - ); - - assert_eq!(System::events().len(), 1); - let evt = System::events().pop().expect("Event expected").event; - - assert_eq!(evt, crate::Event::EraRewardPoints(era_to_validate, stakers_points).into()); - }) -} - -#[test] -fn charge_payments_content_owners_works_as_expected() { - let mut t = new_test_ext(); - - let era_to_validate: EraIndex = 3; - let validator_1_stash = AccountId::from([ - 0xd2, 0xbf, 0x4b, 0x84, 0x4d, 0xfe, 0xfd, 0x67, 0x72, 0xa8, 0x84, 0x3e, 0x66, 0x9f, 0x94, - 0x34, 0x08, 0x96, 0x6a, 0x97, 0x7e, 0x3a, 0xe2, 0xaf, 0x1d, 0xd7, 0x8e, 0x0f, 0x55, 0xf4, - 0xdf, 0x67, - ]); - let validator_1_controller = AccountId::from([0xaa; 32]); - let validator_1_not_controller = AccountId::from([0xdd; 32]); - - let bucket_info = BucketsDetails { bucket_id: 5, amount: 600u128 }; - - t.execute_with(|| { - System::set_block_number(1); - - assert_noop!( - DdcValidator::charge_payments_content_owners( - RuntimeOrigin::signed(validator_1_controller.clone()), - vec![bucket_info.clone()], - ), - ValidatorError::::DDCEraNotSet - ); - - let era_block_number = 20 as u32 * era_to_validate; - System::set_block_number(era_block_number); - Timestamp::set_timestamp( - (DDC_ERA_START_MS + DDC_ERA_DURATION_MS * (era_to_validate as u128 - 1)) as u64, - ); - DdcStaking::on_finalize(era_block_number - 1); - - assert_noop!( - DdcValidator::charge_payments_content_owners( - RuntimeOrigin::signed(validator_1_stash.clone()), - vec![bucket_info.clone()] - ), - ValidatorError::::DDCValidatorKeyNotRegistered - ); - - // Set a mapping from stash to not a validator - DDCValidatorToStashKeys::::insert( - validator_1_stash.clone(), - validator_1_not_controller.clone(), - ); - - assert_noop!( - DdcValidator::charge_payments_content_owners( - RuntimeOrigin::signed(validator_1_stash.clone()), - vec![bucket_info.clone()] - ), - ValidatorError::::NotValidatorStash - ); - - assert_ok!(DdcValidator::set_validator_key( - // register validator 1 - RuntimeOrigin::signed(validator_1_controller.clone()), - validator_1_stash.clone(), - )); - - assert_noop!( - DdcValidator::charge_payments_content_owners( - RuntimeOrigin::signed(validator_1_stash.clone()), - vec![bucket_info.clone()] - ), - ValidatorError::::PricingNotSet - ); - - ddc_staking::Pricing::::set(Some(1)); // set CERE token per byte / reward - - // No buckets were created at this point - assert_noop!( - DdcValidator::charge_payments_content_owners( - RuntimeOrigin::signed(validator_1_stash.clone()), - vec![bucket_info.clone()] - ), - AccountsError::::BucketDoesNotExist - ); - - // Create buckets - for range in 1..6 { - assert_ok!(ddc_customers::Pallet::::create_bucket( - RuntimeOrigin::signed(validator_1_stash.clone()), - true, - range - )); - } - - // Account to charge payments from is not created - assert_noop!( - DdcValidator::charge_payments_content_owners( - RuntimeOrigin::signed(validator_1_stash.clone()), - vec![bucket_info.clone()] - ), - AccountsError::::NotOwner - ); - - // Deposit funds for account - assert_ok!(ddc_customers::Pallet::::deposit( - RuntimeOrigin::signed(validator_1_stash.clone()), - 1_000, - )); - - assert_ok!(DdcValidator::charge_payments_content_owners( - RuntimeOrigin::signed(validator_1_stash.clone()), - vec![bucket_info.clone()] - )); - - // Should not be able to charge account twice by the same validator during one era - assert_noop!( - DdcValidator::charge_payments_content_owners( - RuntimeOrigin::signed(validator_1_stash.clone()), - vec![bucket_info.clone()] - ), - ValidatorError::::ContentOwnersDoubleSpend - ); - - let last_evt = System::events().pop().expect("Event expected").event; - assert_eq!(last_evt, ddc_customers::Event::Charged(bucket_info.amount).into()); - }) -} - -#[test] -fn set_validator_key_works_as_expected() { - let mut t = new_test_ext(); - - let validator_1_stash = AccountId::from([ - 0xd2, 0xbf, 0x4b, 0x84, 0x4d, 0xfe, 0xfd, 0x67, 0x72, 0xa8, 0x84, 0x3e, 0x66, 0x9f, 0x94, - 0x34, 0x08, 0x96, 0x6a, 0x97, 0x7e, 0x3a, 0xe2, 0xaf, 0x1d, 0xd7, 0x8e, 0x0f, 0x55, 0xf4, - 0xdf, 0x67, - ]); - let validator_1_controller: AccountId32 = AccountId::from([0xaa; 32]); - - t.execute_with(|| { - assert_noop!( - DdcValidator::set_validator_key( - RuntimeOrigin::signed(validator_1_stash.clone()), - validator_1_stash.clone(), - ), - ValidatorError::::NotController - ); - - assert_ok!(DdcValidator::set_validator_key( - RuntimeOrigin::signed(validator_1_controller.clone()), - validator_1_stash.clone(), - )); - - staking::Validators::::remove(validator_1_stash.clone()); - - // If stash is not a validator anymore, action will fail - assert_noop!( - DdcValidator::set_validator_key( - RuntimeOrigin::signed(validator_1_controller), - validator_1_stash, - ), - ValidatorError::::NotValidatorStash - ); - }) -} diff --git a/pallets/ddc-validator/src/utils.rs b/pallets/ddc-validator/src/utils.rs deleted file mode 100644 index 5c5459b24..000000000 --- a/pallets/ddc-validator/src/utils.rs +++ /dev/null @@ -1,73 +0,0 @@ -use alloc::{format, string::String}; -use codec::{Decode, Encode}; -use sp_core::crypto::AccountId32; -use sp_io::hashing::blake2_256; -pub use sp_std::prelude::*; - -pub fn account_to_string(account: T::AccountId) -> String { - let to32 = T::AccountId::encode(&account); - let pub_key_str = array_bytes::bytes2hex("", to32); - - pub_key_str -} - -pub fn string_to_account(pub_key_str: String) -> T::AccountId { - let acc32: sp_core::crypto::AccountId32 = - array_bytes::hex2array::<_, 32>(pub_key_str).unwrap().into(); - let mut to32 = AccountId32::as_ref(&acc32); - let address: T::AccountId = T::AccountId::decode(&mut to32).unwrap(); - address -} - -pub(crate) fn hash(data: &String) -> [u8; 32] { - let hash = blake2_256(data.as_bytes()); - let mut result = [0u8; 32]; - result.copy_from_slice(&hash); - - result -} - -pub(crate) fn url_encode(input: &str) -> String { - let mut encoded = String::new(); - - for byte in input.bytes() { - match byte { - // Unreserved characters (alphanumeric and -_.~) - b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'_' | b'.' | b'~' => { - encoded.push(byte as char); - }, - _ => { - encoded.push('%'); - encoded.push_str(&format!("{:02X}", byte)); - }, - } - } - - encoded -} - -pub(crate) fn unescape(json: &str) -> String { - let mut result = String::new(); - let mut chars = json.chars().peekable(); - - while let Some(c) = chars.next() { - if c == '\\' { - match chars.peek() { - Some('u') => { - // Skip over the next 5 characters - for _ in 0..5 { - chars.next(); - } - }, - _ => { - // Skip over the next character - chars.next(); - }, - } - } else { - result.push(c); - } - } - - result -} diff --git a/pallets/ddc-validator/src/validation.rs b/pallets/ddc-validator/src/validation.rs deleted file mode 100644 index 017d90782..000000000 --- a/pallets/ddc-validator/src/validation.rs +++ /dev/null @@ -1 +0,0 @@ -//! DAC Validation implementation. diff --git a/runtime/cere-dev/Cargo.toml b/runtime/cere-dev/Cargo.toml index c5188dbd5..f5ba45aba 100644 --- a/runtime/cere-dev/Cargo.toml +++ b/runtime/cere-dev/Cargo.toml @@ -100,7 +100,6 @@ pallet-ddc-staking = { version = "4.8.1", default-features = false, path = "../. pallet-chainbridge = { version = "4.8.1", default-features = false, path = "../../pallets/chainbridge" } pallet-cere-ddc = { version = "4.8.1", default-features = false, path = "../../pallets/ddc" } pallet-ddc-customers = { version = "0.1.0", default-features = false, path = "../../pallets/ddc-customers" } -pallet-ddc-validator = { version = "0.1.0", default-features = false, path = "../../pallets/ddc-validator" } pallet-erc721 = { version = "4.8.1", default-features = false, path = "../../pallets/erc721" } pallet-erc20 = { version = "4.8.1", default-features = false, path = "../../pallets/erc20" } pallet-ddc-metrics-offchain-worker = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } @@ -185,7 +184,6 @@ std = [ "pallet-ddc-staking/std", "cere-runtime-common/std", "cere-dev-runtime-constants/std", - "pallet-ddc-validator/std", "pallet-ddc-customers/std", "pallet-ddc-nodes/std", "pallet-ddc-clusters/std", diff --git a/runtime/cere-dev/src/lib.rs b/runtime/cere-dev/src/lib.rs index 46ee3b429..0c4f33c1f 100644 --- a/runtime/cere-dev/src/lib.rs +++ b/runtime/cere-dev/src/lib.rs @@ -1487,9 +1487,25 @@ pub type Executive = frame_executive::Executive< >, pallet_staking::migrations::v12::MigrateToV12, pallet_contracts::Migration, + custom_migration::Upgrade, ), >; +mod custom_migration { + use super::*; + + use frame_support::{traits::OnRuntimeUpgrade, weights::Weight, Twox128}; + use sp_io::{hashing::twox_128, storage::clear_prefix}; + + pub struct Upgrade; + impl OnRuntimeUpgrade for Upgrade { + fn on_runtime_upgrade() -> Weight { + clear_prefix(&twox_128(b"DdcValidator"), None); + Weight::from_ref_time(0) + } + } +} + #[cfg(feature = "runtime-benchmarks")] #[macro_use] extern crate frame_benchmarking;