From f35bf4b892d57fb229646364eb7b0159556cb16f Mon Sep 17 00:00:00 2001 From: Islam Date: Fri, 1 Jul 2022 19:41:09 +0000 Subject: [PATCH 01/36] feat(local-setup): Better setup of relay nodes Using spec from build-spec for relays --- .github/dockerfiles/Dockerfile.gitpod-base | 9 ++- .gitpod.yml | 4 +- chainspec-br.md | 82 ++++++++++++++++++++++ polkadot-launch/config.json | 4 +- 4 files changed, 90 insertions(+), 9 deletions(-) create mode 100644 chainspec-br.md diff --git a/.github/dockerfiles/Dockerfile.gitpod-base b/.github/dockerfiles/Dockerfile.gitpod-base index ca52c8c..11b174f 100644 --- a/.github/dockerfiles/Dockerfile.gitpod-base +++ b/.github/dockerfiles/Dockerfile.gitpod-base @@ -28,8 +28,7 @@ RUN git clone https://github.com/paritytech/polkadot.git && \ cargo build --release && \ ./target/release/${BIN} --help && \ find target -type f ! -name ${BIN} -exec rm {} + - - - - - +RUN ./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode > rococo-local.json +RUN ./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > rococo-local-raw.json +# Ease: +ENV POLKADOT_BIN=~/relay/polkadot/target/release/polkadot diff --git a/.gitpod.yml b/.gitpod.yml index 9293c12..96bdbe0 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -3,8 +3,8 @@ image: tasks: - name: Collator 1 init: cargo build - command: ./target/debug/parachain-collator --dev + command: ./target/debug/parachain-collator - name: Relay - command: ~/relay/polkadot/target/release/polkadot --dev + command: ~/relay/polkadot/target/release/polkadot --tmp --chain rococo-local diff --git a/chainspec-br.md b/chainspec-br.md new file mode 100644 index 0000000..f47ee50 --- /dev/null +++ b/chainspec-br.md @@ -0,0 +1,82 @@ +### Chain spec break down + +Literally just comments trying to understand pieces of the chainspec. + +```jsonc + + ... + "paras": { + // array of registered parachains, with ids. Must be correctly assigned + "paras": [] + }, + ... + ... + "sudo": { + // Sudo, alice + "key": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" + }, + ... + + +``` + +### utils + +`$RELAY_BIN key inspect ${key derivation path or key}`, inspect keys. +e.g: +```console +gitpod ~/relay/polkadot (release-v0.9.23) $ ./target/release/polkadot key inspect //Alce +Secret Key URI `//Alce` is account: + Network ID: substrate + Secret seed: 0x2b853e582682f6d9f842ddbb8d03e58de96f33d9276e051c492463addfd8c37f + Public key (hex): 0x2c12a8387f0a9aa821cc520fe3cd7a5b9b74e0c403a40188fd10f5887112a616 + Account ID: 0x2c12a8387f0a9aa821cc520fe3cd7a5b9b74e0c403a40188fd10f5887112a616 + Public key (SS58): 5D4VWKoog7oFQrSVWRWisYyyDHs1p2g4DNhU84NWRBLLDme3 + SS58 Address: 5D4VWKoog7oFQrSVWRWisYyyDHs1p2g4DNhU84NWRBLLDme3 +``` + +### Generate chain spec: + +./target/release/polkadot build-spec --chain rococo-local > ./rococo-local.json +./target/release/polkadot build-spec --chain rococo-local --raw > ./rococo-local-raw.json + +### Alice + +``` +./target/release/polkadot \ +--alice \ +--validator \ +--base-path /tmp/relay/alice \ +--chain ./rococo-local-raw.json \ +--port 30333 \ +--ws-port 9944 + +``` +12D3KooWF2oFXQNxTdpRqKKhcUgbPzhNusTXWGTmLFfRqpcviyk5 + +### Bob + + +./target/release/polkadot \ +--bob \ +--validator \ +--base-path /tmp/relay-bob \ +--chain ./rococo-local-raw.json \ +--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWF2oFXQNxTdpRqKKhcUgbPzhNusTXWGTmLFfRqpcviyk5 \ +--port 30334 \ +--ws-port 9945 + + +### Init: +``` +./target/release/polkadot --alice --validator --base-path /tmp/relay/alice --chain ./rococo-local-raw.json --port 30333 --ws-port 9944 + +./target/release/polkadot \ +--bob \ +--validator \ +--base-path /tmp/relay-bob \ +--chain ./rococo-local-raw.json \ +--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/Alice-node-addr \ +--port 30334 \ +--ws-port 9945 +``` \ No newline at end of file diff --git a/polkadot-launch/config.json b/polkadot-launch/config.json index 4dd6ebf..5d7bebe 100644 --- a/polkadot-launch/config.json +++ b/polkadot-launch/config.json @@ -1,6 +1,6 @@ { "relaychain": { - "bin": "../../polkadot/target/release/polkadot", + "bin": "/home/gitpod/relay/polkadot/target/release/polkadot", "chain": "rococo-local", "nodes": [ { @@ -17,7 +17,7 @@ }, "parachains": [ { - "bin": "../target/release/parachain-collator", + "bin": "../target/debug/parachain-collator", "id": "200", "balance": "1000000000000000000000", "nodes": [ From 8266062d73db69e0b662c9b19b7a920711b846de Mon Sep 17 00:00:00 2001 From: Islam Date: Fri, 1 Jul 2022 20:29:24 +0000 Subject: [PATCH 02/36] build(local-setup): Relay and collator dockerfiles --- .github/dockerfiles/Dockerfile.collator | 14 ++++++++++++++ .github/dockerfiles/Dockerfile.relay | 12 ++++++++++++ .gitpod.yml | 11 ++++++++--- scripts/prep-bins.sh | 2 ++ 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 .github/dockerfiles/Dockerfile.collator create mode 100644 .github/dockerfiles/Dockerfile.relay create mode 100755 scripts/prep-bins.sh diff --git a/.github/dockerfiles/Dockerfile.collator b/.github/dockerfiles/Dockerfile.collator new file mode 100644 index 0000000..efc724e --- /dev/null +++ b/.github/dockerfiles/Dockerfile.collator @@ -0,0 +1,14 @@ +FROM gitpod/workspace-full + +# Change to machine user/group +ARG USER=gitpod +ARG GROUP=gitpod +USER ${USER}:${GROUP} + +EXPOSE 30333 9933 9944 + +ARG COLLATOR_BIN=./target/debug/parachain-collator + +COPY ${COLLATOR_BIN} /usr/local/bin + +ENTRYPOINT ["/usr/local/bin/parachain-collator"] diff --git a/.github/dockerfiles/Dockerfile.relay b/.github/dockerfiles/Dockerfile.relay new file mode 100644 index 0000000..4b810b5 --- /dev/null +++ b/.github/dockerfiles/Dockerfile.relay @@ -0,0 +1,12 @@ +FROM gitpod/workspace-full + +ARG USER=gitpod +ARG GROUP=gitpod +USER ${USER}:${GROUP} + +ARG POLKADOT_BIN=./bins/polkadot + +COPY ${POLKADOT_BIN} /usr/local/bin +EXPOSE 30333 9933 9944 + +ENTRYPOINT ["/usr/local/bin/polkadot"] diff --git a/.gitpod.yml b/.gitpod.yml index 96bdbe0..c0e77ef 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,10 +1,15 @@ image: file: .github/dockerfiles/Dockerfile.gitpod-base + context: . tasks: - - name: Collator 1 - init: cargo build + - name: Init bins + init: docker build --pull --rm -f ".github/dockerfiles/Dockerfile.collator" -t chocnet/parachain-collator "." command: ./target/debug/parachain-collator - name: Relay - command: ~/relay/polkadot/target/release/polkadot --tmp --chain rococo-local + init: | + sh ./scripts/prep-bins.sh + docker build --pull --rm -f ".github/dockerfiles/Dockerfile.relay" -t chocnet/polkadot-debug "." + rm -r bins + diff --git a/scripts/prep-bins.sh b/scripts/prep-bins.sh new file mode 100755 index 0000000..9571029 --- /dev/null +++ b/scripts/prep-bins.sh @@ -0,0 +1,2 @@ +mkdir bins +cp ~/relay/polkadot/target/release/polkadot .github \ No newline at end of file From fa917baed17fb08268e3cfc58eb30653e35a4577 Mon Sep 17 00:00:00 2001 From: Islam Date: Fri, 1 Jul 2022 21:31:34 +0000 Subject: [PATCH 03/36] chore(local-setup): Zombienet install Note: zombienet fails to launch collator-01 due to arg mismatch --- .github/dockerfiles/Dockerfile.gitpod-base | 8 +++++++- .gitpod.yml | 9 +++++++-- zombienet/config.toml | 22 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 zombienet/config.toml diff --git a/.github/dockerfiles/Dockerfile.gitpod-base b/.github/dockerfiles/Dockerfile.gitpod-base index 11b174f..28174e0 100644 --- a/.github/dockerfiles/Dockerfile.gitpod-base +++ b/.github/dockerfiles/Dockerfile.gitpod-base @@ -9,7 +9,13 @@ RUN . $HOME/.cargo/env RUN rustup toolchain install nightly --allow-downgrade --profile minimal --component cargo RUN rustup target add wasm32-unknown-unknown --toolchain nightly # Rustup and cargo should be available - +# TODO: Validate bins +RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \ + sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \ + rm kubectl +RUN wget https://github.com/paritytech/zombienet/releases/download/v1.2.46/zombienet-linux -O zombienet && \ + sudo install -o root -g root -m 0755 zombienet /usr/local/bin/zombienet && \ + rm zombienet # Change to machine user/group ARG USER=gitpod ARG GROUP=gitpod diff --git a/.gitpod.yml b/.gitpod.yml index c0e77ef..48d0752 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -3,13 +3,18 @@ image: context: . tasks: - name: Init bins - init: docker build --pull --rm -f ".github/dockerfiles/Dockerfile.collator" -t chocnet/parachain-collator "." + init: | + docker build --pull --rm -f ".github/dockerfiles/Dockerfile.collator" -t chocnet/parachain-collator "." && + gp sync-done collator command: ./target/debug/parachain-collator - name: Relay init: | sh ./scripts/prep-bins.sh docker build --pull --rm -f ".github/dockerfiles/Dockerfile.relay" -t chocnet/polkadot-debug "." rm -r bins - + gp sync-done relay + - name: Test Net + init: gp sync-await collator && gp sync-await relay + command: zombienet spawn zombienet/config.toml -p native diff --git a/zombienet/config.toml b/zombienet/config.toml new file mode 100644 index 0000000..35fb3ad --- /dev/null +++ b/zombienet/config.toml @@ -0,0 +1,22 @@ +[settings] +timeout = 1000 + +[relaychain] +default_image = "chocnet/polkadot-debug:latest" +default_command = "/home/gitpod/relay/polkadot/target/release/polkadot" +chain = "rococo-local" + + [[relaychain.nodes]] + name = "alice" + + [[relaychain.nodes]] + name = "bob" + +[[parachains]] +id = 100 +addToGenesis = false + + [parachains.collator] + name = "collator01" + image = "chocnet/parachain-collator:latest" + command = "./target/debug/parachain-collator" \ No newline at end of file From ec932e1a3450d848a3244e7e936b27acd34ac679 Mon Sep 17 00:00:00 2001 From: Islam Date: Sat, 2 Jul 2022 06:37:47 +0000 Subject: [PATCH 04/36] chore(local-setup): Parachain setup commands Problem: Parachain-id command not available on cli, try upgrade --- chainspec-br.md | 34 +++++++++++++++++++++++++++++----- zombienet/config.toml | 4 ++-- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/chainspec-br.md b/chainspec-br.md index f47ee50..a0c0eeb 100644 --- a/chainspec-br.md +++ b/chainspec-br.md @@ -37,8 +37,8 @@ Secret Key URI `//Alce` is account: ### Generate chain spec: -./target/release/polkadot build-spec --chain rococo-local > ./rococo-local.json -./target/release/polkadot build-spec --chain rococo-local --raw > ./rococo-local-raw.json +./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode > ./rococo-local.json +./target/release/polkadot build-spec --chain ./rococo-local.json --disable-default-bootnode --raw > ./rococo-local-raw.json ### Alice @@ -52,7 +52,7 @@ Secret Key URI `//Alce` is account: --ws-port 9944 ``` -12D3KooWF2oFXQNxTdpRqKKhcUgbPzhNusTXWGTmLFfRqpcviyk5 +12D3KooWDDyLVA12TTjdFR8cpFE6dPD4uYYqxMT4GMrXSNdiVswK ### Bob @@ -62,10 +62,33 @@ Secret Key URI `//Alce` is account: --validator \ --base-path /tmp/relay-bob \ --chain ./rococo-local-raw.json \ ---bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWF2oFXQNxTdpRqKKhcUgbPzhNusTXWGTmLFfRqpcviyk5 \ +--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWDDyLVA12TTjdFR8cpFE6dPD4uYYqxMT4GMrXSNdiVswK \ --port 30334 \ --ws-port 9945 +### Parachains + +``` +./target/release/parachain-collator \ +--alice \ +--collator \ +--force-authoring \ +--chain rococo-local-parachain-2000-raw.json \ +--base-path /tmp/parachain/alice \ +--port 40333 \ +--ws-port 8844 \ +-- \ +--execution wasm \ +--chain ~/relay/polkadot/rococo-local-raw.json \ +--port 30343 \ +--ws-port 9977 +``` +``` + ./target/release/parachain-collator build-spec --disable-default-bootnode > rococo-local-parachain-plain.json + ./target/release/parachain-collator build-spec --chain rococo-local-parachain-plain.json --raw --disable-default-bootnode > rococo-local-parachain-2000-raw.json + ./target/release/parachain-collator export-genesis-wasm --chain rococo-local-parachain-2000-raw.json > para-2000-wasm + ./target/release/parachain-collator export-genesis-state --chain rococo-local-parachain-2000-raw.json > para-2000-genesis +``` ### Init: ``` @@ -79,4 +102,5 @@ Secret Key URI `//Alce` is account: --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/Alice-node-addr \ --port 30334 \ --ws-port 9945 -``` \ No newline at end of file +``` + diff --git a/zombienet/config.toml b/zombienet/config.toml index 35fb3ad..dc0108d 100644 --- a/zombienet/config.toml +++ b/zombienet/config.toml @@ -14,9 +14,9 @@ chain = "rococo-local" [[parachains]] id = 100 -addToGenesis = false [parachains.collator] name = "collator01" image = "chocnet/parachain-collator:latest" - command = "./target/debug/parachain-collator" \ No newline at end of file + command = "./target/release/parachain-collator" + args = ["-lparachain=debug"] From 8958e3932937c23b7a34da4eeb3b3662fd54f530 Mon Sep 17 00:00:00 2001 From: Islam Date: Sun, 3 Jul 2022 14:56:45 +0000 Subject: [PATCH 05/36] build(local-setup): Upgrade to polkadot v0.9.24 Update cargo cumulus, polkadot, substrate. And dockerfile --- .github/dockerfiles/Dockerfile.gitpod-base | 4 +- Cargo.lock | 1474 +++++++++++--------- node/Cargo.toml | 106 +- pallets/template/Cargo.toml | 14 +- runtime/Cargo.toml | 92 +- 5 files changed, 886 insertions(+), 804 deletions(-) diff --git a/.github/dockerfiles/Dockerfile.gitpod-base b/.github/dockerfiles/Dockerfile.gitpod-base index 28174e0..abf4a46 100644 --- a/.github/dockerfiles/Dockerfile.gitpod-base +++ b/.github/dockerfiles/Dockerfile.gitpod-base @@ -30,10 +30,10 @@ WORKDIR /home/${USER}/relay ARG BIN="polkadot" RUN git clone https://github.com/paritytech/polkadot.git && \ cd polkadot && \ - git checkout release-v0.9.23 && \ + git checkout release-v0.9.24 && \ cargo build --release && \ ./target/release/${BIN} --help && \ - find target -type f ! -name ${BIN} -exec rm {} + + find target -type f ! -name ${BIN} -exec rm {} + RUN ./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode > rococo-local.json RUN ./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > rococo-local-raw.json # Ease: diff --git a/Cargo.lock b/Cargo.lock index 61cb13e..2b16835 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -68,7 +68,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", "once_cell", "version_check", ] @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" +checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" [[package]] name = "approx" @@ -188,14 +188,14 @@ dependencies = [ [[package]] name = "async-global-executor" -version = "2.0.4" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c290043c9a95b05d45e952fb6383c67bcb61471f60cfa21e890dba6654234f43" +checksum = "5262ed948da60dd8956c6c5aca4d4163593dddb7b32d73267c93dab7b2e98940" dependencies = [ "async-channel", "async-executor", "async-io", - "async-mutex", + "async-lock", "blocking", "futures-lite", "num_cpus", @@ -204,9 +204,9 @@ dependencies = [ [[package]] name = "async-io" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" +checksum = "e5e18f61464ae81cde0a23e713ae8fd299580c54d697a35820cfd0625b8b0e07" dependencies = [ "concurrent-queue", "futures-lite", @@ -230,15 +230,6 @@ dependencies = [ "event-listener", ] -[[package]] -name = "async-mutex" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" -dependencies = [ - "event-listener", -] - [[package]] name = "async-process" version = "1.4.0" @@ -258,9 +249,9 @@ dependencies = [ [[package]] name = "async-std" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52580991739c5cdb36cde8b2a516371c0a3b70dda36d916cc08b82372916808c" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ "async-attributes", "async-channel", @@ -277,7 +268,6 @@ dependencies = [ "kv-log-macro", "log", "memchr", - "num_cpus", "once_cell", "pin-project-lite 0.2.9", "pin-utils", @@ -308,9 +298,9 @@ checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9" [[package]] name = "async-trait" -version = "0.1.53" +version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600" +checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" dependencies = [ "proc-macro2", "quote", @@ -330,15 +320,6 @@ dependencies = [ "pin-project-lite 0.2.9", ] -[[package]] -name = "atomic" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" -dependencies = [ - "autocfg", -] - [[package]] name = "atomic-waker" version = "1.0.0" @@ -369,7 +350,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" dependencies = [ "futures-core", - "getrandom 0.2.6", + "getrandom 0.2.7", "instant", "pin-project-lite 0.2.9", "rand 0.8.5", @@ -393,9 +374,9 @@ dependencies = [ [[package]] name = "base-x" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc19a4937b4fbd3fe3379793130e42060d10627a360f2127802b10b87e7baf74" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" [[package]] name = "base16ct" @@ -417,9 +398,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "beef" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bed554bd50246729a1ec158d08aa3235d1b69d94ad120ebe187e28894787e736" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" dependencies = [ "serde", ] @@ -427,7 +408,7 @@ dependencies = [ [[package]] name = "beefy-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "beefy-primitives", "fnv", @@ -436,7 +417,7 @@ dependencies = [ "hex", "log", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "sc-chain-spec", "sc-client-api", "sc-finality-grandpa", @@ -461,7 +442,7 @@ dependencies = [ [[package]] name = "beefy-gadget-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "beefy-gadget", "beefy-primitives", @@ -469,7 +450,7 @@ dependencies = [ "jsonrpsee", "log", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "sc-rpc", "sc-utils", "serde", @@ -481,12 +462,12 @@ dependencies = [ [[package]] name = "beefy-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" [[package]] name = "beefy-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", "scale-info", @@ -676,7 +657,7 @@ dependencies = [ [[package]] name = "bp-header-chain" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bp-runtime", "finality-grandpa", @@ -693,7 +674,7 @@ dependencies = [ [[package]] name = "bp-message-dispatch" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bp-runtime", "frame-support", @@ -705,7 +686,7 @@ dependencies = [ [[package]] name = "bp-messages" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bitvec", "bp-runtime", @@ -722,7 +703,7 @@ dependencies = [ [[package]] name = "bp-polkadot-core" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bp-messages", "bp-runtime", @@ -740,7 +721,7 @@ dependencies = [ [[package]] name = "bp-rococo" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bp-messages", "bp-polkadot-core", @@ -757,7 +738,7 @@ dependencies = [ [[package]] name = "bp-runtime" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "frame-support", "hash-db", @@ -775,7 +756,7 @@ dependencies = [ [[package]] name = "bp-test-utils" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bp-header-chain", "ed25519-dalek", @@ -790,7 +771,7 @@ dependencies = [ [[package]] name = "bp-wococo" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bp-messages", "bp-polkadot-core", @@ -805,7 +786,7 @@ dependencies = [ [[package]] name = "bridge-runtime-common" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bp-message-dispatch", "bp-messages", @@ -853,9 +834,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.9.1" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" [[package]] name = "byte-slice-cast" @@ -924,7 +905,7 @@ checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" dependencies = [ "camino", "cargo-platform", - "semver 1.0.9", + "semver 1.0.12", "serde", "serde_json", ] @@ -1036,9 +1017,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.3.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf6b561dcf059c85bbe388e0a7b0a1469acb3934cc0cfa148613a830629e3049" +checksum = "5a050e2153c5be08febd6734e29298e844fdb0fa21aeddd63b4eb7baa106c69b" dependencies = [ "glob", "libc", @@ -1047,16 +1028,16 @@ dependencies = [ [[package]] name = "clap" -version = "3.1.18" +version = "3.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b" +checksum = "190814073e85d238f31ff738fcb0bf6910cedeb73376c87cd69291028966fd83" dependencies = [ "atty", "bitflags", "clap_derive", "clap_lex", "indexmap", - "lazy_static", + "once_cell", "strsim", "termcolor", "textwrap", @@ -1064,9 +1045,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.1.18" +version = "3.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c" +checksum = "759bf187376e1afa7b85b959e6a664a3e7a95203415dba952ad19139e798f902" dependencies = [ "heck 0.4.0", "proc-macro-error", @@ -1077,13 +1058,22 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.0" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" dependencies = [ "os_str_bytes", ] +[[package]] +name = "cmake" +version = "0.1.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" +dependencies = [ + "cc", +] + [[package]] name = "coarsetime" version = "0.1.22" @@ -1277,9 +1267,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" +checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -1298,15 +1288,15 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" +checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" dependencies = [ "autocfg", "cfg-if 1.0.0", "crossbeam-utils", - "lazy_static", "memoffset", + "once_cell", "scopeguard", ] @@ -1322,12 +1312,12 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83" dependencies = [ "cfg-if 1.0.0", - "lazy_static", + "once_cell", ] [[package]] @@ -1411,7 +1401,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "clap", "sc-cli", @@ -1422,7 +1412,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1430,7 +1420,7 @@ dependencies = [ "cumulus-relay-chain-interface", "futures 0.3.21", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "polkadot-node-primitives", "polkadot-node-subsystem", "polkadot-overseer", @@ -1446,7 +1436,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1475,7 +1465,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1496,7 +1486,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1504,7 +1494,7 @@ dependencies = [ "futures 0.3.21", "futures-timer", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "polkadot-node-primitives", "polkadot-parachain", "polkadot-primitives", @@ -1521,7 +1511,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1545,7 +1535,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1554,7 +1544,7 @@ dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "polkadot-overseer", "polkadot-primitives", "sc-chain-spec", @@ -1575,7 +1565,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "frame-executive", "frame-support", @@ -1593,7 +1583,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1611,7 +1601,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "cumulus-pallet-parachain-system-proc-macro", "cumulus-primitives-core", @@ -1641,7 +1631,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1652,7 +1642,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "frame-benchmarking", "frame-support", @@ -1666,7 +1656,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1683,7 +1673,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1702,7 +1692,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "frame-support", "parity-scale-codec", @@ -1718,7 +1708,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1741,7 +1731,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "cumulus-primitives-core", "futures 0.3.21", @@ -1754,7 +1744,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1771,14 +1761,14 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "async-trait", "cumulus-primitives-core", "cumulus-relay-chain-interface", "futures 0.3.21", "futures-timer", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "polkadot-cli", "polkadot-client", "polkadot-service", @@ -1802,7 +1792,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1810,7 +1800,7 @@ dependencies = [ "futures 0.3.21", "jsonrpsee-core", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "polkadot-overseer", "polkadot-service", "sc-client-api", @@ -1826,7 +1816,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "async-trait", "backoff", @@ -1836,7 +1826,7 @@ dependencies = [ "futures-timer", "jsonrpsee", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "polkadot-service", "sc-client-api", "sc-rpc-api", @@ -1852,7 +1842,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -2075,9 +2065,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e50f3adc76d6a43f5ed73b698a87d0760ca74617f60f7c3b879003536fdd28" +checksum = "140206b78fb2bc3edbcfc9b5ccbd0b30699cfe8d348b8b31b330e47df5291a5a" [[package]] name = "ecdsa" @@ -2116,9 +2106,9 @@ dependencies = [ [[package]] name = "either" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" [[package]] name = "elliptic-curve" @@ -2372,13 +2362,11 @@ checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e" [[package]] name = "flate2" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ - "cfg-if 1.0.0", "crc32fast", - "libc", "libz-sys", "miniz_oxide", ] @@ -2392,7 +2380,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", ] @@ -2410,7 +2398,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "frame-system", @@ -2432,7 +2420,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "Inflector", "chrono", @@ -2482,7 +2470,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2493,7 +2481,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2509,7 +2497,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "frame-system", @@ -2537,7 +2525,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "bitflags", "frame-metadata", @@ -2567,7 +2555,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "Inflector", "frame-support-procedural-tools", @@ -2579,7 +2567,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2591,7 +2579,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "proc-macro2", "quote", @@ -2601,7 +2589,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "log", @@ -2618,7 +2606,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -2633,7 +2621,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", "sp-api", @@ -2642,7 +2630,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "sp-api", @@ -2853,13 +2841,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi 0.10.0+wasi-snapshot-preview1", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -2891,9 +2879,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "globset" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd" +checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a" dependencies = [ "aho-corasick", "bstr", @@ -2946,9 +2934,9 @@ dependencies = [ [[package]] name = "handlebars" -version = "4.3.0" +version = "4.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d113a9853e5accd30f43003560b5563ffbb007e3f325e8b103fa0d0029c6e6df" +checksum = "b66d0c1b6e3abfd1e72818798925e16e02ed77e1b47f6c25a95a23b377ee4299" dependencies = [ "log", "pest", @@ -3077,9 +3065,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff8670570af52249509a86f5e3e18a08c60b177071826898fde8997cf5f6bfbb" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ "bytes", "fnv", @@ -3117,9 +3105,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.18" +version = "0.14.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" +checksum = "42dc3c131584288d375f2d07f822b0cb012d8c6fb899a5b9fdb3cb7eb9b6004f" dependencies = [ "bytes", "futures-channel", @@ -3177,9 +3165,9 @@ dependencies = [ [[package]] name = "if-watch" -version = "1.0.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8f4a3c3d4c89351ca83e120c1c00b27df945d38e05695668c9d4b4f7bc52f3" +checksum = "015a7df1eb6dda30df37f34b63ada9b7b352984b0e84de2a20ed526345000791" dependencies = [ "async-io", "core-foundation", @@ -3224,12 +3212,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.8.1" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", - "hashbrown 0.11.2", + "hashbrown 0.12.1", "serde", ] @@ -3244,9 +3232,9 @@ dependencies = [ [[package]] name = "integer-encoding" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e85a1509a128c855368e135cffcde7eac17d8e1083f41e2b98c58bc1a5074be" +checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02" [[package]] name = "integer-sqrt" @@ -3319,9 +3307,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.57" +version = "0.3.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" +checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" dependencies = [ "wasm-bindgen", ] @@ -3378,7 +3366,7 @@ dependencies = [ "futures-util", "hyper", "jsonrpsee-types", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "rand 0.8.5", "rustc-hash", "serde", @@ -3482,8 +3470,8 @@ checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" [[package]] name = "kusama-runtime" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "beefy-primitives", "bitvec", @@ -3575,8 +3563,8 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "frame-support", "polkadot-primitives", @@ -3612,7 +3600,7 @@ checksum = "ece7e668abd21387aeb6628130a6f4c802787f014fa46bc83221448322250357" dependencies = [ "kvdb", "parity-util-mem", - "parking_lot 0.12.0", + "parking_lot 0.12.1", ] [[package]] @@ -3627,7 +3615,7 @@ dependencies = [ "num_cpus", "owning_ref", "parity-util-mem", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "regex", "rocksdb", "smallvec", @@ -3679,19 +3667,18 @@ checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db" [[package]] name = "libp2p" -version = "0.44.0" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "475ce2ac4a9727e53a519f6ee05b38abfcba8f0d39c4d24f103d184e36fd5b0f" +checksum = "41726ee8f662563fafba2d2d484b14037cc8ecb8c953fbfc8439d4ce3a0a9029" dependencies = [ - "atomic", "bytes", "futures 0.3.21", "futures-timer", - "getrandom 0.2.6", + "getrandom 0.2.7", "instant", "lazy_static", "libp2p-autonat", - "libp2p-core", + "libp2p-core 0.33.0", "libp2p-deflate", "libp2p-dns", "libp2p-floodsub", @@ -3716,7 +3703,7 @@ dependencies = [ "libp2p-websocket", "libp2p-yamux", "multiaddr", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "pin-project 1.0.10", "rand 0.7.3", "smallvec", @@ -3724,20 +3711,20 @@ dependencies = [ [[package]] name = "libp2p-autonat" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13b690e65046af6a09c0b27bd9508fa1cab0efce889de74b0b643b9d2a98f9a" +checksum = "1d45945fd2f96c4b133c23d5c28a8b7fc8d7138e6dd8d5a8cd492dd384f888e3" dependencies = [ "async-trait", "futures 0.3.21", "futures-timer", "instant", - "libp2p-core", + "libp2p-core 0.33.0", "libp2p-request-response", "libp2p-swarm", "log", - "prost 0.9.0", - "prost-build", + "prost 0.10.4", + "prost-build 0.10.4", "rand 0.8.5", ] @@ -3756,18 +3743,52 @@ dependencies = [ "futures-timer", "instant", "lazy_static", - "libsecp256k1", "log", "multiaddr", "multihash", "multistream-select", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "pin-project 1.0.10", "prost 0.9.0", - "prost-build", + "prost-build 0.9.0", "rand 0.8.5", "ring", - "rw-stream-sink", + "rw-stream-sink 0.2.1", + "sha2 0.10.2", + "smallvec", + "thiserror", + "unsigned-varint", + "void", + "zeroize", +] + +[[package]] +name = "libp2p-core" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d46fca305dee6757022e2f5a4f6c023315084d0ed7441c3ab244e76666d979" +dependencies = [ + "asn1_der", + "bs58", + "ed25519-dalek", + "either", + "fnv", + "futures 0.3.21", + "futures-timer", + "instant", + "lazy_static", + "libsecp256k1", + "log", + "multiaddr", + "multihash", + "multistream-select", + "parking_lot 0.12.1", + "pin-project 1.0.10", + "prost 0.10.4", + "prost-build 0.10.4", + "rand 0.8.5", + "ring", + "rw-stream-sink 0.3.0", "sha2 0.10.2", "smallvec", "thiserror", @@ -3778,52 +3799,53 @@ dependencies = [ [[package]] name = "libp2p-deflate" -version = "0.32.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1d37f042f748e224f04785d0e987ae09a2aa518d6401d82d412dad83e360ed" +checksum = "86adefc55ea4ed8201149f052fb441210727481dff1fb0b8318460206a79f5fb" dependencies = [ "flate2", "futures 0.3.21", - "libp2p-core", + "libp2p-core 0.33.0", ] [[package]] name = "libp2p-dns" -version = "0.32.1" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "066e33e854e10b5c93fc650458bf2179c7e0d143db260b0963e44a94859817f1" +checksum = "fbb462ec3a51fab457b4b44ac295e8b0a4b04dc175127e615cf996b1f0f1a268" dependencies = [ "async-std-resolver", "futures 0.3.21", - "libp2p-core", + "libp2p-core 0.33.0", "log", + "parking_lot 0.12.1", "smallvec", "trust-dns-resolver", ] [[package]] name = "libp2p-floodsub" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733d3ea6ebe7a7a85df2bc86678b93f24b015fae5fe3b3acc4c400e795a55d2d" +checksum = "a505d0c6f851cbf2919535150198e530825def8bd3757477f13dc3a57f46cbcc" dependencies = [ "cuckoofilter", "fnv", "futures 0.3.21", - "libp2p-core", + "libp2p-core 0.33.0", "libp2p-swarm", "log", - "prost 0.9.0", - "prost-build", + "prost 0.10.4", + "prost-build 0.10.4", "rand 0.7.3", "smallvec", ] [[package]] name = "libp2p-gossipsub" -version = "0.37.0" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a90c989a7c0969c2ab63e898da9bc735e3be53fb4f376e9c045ce516bcc9f928" +checksum = "43e064ba4d7832e01c738626c6b274ae100baba05f5ffcc7b265c2a3ed398108" dependencies = [ "asynchronous-codec", "base64", @@ -3833,12 +3855,12 @@ dependencies = [ "futures 0.3.21", "hex_fmt", "instant", - "libp2p-core", + "libp2p-core 0.33.0", "libp2p-swarm", "log", "prometheus-client", - "prost 0.9.0", - "prost-build", + "prost 0.10.4", + "prost-build 0.10.4", "rand 0.7.3", "regex", "sha2 0.10.2", @@ -3849,28 +3871,32 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.35.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5ef5a5b57904c7c33d6713ef918d239dc6b7553458f3475d87f8a18e9c651c8" +checksum = "b84b53490442d086db1fa5375670c9666e79143dccadef3f7c74a4346899a984" dependencies = [ + "asynchronous-codec", "futures 0.3.21", "futures-timer", - "libp2p-core", + "libp2p-core 0.33.0", "libp2p-swarm", "log", - "lru 0.7.5", - "prost 0.9.0", - "prost-build", + "lru 0.7.7", + "prost 0.10.4", + "prost-build 0.10.4", + "prost-codec", "smallvec", + "thiserror", + "void", ] [[package]] name = "libp2p-kad" -version = "0.36.0" +version = "0.37.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "564e6bd64d177446399ed835b9451a8825b07929d6daa6a94e6405592974725e" +checksum = "5f6b5d4de90fcd35feb65ea6223fd78f3b747a64ca4b65e0813fbe66a27d56aa" dependencies = [ - "arrayvec 0.5.2", + "arrayvec 0.7.2", "asynchronous-codec", "bytes", "either", @@ -3878,11 +3904,11 @@ dependencies = [ "futures 0.3.21", "futures-timer", "instant", - "libp2p-core", + "libp2p-core 0.33.0", "libp2p-swarm", "log", - "prost 0.9.0", - "prost-build", + "prost 0.10.4", + "prost-build 0.10.4", "rand 0.7.3", "sha2 0.10.2", "smallvec", @@ -3894,9 +3920,9 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611ae873c8e280ccfab0d57c7a13cac5644f364529e233114ff07863946058b0" +checksum = "4783f8cf00c7b6c1ff0f1870b4fcf50b042b45533d2e13b6fb464caf447a6951" dependencies = [ "async-io", "data-encoding", @@ -3904,7 +3930,7 @@ dependencies = [ "futures 0.3.21", "if-watch", "lazy_static", - "libp2p-core", + "libp2p-core 0.33.0", "libp2p-swarm", "log", "rand 0.8.5", @@ -3915,11 +3941,11 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.5.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985be799bb3796e0c136c768208c3c06604a38430571906a13dcfeda225a3b9d" +checksum = "564a7e5284d7d9b3140fdfc3cb6567bc32555e86a21de5604c2ec85da05cf384" dependencies = [ - "libp2p-core", + "libp2p-core 0.33.0", "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", @@ -3931,17 +3957,17 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.32.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "442eb0c9fff0bf22a34f015724b4143ce01877e079ed0963c722d94c07c72160" +checksum = "5ff9c893f2367631a711301d703c47432af898c9bb8253bea0e2c051a13f7640" dependencies = [ "asynchronous-codec", "bytes", "futures 0.3.21", - "libp2p-core", + "libp2p-core 0.33.0", "log", "nohash-hasher", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "rand 0.7.3", "smallvec", "unsigned-varint", @@ -3949,18 +3975,18 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd7e0c94051cda67123be68cf6b65211ba3dde7277be9068412de3e7ffd63ef" +checksum = "cf2cee1dad1c83325bbd182a8e94555778699cec8a9da00086efb7522c4c15ad" dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures 0.3.21", "lazy_static", - "libp2p-core", + "libp2p-core 0.33.0", "log", - "prost 0.9.0", - "prost-build", + "prost 0.10.4", + "prost-build 0.10.4", "rand 0.8.5", "sha2 0.10.2", "snow", @@ -3971,14 +3997,14 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf57a3c2e821331dda9fe612d4654d676ab6e33d18d9434a18cced72630df6ad" +checksum = "d41516c82fe8dd148ec925eead0c5ec08a0628f7913597e93e126e4dfb4e0787" dependencies = [ "futures 0.3.21", "futures-timer", "instant", - "libp2p-core", + "libp2p-core 0.33.0", "libp2p-swarm", "log", "rand 0.7.3", @@ -3987,17 +4013,17 @@ dependencies = [ [[package]] name = "libp2p-plaintext" -version = "0.32.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962c0fb0e7212fb96a69b87f2d09bcefd317935239bdc79cda900e7a8897a3fe" +checksum = "db007e737adc5d28b2e03223b0210164928ad742591127130796a72aa8eaf54f" dependencies = [ "asynchronous-codec", "bytes", "futures 0.3.21", - "libp2p-core", + "libp2p-core 0.33.0", "log", - "prost 0.9.0", - "prost-build", + "prost 0.10.4", + "prost-build 0.10.4", "unsigned-varint", "void", ] @@ -4018,9 +4044,9 @@ dependencies = [ [[package]] name = "libp2p-relay" -version = "0.8.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3aa754cb7bccef51ebc3c458c6bbcef89d83b578a9925438389be841527d408f" +checksum = "624ead3406f64437a0d4567c31bd128a9a0b8226d5f16c074038f5d0fc32f650" dependencies = [ "asynchronous-codec", "bytes", @@ -4028,36 +4054,36 @@ dependencies = [ "futures 0.3.21", "futures-timer", "instant", - "libp2p-core", + "libp2p-core 0.33.0", "libp2p-swarm", "log", "pin-project 1.0.10", - "prost 0.9.0", - "prost-build", + "prost 0.10.4", + "prost-build 0.10.4", + "prost-codec", "rand 0.8.5", "smallvec", "static_assertions", "thiserror", - "unsigned-varint", "void", ] [[package]] name = "libp2p-rendezvous" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd0baab894c5b84da510b915d53264d566c3c35889f09931fe9edbd2a773bee" +checksum = "c59967ea2db2c7560f641aa58ac05982d42131863fcd3dd6dcf0dd1daf81c60c" dependencies = [ "asynchronous-codec", "bimap", "futures 0.3.21", "futures-timer", "instant", - "libp2p-core", + "libp2p-core 0.33.0", "libp2p-swarm", "log", - "prost 0.9.0", - "prost-build", + "prost 0.10.4", + "prost-build 0.10.4", "rand 0.8.5", "sha2 0.10.2", "thiserror", @@ -4067,15 +4093,15 @@ dependencies = [ [[package]] name = "libp2p-request-response" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6a6fc6c9ad95661f46989473b34bd2993d14a4de497ff3b2668a910d4b869" +checksum = "b02e0acb725e5a757d77c96b95298fd73a7394fe82ba7b8bbeea510719cbe441" dependencies = [ "async-trait", "bytes", "futures 0.3.21", "instant", - "libp2p-core", + "libp2p-core 0.33.0", "libp2p-swarm", "log", "rand 0.7.3", @@ -4085,16 +4111,16 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.35.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f0c69ad9e8f7c5fc50ad5ad9c7c8b57f33716532a2b623197f69f93e374d14c" +checksum = "8f4bb21c5abadbf00360c734f16bf87f1712ed4f23cd46148f625d2ddb867346" dependencies = [ "either", "fnv", "futures 0.3.21", "futures-timer", "instant", - "libp2p-core", + "libp2p-core 0.33.0", "log", "pin-project 1.0.10", "rand 0.7.3", @@ -4105,9 +4131,9 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.27.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf2fe8c80b43561355f4d51875273b5b6dfbac37952e8f64b1270769305c9d7" +checksum = "4f693c8c68213034d472cbb93a379c63f4f307d97c06f1c41e4985de481687a5" dependencies = [ "quote", "syn", @@ -4115,9 +4141,9 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.32.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193447aa729c85aac2376828df76d171c1a589c9e6b58fcc7f9d9a020734122c" +checksum = "4f4933e38ef21b50698aefc87799c24f2a365c9d3f6cf50471f3f6a0bc410892" dependencies = [ "async-io", "futures 0.3.21", @@ -4125,7 +4151,7 @@ dependencies = [ "if-watch", "ipnet", "libc", - "libp2p-core", + "libp2p-core 0.33.0", "log", "socket2", ] @@ -4138,19 +4164,19 @@ checksum = "24bdab114f7f2701757d6541266e1131b429bbae382008f207f2114ee4222dcb" dependencies = [ "async-std", "futures 0.3.21", - "libp2p-core", + "libp2p-core 0.32.1", "log", ] [[package]] name = "libp2p-wasm-ext" -version = "0.32.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f6ea0f84a967ef59a16083f222c18115ae2e91db69809dce275df62e101b279" +checksum = "f066f2b8b1a1d64793f05da2256e6842ecd0293d6735ca2e9bda89831a1bdc06" dependencies = [ "futures 0.3.21", "js-sys", - "libp2p-core", + "libp2p-core 0.33.0", "parity-send-wrapper", "wasm-bindgen", "wasm-bindgen-futures", @@ -4158,17 +4184,18 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.34.0" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c932834c3754501c368d1bf3d0fb458487a642b90fc25df082a3a2f3d3b32e37" +checksum = "39d398fbb29f432c4128fabdaac2ed155c3bcaf1b9bd40eeeb10a471eefacbf5" dependencies = [ "either", "futures 0.3.21", "futures-rustls", - "libp2p-core", + "libp2p-core 0.33.0", "log", + "parking_lot 0.12.1", "quicksink", - "rw-stream-sink", + "rw-stream-sink 0.3.0", "soketto", "url", "webpki-roots", @@ -4176,13 +4203,13 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be902ebd89193cd020e89e89107726a38cfc0d16d18f613f4a37d046e92c7517" +checksum = "8fe653639ad74877c759720febb0cbcbf4caa221adde4eed2d3126ce5c6f381f" dependencies = [ "futures 0.3.21", - "libp2p-core", - "parking_lot 0.12.0", + "libp2p-core 0.33.0", + "parking_lot 0.12.1", "thiserror", "yamux", ] @@ -4252,9 +4279,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.6" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e7e15d7610cce1d9752e137625f14e61a28cd45929b6e12e47b50fe154ee2e" +checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" dependencies = [ "cc", "pkg-config", @@ -4263,9 +4290,9 @@ dependencies = [ [[package]] name = "linked-hash-map" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linked_hash_set" @@ -4323,9 +4350,9 @@ dependencies = [ [[package]] name = "lru" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32613e41de4c47ab04970c348ca7ae7382cf116625755af070b008a15516a889" +checksum = "c84e6fe5655adc6ce00787cf7dcaf8dc4f998a0565d23eafc207a8b08ca3349a" dependencies = [ "hashbrown 0.11.2", ] @@ -4430,9 +4457,9 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057a3db23999c867821a7a59feb06a578fcb03685e983dff90daf9e7d24ac08f" +checksum = "d5172b50c23043ff43dd53e51392f36519d9b35a8f3a410d30ece5d1aedd58ae" dependencies = [ "libc", ] @@ -4503,18 +4530,18 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" dependencies = [ "libc", "log", @@ -4618,7 +4645,7 @@ dependencies = [ "matrixmultiply", "nalgebra-macros", "num-complex", - "num-rational 0.4.0", + "num-rational 0.4.1", "num-traits", "rand 0.8.5", "rand_distr", @@ -4666,9 +4693,9 @@ dependencies = [ [[package]] name = "netlink-packet-route" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733ea73609acfd7fa7ddadfb7bf709b0471668c456ad9513685af543a06342b2" +checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" dependencies = [ "anyhow", "bitflags", @@ -4692,23 +4719,24 @@ dependencies = [ [[package]] name = "netlink-proto" -version = "0.9.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8785b8141e8432aa45fceb922a7e876d7da3fad37fa7e7ec702ace3aa0826b" +checksum = "65b4b14489ab424703c092062176d52ba55485a89c076b4f9db05092b7223aa6" dependencies = [ "bytes", "futures 0.3.21", "log", "netlink-packet-core", "netlink-sys", + "thiserror", "tokio", ] [[package]] name = "netlink-sys" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c9f9547a08241bee7b6558b9b98e1f290d187de8b7cfca2bbb4937bcaa8f8" +checksum = "92b654097027250401127914afb37cb1f311df6610a9891ff07a757e94199027" dependencies = [ "async-io", "bytes", @@ -4719,15 +4747,13 @@ dependencies = [ [[package]] name = "nix" -version = "0.22.3" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" +checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9" dependencies = [ "bitflags", - "cc", "cfg-if 1.0.0", "libc", - "memoffset", ] [[package]] @@ -4765,9 +4791,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fbc387afefefd5e9e39493299f3069e14a140dd34dc19b4c1c1a8fddb6a790" +checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" dependencies = [ "num-traits", ] @@ -4806,9 +4832,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", "num-integer", @@ -4882,7 +4908,7 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "orchestra" version = "0.0.1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "async-trait", "dyn-clonable", @@ -4898,7 +4924,7 @@ dependencies = [ [[package]] name = "orchestra-proc-macro" version = "0.0.1" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "expander 0.0.6", "petgraph", @@ -4919,9 +4945,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.0.1" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d8d0b2f198229de29dca79676f2738ff952edf3fde542eb8bf94d8c21b435" +checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" [[package]] name = "owning_ref" @@ -4935,7 +4961,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "frame-system", @@ -4951,7 +4977,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "frame-system", @@ -4967,7 +4993,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "frame-system", @@ -4982,7 +5008,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5006,7 +5032,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5026,7 +5052,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5041,7 +5067,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "beefy-primitives", "frame-support", @@ -5057,7 +5083,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "beefy-merkle-tree", "beefy-primitives", @@ -5080,7 +5106,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5098,7 +5124,7 @@ dependencies = [ [[package]] name = "pallet-bridge-dispatch" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bp-message-dispatch", "bp-runtime", @@ -5115,7 +5141,7 @@ dependencies = [ [[package]] name = "pallet-bridge-grandpa" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bp-header-chain", "bp-runtime", @@ -5137,7 +5163,7 @@ dependencies = [ [[package]] name = "pallet-bridge-messages" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bitvec", "bp-message-dispatch", @@ -5158,7 +5184,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5177,7 +5203,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5197,7 +5223,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5214,7 +5240,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5230,7 +5256,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5253,7 +5279,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5266,7 +5292,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5284,7 +5310,7 @@ dependencies = [ [[package]] name = "pallet-gilt" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5299,7 +5325,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5322,7 +5348,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5338,7 +5364,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5358,7 +5384,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5375,7 +5401,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5392,7 +5418,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "ckb-merkle-mountain-range", "frame-benchmarking", @@ -5410,7 +5436,7 @@ dependencies = [ [[package]] name = "pallet-mmr-rpc" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -5425,7 +5451,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5440,7 +5466,7 @@ dependencies = [ [[package]] name = "pallet-nicks" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "frame-system", @@ -5454,7 +5480,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "frame-system", @@ -5470,7 +5496,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5489,7 +5515,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "frame-system", @@ -5506,7 +5532,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5529,7 +5555,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5545,7 +5571,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5560,7 +5586,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5575,7 +5601,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5591,7 +5617,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "frame-system", @@ -5612,7 +5638,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5628,7 +5654,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "frame-system", @@ -5642,7 +5668,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5665,7 +5691,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5676,7 +5702,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "log", "sp-arithmetic", @@ -5685,7 +5711,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "frame-system", @@ -5714,7 +5740,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5732,7 +5758,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5751,7 +5777,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-support", "frame-system", @@ -5767,7 +5793,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -5782,7 +5808,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -5793,7 +5819,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5810,7 +5836,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5826,7 +5852,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-benchmarking", "frame-support", @@ -5840,8 +5866,8 @@ dependencies = [ [[package]] name = "pallet-xcm" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "frame-support", "frame-system", @@ -5858,8 +5884,8 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5876,7 +5902,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.23#e5889f1d71975a192c98fa43b1c18c94ffda3bbd" +source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.24#95ca5a085727c1494ddeeae4a2b2e69c4ee1933b" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -6012,9 +6038,9 @@ dependencies = [ [[package]] name = "parity-db" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55a7901b85874402471e131de3332dde0e51f38432c69a3853627c8e25433048" +checksum = "966eb23bd3a09758b8dac09f82b9d417c00f14e5d46171bf04cffdd9cb2e1eb1" dependencies = [ "blake2-rfc", "crc32fast", @@ -6031,9 +6057,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.1.2" +version = "3.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8b44461635bbb1a0300f100a841e571e7d919c81c73075ef5d152ffdb521066" +checksum = "9182e4a71cae089267ab03e67c99368db7cd877baf50f931e5d6d4b71e195ac0" dependencies = [ "arrayvec 0.7.2", "bitvec", @@ -6045,9 +6071,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.2" +version = "3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c45ed1f39709f5a89338fab50e59816b2e8815f5bb58276e7ddf9afd495f73f8" +checksum = "9299338969a3d2f491d65f140b00ddec470858402f888af98e8642fb5e8965cd" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6071,7 +6097,7 @@ dependencies = [ "hashbrown 0.12.1", "impl-trait-for-tuples", "parity-util-mem-derive", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "primitive-types", "smallvec", "winapi", @@ -6122,9 +6148,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", "parking_lot_core 0.9.3", @@ -6238,9 +6264,9 @@ dependencies = [ [[package]] name = "petgraph" -version = "0.6.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f" +checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" dependencies = [ "fixedbitset", "indexmap", @@ -6318,8 +6344,8 @@ checksum = "e8d0eef3571242013a0d5dc84861c3ae4a652e56e12adf8bdc26ff5f8cb34c94" [[package]] name = "polkadot-approval-distribution" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "futures 0.3.21", "polkadot-node-network-protocol", @@ -6333,8 +6359,8 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "futures 0.3.21", "polkadot-node-network-protocol", @@ -6347,13 +6373,13 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "derive_more", "fatality", "futures 0.3.21", - "lru 0.7.5", + "lru 0.7.7", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -6370,12 +6396,12 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "fatality", "futures 0.3.21", - "lru 0.7.5", + "lru 0.7.7", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -6391,8 +6417,8 @@ dependencies = [ [[package]] name = "polkadot-cli" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "clap", "frame-benchmarking-cli", @@ -6416,8 +6442,8 @@ dependencies = [ [[package]] name = "polkadot-client" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "beefy-primitives", "frame-benchmarking", @@ -6456,8 +6482,8 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "always-assert", "fatality", @@ -6477,8 +6503,8 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "parity-scale-codec", "parity-util-mem", @@ -6490,13 +6516,13 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "derive_more", "fatality", "futures 0.3.21", - "lru 0.7.5", + "lru 0.7.7", "parity-scale-codec", "polkadot-erasure-coding", "polkadot-node-network-protocol", @@ -6513,8 +6539,8 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -6527,8 +6553,8 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "futures 0.3.21", "futures-timer", @@ -6547,15 +6573,15 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "always-assert", "async-trait", "bytes", "futures 0.3.21", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "polkadot-node-network-protocol", "polkadot-node-subsystem", "polkadot-node-subsystem-util", @@ -6568,8 +6594,8 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "futures 0.3.21", "parity-scale-codec", @@ -6586,15 +6612,15 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bitvec", "derive_more", "futures 0.3.21", "futures-timer", "kvdb", - "lru 0.7.5", + "lru 0.7.7", "merlin", "parity-scale-codec", "polkadot-node-jaeger", @@ -6615,8 +6641,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bitvec", "futures 0.3.21", @@ -6635,8 +6661,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bitvec", "fatality", @@ -6654,8 +6680,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "futures 0.3.21", "polkadot-node-subsystem", @@ -6669,8 +6695,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "async-trait", "futures 0.3.21", @@ -6687,8 +6713,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "futures 0.3.21", "polkadot-node-subsystem", @@ -6702,8 +6728,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "futures 0.3.21", "futures-timer", @@ -6719,13 +6745,13 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "fatality", "futures 0.3.21", "kvdb", - "lru 0.7.5", + "lru 0.7.7", "parity-scale-codec", "polkadot-node-primitives", "polkadot-node-subsystem", @@ -6738,8 +6764,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "async-trait", "futures 0.3.21", @@ -6755,8 +6781,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bitvec", "fatality", @@ -6773,8 +6799,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "always-assert", "assert_matches", @@ -6804,8 +6830,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "futures 0.3.21", "polkadot-node-primitives", @@ -6820,8 +6846,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "futures 0.3.21", "memory-lru", @@ -6837,15 +6863,15 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "async-std", "lazy_static", "log", "mick-jaeger", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "polkadot-node-primitives", "polkadot-primitives", "sc-network", @@ -6855,8 +6881,8 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bs58", "futures 0.3.21", @@ -6874,8 +6900,8 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "async-trait", "derive_more", @@ -6888,15 +6914,15 @@ dependencies = [ "rand 0.8.5", "sc-authority-discovery", "sc-network", - "strum 0.24.0", + "strum 0.24.1", "thiserror", "tracing-gum", ] [[package]] name = "polkadot-node-primitives" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bounded-vec", "futures 0.3.21", @@ -6917,8 +6943,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -6927,8 +6953,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "derive_more", "futures 0.3.21", @@ -6946,8 +6972,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "async-trait", "derive_more", @@ -6955,7 +6981,7 @@ dependencies = [ "futures 0.3.21", "itertools", "kvdb", - "lru 0.7.5", + "lru 0.7.7", "parity-db", "parity-scale-codec", "parity-util-mem", @@ -6979,15 +7005,15 @@ dependencies = [ [[package]] name = "polkadot-overseer" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "futures 0.3.21", "futures-timer", - "lru 0.7.5", + "lru 0.7.7", "orchestra", "parity-util-mem", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "polkadot-node-metrics", "polkadot-node-network-protocol", "polkadot-node-primitives", @@ -7001,8 +7027,8 @@ dependencies = [ [[package]] name = "polkadot-parachain" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "derive_more", "frame-support", @@ -7018,8 +7044,8 @@ dependencies = [ [[package]] name = "polkadot-performance-test" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "env_logger", "kusama-runtime", @@ -7033,8 +7059,8 @@ dependencies = [ [[package]] name = "polkadot-primitives" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bitvec", "frame-system", @@ -7063,8 +7089,8 @@ dependencies = [ [[package]] name = "polkadot-rpc" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "beefy-gadget", "beefy-gadget-rpc", @@ -7095,8 +7121,8 @@ dependencies = [ [[package]] name = "polkadot-runtime" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "beefy-primitives", "bitvec", @@ -7181,8 +7207,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "beefy-primitives", "bitvec", @@ -7228,8 +7254,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "frame-support", "polkadot-primitives", @@ -7240,8 +7266,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bs58", "parity-scale-codec", @@ -7252,8 +7278,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "bitflags", "bitvec", @@ -7295,8 +7321,8 @@ dependencies = [ [[package]] name = "polkadot-service" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "async-trait", "beefy-gadget", @@ -7307,7 +7333,7 @@ dependencies = [ "kusama-runtime", "kvdb", "kvdb-rocksdb", - "lru 0.7.5", + "lru 0.7.7", "pallet-babe", "pallet-im-online", "pallet-staking", @@ -7398,8 +7424,8 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -7419,8 +7445,8 @@ dependencies = [ [[package]] name = "polkadot-statement-table" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -7485,7 +7511,7 @@ dependencies = [ [[package]] name = "prioritized-metered-channel" version = "0.2.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "coarsetime", "crossbeam-queue", @@ -7533,9 +7559,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.39" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" dependencies = [ "unicode-ident", ] @@ -7550,15 +7576,15 @@ dependencies = [ "fnv", "lazy_static", "memchr", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "thiserror", ] [[package]] name = "prometheus-client" -version = "0.15.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a896938cc6018c64f279888b8c7559d3725210d5db9a3a1ee6bc7188d51d34" +checksum = "ac1abe0255c04d15f571427a2d1e00099016506cf3297b53853acd2b7eb87825" dependencies = [ "dtoa", "itoa 1.0.2", @@ -7611,12 +7637,47 @@ dependencies = [ "multimap", "petgraph", "prost 0.9.0", - "prost-types", + "prost-types 0.9.0", + "regex", + "tempfile", + "which", +] + +[[package]] +name = "prost-build" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae5a4388762d5815a9fc0dea33c56b021cdc8dde0c55e0c9ca57197254b0cab" +dependencies = [ + "bytes", + "cfg-if 1.0.0", + "cmake", + "heck 0.4.0", + "itertools", + "lazy_static", + "log", + "multimap", + "petgraph", + "prost 0.10.4", + "prost-types 0.10.1", "regex", "tempfile", "which", ] +[[package]] +name = "prost-codec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00af1e92c33b4813cc79fda3f2dbf56af5169709be0202df730e9ebc3e4cd007" +dependencies = [ + "asynchronous-codec", + "bytes", + "prost 0.10.4", + "thiserror", + "unsigned-varint", +] + [[package]] name = "prost-derive" version = "0.9.0" @@ -7653,6 +7714,16 @@ dependencies = [ "prost 0.9.0", ] +[[package]] +name = "prost-types" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" +dependencies = [ + "bytes", + "prost 0.10.4", +] + [[package]] name = "psm" version = "0.1.18" @@ -7681,9 +7752,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" dependencies = [ "proc-macro2", ] @@ -7754,7 +7825,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", ] [[package]] @@ -7839,7 +7910,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.6", + "getrandom 0.2.7", "redox_syscall", "thiserror", ] @@ -7929,7 +8000,7 @@ dependencies = [ [[package]] name = "remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "env_logger", "jsonrpsee", @@ -8006,8 +8077,8 @@ dependencies = [ [[package]] name = "rococo-runtime" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "beefy-merkle-tree", "beefy-primitives", @@ -8083,8 +8154,8 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "frame-support", "polkadot-primitives", @@ -8105,9 +8176,9 @@ dependencies = [ [[package]] name = "rtnetlink" -version = "0.9.1" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f54290e54521dac3de4149d83ddf9f62a359b3cc93bcb494a794a41e6f4744b" +checksum = "322c53fd76a18698f1c27381d58091de3a043d356aa5bd0d510608b565f469a0" dependencies = [ "async-global-executor", "futures 0.3.21", @@ -8142,7 +8213,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.9", + "semver 1.0.12", ] [[package]] @@ -8194,9 +8265,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" +checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf" [[package]] name = "rw-stream-sink" @@ -8209,6 +8280,17 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "rw-stream-sink" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" +dependencies = [ + "futures 0.3.21", + "pin-project 1.0.10", + "static_assertions", +] + [[package]] name = "ryu" version = "1.0.10" @@ -8236,7 +8318,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "log", "sp-core", @@ -8247,7 +8329,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "futures 0.3.21", @@ -8257,7 +8339,7 @@ dependencies = [ "log", "parity-scale-codec", "prost 0.10.4", - "prost-build", + "prost-build 0.9.0", "rand 0.7.3", "sc-client-api", "sc-network", @@ -8274,7 +8356,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "futures-timer", @@ -8297,7 +8379,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -8313,10 +8395,10 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "impl-trait-for-tuples", - "memmap2 0.5.3", + "memmap2 0.5.4", "parity-scale-codec", "sc-chain-spec-derive", "sc-network", @@ -8330,7 +8412,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -8341,7 +8423,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "chrono", "clap", @@ -8380,14 +8462,14 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "fnv", "futures 0.3.21", "hash-db", "log", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "sc-executor", "sc-transaction-pool-api", "sc-utils", @@ -8408,7 +8490,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "hash-db", "kvdb", @@ -8418,7 +8500,7 @@ dependencies = [ "log", "parity-db", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "sc-client-api", "sc-state-db", "sp-arithmetic", @@ -8433,14 +8515,14 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "futures 0.3.21", "futures-timer", "libp2p", "log", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "sc-client-api", "sc-utils", "serde", @@ -8457,7 +8539,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "futures 0.3.21", @@ -8486,7 +8568,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "fork-tree", @@ -8497,7 +8579,7 @@ dependencies = [ "num-rational 0.2.4", "num-traits", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "rand 0.7.3", "retain_mut", "sc-client-api", @@ -8529,7 +8611,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "jsonrpsee", @@ -8551,7 +8633,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "fork-tree", "parity-scale-codec", @@ -8564,7 +8646,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "futures 0.3.21", @@ -8589,7 +8671,7 @@ dependencies = [ [[package]] name = "sc-consensus-uncles" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "sc-client-api", "sp-authorship", @@ -8600,12 +8682,12 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "lazy_static", - "lru 0.7.5", + "lru 0.7.7", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "sc-executor-common", "sc-executor-wasmi", "sc-executor-wasmtime", @@ -8627,7 +8709,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "environmental", "parity-scale-codec", @@ -8644,7 +8726,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "log", "parity-scale-codec", @@ -8659,7 +8741,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "cfg-if 1.0.0", "libc", @@ -8677,7 +8759,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "ahash", "async-trait", @@ -8689,7 +8771,7 @@ dependencies = [ "hex", "log", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "rand 0.8.5", "sc-block-builder", "sc-chain-spec", @@ -8717,7 +8799,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "finality-grandpa", "futures 0.3.21", @@ -8738,7 +8820,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "ansi_term", "futures 0.3.21", @@ -8755,11 +8837,11 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "hex", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "serde_json", "sp-application-crypto", "sp-core", @@ -8770,7 +8852,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "asynchronous-codec", @@ -8788,12 +8870,12 @@ dependencies = [ "linked-hash-map", "linked_hash_set", "log", - "lru 0.7.5", + "lru 0.7.7", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "pin-project 1.0.10", "prost 0.10.4", - "prost-build", + "prost-build 0.9.0", "rand 0.7.3", "sc-block-builder", "sc-client-api", @@ -8822,12 +8904,12 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "libp2p", "parity-scale-codec", - "prost-build", + "prost-build 0.9.0", "sc-peerset", "smallvec", ] @@ -8835,14 +8917,14 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "ahash", "futures 0.3.21", "futures-timer", "libp2p", "log", - "lru 0.7.5", + "lru 0.7.7", "sc-network", "sp-runtime", "substrate-prometheus-endpoint", @@ -8852,14 +8934,14 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "libp2p", "log", "parity-scale-codec", "prost 0.10.4", - "prost-build", + "prost-build 0.9.0", "sc-client-api", "sc-network-common", "sc-peerset", @@ -8872,7 +8954,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "bitflags", "either", @@ -8880,10 +8962,10 @@ dependencies = [ "futures 0.3.21", "libp2p", "log", - "lru 0.7.5", + "lru 0.7.7", "parity-scale-codec", "prost 0.10.4", - "prost-build", + "prost-build 0.9.0", "sc-client-api", "sc-consensus", "sc-network-common", @@ -8901,7 +8983,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "bytes", "fnv", @@ -8913,7 +8995,7 @@ dependencies = [ "num_cpus", "once_cell", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "rand 0.7.3", "sc-client-api", "sc-network", @@ -8929,7 +9011,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "libp2p", @@ -8942,7 +9024,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -8951,14 +9033,14 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "hash-db", "jsonrpsee", "log", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "sc-block-builder", "sc-chain-spec", "sc-client-api", @@ -8981,13 +9063,13 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "jsonrpsee", "log", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "sc-chain-spec", "sc-transaction-pool-api", "scale-info", @@ -9004,7 +9086,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "jsonrpsee", @@ -9017,7 +9099,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "directories", @@ -9029,7 +9111,7 @@ dependencies = [ "log", "parity-scale-codec", "parity-util-mem", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "pin-project 1.0.10", "rand 0.7.3", "sc-block-builder", @@ -9082,13 +9164,13 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "log", "parity-scale-codec", "parity-util-mem", "parity-util-mem-derive", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "sc-client-api", "sp-core", ] @@ -9096,7 +9178,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -9115,7 +9197,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "libc", @@ -9134,13 +9216,13 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "chrono", "futures 0.3.21", "libp2p", "log", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "pin-project 1.0.10", "rand 0.7.3", "serde", @@ -9152,7 +9234,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "ansi_term", "atty", @@ -9161,7 +9243,7 @@ dependencies = [ "libc", "log", "once_cell", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "regex", "rustc-hash", "sc-client-api", @@ -9183,7 +9265,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -9194,7 +9276,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "futures-timer", @@ -9202,7 +9284,7 @@ dependencies = [ "log", "parity-scale-codec", "parity-util-mem", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "retain_mut", "sc-client-api", "sc-transaction-pool-api", @@ -9221,7 +9303,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "log", @@ -9234,13 +9316,13 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "futures-timer", "lazy_static", "log", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "prometheus", ] @@ -9387,9 +9469,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.9" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb243bdfdb5936c8dc3c45762a19d12ab4550cdc753bc247637d4ec35a040fd" +checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" dependencies = [ "serde", ] @@ -9402,18 +9484,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.137" +version = "1.0.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.137" +version = "1.0.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c" dependencies = [ "proc-macro2", "quote", @@ -9422,9 +9504,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" dependencies = [ "itoa 1.0.2", "ryu", @@ -9587,8 +9669,8 @@ checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" [[package]] name = "slot-range-helper" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "enumn", "parity-scale-codec", @@ -9608,9 +9690,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "snap" @@ -9664,7 +9746,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "hash-db", "log", @@ -9681,7 +9763,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "blake2", "proc-macro-crate", @@ -9693,7 +9775,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", "scale-info", @@ -9706,7 +9788,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "integer-sqrt", "num-traits", @@ -9721,7 +9803,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", "scale-info", @@ -9734,7 +9816,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "parity-scale-codec", @@ -9746,7 +9828,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", "sp-api", @@ -9758,13 +9840,13 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "log", - "lru 0.7.5", + "lru 0.7.7", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "sp-api", "sp-consensus", "sp-database", @@ -9776,7 +9858,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "futures 0.3.21", @@ -9795,7 +9877,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "parity-scale-codec", @@ -9813,7 +9895,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "merlin", @@ -9836,7 +9918,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", "scale-info", @@ -9850,7 +9932,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", "scale-info", @@ -9863,7 +9945,7 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "base58", "bitflags", @@ -9883,7 +9965,7 @@ dependencies = [ "num-traits", "parity-scale-codec", "parity-util-mem", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "primitive-types", "rand 0.7.3", "regex", @@ -9909,7 +9991,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "blake2", "byteorder", @@ -9923,7 +10005,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "proc-macro2", "quote", @@ -9934,16 +10016,16 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "kvdb", - "parking_lot 0.12.0", + "parking_lot 0.12.1", ] [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "proc-macro2", "quote", @@ -9953,7 +10035,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "environmental", "parity-scale-codec", @@ -9964,7 +10046,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "finality-grandpa", "log", @@ -9982,7 +10064,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -9996,14 +10078,14 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures 0.3.21", "hash-db", "libsecp256k1", "log", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "secp256k1", "sp-core", "sp-externalities", @@ -10021,7 +10103,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "lazy_static", "sp-core", @@ -10032,13 +10114,13 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "futures 0.3.21", "merlin", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "schnorrkel", "serde", "sp-core", @@ -10049,7 +10131,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "thiserror", "zstd", @@ -10058,7 +10140,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "log", "parity-scale-codec", @@ -10073,7 +10155,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", "scale-info", @@ -10087,7 +10169,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "sp-api", "sp-core", @@ -10097,7 +10179,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "backtrace", "lazy_static", @@ -10107,7 +10189,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "rustc-hash", "serde", @@ -10117,7 +10199,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "either", "hash256-std-hasher", @@ -10139,7 +10221,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "impl-trait-for-tuples", "parity-scale-codec", @@ -10156,7 +10238,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "Inflector", "proc-macro-crate", @@ -10168,7 +10250,7 @@ dependencies = [ [[package]] name = "sp-sandbox" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "log", "parity-scale-codec", @@ -10182,7 +10264,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "serde", "serde_json", @@ -10191,7 +10273,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", "scale-info", @@ -10205,7 +10287,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", "scale-info", @@ -10216,13 +10298,13 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "hash-db", "log", "num-traits", "parity-scale-codec", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "rand 0.7.3", "smallvec", "sp-core", @@ -10238,12 +10320,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "impl-serde", "parity-scale-codec", @@ -10256,7 +10338,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "log", "sp-core", @@ -10269,7 +10351,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "futures-timer", @@ -10285,7 +10367,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", "sp-std", @@ -10297,7 +10379,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "sp-api", "sp-runtime", @@ -10306,7 +10388,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "async-trait", "log", @@ -10322,7 +10404,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "hash-db", "memory-db", @@ -10338,7 +10420,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "impl-serde", "parity-scale-codec", @@ -10355,7 +10437,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -10366,7 +10448,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "impl-trait-for-tuples", "log", @@ -10384,9 +10466,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "ss58-registry" -version = "1.19.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70850dd1812f04824cd78912213e56e616cb5225af02da94080c2ef5669ed718" +checksum = "77ef98aedad3dc52e10995e7ed15f1279e11d4da35795f5dac7305742d0feb66" dependencies = [ "Inflector", "num-format", @@ -10464,11 +10546,11 @@ dependencies = [ [[package]] name = "strum" -version = "0.24.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96acfc1b70604b8b2f1ffa4c57e59176c7dbb05d556c71ecd2f5498a1dee7f8" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" dependencies = [ - "strum_macros 0.24.0", + "strum_macros 0.24.2", ] [[package]] @@ -10486,9 +10568,9 @@ dependencies = [ [[package]] name = "strum_macros" -version = "0.24.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6878079b17446e4d3eba6192bb0a2950d5b14f0ed8424b852310e5a94345d0ef" +checksum = "4faebde00e8ff94316c01800f9054fd2ba77d30d9e922541913051d1d978918b" dependencies = [ "heck 0.4.0", "proc-macro2", @@ -10513,7 +10595,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "platforms", ] @@ -10521,7 +10603,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.21", @@ -10542,7 +10624,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "futures-util", "hyper", @@ -10555,7 +10637,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "jsonrpsee", "log", @@ -10576,7 +10658,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "ansi_term", "build-helper", @@ -10597,9 +10679,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.95" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbaf6116ab8924f39d52792136fb74fd60a80194cf1b1c6ffa6453eef1c3f942" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" dependencies = [ "proc-macro2", "quote", @@ -10795,9 +10877,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.18.2" +version = "1.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4903bf0427cf68dddd5aa6a93220756f8be0c34fcfa9f5e6191e103e15a31395" +checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439" dependencies = [ "bytes", "libc", @@ -10805,7 +10887,7 @@ dependencies = [ "mio", "num_cpus", "once_cell", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "pin-project-lite 0.2.9", "signal-hook-registry", "socket2", @@ -10815,9 +10897,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" dependencies = [ "proc-macro2", "quote", @@ -10837,9 +10919,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f988a1a1adc2fb21f9c12aa96441da33a1728193ae0b95d2be22dbd17fcb4e5c" +checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" dependencies = [ "bytes", "futures-core", @@ -10861,15 +10943,15 @@ dependencies = [ [[package]] name = "tower-service" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.34" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" +checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" dependencies = [ "cfg-if 1.0.0", "pin-project-lite 0.2.9", @@ -10879,9 +10961,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" +checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" dependencies = [ "proc-macro2", "quote", @@ -10890,11 +10972,11 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.26" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" +checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7" dependencies = [ - "lazy_static", + "once_cell", "valuable", ] @@ -10910,8 +10992,8 @@ dependencies = [ [[package]] name = "tracing-gum" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -10921,8 +11003,8 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "expander 0.0.6", "proc-macro-crate", @@ -10940,7 +11022,7 @@ dependencies = [ "ahash", "lazy_static", "log", - "lru 0.7.5", + "lru 0.7.7", "tracing-core", ] @@ -11035,7 +11117,7 @@ dependencies = [ "lazy_static", "log", "lru-cache", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "resolv-conf", "smallvec", "thiserror", @@ -11051,7 +11133,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.23#6cbe1772bf258793fa9845daa8f43ea0cadee596" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.24#814752f60ab8cce7e2ece3ce0c1b10799b4eab28" dependencies = [ "clap", "jsonrpsee", @@ -11132,15 +11214,15 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" +checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" dependencies = [ "tinyvec", ] @@ -11284,9 +11366,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" +checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -11294,9 +11376,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" +checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" dependencies = [ "bumpalo", "lazy_static", @@ -11309,9 +11391,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.30" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" +checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -11321,9 +11403,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" +checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -11331,9 +11413,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" +checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" dependencies = [ "proc-macro2", "quote", @@ -11344,9 +11426,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" +checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" [[package]] name = "wasm-gc-api" @@ -11584,9 +11666,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.57" +version = "0.3.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" +checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" dependencies = [ "js-sys", "wasm-bindgen", @@ -11622,8 +11704,8 @@ dependencies = [ [[package]] name = "westend-runtime" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "beefy-primitives", "bitvec", @@ -11711,8 +11793,8 @@ dependencies = [ [[package]] name = "westend-runtime-constants" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "frame-support", "polkadot-primitives", @@ -11771,15 +11853,15 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.29.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aac7fef12f4b59cd0a29339406cc9203ab44e440ddff6b3f5a41455349fa9cf3" +checksum = "45296b64204227616fdbf2614cefa4c236b98ee64dfaaaa435207ed99fe7829f" dependencies = [ - "windows_aarch64_msvc 0.29.0", - "windows_i686_gnu 0.29.0", - "windows_i686_msvc 0.29.0", - "windows_x86_64_gnu 0.29.0", - "windows_x86_64_msvc 0.29.0", + "windows_aarch64_msvc 0.34.0", + "windows_i686_gnu 0.34.0", + "windows_i686_msvc 0.34.0", + "windows_x86_64_gnu 0.34.0", + "windows_x86_64_msvc 0.34.0", ] [[package]] @@ -11797,9 +11879,9 @@ dependencies = [ [[package]] name = "windows_aarch64_msvc" -version = "0.29.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d027175d00b01e0cbeb97d6ab6ebe03b12330a35786cbaca5252b1c4bf5d9b" +checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" [[package]] name = "windows_aarch64_msvc" @@ -11809,9 +11891,9 @@ checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] name = "windows_i686_gnu" -version = "0.29.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8793f59f7b8e8b01eda1a652b2697d87b93097198ae85f823b969ca5b89bba58" +checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" [[package]] name = "windows_i686_gnu" @@ -11821,9 +11903,9 @@ checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] name = "windows_i686_msvc" -version = "0.29.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8602f6c418b67024be2996c512f5f995de3ba417f4c75af68401ab8756796ae4" +checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" [[package]] name = "windows_i686_msvc" @@ -11833,9 +11915,9 @@ checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] name = "windows_x86_64_gnu" -version = "0.29.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d615f419543e0bd7d2b3323af0d86ff19cbc4f816e6453f36a2c2ce889c354" +checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" [[package]] name = "windows_x86_64_gnu" @@ -11845,9 +11927,9 @@ checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] name = "windows_x86_64_msvc" -version = "0.29.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d95421d9ed3672c280884da53201a5c46b7b2765ca6faf34b0d71cf34a3561" +checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" [[package]] name = "windows_x86_64_msvc" @@ -11886,8 +11968,8 @@ dependencies = [ [[package]] name = "xcm" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "derivative", "impl-trait-for-tuples", @@ -11899,8 +11981,8 @@ dependencies = [ [[package]] name = "xcm-builder" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "frame-support", "frame-system", @@ -11919,8 +12001,8 @@ dependencies = [ [[package]] name = "xcm-executor" -version = "0.9.23" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +version = "0.9.24" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "frame-benchmarking", "frame-support", @@ -11938,7 +12020,7 @@ dependencies = [ [[package]] name = "xcm-procedural" version = "0.1.0" -source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.23#a7e188cd9665c735f4b9d5a58cdbc4dd1850eae0" +source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.24#22836e55d41eef24ed5917fd654ee82a683a7cfe" dependencies = [ "Inflector", "proc-macro2", @@ -11955,7 +12037,7 @@ dependencies = [ "futures 0.3.21", "log", "nohash-hasher", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "rand 0.8.5", "static_assertions", ] diff --git a/node/Cargo.toml b/node/Cargo.toml index 190d9ac..c51360c 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -26,64 +26,64 @@ jsonrpsee = { version = "0.13.1", features = ["server"] } parachain-template-runtime = { path = "../runtime" } # Substrate -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sc-cli = { git = "https://github.com/paritytech/substrate", features = ["wasmtime"] , branch = "polkadot-v0.9.23" } -sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sc-executor = { git = "https://github.com/paritytech/substrate", features = ["wasmtime"] , branch = "polkadot-v0.9.23" } -sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sc-service = { git = "https://github.com/paritytech/substrate", features = ["wasmtime"] , branch = "polkadot-v0.9.23" } -sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } -try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sc-cli = { git = "https://github.com/paritytech/substrate", features = ["wasmtime"] , branch = "polkadot-v0.9.24" } +sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sc-executor = { git = "https://github.com/paritytech/substrate", features = ["wasmtime"] , branch = "polkadot-v0.9.24" } +sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sc-service = { git = "https://github.com/paritytech/substrate", features = ["wasmtime"] , branch = "polkadot-v0.9.24" } +sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } +try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } # Polkadot -polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.23" } -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.23" } -polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.23" } -polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.23" } -xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.23" } +polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.24" } +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.24" } +polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.24" } +polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.24" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.24" } # Cumulus -cumulus-client-cli = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.23" } -cumulus-client-collator = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.23" } -cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.23" } -cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.23" } -cumulus-client-network = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.23" } -cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.23" } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.23" } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.23" } -cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.23" } -cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.23" } -cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.23" } +cumulus-client-cli = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" } +cumulus-client-collator = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" } +cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" } +cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" } +cumulus-client-network = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" } +cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" } +cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" } +cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" } +cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.24" } [build-dependencies] -substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } +substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } [features] default = [] @@ -91,4 +91,4 @@ runtime-benchmarks = [ "parachain-template-runtime/runtime-benchmarks", "polkadot-cli/runtime-benchmarks", ] -try-runtime = ["parachain-template-runtime/try-runtime"] +try-runtime = ["parachain-template-runtime/try-runtime"] \ No newline at end of file diff --git a/pallets/template/Cargo.toml b/pallets/template/Cargo.toml index 01085b7..2074b32 100644 --- a/pallets/template/Cargo.toml +++ b/pallets/template/Cargo.toml @@ -16,17 +16,17 @@ codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive scale-info = { version = "2.0.0", default-features = false, features = ["derive"] } # Substrate -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.23" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.24" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } [dev-dependencies] serde = { version = "1.0.132" } # Substrate -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } [features] default = ["std"] @@ -38,4 +38,4 @@ std = [ "frame-support/std", "frame-system/std", ] -try-runtime = [ "frame-support/try-runtime" ] +try-runtime = [ "frame-support/try-runtime" ] \ No newline at end of file diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 9be05cb..a3226cd 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -12,7 +12,7 @@ edition = "2021" targets = ["x86_64-unknown-linux-gnu"] [build-dependencies] -substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.23" } +substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } @@ -26,54 +26,54 @@ smallvec = "1.6.1" pallet-template = { path = "../pallets/template", default-features = false } # Substrate -frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.23" } -frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.23" } -frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.23" } -pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } -sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.23" } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.24" } +frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.24" } +frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.24" } +pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } # Polkadot -pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.23" } -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.23" } -polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.23" } -xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.23" } -xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.23" } -xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.23" } +pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.24" } +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.24" } +polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.24" } +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.24" } +xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.24" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.24" } # Cumulus -cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.23" } -cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.23" } -cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.23" } -cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.23" } -cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.23" } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.23" } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.23" } -cumulus-primitives-timestamp = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.23" } -cumulus-primitives-utility = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.23" } -pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.23" } -parachain-info = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.23" } +cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.24" } +cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.24" } +cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.24" } +cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.24" } +cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.24" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.24" } +cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.24" } +cumulus-primitives-timestamp = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.24" } +cumulus-primitives-utility = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.24" } +pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.24" } +parachain-info = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.24" } [features] default = [ @@ -147,4 +147,4 @@ runtime-benchmarks = [ try-runtime = [ "frame-executive/try-runtime", "frame-try-runtime", -] +] \ No newline at end of file From 1eb3f4980f0977d52abd1d36457111c34230173a Mon Sep 17 00:00:00 2001 From: Islam Date: Sun, 3 Jul 2022 21:56:48 +0000 Subject: [PATCH 06/36] build(local-setup): Automate manual parachain setup Scripts to prep and start relay nodes, and collator --- .gitignore | 3 ++- .gitpod.yml | 27 +++++++++++++-------------- scripts/prep-bins.sh | 2 -- scripts/prep-collator.sh | 25 +++++++++++++++++++++++++ scripts/prep-relay.sh | 25 +++++++++++++++++++++++++ scripts/start-collator.sh | 16 ++++++++++++++++ scripts/start-relay.sh | 30 ++++++++++++++++++++++++++++++ 7 files changed, 111 insertions(+), 17 deletions(-) delete mode 100755 scripts/prep-bins.sh create mode 100644 scripts/prep-collator.sh create mode 100755 scripts/prep-relay.sh create mode 100644 scripts/start-collator.sh create mode 100644 scripts/start-relay.sh diff --git a/.gitignore b/.gitignore index 1e0870f..3670510 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ .DS_Store .idea -.vscode \ No newline at end of file +.vscode +/ch_spec \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml index 48d0752..04870ac 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -2,19 +2,18 @@ image: file: .github/dockerfiles/Dockerfile.gitpod-base context: . tasks: - - name: Init bins - init: | - docker build --pull --rm -f ".github/dockerfiles/Dockerfile.collator" -t chocnet/parachain-collator "." && - gp sync-done collator - command: ./target/debug/parachain-collator - - name: Relay - init: | - sh ./scripts/prep-bins.sh - docker build --pull --rm -f ".github/dockerfiles/Dockerfile.relay" -t chocnet/polkadot-debug "." - rm -r bins - gp sync-done relay - - name: Test Net - init: gp sync-await collator && gp sync-await relay - command: zombienet spawn zombienet/config.toml -p native + - name: Collator + init: bash ./scripts/prep-collator.sh main && gp sync-await relay + command: ./scripts/start-collator.sh + - name: Relay Alice + init: bash ./scripts/prep-relay.sh + command: bash ./scripts/start-relay.sh + - name: Relay Bob + # Wait for alice + init: gp sync-await relay + command: bash ./scripts/start-relay.sh + # - name: Test Net + # init: gp sync-await collator && gp sync-await relay + # command: zombienet spawn zombienet/config.toml -p native diff --git a/scripts/prep-bins.sh b/scripts/prep-bins.sh deleted file mode 100755 index 9571029..0000000 --- a/scripts/prep-bins.sh +++ /dev/null @@ -1,2 +0,0 @@ -mkdir bins -cp ~/relay/polkadot/target/release/polkadot .github \ No newline at end of file diff --git a/scripts/prep-collator.sh b/scripts/prep-collator.sh new file mode 100644 index 0000000..329b343 --- /dev/null +++ b/scripts/prep-collator.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Prep bins for docker +function prepBins { + cargo build --release + find target/release -type f ! -name parachain-collator -exec rm {} + + + docker build --pull --rm -f ".github/dockerfiles/Dockerfile.collator" -t chocnet/parachain-collator "." && + gp sync-done collator +} + +# Export chain spec, etc to ch_spec dir. +function exportChainSpec { + mkdir ch_spec + ./target/release/parachain-collator build-spec --disable-default-bootnode > ch_spec/rococo-local-parachain-plain.json + ./target/release/parachain-collator build-spec --chain ch_spec/rococo-local-parachain-plain.json --raw --disable-default-bootnode > ch_spec/rococo-local-parachain-2000-raw.json + ./target/release/parachain-collator export-genesis-wasm --chain ch_spec/rococo-local-parachain-2000-raw.json > ch_spec/para-2000-wasm + ./target/release/parachain-collator export-genesis-state --chain ch_spec/rococo-local-parachain-2000-raw.json > ch_spec/para-2000-genesis +} + +function main { + prepBins + exportChainSpec +} +"$@" \ No newline at end of file diff --git a/scripts/prep-relay.sh b/scripts/prep-relay.sh new file mode 100755 index 0000000..599999a --- /dev/null +++ b/scripts/prep-relay.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Zombienet: Build relay image +function makeBins { + mkdir bins + cp ~/relay/polkadot/target/release/polkadot .github + docker build --pull --rm -f ".github/dockerfiles/Dockerfile.relay" -t chocnet/polkadot-debug "." + rm .github/polkadot + gp sync-done relay +} +# Setup files for local +function buildSpec { + cd ~/relay/polkadot + + ./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode > ./rococo-local.json + ./target/release/polkadot build-spec --chain ./rococo-local.json --disable-default-bootnode --raw > ./rococo-local-raw.json + +} + +function main { + makeBins + buildSpec +} + +"$@" \ No newline at end of file diff --git a/scripts/start-collator.sh b/scripts/start-collator.sh new file mode 100644 index 0000000..79aa8ec --- /dev/null +++ b/scripts/start-collator.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Run node1 +./target/release/parachain-collator \ +--alice \ +--collator \ +--force-authoring \ +--chain ch_spec/rococo-local-parachain-2000-raw.json \ +--base-path /tmp/parachain/alice \ +--port 40333 \ +--ws-port 8844 \ +-- \ +--execution wasm \ +--chain ~/relay/polkadot/rococo-local-raw.json \ +--port 30343 \ +--ws-port 9977 diff --git a/scripts/start-relay.sh b/scripts/start-relay.sh new file mode 100644 index 0000000..0c79201 --- /dev/null +++ b/scripts/start-relay.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +cd ~/relay/polkadot +# echo start alice command, +echo "Start Alice command" +echo "bash ./scripts/start-relay.sh alice" +echo "" + +function alice { + cd ~/relay/polkadot + ./target/release/polkadot --alice --validator --base-path /tmp/relay/alice --chain ./rococo-local-raw.json --port 30333 --ws-port 9944 +} +echo "Start Bob command" +echo "bash ./scripts/start-relay.sh bob --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/AliceAddr " +echo "" + +function bob { + cd ~/relay/polkadot + + ./target/release/polkadot \ + --bob \ + --validator \ + --base-path /tmp/relay-bob \ + --chain ./rococo-local-raw.json \ + --port 30334 \ + --ws-port 9945 \ + --bootnodes "$1" +} + +"$@" \ No newline at end of file From 8754213a04147562323018ebe697829cd97ab208 Mon Sep 17 00:00:00 2001 From: Islam Date: Sun, 3 Jul 2022 22:05:45 +0000 Subject: [PATCH 07/36] build(local-setup): Add proper parachain id --- node/src/chain_spec.rs | 4 ++-- polkadot-launch/config.json | 2 +- zombienet/config.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index afb7606..bceca8e 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -111,7 +111,7 @@ pub fn development_config() -> ChainSpec { None, Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! - para_id: 1000, + para_id: 2000, }, ) } @@ -172,7 +172,7 @@ pub fn local_testnet_config() -> ChainSpec { // Extensions Extensions { relay_chain: "rococo-local".into(), // You MUST set this to the correct network! - para_id: 1000, + para_id: 2000, }, ) } diff --git a/polkadot-launch/config.json b/polkadot-launch/config.json index 5d7bebe..f14dbbe 100644 --- a/polkadot-launch/config.json +++ b/polkadot-launch/config.json @@ -18,7 +18,7 @@ "parachains": [ { "bin": "../target/debug/parachain-collator", - "id": "200", + "id": "2000", "balance": "1000000000000000000000", "nodes": [ { diff --git a/zombienet/config.toml b/zombienet/config.toml index dc0108d..4bf8af0 100644 --- a/zombienet/config.toml +++ b/zombienet/config.toml @@ -13,7 +13,7 @@ chain = "rococo-local" name = "bob" [[parachains]] -id = 100 +id = 2000 [parachains.collator] name = "collator01" From e95c1125f25da925b52d0fa5f8d9b9f349017a36 Mon Sep 17 00:00:00 2001 From: Islam Date: Sun, 3 Jul 2022 22:17:59 +0000 Subject: [PATCH 08/36] build(local-setup): Change bob base-path Groups tmp chain state under /tmp/relay/ --- scripts/start-relay.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/start-relay.sh b/scripts/start-relay.sh index 0c79201..537c06b 100644 --- a/scripts/start-relay.sh +++ b/scripts/start-relay.sh @@ -20,7 +20,7 @@ function bob { ./target/release/polkadot \ --bob \ --validator \ - --base-path /tmp/relay-bob \ + --base-path /tmp/relay/bob \ --chain ./rococo-local-raw.json \ --port 30334 \ --ws-port 9945 \ From aa743a7331c542724de66745aa78944596fb4fd8 Mon Sep 17 00:00:00 2001 From: Islam Date: Sun, 3 Jul 2022 22:24:28 +0000 Subject: [PATCH 09/36] build(local-setup): Use mdns and start relays immediately --- .gitpod.yml | 4 ++-- scripts/start-relay.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 04870ac..38766c4 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -7,11 +7,11 @@ tasks: command: ./scripts/start-collator.sh - name: Relay Alice init: bash ./scripts/prep-relay.sh - command: bash ./scripts/start-relay.sh + command: bash ./scripts/start-relay.sh alice - name: Relay Bob # Wait for alice init: gp sync-await relay - command: bash ./scripts/start-relay.sh + command: bash ./scripts/start-relay.sh bob # - name: Test Net # init: gp sync-await collator && gp sync-await relay # command: zombienet spawn zombienet/config.toml -p native diff --git a/scripts/start-relay.sh b/scripts/start-relay.sh index 537c06b..42aa105 100644 --- a/scripts/start-relay.sh +++ b/scripts/start-relay.sh @@ -11,7 +11,7 @@ function alice { ./target/release/polkadot --alice --validator --base-path /tmp/relay/alice --chain ./rococo-local-raw.json --port 30333 --ws-port 9944 } echo "Start Bob command" -echo "bash ./scripts/start-relay.sh bob --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/AliceAddr " +echo "bash ./scripts/start-relay.sh bob" echo "" function bob { @@ -24,7 +24,7 @@ function bob { --chain ./rococo-local-raw.json \ --port 30334 \ --ws-port 9945 \ - --bootnodes "$1" + # Mdns works } "$@" \ No newline at end of file From 97283f955fb05bf5ad736a30871846094800fdf3 Mon Sep 17 00:00:00 2001 From: Islam Date: Mon, 4 Jul 2022 04:42:32 +0000 Subject: [PATCH 10/36] fix(local-setup): Chain spec gen, prep-relay build-spec steps should be in polkadot dir, prep-relay should use bin dir --- .github/dockerfiles/Dockerfile.collator | 2 +- .github/dockerfiles/Dockerfile.gitpod-base | 6 +++--- scripts/prep-relay.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/dockerfiles/Dockerfile.collator b/.github/dockerfiles/Dockerfile.collator index efc724e..b8ec406 100644 --- a/.github/dockerfiles/Dockerfile.collator +++ b/.github/dockerfiles/Dockerfile.collator @@ -7,7 +7,7 @@ USER ${USER}:${GROUP} EXPOSE 30333 9933 9944 -ARG COLLATOR_BIN=./target/debug/parachain-collator +ARG COLLATOR_BIN=./target/release/parachain-collator COPY ${COLLATOR_BIN} /usr/local/bin diff --git a/.github/dockerfiles/Dockerfile.gitpod-base b/.github/dockerfiles/Dockerfile.gitpod-base index abf4a46..66f20e1 100644 --- a/.github/dockerfiles/Dockerfile.gitpod-base +++ b/.github/dockerfiles/Dockerfile.gitpod-base @@ -33,8 +33,8 @@ RUN git clone https://github.com/paritytech/polkadot.git && \ git checkout release-v0.9.24 && \ cargo build --release && \ ./target/release/${BIN} --help && \ - find target -type f ! -name ${BIN} -exec rm {} + -RUN ./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode > rococo-local.json -RUN ./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > rococo-local-raw.json + find target -type f ! -name ${BIN} -exec rm {} + \ + ./target/release/${BIN} build-spec --chain rococo-local --disable-default-bootnode > rococo-local.json \ + ./target/release/${BIN} build-spec --chain rococo-local --disable-default-bootnode --raw > rococo-local-raw.json # Ease: ENV POLKADOT_BIN=~/relay/polkadot/target/release/polkadot diff --git a/scripts/prep-relay.sh b/scripts/prep-relay.sh index 599999a..82ffa84 100755 --- a/scripts/prep-relay.sh +++ b/scripts/prep-relay.sh @@ -3,9 +3,9 @@ # Zombienet: Build relay image function makeBins { mkdir bins - cp ~/relay/polkadot/target/release/polkadot .github + cp ~/relay/polkadot/target/release/polkadot bins/ docker build --pull --rm -f ".github/dockerfiles/Dockerfile.relay" -t chocnet/polkadot-debug "." - rm .github/polkadot + rm -r bins gp sync-done relay } # Setup files for local From f644371b31afa77dfa212bd0b7f6d0def0e40ce9 Mon Sep 17 00:00:00 2001 From: Islam Date: Mon, 4 Jul 2022 08:41:23 +0000 Subject: [PATCH 11/36] build(local-setup): Remove repeated relay buildspec, call main in init --- .github/dockerfiles/Dockerfile.gitpod-base | 2 -- .gitpod.yml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/dockerfiles/Dockerfile.gitpod-base b/.github/dockerfiles/Dockerfile.gitpod-base index 66f20e1..4baa8f9 100644 --- a/.github/dockerfiles/Dockerfile.gitpod-base +++ b/.github/dockerfiles/Dockerfile.gitpod-base @@ -34,7 +34,5 @@ RUN git clone https://github.com/paritytech/polkadot.git && \ cargo build --release && \ ./target/release/${BIN} --help && \ find target -type f ! -name ${BIN} -exec rm {} + \ - ./target/release/${BIN} build-spec --chain rococo-local --disable-default-bootnode > rococo-local.json \ - ./target/release/${BIN} build-spec --chain rococo-local --disable-default-bootnode --raw > rococo-local-raw.json # Ease: ENV POLKADOT_BIN=~/relay/polkadot/target/release/polkadot diff --git a/.gitpod.yml b/.gitpod.yml index 38766c4..08b6e06 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -6,7 +6,7 @@ tasks: init: bash ./scripts/prep-collator.sh main && gp sync-await relay command: ./scripts/start-collator.sh - name: Relay Alice - init: bash ./scripts/prep-relay.sh + init: bash ./scripts/prep-relay.sh main command: bash ./scripts/start-relay.sh alice - name: Relay Bob # Wait for alice From a2322b276fd3a277c7a57524b961463fb4eafa79 Mon Sep 17 00:00:00 2001 From: Islam Date: Mon, 4 Jul 2022 08:42:23 +0000 Subject: [PATCH 12/36] fix(local-setup): Stop docker RUN cmd --- .github/dockerfiles/Dockerfile.gitpod-base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dockerfiles/Dockerfile.gitpod-base b/.github/dockerfiles/Dockerfile.gitpod-base index 4baa8f9..56a2826 100644 --- a/.github/dockerfiles/Dockerfile.gitpod-base +++ b/.github/dockerfiles/Dockerfile.gitpod-base @@ -33,6 +33,6 @@ RUN git clone https://github.com/paritytech/polkadot.git && \ git checkout release-v0.9.24 && \ cargo build --release && \ ./target/release/${BIN} --help && \ - find target -type f ! -name ${BIN} -exec rm {} + \ + find target -type f ! -name ${BIN} -exec rm {} + # Ease: ENV POLKADOT_BIN=~/relay/polkadot/target/release/polkadot From 4d13577a125e14f62d1cd1015146df39d8b12cb4 Mon Sep 17 00:00:00 2001 From: Islam Date: Mon, 4 Jul 2022 11:42:41 +0000 Subject: [PATCH 13/36] build(local-setup): Fix start and prep scripts relay, collator Enabled prebuilds for gitpod.yml --- .gitpod.yml | 4 +++- scripts/prep-relay.sh | 6 +++--- scripts/start-collator.sh | 2 +- scripts/start-relay.sh | 13 +++++++------ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 08b6e06..e694ed5 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -16,4 +16,6 @@ tasks: # init: gp sync-await collator && gp sync-await relay # command: zombienet spawn zombienet/config.toml -p native - +github: + prebuilds: + development: true diff --git a/scripts/prep-relay.sh b/scripts/prep-relay.sh index 82ffa84..3395d0b 100755 --- a/scripts/prep-relay.sh +++ b/scripts/prep-relay.sh @@ -10,10 +10,10 @@ function makeBins { } # Setup files for local function buildSpec { - cd ~/relay/polkadot + RELAY_BIN=~/relay/polkadot/target/release/polkadot - ./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode > ./rococo-local.json - ./target/release/polkadot build-spec --chain ./rococo-local.json --disable-default-bootnode --raw > ./rococo-local-raw.json + $RELAY_BIN build-spec --chain rococo-local --disable-default-bootnode > ch_spec/rococo-local.json + $RELAY_BIN build-spec --chain ch_spec/rococo-local.json --disable-default-bootnode --raw > ch_spec/rococo-local-raw.json } diff --git a/scripts/start-collator.sh b/scripts/start-collator.sh index 79aa8ec..ae7a197 100644 --- a/scripts/start-collator.sh +++ b/scripts/start-collator.sh @@ -11,6 +11,6 @@ --ws-port 8844 \ -- \ --execution wasm \ ---chain ~/relay/polkadot/rococo-local-raw.json \ +--chain ch_spec/rococo-local-raw.json \ --port 30343 \ --ws-port 9977 diff --git a/scripts/start-relay.sh b/scripts/start-relay.sh index 42aa105..59aa175 100644 --- a/scripts/start-relay.sh +++ b/scripts/start-relay.sh @@ -1,27 +1,28 @@ #!/bin/bash -cd ~/relay/polkadot # echo start alice command, echo "Start Alice command" echo "bash ./scripts/start-relay.sh alice" echo "" +RELAY_BIN=~/relay/polkadot/target/release/polkadot +ROCOCO_LOCAL=ch_spec/rococo-local.json +ROCOCO_LOCAL_RAW=ch_spec/rococo-local-raw.json + function alice { - cd ~/relay/polkadot - ./target/release/polkadot --alice --validator --base-path /tmp/relay/alice --chain ./rococo-local-raw.json --port 30333 --ws-port 9944 + $RELAY_BIN --alice --validator --base-path /tmp/relay/alice --chain $ROCOCO_LOCAL_RAW --port 30333 --ws-port 9944 } echo "Start Bob command" echo "bash ./scripts/start-relay.sh bob" echo "" function bob { - cd ~/relay/polkadot - ./target/release/polkadot \ + $RELAY_BIN \ --bob \ --validator \ --base-path /tmp/relay/bob \ - --chain ./rococo-local-raw.json \ + --chain $ROCOCO_LOCAL_RAW \ --port 30334 \ --ws-port 9945 \ # Mdns works From 33c30b350117f5c3d5aa329a55affe306a4620b2 Mon Sep 17 00:00:00 2001 From: Islam Date: Mon, 4 Jul 2022 17:19:48 +0000 Subject: [PATCH 14/36] build(local-setup): Fix gitpod.yml, start scripts --- .gitpod.yml | 7 ++++++- scripts/prep-collator.sh | 4 ++-- scripts/prep-relay.sh | 4 ++-- scripts/start-collator.sh | 0 scripts/start-relay.sh | 0 5 files changed, 10 insertions(+), 5 deletions(-) mode change 100644 => 100755 scripts/prep-collator.sh mode change 100644 => 100755 scripts/start-collator.sh mode change 100644 => 100755 scripts/start-relay.sh diff --git a/.gitpod.yml b/.gitpod.yml index e694ed5..e96aca5 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -4,7 +4,7 @@ image: tasks: - name: Collator init: bash ./scripts/prep-collator.sh main && gp sync-await relay - command: ./scripts/start-collator.sh + command: bash ./scripts/start-collator.sh - name: Relay Alice init: bash ./scripts/prep-relay.sh main command: bash ./scripts/start-relay.sh alice @@ -19,3 +19,8 @@ tasks: github: prebuilds: development: true +ports: + - port: 8844 + visibility: public + - port: 9944 + visibility: public \ No newline at end of file diff --git a/scripts/prep-collator.sh b/scripts/prep-collator.sh old mode 100644 new mode 100755 index 329b343..4003407 --- a/scripts/prep-collator.sh +++ b/scripts/prep-collator.sh @@ -6,16 +6,16 @@ function prepBins { find target/release -type f ! -name parachain-collator -exec rm {} + docker build --pull --rm -f ".github/dockerfiles/Dockerfile.collator" -t chocnet/parachain-collator "." && - gp sync-done collator } # Export chain spec, etc to ch_spec dir. function exportChainSpec { - mkdir ch_spec + mkdir -p ch_spec ./target/release/parachain-collator build-spec --disable-default-bootnode > ch_spec/rococo-local-parachain-plain.json ./target/release/parachain-collator build-spec --chain ch_spec/rococo-local-parachain-plain.json --raw --disable-default-bootnode > ch_spec/rococo-local-parachain-2000-raw.json ./target/release/parachain-collator export-genesis-wasm --chain ch_spec/rococo-local-parachain-2000-raw.json > ch_spec/para-2000-wasm ./target/release/parachain-collator export-genesis-state --chain ch_spec/rococo-local-parachain-2000-raw.json > ch_spec/para-2000-genesis + gp sync-done collator } function main { diff --git a/scripts/prep-relay.sh b/scripts/prep-relay.sh index 3395d0b..79dd9b3 100755 --- a/scripts/prep-relay.sh +++ b/scripts/prep-relay.sh @@ -6,15 +6,15 @@ function makeBins { cp ~/relay/polkadot/target/release/polkadot bins/ docker build --pull --rm -f ".github/dockerfiles/Dockerfile.relay" -t chocnet/polkadot-debug "." rm -r bins - gp sync-done relay } # Setup files for local function buildSpec { + mkdir -p ch_spec RELAY_BIN=~/relay/polkadot/target/release/polkadot $RELAY_BIN build-spec --chain rococo-local --disable-default-bootnode > ch_spec/rococo-local.json $RELAY_BIN build-spec --chain ch_spec/rococo-local.json --disable-default-bootnode --raw > ch_spec/rococo-local-raw.json - + gp sync-done relay } function main { diff --git a/scripts/start-collator.sh b/scripts/start-collator.sh old mode 100644 new mode 100755 diff --git a/scripts/start-relay.sh b/scripts/start-relay.sh old mode 100644 new mode 100755 From 4e46fba09909b7fce5ae2643bfe13321213ceb1e Mon Sep 17 00:00:00 2001 From: Islam Date: Mon, 4 Jul 2022 17:29:22 +0000 Subject: [PATCH 15/36] refactor(local-setup): Remove ideation file --- chainspec-br.md | 106 ------------------------------------------------ 1 file changed, 106 deletions(-) delete mode 100644 chainspec-br.md diff --git a/chainspec-br.md b/chainspec-br.md deleted file mode 100644 index a0c0eeb..0000000 --- a/chainspec-br.md +++ /dev/null @@ -1,106 +0,0 @@ -### Chain spec break down - -Literally just comments trying to understand pieces of the chainspec. - -```jsonc - - ... - "paras": { - // array of registered parachains, with ids. Must be correctly assigned - "paras": [] - }, - ... - ... - "sudo": { - // Sudo, alice - "key": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" - }, - ... - - -``` - -### utils - -`$RELAY_BIN key inspect ${key derivation path or key}`, inspect keys. -e.g: -```console -gitpod ~/relay/polkadot (release-v0.9.23) $ ./target/release/polkadot key inspect //Alce -Secret Key URI `//Alce` is account: - Network ID: substrate - Secret seed: 0x2b853e582682f6d9f842ddbb8d03e58de96f33d9276e051c492463addfd8c37f - Public key (hex): 0x2c12a8387f0a9aa821cc520fe3cd7a5b9b74e0c403a40188fd10f5887112a616 - Account ID: 0x2c12a8387f0a9aa821cc520fe3cd7a5b9b74e0c403a40188fd10f5887112a616 - Public key (SS58): 5D4VWKoog7oFQrSVWRWisYyyDHs1p2g4DNhU84NWRBLLDme3 - SS58 Address: 5D4VWKoog7oFQrSVWRWisYyyDHs1p2g4DNhU84NWRBLLDme3 -``` - -### Generate chain spec: - -./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode > ./rococo-local.json -./target/release/polkadot build-spec --chain ./rococo-local.json --disable-default-bootnode --raw > ./rococo-local-raw.json - -### Alice - -``` -./target/release/polkadot \ ---alice \ ---validator \ ---base-path /tmp/relay/alice \ ---chain ./rococo-local-raw.json \ ---port 30333 \ ---ws-port 9944 - -``` -12D3KooWDDyLVA12TTjdFR8cpFE6dPD4uYYqxMT4GMrXSNdiVswK - -### Bob - - -./target/release/polkadot \ ---bob \ ---validator \ ---base-path /tmp/relay-bob \ ---chain ./rococo-local-raw.json \ ---bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWDDyLVA12TTjdFR8cpFE6dPD4uYYqxMT4GMrXSNdiVswK \ ---port 30334 \ ---ws-port 9945 - -### Parachains - -``` -./target/release/parachain-collator \ ---alice \ ---collator \ ---force-authoring \ ---chain rococo-local-parachain-2000-raw.json \ ---base-path /tmp/parachain/alice \ ---port 40333 \ ---ws-port 8844 \ --- \ ---execution wasm \ ---chain ~/relay/polkadot/rococo-local-raw.json \ ---port 30343 \ ---ws-port 9977 -``` -``` - ./target/release/parachain-collator build-spec --disable-default-bootnode > rococo-local-parachain-plain.json - ./target/release/parachain-collator build-spec --chain rococo-local-parachain-plain.json --raw --disable-default-bootnode > rococo-local-parachain-2000-raw.json - ./target/release/parachain-collator export-genesis-wasm --chain rococo-local-parachain-2000-raw.json > para-2000-wasm - ./target/release/parachain-collator export-genesis-state --chain rococo-local-parachain-2000-raw.json > para-2000-genesis -``` - -### Init: -``` -./target/release/polkadot --alice --validator --base-path /tmp/relay/alice --chain ./rococo-local-raw.json --port 30333 --ws-port 9944 - -./target/release/polkadot \ ---bob \ ---validator \ ---base-path /tmp/relay-bob \ ---chain ./rococo-local-raw.json \ ---bootnodes /ip4/127.0.0.1/tcp/30333/p2p/Alice-node-addr \ ---port 30334 \ ---ws-port 9945 -``` - From c8647afa452f5f7d8b1853913ee1c6662dfdb49e Mon Sep 17 00:00:00 2001 From: Islam Date: Mon, 4 Jul 2022 17:51:59 +0000 Subject: [PATCH 16/36] docs(multi): :tada: Multi assets idea layout --- multi.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 multi.md diff --git a/multi.md b/multi.md new file mode 100644 index 0000000..53424cb --- /dev/null +++ b/multi.md @@ -0,0 +1,21 @@ +## Goal: + +To integrate the multiassets pallet into chocolate with: + +1. CHOC as spending token for settling fees, etc +2. Any generic asset is available for reserve and the like in other pallets (drop-in replacement.). + +> Ideally, there should already be a way of integrating this pallet with specific ones that have actual value e.g DOT,KSM + +## Needs + +* Some partial migration of the chocolate-node (specifically, native token name: CHOC) + +## Testing: + +(As used in chocolate pallet) Reserve, unreserve balances. Fail TX if not enough native token. + +* A simple extrinsic that reserves a generic asset in the template pallet, and test that it is reserved as expected. +* A simple extrinsic that unreserves the same generic asset in the template pallet, and test that it is unreserved as expected. +* Both extrinsics will be paid in the native token, test that it fails if the user doesn't have sufficient balance. + From d490b4ab130319ba3ed4fc8f1b412bc433c11f64 Mon Sep 17 00:00:00 2001 From: Islam Date: Tue, 5 Jul 2022 05:41:34 +0000 Subject: [PATCH 17/36] fix(local-setup): Switch to debug build, fix prep-collator script --- .github/dockerfiles/Dockerfile.collator | 2 +- scripts/prep-collator.sh | 14 +++++++------- scripts/start-collator.sh | 2 +- zombienet/config.toml | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/dockerfiles/Dockerfile.collator b/.github/dockerfiles/Dockerfile.collator index b8ec406..efc724e 100644 --- a/.github/dockerfiles/Dockerfile.collator +++ b/.github/dockerfiles/Dockerfile.collator @@ -7,7 +7,7 @@ USER ${USER}:${GROUP} EXPOSE 30333 9933 9944 -ARG COLLATOR_BIN=./target/release/parachain-collator +ARG COLLATOR_BIN=./target/debug/parachain-collator COPY ${COLLATOR_BIN} /usr/local/bin diff --git a/scripts/prep-collator.sh b/scripts/prep-collator.sh index 4003407..78e0ec4 100755 --- a/scripts/prep-collator.sh +++ b/scripts/prep-collator.sh @@ -2,19 +2,19 @@ # Prep bins for docker function prepBins { - cargo build --release - find target/release -type f ! -name parachain-collator -exec rm {} + + cargo build + find target/debug -type f ! -name parachain-collator -exec rm {} + - docker build --pull --rm -f ".github/dockerfiles/Dockerfile.collator" -t chocnet/parachain-collator "." && + docker build --pull --rm -f ".github/dockerfiles/Dockerfile.collator" -t chocnet/parachain-collator "." } # Export chain spec, etc to ch_spec dir. function exportChainSpec { mkdir -p ch_spec - ./target/release/parachain-collator build-spec --disable-default-bootnode > ch_spec/rococo-local-parachain-plain.json - ./target/release/parachain-collator build-spec --chain ch_spec/rococo-local-parachain-plain.json --raw --disable-default-bootnode > ch_spec/rococo-local-parachain-2000-raw.json - ./target/release/parachain-collator export-genesis-wasm --chain ch_spec/rococo-local-parachain-2000-raw.json > ch_spec/para-2000-wasm - ./target/release/parachain-collator export-genesis-state --chain ch_spec/rococo-local-parachain-2000-raw.json > ch_spec/para-2000-genesis + ./target/debug/parachain-collator build-spec --disable-default-bootnode > ch_spec/rococo-local-parachain-plain.json + ./target/debug/parachain-collator build-spec --chain ch_spec/rococo-local-parachain-plain.json --raw --disable-default-bootnode > ch_spec/rococo-local-parachain-2000-raw.json + ./target/debug/parachain-collator export-genesis-wasm --chain ch_spec/rococo-local-parachain-2000-raw.json > ch_spec/para-2000-wasm + ./target/debug/parachain-collator export-genesis-state --chain ch_spec/rococo-local-parachain-2000-raw.json > ch_spec/para-2000-genesis gp sync-done collator } diff --git a/scripts/start-collator.sh b/scripts/start-collator.sh index ae7a197..d5fd3e9 100755 --- a/scripts/start-collator.sh +++ b/scripts/start-collator.sh @@ -1,7 +1,7 @@ #!/bin/bash # Run node1 -./target/release/parachain-collator \ +./target/debug/parachain-collator \ --alice \ --collator \ --force-authoring \ diff --git a/zombienet/config.toml b/zombienet/config.toml index 4bf8af0..a3e956a 100644 --- a/zombienet/config.toml +++ b/zombienet/config.toml @@ -18,5 +18,5 @@ id = 2000 [parachains.collator] name = "collator01" image = "chocnet/parachain-collator:latest" - command = "./target/release/parachain-collator" + command = "./target/debug/parachain-collator" args = ["-lparachain=debug"] From 623d415836ddaf65791f5d730684fe3e2495cea7 Mon Sep 17 00:00:00 2001 From: Islam Date: Wed, 6 Jul 2022 11:25:59 +0000 Subject: [PATCH 18/36] feat(multi): Add multicurrencies to runtime --- Cargo.lock | 67 ++++++++++++++++++++++++++++++++++ node/src/chain_spec.rs | 16 +++++++- runtime/Cargo.toml | 9 +++++ runtime/src/asset_config.rs | 16 ++++++++ runtime/src/lib.rs | 73 ++++++++++++++++++++++++++++++++++++- 5 files changed, 177 insertions(+), 4 deletions(-) create mode 100644 runtime/src/asset_config.rs diff --git a/Cargo.lock b/Cargo.lock index 2b16835..2d08494 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4943,6 +4943,70 @@ dependencies = [ "num-traits", ] +[[package]] +name = "orml-currencies" +version = "0.4.1-dev" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.24#41dddc878ecef961b9b20207713abdcb8d84ae53" +dependencies = [ + "frame-support", + "frame-system", + "orml-traits", + "orml-utilities", + "parity-scale-codec", + "scale-info", + "serde", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "orml-tokens" +version = "0.4.1-dev" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.24#41dddc878ecef961b9b20207713abdcb8d84ae53" +dependencies = [ + "frame-support", + "frame-system", + "orml-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "orml-traits" +version = "0.4.1-dev" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.24#41dddc878ecef961b9b20207713abdcb8d84ae53" +dependencies = [ + "frame-support", + "impl-trait-for-tuples", + "num-traits", + "orml-utilities", + "parity-scale-codec", + "scale-info", + "serde", + "sp-io", + "sp-runtime", + "sp-std", + "xcm", +] + +[[package]] +name = "orml-utilities" +version = "0.4.1-dev" +source = "git+https://github.com/open-web3-stack/open-runtime-module-library?branch=polkadot-v0.9.24#41dddc878ecef961b9b20207713abdcb8d84ae53" +dependencies = [ + "frame-support", + "parity-scale-codec", + "scale-info", + "serde", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "os_str_bytes" version = "6.1.0" @@ -6000,6 +6064,9 @@ dependencies = [ "frame-try-runtime", "hex-literal", "log", + "orml-currencies", + "orml-tokens", + "orml-traits", "pallet-aura", "pallet-authorship", "pallet-balances", diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index bceca8e..02eb3f5 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -1,5 +1,5 @@ use cumulus_primitives_core::ParaId; -use parachain_template_runtime::{AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT}; +use parachain_template_runtime::{AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT, TokensConfig, CurrencyId}; use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::ChainType; use serde::{Deserialize, Serialize}; @@ -119,7 +119,7 @@ pub fn development_config() -> ChainSpec { pub fn local_testnet_config() -> ChainSpec { // Give your base currency a unit name and decimal places let mut properties = sc_chain_spec::Properties::new(); - properties.insert("tokenSymbol".into(), "UNIT".into()); + properties.insert("tokenSymbol".into(), "CHOC".into()); properties.insert("tokenDecimals".into(), 12.into()); properties.insert("ss58Format".into(), 42.into()); @@ -217,5 +217,17 @@ fn testnet_genesis( polkadot_xcm: parachain_template_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), }, + + tokens: TokensConfig { + balances: endowed_accounts + .iter() + .flat_map(|x| { + vec![ + (x.clone(), CurrencyId::DOT, 10u128.pow(16)), + (x.clone(), CurrencyId::BTC, 10u128.pow(16)), + ] + }) + .collect(), + }, } } diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index a3226cd..6ea5ca7 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -25,6 +25,12 @@ smallvec = "1.6.1" # Local pallet-template = { path = "../pallets/template", default-features = false } +# ORML + +orml-currencies = {git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } +orml-tokens = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } +orml-traits = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } + # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.24" } frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } @@ -125,6 +131,9 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", + 'orml-currencies/std', + 'orml-tokens/std', + 'orml-traits/std', ] runtime-benchmarks = [ diff --git a/runtime/src/asset_config.rs b/runtime/src/asset_config.rs new file mode 100644 index 0000000..f04a2d9 --- /dev/null +++ b/runtime/src/asset_config.rs @@ -0,0 +1,16 @@ +use super::AccountId; +use frame_support::traits::Contains; +use sp_std::prelude::*; + +pub fn get_all_module_accounts() -> Vec { + // Add whitelist here, usually this is the system account like treasury + vec![] +} + + +pub struct DustRemovalWhitelist; +impl Contains for DustRemovalWhitelist { + fn contains(a: &AccountId) -> bool { + get_all_module_accounts().contains(a) + } +} diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 887de0b..f0f585a 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -9,6 +9,12 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); mod weights; pub mod xcm_config; +/// Asset config options. As used on litentry. Will Revisit for xcm +pub mod asset_config; + +use asset_config::DustRemovalWhitelist; +use codec::{Decode, Encode, MaxEncodedLen}; +use scale_info::TypeInfo; use smallvec::smallvec; use sp_api::impl_runtime_apis; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; @@ -18,7 +24,6 @@ use sp_runtime::{ transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, MultiSignature, }; - use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; @@ -38,9 +43,12 @@ use frame_system::{ EnsureRoot, }; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; -pub use sp_runtime::{MultiAddress, Perbill, Permill}; +pub use sp_runtime::{MultiAddress, Perbill, Permill, RuntimeDebug}; use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin}; +#[cfg(feature = "std")] +use serde::{Deserialize, Serialize}; + #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; @@ -49,6 +57,10 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; +// Orml imports +use orml_traits::parameter_type_with_key; +use orml_currencies::BasicCurrencyAdapter; + // XCM Imports use xcm::latest::prelude::BodyId; use xcm_executor::XcmExecutor; @@ -144,6 +156,20 @@ impl WeightToFeePolynomial for WeightToFee { } } +#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, RuntimeDebug,TypeInfo, MaxEncodedLen, PartialOrd, Ord)] +#[cfg_attr(feature = "std", derive(Serialize, Deserialize))] +pub enum CurrencyId { + Native, + DOT, + KSM, + BTC, +} + +pub type Amount = i128; + +/// Identifier for a named reserve in orml tokens +pub type ReserveIdentifier = [u8; 8]; + /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// the specifics of the runtime. They can then be made to be agnostic over specific formats /// of data like extrinsics, allowing for them to continue syncing the network through upgrades @@ -456,6 +482,45 @@ impl pallet_template::Config for Runtime { type Event = Event; } + +impl orml_tokens::Config for Runtime { + type Event = Event; + type Balance = Balance; + type Amount = Amount; + type CurrencyId = CurrencyId; + type WeightInfo = (); + type ExistentialDeposits = ExistentialDeposits; + type OnDust = (); + type OnNewTokenAccount = (); + type OnKilledTokenAccount = (); + // Shared with balances. + type MaxLocks = MaxLocks; + type MaxReserves = MaxReserves; + type ReserveIdentifier = ReserveIdentifier; + type DustRemovalWhitelist = DustRemovalWhitelist; +} + + +parameter_type_with_key! { + pub ExistentialDeposits: |_currency_id: CurrencyId| -> Balance { + match _currency_id { + CurrencyId::Native => 1000, + _ => 2 + } + }; +} + +parameter_types! { + pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native; +} + +impl orml_currencies::Config for Runtime { + type MultiCurrency = Tokens; + type NativeCurrency = BasicCurrencyAdapter; + type GetNativeCurrencyId = GetNativeCurrencyId; + type WeightInfo = (); +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -490,6 +555,10 @@ construct_runtime!( // Template TemplatePallet: pallet_template::{Pallet, Call, Storage, Event} = 40, + + // Orml + Currencies: orml_currencies::{Pallet, Call} = 41, + Tokens: orml_tokens::{Pallet, Storage, Event, Config} = 42, } ); From 3a6e2c8b318400c1af822b8582b60a0d034f3ba6 Mon Sep 17 00:00:00 2001 From: Islam Date: Wed, 6 Jul 2022 17:56:33 +0000 Subject: [PATCH 19/36] feat(multi): Add multicurrencies to template All but testUnresTo works with NativeCurrency, it integrates with balances and reserved balance is shown for native. Possible cause: Wrong accountinfo from balances pallet which always stays at zero regardless of reserved status --- Cargo.lock | 2 ++ node/src/chain_spec.rs | 4 +-- pallets/template/Cargo.toml | 6 +++++ pallets/template/src/lib.rs | 54 ++++++++++++++++++++++++++++++++++++- runtime/src/lib.rs | 1 + scripts/prep-collator.sh | 2 +- 6 files changed, 65 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d08494..fe23fbc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5793,6 +5793,8 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "orml-traits", + "orml-utilities", "parity-scale-codec", "scale-info", "serde", diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 02eb3f5..7d41cee 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -1,5 +1,5 @@ use cumulus_primitives_core::ParaId; -use parachain_template_runtime::{AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT, TokensConfig, CurrencyId}; +use parachain_template_runtime::{AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT, CurrencyId}; use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::ChainType; use serde::{Deserialize, Serialize}; @@ -218,7 +218,7 @@ fn testnet_genesis( safe_xcm_version: Some(SAFE_XCM_VERSION), }, - tokens: TokensConfig { + tokens: parachain_template_runtime::TokensConfig { balances: endowed_accounts .iter() .flat_map(|x| { diff --git a/pallets/template/Cargo.toml b/pallets/template/Cargo.toml index 2074b32..039a0bc 100644 --- a/pallets/template/Cargo.toml +++ b/pallets/template/Cargo.toml @@ -20,6 +20,10 @@ frame-benchmarking = { git = "https://github.com/paritytech/substrate", default- frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +# ORML +orml-traits = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } +orml-utilities = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } + [dev-dependencies] serde = { version = "1.0.132" } @@ -37,5 +41,7 @@ std = [ "frame-benchmarking/std", "frame-support/std", "frame-system/std", + "orml-traits/std", + "orml-utilities/std", ] try-runtime = [ "frame-support/try-runtime" ] \ No newline at end of file diff --git a/pallets/template/src/lib.rs b/pallets/template/src/lib.rs index 0afd7c6..84df98d 100644 --- a/pallets/template/src/lib.rs +++ b/pallets/template/src/lib.rs @@ -1,5 +1,8 @@ #![cfg_attr(not(feature = "std"), no_std)] +use orml_traits::{MultiCurrency, MultiReservableCurrency,arithmetic::Zero, BalanceStatus}; +use orml_utilities::with_transaction_result; + /// Edit this file to define custom logic or remove it if it is not needed. /// Learn more about FRAME and the core library of Substrate FRAME pallets: /// @@ -14,9 +17,17 @@ mod tests; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; + +type BalanceOf = + <::Currency as MultiCurrency<::AccountId>>::Balance; +type CurrencyIdOf = + <::Currency as MultiCurrency<::AccountId>>::CurrencyId; + + #[frame_support::pallet] pub mod pallet { - use frame_support::{dispatch::DispatchResultWithPostInfo, pallet_prelude::*}; + use super::*; + use frame_support::{dispatch::DispatchResultWithPostInfo,ensure, pallet_prelude::*}; use frame_system::pallet_prelude::*; /// Configure the pallet by specifying the parameters and types on which it depends. @@ -24,6 +35,8 @@ pub mod pallet { pub trait Config: frame_system::Config { /// Because this pallet emits events, it depends on the runtime's definition of an event. type Event: From> + IsType<::Event>; + /// Currency + type Currency: MultiReservableCurrency; } #[pallet::pallet] @@ -55,6 +68,8 @@ pub mod pallet { NoneValue, /// Errors should have helpful documentation associated with them. StorageOverflow, + /// Insufficeint balance to unreserve + InsufficientBalance, } #[pallet::hooks] @@ -82,7 +97,44 @@ pub mod pallet { // Return a successful DispatchResultWithPostInfo Ok(().into()) } + /// Reserves some amount of generic assets for the roigin + #[pallet::weight(10_000)] + pub fn test_res (origin: OriginFor, currency_id: CurrencyIdOf, amount: BalanceOf) ->DispatchResultWithPostInfo{ + let who = ensure_signed(origin)?; + T::Currency::reserve(currency_id,&who, amount)?; + Ok(().into()) + } + /// UnReserves some amount of generic assets for the roigin + #[pallet::weight(10_000)] + pub fn test_unres (origin: OriginFor, currency_id: CurrencyIdOf, amount: BalanceOf) -> DispatchResult { + let who = ensure_signed(origin)?; + with_transaction_result(|| { + + let remainder = T::Currency::unreserve(currency_id,&who, amount); + ensure!(remainder.is_zero(),Error::::InsufficientBalance); + Ok(().into()) + }) + + } + + /// UnReserves some amount of generic assets for the origin and transfers it to some other account. In choc, this is same account. + /// Pure unreserve could also work. Just showing that this is possible. + #[pallet::weight(10_000)] + pub fn test_unres_to (origin: OriginFor, currency_id: CurrencyIdOf, amount: BalanceOf) -> DispatchResult { + let who = ensure_signed(origin)?; + let to = who.clone(); + + // A transaction can either succeed and commit, or fail and rollback. This helps avoid prelim. checks. Tradeoffs? + with_transaction_result(|| { + let remainder = T::Currency::repatriate_reserved(currency_id,&who, &to, amount, BalanceStatus::Free)?; + ensure!(remainder.is_zero(),Error::::InsufficientBalance); + + Ok(().into()) + }) + + + } /// An example dispatchable that may throw a custom error. #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))] pub fn cause_error(origin: OriginFor) -> DispatchResultWithPostInfo { diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index f0f585a..2454b4f 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -480,6 +480,7 @@ impl pallet_collator_selection::Config for Runtime { /// Configure the pallet template in pallets/template. impl pallet_template::Config for Runtime { type Event = Event; + type Currency = Currencies; } diff --git a/scripts/prep-collator.sh b/scripts/prep-collator.sh index 4003407..a69d989 100755 --- a/scripts/prep-collator.sh +++ b/scripts/prep-collator.sh @@ -5,7 +5,7 @@ function prepBins { cargo build --release find target/release -type f ! -name parachain-collator -exec rm {} + - docker build --pull --rm -f ".github/dockerfiles/Dockerfile.collator" -t chocnet/parachain-collator "." && + docker build --pull --rm -f ".github/dockerfiles/Dockerfile.collator" -t chocnet/parachain-collator "." } # Export chain spec, etc to ch_spec dir. From a7b616e91b45f97d0a6fd54b947dca3ab9a2091f Mon Sep 17 00:00:00 2001 From: Islam Date: Thu, 7 Jul 2022 19:23:18 +0000 Subject: [PATCH 20/36] fix(multi): Removed same-account call to repartriate_reserved Repartriate reserved will fail with remainder if called with same account, use unreserve instead --- pallets/template/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pallets/template/src/lib.rs b/pallets/template/src/lib.rs index 84df98d..66c1ef6 100644 --- a/pallets/template/src/lib.rs +++ b/pallets/template/src/lib.rs @@ -121,13 +121,15 @@ pub mod pallet { /// UnReserves some amount of generic assets for the origin and transfers it to some other account. In choc, this is same account. /// Pure unreserve could also work. Just showing that this is possible. #[pallet::weight(10_000)] - pub fn test_unres_to (origin: OriginFor, currency_id: CurrencyIdOf, amount: BalanceOf) -> DispatchResult { + pub fn test_unres_to (origin: OriginFor, currency_id: CurrencyIdOf,to: T::AccountId, amount: BalanceOf) -> DispatchResult { let who = ensure_signed(origin)?; - let to = who.clone(); // A transaction can either succeed and commit, or fail and rollback. This helps avoid prelim. checks. Tradeoffs? with_transaction_result(|| { let remainder = T::Currency::repatriate_reserved(currency_id,&who, &to, amount, BalanceStatus::Free)?; + + // Never use this check with the same account, else transaction will fail with remainder balance returned. + // Use unreserve instead ensure!(remainder.is_zero(),Error::::InsufficientBalance); Ok(().into()) From 57583625a758299792c049d0387f48229bd83c9f Mon Sep 17 00:00:00 2001 From: Islam Date: Fri, 8 Jul 2022 10:32:46 +0000 Subject: [PATCH 21/36] feat(migration): Add chocolate, primitives crates **merged from master** Added the primitives and chocolate crates, merged primitives into one crate with mods. Migrated cargo.tomls, made structs use BoundedVec **Note: This was merged from master** Testing is broken, and some logic differs from dev --- Cargo.lock | 37 ++ Cargo.toml | 1 + pallets/chocolate/Cargo.toml | 64 +++ pallets/chocolate/src/benchmarking.rs | 33 ++ pallets/chocolate/src/constants.rs | 16 + pallets/chocolate/src/lib.rs | 571 ++++++++++++++++++++++++++ pallets/chocolate/src/mock.rs | 108 +++++ pallets/chocolate/src/tests.rs | 18 + pallets/template/src/mock.rs | 1 + primitives/Cargo.toml | 46 +++ primitives/src/lib.rs | 3 + primitives/src/projects.rs | 213 ++++++++++ primitives/src/users.rs | 35 ++ 13 files changed, 1146 insertions(+) create mode 100644 pallets/chocolate/Cargo.toml create mode 100644 pallets/chocolate/src/benchmarking.rs create mode 100644 pallets/chocolate/src/constants.rs create mode 100644 pallets/chocolate/src/lib.rs create mode 100644 pallets/chocolate/src/mock.rs create mode 100644 pallets/chocolate/src/tests.rs create mode 100644 primitives/Cargo.toml create mode 100644 primitives/src/lib.rs create mode 100644 primitives/src/projects.rs create mode 100644 primitives/src/users.rs diff --git a/Cargo.lock b/Cargo.lock index fe23fbc..36f58e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -971,6 +971,22 @@ dependencies = [ "zeroize", ] +[[package]] +name = "chocolate-primitives" +version = "0.1.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "chrono" version = "0.4.19" @@ -5264,6 +5280,27 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-chocolate" +version = "0.1.0" +dependencies = [ + "chocolate-primitives", + "frame-benchmarking", + "frame-support", + "frame-system", + "orml-traits", + "orml-utilities", + "pallet-balances", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-collator-selection" version = "3.0.0" diff --git a/Cargo.toml b/Cargo.toml index f95719d..c1d709f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,5 +5,6 @@ panic = "unwind" members = [ "node", "pallets/*", + "primitives", "runtime", ] diff --git a/pallets/chocolate/Cargo.toml b/pallets/chocolate/Cargo.toml new file mode 100644 index 0000000..161eb03 --- /dev/null +++ b/pallets/chocolate/Cargo.toml @@ -0,0 +1,64 @@ +[package] +authors = ['Kresna SHA888 '] +description = 'Substrate FRAME chocolate pallet for defining custom runtime logic.' +edition = '2021' +homepage = '' +license = 'Unlicense' +name = 'pallet-chocolate' +publish = false +repository = 'https://github.com/Chocolate-Project/chocolate-node' +version = '0.1.0' +readme = 'README.md' + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +serde = { version = "1.0.132", optional=true } +codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } +scale-info = { version = "2.0.0", default-features = false, features = ["derive"] } + +# Substrate +frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.24" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } + + +# ORML +orml-traits = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } +orml-utilities = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } + +# Chocolate + +chocolate-primitives = { path="../../primitives", default-features = false } + +[dev-dependencies] + +# Substrate +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +pallet-treasury = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } + +# Chocolate. For Tests. +# pallet-users = { path="../pallets/pallet-users", default-features = false } + +[features] +default = ['std'] +runtime-benchmarks = ['frame-benchmarking'] +std = [ + 'serde', + 'codec/std', + 'sp-std/std', + 'frame-support/std', + 'frame-system/std', + 'pallet-treasury/std', + 'pallet-balances/std', + 'frame-benchmarking/std', + # added + 'chocolate-primitives/std', + # 'pallet-users/std', +] +try-runtime = ['frame-support/try-runtime'] diff --git a/pallets/chocolate/src/benchmarking.rs b/pallets/chocolate/src/benchmarking.rs new file mode 100644 index 0000000..385bd6d --- /dev/null +++ b/pallets/chocolate/src/benchmarking.rs @@ -0,0 +1,33 @@ +//! Benchmarking setup for pallet-chocolate + +use super::*; +#[allow(unused)] +use crate::Pallet as Chocolate; +use chocolate_projects::Review; +use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller}; +use frame_support::traits::{Currency, ExistenceRequirement, Get, Imbalance, OnUnbalanced}; +use frame_system::RawOrigin; +// calls do_something multiple times 0..100 inputs verifying it got stored each time +benchmarks! { // comment for now, do_something is gone, but it's legacy remains + create_review { + let caller: T::AccountId = whitelisted_caller(); + let s = (b"random").to_vec(); + let prj_id = 1; + let rev = Review{ + user_id: caller.clone(), + proposal_status: Default::default(), + content: s.clone(), + project_id: prj_id, + point_snapshot: 12,}; + // costs + let price = T::Currency::minimum_balance(); + let collat = T::UserCollateral::get(); + let imb = T::Currency::issue(collat); + let _ = T::Currency::make_free_balance_be(&caller, imb.peek()); + }: create_review(RawOrigin::Signed(caller), s,prj_id) + // verify { + // assert_eq!(Reviews::::get(1), Some(rev)); + // } +} + +impl_benchmark_test_suite!(Chocolate, crate::mock::new_test_ext(), crate::mock::Test); diff --git a/pallets/chocolate/src/constants.rs b/pallets/chocolate/src/constants.rs new file mode 100644 index 0000000..9726408 --- /dev/null +++ b/pallets/chocolate/src/constants.rs @@ -0,0 +1,16 @@ +pub mod project { + pub const METADATA: [&[u8]; 5] = [ + b"QmPAVb28J73KjzcjTQ85oJLyftmm4kEgTTptRssPnKjKZD", + b"QmQLVGKfigHsnguvK8X2kiYX4o7tp2Zm5k14Gr928bpcPE", + b"QmUBtn48fKxGSzxGQsz4h3kxUqJMd2ZpKo7MUhrxCFq3Sd", + b"QmfLaEuVr6kZqyEeHRBZqEfvGTEL5x85YsNfEriDDxGPd1", + b"QmVzxGUaVF4HVfvtoaVqXBcVGqyEq72TAp8s9u9pmH5Vra", + ]; + + pub const REVS: [&[u8]; 4] = [ + b"QmdKx4pmnJUP5GdjtpJE2ei4xeaRKQWYwvXGuVY1AbAwDM/review1.json", + b"QmdKx4pmnJUP5GdjtpJE2ei4xeaRKQWYwvXGuVY1AbAwDM/review2.json", + b"QmdKx4pmnJUP5GdjtpJE2ei4xeaRKQWYwvXGuVY1AbAwDM/review3.json", + b"QmdKx4pmnJUP5GdjtpJE2ei4xeaRKQWYwvXGuVY1AbAwDM/review4.json", + ]; +} diff --git a/pallets/chocolate/src/lib.rs b/pallets/chocolate/src/lib.rs new file mode 100644 index 0000000..2922c9c --- /dev/null +++ b/pallets/chocolate/src/lib.rs @@ -0,0 +1,571 @@ +#![cfg_attr(not(feature = "std"), no_std)] +/// Study the nicks pallet and modify it after stating its config values to push balances to treasury and have commission control it. + +/// Edit this file to define custom logic or remove it if it is not needed. +/// Learn more about FRAME and the core library of Substrate FRAME pallets: +/// +pub use pallet::*; + +#[cfg(test)] +mod mock; + +#[cfg(test)] +mod tests; + +#[cfg(feature = "runtime-benchmarks")] +mod benchmarking; + +pub mod constants; + +#[frame_support::pallet] +pub mod pallet { + use crate::constants; + use chocolate_primitives::{projects::*,users::UserIO}; + use frame_support::{ + dispatch::DispatchResult, + pallet_prelude::*, + sp_runtime::{traits::{CheckedDiv,Saturating}, ArithmeticError}, + traits::{ + Currency, ExistenceRequirement::KeepAlive, Imbalance, OnUnbalanced, ReservableCurrency, + }, + }; + use frame_system::pallet_prelude::*; + use sp_std::str; + use sp_std::vec::Vec; + // Include the ApprovedOrigin type here, and the method to get treasury id, then mint with currencymodule + /// Configure the pallet by specifying the parameters and types on which it depends. + #[pallet::config] + pub trait Config: frame_system::Config { + /// Because this pallet emits events, it depends on the runtime's definition of an event. + type Event: From> + IsType<::Event>; + /// Origins that must approve to use the pallet - Should be implemented properly by provider. + type ApprovedOrigin: EnsureOrigin; + /// The currency trait, associated to the pallet. All methods accessible from T::Currency* + type Currency: Currency + ReservableCurrency; + /// * Treasury outlet: A type with bounds to move slashed funds to the treasury. + type TreasuryOutlet: OnUnbalanced>; + /// This is it! The user pallet. A type with bounds to access the user module. + type UsersOutlet: UserIO; + /// * Reward Cap: Max reward projects can place on themselves. Interestingly, this also serves as their stake amount. + #[pallet::constant] + type RewardCap: Get>; + /// Hard coded collateral amount for the Users + #[pallet::constant] + type UserCollateral: Get>; + /// The maximum length of a name or symbol stored on-chain. + #[pallet::constant] + type StringLimit: Get + Member + Parameter + MaybeSerializeDeserialize + Clone; + } + // ------------------------------------------------------------Type aliases ---------------------\ + pub type NegativeImbalanceOf = <::Currency as Currency< + ::AccountId, + >>::NegativeImbalance; + /// type alias for review - this is the base struct, like the 2nd part of Balancesof + pub type ReviewAl = Review<::AccountId, ::StringLimit>; + /// type alias for project + pub type ProjectAl = Project<::AccountId, BalanceOf,::StringLimit>; + /// Type alias for balance, binding T::Currency to Currency::AccountId and then extracting from that Balance. Accessible via T::BalanceOf. T is frame_System. + pub type BalanceOf = + <::Currency as Currency<::AccountId>>::Balance; + /// Type alias for reason + pub type ReasonOf = Reason<::StringLimit>; + /// Type Alias for Bounded Vec + pub type BoundedVecOf = BoundedVec::StringLimit>; + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(_); + + /// Storage map from the project index - id to the projects. getters are for json rpc. + #[pallet::storage] + #[pallet::getter(fn get_projects)] + pub type Projects = StorageMap<_, Blake2_128Concat, ProjectID, ProjectAl>; + /// Storage double map from the userid and projectid to the reviews. + /// I.e A user owns many reviews,each belonging to a unique project. + #[pallet::storage] + pub type Reviews = StorageDoubleMap< + _, + Blake2_128Concat, + T::AccountId, + Blake2_128Concat, + ProjectID, + ReviewAl, + >; + /// Storage value for project index. Increment as we go. + /// Analogous to 1+length of project map. it starts at 1. + #[pallet::storage] + pub type NextProjectIndex = StorageValue<_, ProjectID>; + // Pallets use events to inform users when important changes are made. + // https://substrate.dev/docs/en/knowledgebase/runtime/events + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + /// Event documentation should end with an array that provides descriptive names for event + /// parameters. [something, who] + SomethingStored(u32, T::AccountId), + /// parameters. [owner,cid,project_id] + ProjectCreated(T::AccountId, BoundedVec, ProjectID), + /// parameters. [owner,project_id] + ReviewCreated(T::AccountId, ProjectID), + /// parameters [owner,id] + ReviewAccepted(T::AccountId, ProjectID), + /// Minted [amount] + Minted(BalanceOf), + } + // ----^edit + // Errors inform users that something went wrong. + #[pallet::error] + pub enum Error { + NoneValue, + /// The project does not exist + NoProjectWithId, + /// The reviewer has already placed a review on this project with following id + DuplicateReview, + /// The index exceeds max usize. + StorageOverflow, + /// Project owners cannot review their projects + OwnerReviewedProject, + /// Insufficient funds for performing a task. Add more funds to your account/call/reserve. + InsufficientBalance, + /// The reward on the project isn't same as reserve + RewardInconsistent, + /// User already owns a project + AlreadyOwnsProject, + /// The collateral for the review is not present + InconsistentCollateral, + /// The review matching this key cannot be found + ReviewNotFound, + /// The call to accept must be on a proposed review with appropriate state + AcceptingNotProposed, + /// The checked division method failed, either due to overflow/underflow or because of division by zero. + CheckedDivisionFailed, + } + // Dispatchable functions must be annotated with a weight and must return a DispatchResult. + #[pallet::call] + impl Pallet { + /// Create a project + /// + /// - O(1). + /// - Init: Index starts at 0 + #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,3))] + pub fn create_project(origin: OriginFor, project_meta: BoundedVec) -> DispatchResult { + let who = ensure_signed(origin)?; + // CHECKS + let index = >::get().unwrap_or(1); + let new_index = index.checked_add(1).ok_or(Error::::StorageOverflow)?; + let mut user = T::UsersOutlet::get_or_create_default(&who).unwrap_or_default(); + let user_project_id = user.project_id.unwrap_or_default(); + // default for u32 is 0 but projectID starts at 1 + ensure!(user_project_id == 0, Error::::AlreadyOwnsProject); + ensure!(Pallet::::can_reward(&who), Error::::InsufficientBalance); + // Init structs. + let mut project = ProjectAl::::new(who.clone(), project_meta.clone()); + // FALLIBLE MUTATIONS + Pallet::::reserve_reward(&mut project)?; + user.project_id = Some(new_index); + // STORAGE MUTATIONS + >::insert(index, project); + >::put(new_index); + T::UsersOutlet::update_user(&who, user).expect("User should already exist"); + Self::deposit_event(Event::ProjectCreated(who, project_meta, index)); + Ok(()) + } + /// Create a review, reserve required collateral and increase total of user trust scores on project. + #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(2,3))] + pub fn create_review( + origin: OriginFor, + review_meta: BoundedVecOf, + project_id: ProjectID, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + // CHECKS & Inits + let mut this_project = + >::get(project_id).ok_or(Error::::NoProjectWithId)?; + ensure!(!>::contains_key(&who, project_id), Error::::DuplicateReview); + ensure!(this_project.owner_id.ne(&who), Error::::OwnerReviewedProject); + let reserve = Pallet::::can_collateralise(&who)?; + // Fallible MUTATIONS + Pallet::::collateralise(&who, reserve)?; + let user = T::UsersOutlet::get_or_create_default(&who)?; + this_project.total_user_scores = + this_project.total_user_scores.saturating_add(user.rank_points); + // STORAGE MUTATIONS + >::insert( + who.clone(), + project_id, + Review { + user_id: who.clone(), + content: review_meta, + project_id, + proposal_status: ProposalStatus { + status: Default::default(), + reason: Default::default() + }, + point_snapshot: user.rank_points, + }, + ); + >::mutate(project_id, |project| { + *project = Some(this_project); + }); + Self::deposit_event(Event::ReviewCreated(who, project_id)); + Ok(()) + } + /// Releases collateral and rewards user for a good review. + /// + /// **Call requirements**: + /// - Origin must be cacao + /// + #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(2,3))] + pub fn accept_review( + origin: OriginFor, + user_id: T::AccountId, + project_id: ProjectID, + ) -> DispatchResult { + T::ApprovedOrigin::ensure_origin(origin)?; + // Values + let mut review = + >::get(&user_id, project_id).ok_or(Error::::ReviewNotFound)?; + let mut project = >::get(project_id).ok_or(Error::::NoProjectWithId)?; + // CHECKS + let is_proposed = review.proposal_status.status.eq(&Status::Proposed); + ensure!(is_proposed, Error::::AcceptingNotProposed); + ensure!(Pallet::::check_collateral(&user_id), Error::::InconsistentCollateral); + Pallet::::check_reward(&project)?; + // MUTATIONS - Fallible + Pallet::::reward_user(&user_id, &mut project, &review)?; + review.proposal_status.status = Status::Accepted; + review.proposal_status.reason = Reason::PassedRequirements; + // STORAGE MUTATIONS + >::mutate(&user_id, project_id, |r| { + *r = Option::Some(review); + }); + >::mutate(project_id, |p| { + *p = Option::Some(project); + }); + Self::deposit_event(Event::ReviewCreated(user_id, project_id)); + Ok(()) + } + #[pallet::weight(10_000)] + pub fn mint(origin: OriginFor, x: BalanceOf) -> DispatchResult { + // call its ensure origin - doesn't return origin. Only checks + T::ApprovedOrigin::ensure_origin(origin)?; + let imbalance = T::Currency::issue(x); + let minted = imbalance.peek(); + Self::do_mint(imbalance); + Self::deposit_event(Event::Minted(minted)); + Ok(()) + } + } + + impl ProjectIO for Pallet { + type UserID = T::AccountId; + type Balance = BalanceOf; + type StringLen = T::StringLimit; + /// does existence checks for us to see if the project owner can release required reward+liveness req safely + fn can_reward(who: &Self::UserID) -> bool { + let existential = T::Currency::minimum_balance(); + let mut amount = T::RewardCap::get(); + let reserved = T::Currency::reserved_balance(who); + // modulo test two + if (reserved % amount) < existential { + amount = amount.saturating_add(existential); + } + T::Currency::can_reserve(who, amount) + } + /// Performs the necessary checks on the project's side to ensure that they can reward the user + /// At this instance + /// + /// - checks if the project's advertised reward is same as reserved balance + /// - checks if the project has enough free balance to safely transfer reward after release to the user + fn check_reward(project_struct: &ProjectAl) -> DispatchResult { + // If the reward is what is reserved + existential + let reserve = T::Currency::reserved_balance(&project_struct.owner_id); // If we had the reward, taking the modulo with reward cap would yield what we have?? + let existential = T::Currency::minimum_balance(); + // assume reserve to be a superset of our reward. + let is_sufficient = reserve >= (project_struct.reward.saturating_add(existential)); + ensure!(is_sufficient, Error::::RewardInconsistent); + // ensure free balance too for the next step + let free_balance = T::Currency::free_balance(&project_struct.owner_id); + ensure!(free_balance >= existential, Error::::InsufficientBalance); + Ok(()) + } + /// Reserve some reward and possibly + liveness req as we initialise the project + /// # Fallible + /// does no checks for ability to reserve. + /// (When safe, move from mut to immut) + fn reserve_reward(project_struct: &mut ProjectAl) -> DispatchResult { + let existential = T::Currency::minimum_balance(); + let mut amount = T::RewardCap::get(); + let reserved = T::Currency::reserved_balance(&project_struct.owner_id); + // modulo test two + if (reserved % amount) < existential { + amount = amount.saturating_add(existential); + } + T::Currency::reserve(&project_struct.owner_id, amount)?; + project_struct.reward = T::RewardCap::get(); + Ok(()) + } + /// * Releases an amount from the reward reserved with the project + /// Assumed to be called in the context of rewarding the user wherein amount + /// is the final reward calculated. + /// * **Does no checks**. Assumes specific state of review and project . i.e default Proposed and Accepted states respectively. + /// * Since unreserve doesn't have an expect block, if there is remaining balance, we assume error and rollback + /// # Panics! + /// with expect if we can't rollback, and returns dispatch error for inconsistent reward. + /// **Requires** : check_reward , check_collateral, (caller) reward_user (In context of accept reward) + fn reward(project_struct: &mut ProjectAl, amount: Self::Balance) -> DispatchResult { + // MUTATIONS + let _missing_reward = T::Currency::unreserve(&project_struct.owner_id, amount); + if _missing_reward > BalanceOf::::from(0u32) { + // assuming our can_unreserve failed + // rollback ---- + T::Currency::reserve( + &project_struct.owner_id, + amount.saturating_sub(_missing_reward), + ) + .expect("Should be enough to rollback following our initial unreserve"); + return Err(Error::::RewardInconsistent.into()); + } + // Update the reward on project. + project_struct.reward = project_struct.reward.saturating_sub(amount); + Ok(()) + } + } + + /// A separate impl pallet for custom functions that aren't extrinsics + impl Pallet { + /// checks if the user's collateral is complete and sufficient for the rewarding process. + /// Assumed to be used in context where we'll be using this collateral balance immediately. + /// E.g for rewarding + pub fn check_collateral(who: &T::AccountId) -> bool { + let collateral = T::UserCollateral::get(); + let existential_deposit = T::Currency::minimum_balance(); + let reserve = T::Currency::reserved_balance(who); + reserve >= (collateral.saturating_add(existential_deposit)) + } + /// Release the collateral held by the account. Should only be called in the context of acceptance. + /// Does no checks. Assumes the state is as required. + /// + /// **Requires** : check_collateral + pub fn release_collateral(who: &T::AccountId) -> DispatchResult { + T::Currency::unreserve(&who, T::UserCollateral::get()); + Ok(()) + } + /// Reward the user for their contribution to the project. Assumed to be called after acceptance. + /// + /// **requires**: check_reward and check_collateral + pub fn reward_user( + who: &T::AccountId, + project: &mut ProjectAl, + review: &ReviewAl, + ) -> DispatchResult { + let reward = project.reward.clone(); + // Reward calc + // reward is reward * (user_point/ttl_project_point )-- use fixed point attr of BalanceOf and move vars around in eqn. + + let balance_prj_score = BalanceOf::::from(project.total_user_scores); + let balance_rev_sshot = BalanceOf::::from(review.point_snapshot); + let balance_div = reward + .checked_div(&balance_prj_score) + .ok_or(DispatchError::Arithmetic(ArithmeticError::DivisionByZero))?; + + let reward_fraction = balance_div.saturating_mul(balance_rev_sshot); + // Unreserve our final decision from project. + // We expect projects to not edit this reserve. What if they do?? - Users tx start failing: Ask users to Report! if found, and track txs + + // Mutations + Pallet::::release_collateral(who)?; + Pallet::::reward(project, reward_fraction).expect("should be able to reward"); // nothing should fail after release + T::Currency::transfer(&project.owner_id, who, reward_fraction, KeepAlive) + .expect("should be enough to safely transfer"); + Ok(()) + } + /// Check if a **user** can serve up the required collateral + /// + /// includes existential requirement for reserved balance if it doesn't already exist. + /// + /// Returns the amount of collateral after performing checks + pub fn can_collateralise(id: &T::AccountId) -> Result, DispatchError> { + let mut reserve = T::UserCollateral::get(); + // check if existential deposit already exists in reserve, add to balance to reserve if not + let existential_deposit = T::Currency::minimum_balance(); + let reserved = T::Currency::reserved_balance(id); + if (reserved % reserve) < existential_deposit { + reserve = reserve.saturating_add(existential_deposit); + } + let can_reserve = T::Currency::can_reserve(id, reserve); + if can_reserve { + Ok(reserve) + } else { + Err(Error::::InsufficientBalance.into()) + } + } + /// Reserve a specific amount for the review. + /// + /// Assumes checks have already been made for the specified amount. + /// Requires `can_collateralise` + pub fn collateralise(id: &T::AccountId, reserve: BalanceOf) -> DispatchResult { + T::Currency::reserve(&id, reserve)?; + Ok(()) + } + /// Function to take negative imbalance to the treasury, expected to be called after creating one e.g through T::Currency::issue() + pub fn do_mint(amount: NegativeImbalanceOf) { + T::TreasuryOutlet::on_unbalanced(amount); + } + + /// Create a project from required data - only for genesis + /// Assumes user has already been craeted. + /// # Panics + /// Panics with expect block if it cannot update the user or reserve the reward amount. + pub fn initialize_project( + who: T::AccountId, + metadata: BoundedVecOf, + status: Status, + reason: ReasonOf, + count: ProjectID, + ) -> ProjectAl { + let mut project = ProjectAl::::new(who.clone(), metadata); + let mut user = T::UsersOutlet::get_user_by_id(&who).unwrap_or_default(); + // FALLIBLE MUTATIONS + Pallet::::reserve_reward(&mut project) + .expect("The project owner should have sufficient balance"); + user.project_id = Some(count); + project.proposal_status.status = status; + project.proposal_status.reason = reason; + // STORAGE MUTATIONS + >::insert(count, project.clone()); + // >::put(count.saturating_add(1)); + T::UsersOutlet::update_user(&who, user).expect("User should exist"); + project + } + /// Create a set of reviews from a set of ids as needed and places them in storage + pub fn initialize_reviews( + acnt_ids: Vec, + project: &mut ProjectAl, + count: ProjectID, + ) -> Vec> { + let acnt_ids_iter = acnt_ids.iter(); + let mut local_pt = count; + // 15 is our target "gp". Pseudo random. This seed seems good enough. + let mut spread_points = || { + local_pt = local_pt.saturating_add(local_pt.saturating_add(7)); + local_pt = local_pt.saturating_mul(17) % 15u32; + if local_pt == 0 { + local_pt = local_pt.saturating_add(7); + } + local_pt + }; + // intialize review contents with their ids + let list_of_revs: Vec> = constants::project::REVS + .iter() + .zip(acnt_ids_iter) + .map(|(rev, id)| { + let reserve = Pallet::::can_collateralise(id).expect( + "The user should have the required balance, enough to avoid reaping too", + ); + let _ = Pallet::::collateralise(id, reserve); + // force collateralise each so we can immediately apply accept i.e update stake on project and supply reward. + let mut user = T::UsersOutlet::get_user_by_id(id).unwrap_or_default(); + + user.rank_points = spread_points(); + let rev_vec: BoundedVec<_,T::StringLimit> = rev.to_vec().try_into().unwrap(); + // init rev + let review: ReviewAl = Review{ + project_id: count, + proposal_status: ProposalStatus{ + status: Status::Accepted, + reason: Default::default() + }, + user_id: id.clone(), + point_snapshot: user.rank_points, + content: rev_vec, + }; + project.total_user_scores = + project.total_user_scores.saturating_add(user.rank_points); + + T::UsersOutlet::update_user(id, user).expect("User should exist"); + >::insert(id.clone(), count, review.clone()); + + review + }) + .collect(); + + // storage mutations + >::mutate(count, |p| *p = Some(project.clone())); + for elem in list_of_revs.iter() { + let _ = Pallet::::reward_user(&elem.user_id, project, &elem) + .expect("The collateral and all exists"); + >::mutate(count, |p| *p = Some(project.clone())); + } + list_of_revs + } + } + /// Genesis config for the chocolate pallet + #[pallet::genesis_config] + pub struct GenesisConfig { + /// Get the parameters for the init projects function + pub init_projects: Vec<(T::AccountId, Status, ReasonOf)>, + } + /// By default a generic project or known projects will be shown - polkadot & sisters + #[cfg(feature = "std")] + impl Default for GenesisConfig { + fn default() -> Self { + // to-do actually make this known projects. In the meantime, default will do. + Self { init_projects: Vec::new() } + } + } + + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig + { + fn build(&self) { + // setup a counter to serve as project index + let mut count: ProjectID = 1; + let meta: Vec> = + constants::project::METADATA.iter().map(|each| each.to_vec().try_into().ok().unwrap()).collect(); + let zipped = (&self.init_projects).into_iter().zip(meta.iter()); + // create project from associated metadata in zip. + for each in zipped { + let (this_project, meta_ref) = each; + let meta_cid = meta_ref.to_owned(); + let (acnt, stat, reas) = this_project.to_owned(); + // Filter ids so generated reviews do not include project owner + let filtered_ids: Vec<_> = (&self.init_projects) + .into_iter() + .filter(|(id, ..)| acnt.ne(id)) + .map(|long| long.0.clone()) + .collect(); + // Give filtered ids and main acnt enough funds to pay for reward. + // (Hack). More formal ways should be decided upon. + + let two = BalanceOf::::from(2u32); + let minimum = T::Currency::minimum_balance(); + let amnt_issue = T::RewardCap::get().saturating_mul(two).saturating_add(minimum); + let amnt_issue2 = + T::UserCollateral::get().saturating_mul(two).saturating_add(minimum); + let total = amnt_issue.saturating_add(amnt_issue2).saturating_mul(two); + let imbalance = T::Currency::issue(total.clone()); + T::Currency::resolve_creating(&acnt, imbalance); + filtered_ids + .iter() + .for_each(|id| T::Currency::resolve_creating(id, T::Currency::issue(total))); + // create the users. + filtered_ids.iter().for_each(|id| { + T::UsersOutlet::get_or_create_default(&acnt).expect("Should complete"); + T::UsersOutlet::get_or_create_default(id).expect("Should complete"); + }); + // create reviews and projects and store. + let mut returnable = + Pallet::::initialize_project(acnt, meta_cid, stat, reas, count); + let _reviews: Vec<_> = + Pallet::::initialize_reviews(filtered_ids, &mut returnable, count); + // STORAGE MUTATIONS -- after due to mut + count += 1; + >::put(count); + } + // Fill the treasury - A little hack. + let imbalance = T::Currency::issue(T::RewardCap::get()); + Pallet::::do_mint(imbalance); + } + } +} diff --git a/pallets/chocolate/src/mock.rs b/pallets/chocolate/src/mock.rs new file mode 100644 index 0000000..adea6cd --- /dev/null +++ b/pallets/chocolate/src/mock.rs @@ -0,0 +1,108 @@ +use crate as pallet_chocolate; +use frame_support::parameter_types; +use frame_system as system; +use pallet_users; +use sp_core::H256; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, +}; + +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +// The runtime is an enum. omoshiroi +// Configure a mock runtime to test the pallet. +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + ChocolateModule: pallet_chocolate::{Pallet, Call, Storage, Event}, + Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + UsersModule: pallet_users::{Pallet, Call, Storage, Event}, + } +); + +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const SS58Prefix: u8 = 42; +} + +impl system::Config for Test { + type BaseCallFilter = frame_support::traits::Everything; + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type Origin = Origin; + type Call = Call; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Header = Header; + type Event = Event; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = SS58Prefix; + type OnSetCode = (); +} + +parameter_types! { + pub const ExistentialDeposit: u128 = 500; +} + +impl pallet_balances::Config for Test { + // from treasury tests...not using + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + /// The type for recording an account's balance. + type Balance = u128; + /// The ubiquitous event type. + type Event = Event; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = (); +} +// ToDo! temp treasury that has implements unbalanced which stores outer state that can be queried + +// This is a mock runtime hence we can't avoid importing users and other deps. +/// Configure the pallet-users for UserIO trait +impl pallet_users::Config for Test { + type Event = Event; +} +parameter_types! { + pub const Cap: u128 = 5 * 1; + pub const UserCollateral: u128 = 1_000_000_000; // Look into importing constants crate. + pub const StringLimit: u32 = 1_000_000_000; +} +// our configs start here +impl pallet_chocolate::Config for Test { + type Event = Event; + // no need to rope in collective pallet. we are enough + type ApprovedOrigin = frame_system::EnsureRoot; + // this is simply a pointer to the true implementor,and creator of the currency trait...the balances pallet + type Currency = Balances; + type TreasuryOutlet = (); + type RewardCap = Cap; + type UsersOutlet = UsersModule; + type UserCollateral = UserCollateral; + type StringLimit = StringLimit; +} + +// construct a test that mocks treasury runtime but prints imbalance value instead +// Build genesis storage according to the mock runtime. +pub fn new_test_ext() -> sp_io::TestExternalities { + system::GenesisConfig::default().build_storage::().unwrap().into() +} diff --git a/pallets/chocolate/src/tests.rs b/pallets/chocolate/src/tests.rs new file mode 100644 index 0000000..f456af2 --- /dev/null +++ b/pallets/chocolate/src/tests.rs @@ -0,0 +1,18 @@ +use crate::{mock::*, Error}; +use frame_support::{assert_noop, assert_ok}; + +#[test] +fn it_works_for_default_value() { + new_test_ext().execute_with(|| { + // dispatch our test call + + // check that the stored value is correct + + }); +} + +#[test] +fn correct_error_for_none_value() { + new_test_ext().execute_with(|| { + }); +} diff --git a/pallets/template/src/mock.rs b/pallets/template/src/mock.rs index 917356c..006dcff 100644 --- a/pallets/template/src/mock.rs +++ b/pallets/template/src/mock.rs @@ -56,6 +56,7 @@ impl system::Config for Test { impl pallet_template::Config for Test { type Event = Event; + type Currency = Currencies; } // Build genesis storage according to the mock runtime. diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml new file mode 100644 index 0000000..273a3a1 --- /dev/null +++ b/primitives/Cargo.toml @@ -0,0 +1,46 @@ +[package] +name = "chocolate-primitives" +version = "0.1.0" +edition = "2021" +description = "Primitives crate for chocolate users" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +serde = { version = "1.0.132", optional=true } +codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } +scale-info = { version = "2.0.0", default-features = false, features = ["derive"] } + +# Substrate +frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.24" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } + +[dev-dependencies] + +# Substrate +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } + +[features] +default = ['std'] +# is benchmarking necessary here? +runtime-benchmarks = ['frame-benchmarking'] +std = [ + 'serde', + 'codec/std', + 'sp-std/std', + "sp-runtime/std", + "sp-core/std", + "sp-io/std", + "scale-info/std", + 'frame-support/std', + 'frame-system/std', + 'frame-benchmarking/std', +] +try-runtime = ['frame-support/try-runtime'] diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs new file mode 100644 index 0000000..4587dff --- /dev/null +++ b/primitives/src/lib.rs @@ -0,0 +1,3 @@ +pub mod projects; + +pub mod users; \ No newline at end of file diff --git a/primitives/src/projects.rs b/primitives/src/projects.rs new file mode 100644 index 0000000..4e0c364 --- /dev/null +++ b/primitives/src/projects.rs @@ -0,0 +1,213 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use frame_support::{ + dispatch::DispatchResult, sp_runtime::traits::{AtLeast32BitUnsigned,Zero}, traits::Get, BoundedVec, + RuntimeDebug, pallet_prelude::{Member, MaybeSerializeDeserialize}, Parameter, +}; +use frame_system::Config; +use scale_info::TypeInfo; + +/// A simple u32 +pub type ProjectID = u32; +/// Index for reviews , use to link to project +pub type ReviewID = u64; +use codec::{Decode, Encode, MaxEncodedLen}; + +#[derive( + Encode, Decode, Eq, PartialEq, Clone, RuntimeDebug, TypeInfo, MaxEncodedLen, PartialOrd, Ord, +)] +pub struct Review +where + StringLen: Get, +{ + pub proposal_status: ProposalStatus, + pub user_id: UserID, + pub content: BoundedVec, + pub project_id: ProjectID, + /// A snapshot of the user's rank at the time of review + pub point_snapshot: u32, +} + +/// The metadata of a project. +type MetaData = BoundedVec; + +#[cfg(feature = "std")] +pub use serde::{Deserialize, Serialize}; + +/// The status of the proposal +#[derive( + Encode, + Decode, + Eq, + PartialEq, + Copy, + Clone, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, + PartialOrd, + Ord, +)] +#[cfg_attr(feature = "std", derive(Deserialize, Serialize))] +pub enum Status { + ///Proposal created + Proposed, + /// Proposal accepted + Accepted, + /// Proposal rejected + Rejected, +} +/// Reason for the current status - Required for rejected proposal. +#[derive( + Encode, Decode, Eq, PartialEq, Clone, RuntimeDebug, TypeInfo, MaxEncodedLen, PartialOrd, Ord, +)] +#[derive(Deserialize, Serialize)] +pub enum Reason +where +StringLen: Get, +{ + /// Custom reason to encapsulate further things like marketCap and other details + Other(BoundedVec), + /// Negative lenient - base conditions for project missing or review lacking detail + InsufficientMetaData, + /// Negative harsh, project or review is malicious + Malicious, + /// Positive neutral, covers rank up to accepted. + PassedRequirements, +} +/// The status of a proposal sent to the council from here. +#[derive( + Encode, + Decode, + Default, + Eq, + PartialEq, + Clone, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, + PartialOrd, + Ord, +)] +pub struct ProposalStatus +where +StringLen: Get, + +{ + pub status: Status, + pub reason: Reason, +} +/// Default status - storage req +impl Default for Status { + fn default() -> Self { + Status::Proposed + } +} +/// Default reason - storage req +impl Default for Reason +where +StringLen: Get, + +{ + fn default() -> Self { + Reason::PassedRequirements + } +} +/// The project structure. +#[derive( + Encode, + Decode, + Default, + Eq, + PartialEq, + Clone, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, + PartialOrd, + Ord, +)] +pub struct Project +where + Balance: AtLeast32BitUnsigned, + StringLen: Get, +{ + /// The owner of the project + pub owner_id: UserID, + /// A bool that allows for simple allocation of the unique chocolate badge. NFT?? (default: false) + badge: Option, + /// Project metadata - req - default some . + metadata: MetaData, + /// the status of the project's proposal in the council - default proposed. + pub proposal_status: ProposalStatus, + /// A reward value for the project ---------_switch to idea of named reserve hash - (default: Reward). + pub reward: Balance, + /// A sum of all the scores of reviews proposed to the project. Saturate when u32::MAX. + pub total_user_scores: u32, +} +// ------------------------------------------------------------^edit +impl Project +where + Balance: AtLeast32BitUnsigned, + StringLen: Get, +{ + /// Set useful defaults. + /// Initialises a project with defaults on everything except id and metadata + pub fn new(owner_id: UserID, metadata: MetaData) -> Self { + Project { + owner_id, + badge: Option::None, + metadata, + reward: Zero::zero(), + proposal_status: ProposalStatus { + status: Default::default(), + reason: Default::default() + }, + total_user_scores: Default::default(), + } + } +} +/// A trait that allows project to: +/// - reserve some token for rewarding its reviewers. +pub trait ProjectIO { + type UserID; + type Balance: AtLeast32BitUnsigned; + type StringLen: Get + Member + Parameter + MaybeSerializeDeserialize + Clone; + /// Checks: + /// If the projects' reward value reflects what is reserved, excluding existential value + fn check_reward( + project: &Project, + ) -> DispatchResult; + /// Check if the project owner can offer up hardcoded amount as init. + fn can_reward(project: &Self::UserID) -> bool; + /// Reserve an initial amount for use as reward + fn reserve_reward( + project: &mut Project, + ) -> DispatchResult; + /// Reward the user with an amount and effect edits on the struct level. (Exposes amount in free balance for next step (transfer)) + /// Assumed to be executed right before the final balance transfer + /// Note: If any failure happens after, reward may be lost. + fn reward( + project: &mut Project, + amount: Self::Balance, + ) -> DispatchResult; +} +/// Easy way of differentaiting the two. We'll need this. +#[derive( + Encode, + Decode, + Eq, + PartialEq, + Copy, + Clone, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, + PartialOrd, + Ord, +)] +#[cfg_attr(feature = "std", derive(Deserialize, Serialize))] +pub enum EntityKind { + Project, + User, +} diff --git a/primitives/src/users.rs b/primitives/src/users.rs new file mode 100644 index 0000000..b8c2596 --- /dev/null +++ b/primitives/src/users.rs @@ -0,0 +1,35 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use codec::{Decode, Encode, MaxEncodedLen}; +use frame_support::{dispatch::{DispatchError, DispatchResult}, RuntimeDebug}; +use frame_system::Config; +use scale_info::TypeInfo; + +#[derive( + Encode, + Decode, + Default, + Eq, + PartialEq, + Clone, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, + PartialOrd, + Ord, +)] +pub struct User { + pub rank_points: u32, + pub project_id: Option, +} + +/// UserIO trait for CRUD on users store +pub trait UserIO { + fn get_user_by_id(id: &T::AccountId) -> Option; + fn check_owns_project(id: &T::AccountId) -> bool; + fn check_user_exists(id: &T::AccountId) -> bool; + /// Checks if the user exists, else creates a new user with wanted defaults. + fn get_or_create_default(id: &T::AccountId) -> Result; + fn set_user(id: &T::AccountId, user: User) -> DispatchResult; + fn update_user(id: &T::AccountId, user: User) -> DispatchResult; +} From 87492f5c0dd6539bae2472cbbaeb25b62584d0c2 Mon Sep 17 00:00:00 2001 From: Islam Date: Fri, 8 Jul 2022 11:25:32 +0000 Subject: [PATCH 22/36] feat(migration): add new genesis config, onchain review score Updated struct, extrinsics, and Chainspec --- pallets/chocolate/src/constants.rs | 10 +- pallets/chocolate/src/lib.rs | 236 ++++++++++++++--------------- primitives/src/projects.rs | 14 +- primitives/src/users.rs | 16 +- 4 files changed, 137 insertions(+), 139 deletions(-) diff --git a/pallets/chocolate/src/constants.rs b/pallets/chocolate/src/constants.rs index 9726408..bc2c741 100644 --- a/pallets/chocolate/src/constants.rs +++ b/pallets/chocolate/src/constants.rs @@ -7,10 +7,10 @@ pub mod project { b"QmVzxGUaVF4HVfvtoaVqXBcVGqyEq72TAp8s9u9pmH5Vra", ]; - pub const REVS: [&[u8]; 4] = [ - b"QmdKx4pmnJUP5GdjtpJE2ei4xeaRKQWYwvXGuVY1AbAwDM/review1.json", - b"QmdKx4pmnJUP5GdjtpJE2ei4xeaRKQWYwvXGuVY1AbAwDM/review2.json", - b"QmdKx4pmnJUP5GdjtpJE2ei4xeaRKQWYwvXGuVY1AbAwDM/review3.json", - b"QmdKx4pmnJUP5GdjtpJE2ei4xeaRKQWYwvXGuVY1AbAwDM/review4.json", + pub const REVS: [(u8,&[u8]); 4] = [ + (3,b"QmdKx4pmnJUP5GdjtpJE2ei4xeaRKQWYwvXGuVY1AbAwDM/review1.json"), + (5,b"QmdKx4pmnJUP5GdjtpJE2ei4xeaRKQWYwvXGuVY1AbAwDM/review2.json"), + (5,b"QmdKx4pmnJUP5GdjtpJE2ei4xeaRKQWYwvXGuVY1AbAwDM/review3.json"), + (3,b"QmdKx4pmnJUP5GdjtpJE2ei4xeaRKQWYwvXGuVY1AbAwDM/review4.json"), ]; } diff --git a/pallets/chocolate/src/lib.rs b/pallets/chocolate/src/lib.rs index 2922c9c..2df1e55 100644 --- a/pallets/chocolate/src/lib.rs +++ b/pallets/chocolate/src/lib.rs @@ -20,16 +20,20 @@ pub mod constants; #[frame_support::pallet] pub mod pallet { use crate::constants; - use chocolate_primitives::{projects::*,users::UserIO}; + use chocolate_primitives::{projects::*, users::UserIO}; use frame_support::{ + assert_ok, dispatch::DispatchResult, pallet_prelude::*, - sp_runtime::{traits::{CheckedDiv,Saturating}, ArithmeticError}, + sp_runtime::{ + traits::{CheckedDiv, Saturating}, + ArithmeticError, + }, traits::{ Currency, ExistenceRequirement::KeepAlive, Imbalance, OnUnbalanced, ReservableCurrency, }, }; - use frame_system::pallet_prelude::*; + use frame_system::{pallet_prelude::*, Origin}; use sp_std::str; use sp_std::vec::Vec; // Include the ApprovedOrigin type here, and the method to get treasury id, then mint with currencymodule @@ -54,23 +58,25 @@ pub mod pallet { type UserCollateral: Get>; /// The maximum length of a name or symbol stored on-chain. #[pallet::constant] - type StringLimit: Get + Member + Parameter + MaybeSerializeDeserialize + Clone; + type StringLimit: Get + Member + Parameter + MaybeSerializeDeserialize + Clone; } // ------------------------------------------------------------Type aliases ---------------------\ pub type NegativeImbalanceOf = <::Currency as Currency< ::AccountId, >>::NegativeImbalance; /// type alias for review - this is the base struct, like the 2nd part of Balancesof - pub type ReviewAl = Review<::AccountId, ::StringLimit>; + pub type ReviewAl = + Review<::AccountId, ::StringLimit>; /// type alias for project - pub type ProjectAl = Project<::AccountId, BalanceOf,::StringLimit>; + pub type ProjectAl = + Project<::AccountId, BalanceOf, ::StringLimit>; /// Type alias for balance, binding T::Currency to Currency::AccountId and then extracting from that Balance. Accessible via T::BalanceOf. T is frame_System. pub type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; /// Type alias for reason - pub type ReasonOf = Reason<::StringLimit>; + pub type ReasonOf = Reason<::StringLimit>; /// Type Alias for Bounded Vec - pub type BoundedVecOf = BoundedVec::StringLimit>; + pub type BoundedVecOf = BoundedVec::StringLimit>; #[pallet::pallet] #[pallet::generate_store(pub(super) trait Store)] @@ -104,7 +110,7 @@ pub mod pallet { /// parameters. [something, who] SomethingStored(u32, T::AccountId), /// parameters. [owner,cid,project_id] - ProjectCreated(T::AccountId, BoundedVec, ProjectID), + ProjectCreated(T::AccountId, BoundedVec, ProjectID), /// parameters. [owner,project_id] ReviewCreated(T::AccountId, ProjectID), /// parameters [owner,id] @@ -139,6 +145,8 @@ pub mod pallet { AcceptingNotProposed, /// The checked division method failed, either due to overflow/underflow or because of division by zero. CheckedDivisionFailed, + /// Review score is out of range 1-5 + ReviewScoreOutOfRange, } // Dispatchable functions must be annotated with a weight and must return a DispatchResult. #[pallet::call] @@ -146,17 +154,19 @@ pub mod pallet { /// Create a project /// /// - O(1). - /// - Init: Index starts at 0 + /// - Init: Index starts at 1 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,3))] - pub fn create_project(origin: OriginFor, project_meta: BoundedVec) -> DispatchResult { + pub fn create_project( + origin: OriginFor, + project_meta: BoundedVec, + ) -> DispatchResult { let who = ensure_signed(origin)?; // CHECKS let index = >::get().unwrap_or(1); let new_index = index.checked_add(1).ok_or(Error::::StorageOverflow)?; - let mut user = T::UsersOutlet::get_or_create_default(&who).unwrap_or_default(); - let user_project_id = user.project_id.unwrap_or_default(); - // default for u32 is 0 but projectID starts at 1 - ensure!(user_project_id == 0, Error::::AlreadyOwnsProject); + let mut user = T::UsersOutlet::get_or_create_default(&who); + let not_own_project = user.project_id.is_none(); + ensure!(not_own_project, Error::::AlreadyOwnsProject); ensure!(Pallet::::can_reward(&who), Error::::InsufficientBalance); // Init structs. let mut project = ProjectAl::::new(who.clone(), project_meta.clone()); @@ -174,7 +184,7 @@ pub mod pallet { #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(2,3))] pub fn create_review( origin: OriginFor, - review_meta: BoundedVecOf, + review_meta: (u8, BoundedVecOf), project_id: ProjectID, ) -> DispatchResult { let who = ensure_signed(origin)?; @@ -183,10 +193,11 @@ pub mod pallet { >::get(project_id).ok_or(Error::::NoProjectWithId)?; ensure!(!>::contains_key(&who, project_id), Error::::DuplicateReview); ensure!(this_project.owner_id.ne(&who), Error::::OwnerReviewedProject); + ensure!(review_meta.0 <= 5 && review_meta.0 >= 1, Error::::ReviewScoreOutOfRange); let reserve = Pallet::::can_collateralise(&who)?; // Fallible MUTATIONS Pallet::::collateralise(&who, reserve)?; - let user = T::UsersOutlet::get_or_create_default(&who)?; + let user = T::UsersOutlet::get_or_create_default(&who); this_project.total_user_scores = this_project.total_user_scores.saturating_add(user.rank_points); // STORAGE MUTATIONS @@ -195,13 +206,14 @@ pub mod pallet { project_id, Review { user_id: who.clone(), - content: review_meta, + content: review_meta.1, project_id, - proposal_status: ProposalStatus { + proposal_status: ProposalStatus { status: Default::default(), - reason: Default::default() + reason: Default::default(), }, point_snapshot: user.rank_points, + review_score: review_meta.0, }, ); >::mutate(project_id, |project| { @@ -235,6 +247,9 @@ pub mod pallet { Pallet::::reward_user(&user_id, &mut project, &review)?; review.proposal_status.status = Status::Accepted; review.proposal_status.reason = Reason::PassedRequirements; + project.number_of_reviews = project.number_of_reviews.saturating_add(1); + project.total_review_score = + project.total_review_score.saturating_add(u64::from(review.review_score)); // STORAGE MUTATIONS >::mutate(&user_id, project_id, |r| { *r = Option::Some(review); @@ -319,11 +334,11 @@ pub mod pallet { if _missing_reward > BalanceOf::::from(0u32) { // assuming our can_unreserve failed // rollback ---- + // It Should be enough to rollback following our initial unreserve T::Currency::reserve( &project_struct.owner_id, amount.saturating_sub(_missing_reward), - ) - .expect("Should be enough to rollback following our initial unreserve"); + )?; return Err(Error::::RewardInconsistent.into()); } // Update the reward on project. @@ -346,10 +361,9 @@ pub mod pallet { /// Release the collateral held by the account. Should only be called in the context of acceptance. /// Does no checks. Assumes the state is as required. /// - /// **Requires** : check_collateral - pub fn release_collateral(who: &T::AccountId) -> DispatchResult { + /// **Requires** : check_collateral. Calls currency::unreserve + pub fn release_collateral(who: &T::AccountId) { T::Currency::unreserve(&who, T::UserCollateral::get()); - Ok(()) } /// Reward the user for their contribution to the project. Assumed to be called after acceptance. /// @@ -360,24 +374,35 @@ pub mod pallet { review: &ReviewAl, ) -> DispatchResult { let reward = project.reward.clone(); + let mut user = T::UsersOutlet::get_user_by_id(&who).ok_or(Error::::NoneValue)?; // Reward calc // reward is reward * (user_point/ttl_project_point )-- use fixed point attr of BalanceOf and move vars around in eqn. let balance_prj_score = BalanceOf::::from(project.total_user_scores); let balance_rev_sshot = BalanceOf::::from(review.point_snapshot); - let balance_div = reward - .checked_div(&balance_prj_score) - .ok_or(DispatchError::Arithmetic(ArithmeticError::DivisionByZero))?; + let balance_div = reward.checked_div(&balance_prj_score).ok_or({ + ensure!( + balance_prj_score != BalanceOf::::from(0u32), + DispatchError::Arithmetic(ArithmeticError::DivisionByZero) + ); + ensure!( + reward > balance_prj_score, + DispatchError::Arithmetic(ArithmeticError::Underflow) + ); + DispatchError::Arithmetic(ArithmeticError::Overflow) + })?; let reward_fraction = balance_div.saturating_mul(balance_rev_sshot); // Unreserve our final decision from project. // We expect projects to not edit this reserve. What if they do?? - Users tx start failing: Ask users to Report! if found, and track txs - // Mutations - Pallet::::release_collateral(who)?; - Pallet::::reward(project, reward_fraction).expect("should be able to reward"); // nothing should fail after release - T::Currency::transfer(&project.owner_id, who, reward_fraction, KeepAlive) - .expect("should be enough to safely transfer"); + // Mutations - Fallible. Expect: All of these to rollback changes if they fail. + user.rank_points = user.rank_points.saturating_add(1); + Pallet::::reward(project, reward_fraction)?; + T::Currency::transfer(&project.owner_id, who, reward_fraction, KeepAlive)?; + T::UsersOutlet::update_user(&who, user)?; + // Mutations - Infallible + Pallet::::release_collateral(who); Ok(()) } /// Check if a **user** can serve up the required collateral @@ -419,121 +444,88 @@ pub mod pallet { /// Panics with expect block if it cannot update the user or reserve the reward amount. pub fn initialize_project( who: T::AccountId, - metadata: BoundedVecOf, + metadata: BoundedVecOf, status: Status, reason: ReasonOf, - count: ProjectID, ) -> ProjectAl { - let mut project = ProjectAl::::new(who.clone(), metadata); - let mut user = T::UsersOutlet::get_user_by_id(&who).unwrap_or_default(); // FALLIBLE MUTATIONS - Pallet::::reserve_reward(&mut project) - .expect("The project owner should have sufficient balance"); - user.project_id = Some(count); + let t = Origin::::Signed(who.clone()); + assert_ok!(Pallet::::create_project(t.into(), metadata.clone())); + let next_index = >::get().unwrap_or_default(); + let index = next_index.saturating_sub(1); + // STORAGE MUTATIONS + let mut project = >::get(index).unwrap(); project.proposal_status.status = status; project.proposal_status.reason = reason; - // STORAGE MUTATIONS - >::insert(count, project.clone()); - // >::put(count.saturating_add(1)); - T::UsersOutlet::update_user(&who, user).expect("User should exist"); + >::insert(index, project.clone()); project } /// Create a set of reviews from a set of ids as needed and places them in storage - pub fn initialize_reviews( - acnt_ids: Vec, - project: &mut ProjectAl, - count: ProjectID, - ) -> Vec> { + pub fn initialize_reviews(acnt_ids: Vec) { + let proj = >::get().unwrap_or_default(); + let project_id = proj.saturating_sub(1); let acnt_ids_iter = acnt_ids.iter(); - let mut local_pt = count; - // 15 is our target "gp". Pseudo random. This seed seems good enough. - let mut spread_points = || { - local_pt = local_pt.saturating_add(local_pt.saturating_add(7)); - local_pt = local_pt.saturating_mul(17) % 15u32; - if local_pt == 0 { - local_pt = local_pt.saturating_add(7); - } - local_pt - }; // intialize review contents with their ids - let list_of_revs: Vec> = constants::project::REVS - .iter() - .zip(acnt_ids_iter) - .map(|(rev, id)| { - let reserve = Pallet::::can_collateralise(id).expect( - "The user should have the required balance, enough to avoid reaping too", - ); - let _ = Pallet::::collateralise(id, reserve); - // force collateralise each so we can immediately apply accept i.e update stake on project and supply reward. - let mut user = T::UsersOutlet::get_user_by_id(id).unwrap_or_default(); - - user.rank_points = spread_points(); - let rev_vec: BoundedVec<_,T::StringLimit> = rev.to_vec().try_into().unwrap(); - // init rev - let review: ReviewAl = Review{ - project_id: count, - proposal_status: ProposalStatus{ - status: Status::Accepted, - reason: Default::default() - }, - user_id: id.clone(), - point_snapshot: user.rank_points, - content: rev_vec, - }; - project.total_user_scores = - project.total_user_scores.saturating_add(user.rank_points); - - T::UsersOutlet::update_user(id, user).expect("User should exist"); - >::insert(id.clone(), count, review.clone()); - - review - }) - .collect(); - - // storage mutations - >::mutate(count, |p| *p = Some(project.clone())); - for elem in list_of_revs.iter() { - let _ = Pallet::::reward_user(&elem.user_id, project, &elem) - .expect("The collateral and all exists"); - >::mutate(count, |p| *p = Some(project.clone())); + for (rev, id) in constants::project::REVS.iter().zip(acnt_ids_iter.clone()) { + let dispatch = Pallet::::create_review( + Origin::::Signed(id.clone()).into(), + (rev.0, rev.1.to_vec().try_into().expect("Metadata should be within StringLimit")), + project_id, + ); + assert_ok!(dispatch); + } + // Accept the reviews. + for (_, id) in constants::project::REVS.iter().zip(acnt_ids_iter){ + let dispatch2 =Pallet::::accept_review(Origin::::Root.into(), id.clone(), project_id); + assert_ok!(dispatch2); } - list_of_revs } } /// Genesis config for the chocolate pallet #[pallet::genesis_config] pub struct GenesisConfig { /// Get the parameters for the init projects function - pub init_projects: Vec<(T::AccountId, Status, ReasonOf)>, + pub init_projects: Vec<(Status, ReasonOf)>, + pub init_users: Vec, } /// By default a generic project or known projects will be shown - polkadot & sisters #[cfg(feature = "std")] impl Default for GenesisConfig { fn default() -> Self { // to-do actually make this known projects. In the meantime, default will do. - Self { init_projects: Vec::new() } + Self { init_projects: Vec::new(), init_users: Vec::new() } } } #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig - { + impl GenesisBuild for GenesisConfig { fn build(&self) { + // Create users. + let iter_users = (&self.init_users).iter(); + for id in iter_users.clone() { + T::UsersOutlet::set_user(id, Default::default()); + } // setup a counter to serve as project index - let mut count: ProjectID = 1; - let meta: Vec> = - constants::project::METADATA.iter().map(|each| each.to_vec().try_into().ok().unwrap()).collect(); - let zipped = (&self.init_projects).into_iter().zip(meta.iter()); + let meta: Vec> = constants::project::METADATA + .iter() + .map(|each| each.to_vec().try_into().expect("Metadata should be within StringLimit")) + .collect(); + let init_projects_w_users: Vec<_> = (&self.init_projects) + .into_iter() + .zip(iter_users) + .map(|((s, r), accnt)| (accnt, s.clone(), r.clone())) + .collect(); + let zipped = (init_projects_w_users).into_iter().zip(meta.iter()); // create project from associated metadata in zip. for each in zipped { - let (this_project, meta_ref) = each; + let (project_ref, meta_ref) = each; let meta_cid = meta_ref.to_owned(); - let (acnt, stat, reas) = this_project.to_owned(); + let (acnt, stat, reas) = project_ref.to_owned(); // Filter ids so generated reviews do not include project owner - let filtered_ids: Vec<_> = (&self.init_projects) - .into_iter() - .filter(|(id, ..)| acnt.ne(id)) - .map(|long| long.0.clone()) + let filtered_ids: Vec<_> = (&self.init_users) + .iter() + .filter(|id| acnt.ne(id)) + .map(|long| long.clone()) .collect(); // Give filtered ids and main acnt enough funds to pay for reward. // (Hack). More formal ways should be decided upon. @@ -549,19 +541,11 @@ pub mod pallet { filtered_ids .iter() .for_each(|id| T::Currency::resolve_creating(id, T::Currency::issue(total))); - // create the users. - filtered_ids.iter().for_each(|id| { - T::UsersOutlet::get_or_create_default(&acnt).expect("Should complete"); - T::UsersOutlet::get_or_create_default(id).expect("Should complete"); - }); + // create reviews and projects and store. - let mut returnable = - Pallet::::initialize_project(acnt, meta_cid, stat, reas, count); - let _reviews: Vec<_> = - Pallet::::initialize_reviews(filtered_ids, &mut returnable, count); - // STORAGE MUTATIONS -- after due to mut - count += 1; - >::put(count); + + Pallet::::initialize_project(acnt.clone(), meta_cid, stat, reas); + Pallet::::initialize_reviews(filtered_ids); } // Fill the treasury - A little hack. let imbalance = T::Currency::issue(T::RewardCap::get()); diff --git a/primitives/src/projects.rs b/primitives/src/projects.rs index 4e0c364..4d4a998 100644 --- a/primitives/src/projects.rs +++ b/primitives/src/projects.rs @@ -26,6 +26,8 @@ where pub project_id: ProjectID, /// A snapshot of the user's rank at the time of review pub point_snapshot: u32, + /// Score of a review + pub review_score: u8 } /// The metadata of a project. @@ -142,10 +144,14 @@ where pub proposal_status: ProposalStatus, /// A reward value for the project ---------_switch to idea of named reserve hash - (default: Reward). pub reward: Balance, - /// A sum of all the scores of reviews proposed to the project. Saturate when u32::MAX. + /// A sum of all the points of users who wrote a review for the project. Saturate when u32::MAX. pub total_user_scores: u32, + /// The total review scores for a project + pub total_review_score: u64, + /// The number of reviews submitted + pub number_of_reviews: u32 } -// ------------------------------------------------------------^edit + impl Project where Balance: AtLeast32BitUnsigned, @@ -163,7 +169,9 @@ where status: Default::default(), reason: Default::default() }, - total_user_scores: Default::default(), + total_user_scores: Zero::zero(), + number_of_reviews: Zero::zero(), + total_review_score: Zero::zero() } } } diff --git a/primitives/src/users.rs b/primitives/src/users.rs index b8c2596..47fc458 100644 --- a/primitives/src/users.rs +++ b/primitives/src/users.rs @@ -1,14 +1,13 @@ #![cfg_attr(not(feature = "std"), no_std)] use codec::{Decode, Encode, MaxEncodedLen}; -use frame_support::{dispatch::{DispatchError, DispatchResult}, RuntimeDebug}; +use frame_support::{dispatch::{ DispatchResult}, RuntimeDebug}; use frame_system::Config; use scale_info::TypeInfo; #[derive( Encode, Decode, - Default, Eq, PartialEq, Clone, @@ -22,14 +21,21 @@ pub struct User { pub rank_points: u32, pub project_id: Option, } - +impl Default for User{ + fn default() -> Self{ + // Start from 1 because of total project score calc to avoid accidentally recording zero when we use Default::default() + User { rank_points: 1, project_id: Option::None } + } +} /// UserIO trait for CRUD on users store pub trait UserIO { fn get_user_by_id(id: &T::AccountId) -> Option; fn check_owns_project(id: &T::AccountId) -> bool; + /// Allows us to check if the user even exists before calling get by id. fn check_user_exists(id: &T::AccountId) -> bool; /// Checks if the user exists, else creates a new user with wanted defaults. - fn get_or_create_default(id: &T::AccountId) -> Result; - fn set_user(id: &T::AccountId, user: User) -> DispatchResult; + fn get_or_create_default(id: &T::AccountId) -> User; + /// Idempotent. Simply creates item in storage if it doesn't already exist. Use update_user if you'd like to mutate the user after knowing it's been created + fn set_user(id: &T::AccountId, user: User) -> (); fn update_user(id: &T::AccountId, user: User) -> DispatchResult; } From d32d2b1ad3f3d93e9709c6d3350ee33bb7be24ca Mon Sep 17 00:00:00 2001 From: Islam Date: Fri, 8 Jul 2022 20:42:22 +0000 Subject: [PATCH 23/36] feat(migration): Add chocolate module to runtime, and its tests Benchmarks use new format: https://substrate.stackexchange.com/a/3675/88 --- node/src/chain_spec.rs | 34 +++++++++++++++++++++++++++++ pallets/chocolate/src/mock.rs | 39 +++++++++++++++++++++++++++++----- pallets/chocolate/src/tests.rs | 32 ++++++++++++++++++++++------ runtime/src/lib.rs | 25 +++++++++++++++++++++- 4 files changed, 117 insertions(+), 13 deletions(-) diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 7d41cee..b520cec 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -228,6 +228,40 @@ fn testnet_genesis( ] }) .collect(), + + }, + // this isn't dynamic as we do not know the data passed. + chocolate_module: parachain_template_runtime::ChocolateModuleConfig { + init_projects: { + let ps_req = Reason::PassedRequirements; + // use a static list for accounts + vec![ + (Status::Accepted, ps_req.clone()), + (Status::Rejected, Reason::Malicious), + (Status::Accepted, ps_req.clone()), + (Status::Accepted, ps_req.clone()), + (Status::Proposed, ps_req.clone()), + (Status::Accepted, ps_req.clone()), + (Status::Accepted, ps_req.clone()), + (Status::Accepted, ps_req.clone()), + ] + }, + init_users: { + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), + ] + }, }, } } diff --git a/pallets/chocolate/src/mock.rs b/pallets/chocolate/src/mock.rs index adea6cd..e4d1f5f 100644 --- a/pallets/chocolate/src/mock.rs +++ b/pallets/chocolate/src/mock.rs @@ -1,17 +1,19 @@ use crate as pallet_chocolate; -use frame_support::parameter_types; +use frame_support::{parameter_types,traits::GenesisBuild}; use frame_system as system; use pallet_users; use sp_core::H256; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup}, + BuildStorage, }; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; +use chocolate_primitives::projects::{Reason, Status}; -// The runtime is an enum. omoshiroi +// The runtime is an enum. // Configure a mock runtime to test the pallet. frame_support::construct_runtime!( pub enum Test where @@ -83,8 +85,8 @@ impl pallet_users::Config for Test { type Event = Event; } parameter_types! { - pub const Cap: u128 = 5 * 1; - pub const UserCollateral: u128 = 1_000_000_000; // Look into importing constants crate. + pub const Cap: u128 = 100; + pub const UserCollateral: u128 = 10; pub const StringLimit: u32 = 1_000_000_000; } // our configs start here @@ -104,5 +106,32 @@ impl pallet_chocolate::Config for Test { // construct a test that mocks treasury runtime but prints imbalance value instead // Build genesis storage according to the mock runtime. pub fn new_test_ext() -> sp_io::TestExternalities { - system::GenesisConfig::default().build_storage::().unwrap().into() + let mut t = system::GenesisConfig::default().build_storage::().unwrap(); + GenesisConfig { + // + balances: BalancesConfig { balances: vec![(1, 5000)] }, + ..Default::default() + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext +} +pub fn choc_ext() -> sp_io::TestExternalities { + let mut t = pallet_chocolate::GenesisConfig::::default().build_storage().unwrap(); + + pallet_chocolate::GenesisConfig:: { + // + init_projects: vec![(Status::Accepted, Reason::PassedRequirements)], + init_users: vec![1,2,3,4,5,6], + + ..Default::default() + } + .assimilate_storage(&mut t) + .unwrap(); + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext } diff --git a/pallets/chocolate/src/tests.rs b/pallets/chocolate/src/tests.rs index f456af2..82443e0 100644 --- a/pallets/chocolate/src/tests.rs +++ b/pallets/chocolate/src/tests.rs @@ -1,18 +1,36 @@ use crate::{mock::*, Error}; -use frame_support::{assert_noop, assert_ok}; +use frame_support::{assert_noop, assert_ok, assert_err}; #[test] -fn it_works_for_default_value() { +fn create_project_should_work() { new_test_ext().execute_with(|| { - // dispatch our test call - - // check that the stored value is correct - + // Dispatch a signed extrinsic. + // Try using match expression here. Problem: how to get T for BoundedVec? + assert_ok!(ChocolateModule::create_project(Origin::signed(1), [42_u8].to_vec().try_into().expect("Metadata should be within string limit"))); }); } #[test] -fn correct_error_for_none_value() { +fn create_project_should_fail() { new_test_ext().execute_with(|| { + assert_ok!(ChocolateModule::create_project(Origin::signed(1), [40_u8].to_vec().try_into().expect("Metadata should be within string limit"))); + }); +} + +#[test] +fn create_review_should_work() { + choc_ext().execute_with(|| { + // Dispatch a signed extrinsic. + assert_ok!(ChocolateModule::create_review(Origin::signed(6), (3,[42_u8].to_vec().try_into().expect("Metadata should be within string limit")), 1_u32)); + }); +} +#[test] +fn create_review_should_fail() { + choc_ext().execute_with(|| { + // Based on current genesis config. + assert_err!(ChocolateModule::create_review(Origin::signed(1), (3,[40_u8].to_vec().try_into().expect("Metadata should be within string limit")), 1_u32),Error::::OwnerReviewedProject); + assert_err!(ChocolateModule::create_review(Origin::signed(2), (3,[40_u8].to_vec().try_into().expect("Metadata should be within string limit")), 1_u32),Error::::DuplicateReview); + assert_err!(ChocolateModule::create_review(Origin::signed(6), (60,[40_u8].to_vec().try_into().expect("Metadata should be within string limit")), 1_u32),Error::::ReviewScoreOutOfRange); + }); } diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 2454b4f..d2373eb 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -223,6 +223,7 @@ pub const HOURS: BlockNumber = MINUTES * 60; pub const DAYS: BlockNumber = HOURS * 24; // Unit = the base number of indivisible units for balances +pub const HECTOUNIT: Balance = 100 * UNIT; pub const UNIT: Balance = 1_000_000_000_000; pub const MILLIUNIT: Balance = 1_000_000_000; pub const MICROUNIT: Balance = 1_000_000; @@ -482,6 +483,26 @@ impl pallet_template::Config for Runtime { type Event = Event; type Currency = Currencies; } +parameter_types! { + pub const RewardCap: Balance = 50 * HECTOUNIT; + pub const UserCollateral: Balance = 10 * HECTOUNIT; + pub const StringLimit: u32 = 1_000_000_000_000; +} +/// Configure the pallet-chocolate in pallets/chocolate. +impl pallet_chocolate::Config for Runtime { + type Event = Event; + type ApprovedOrigin = EnsureOneOf< + AccountId, + EnsureRoot, + pallet_collective::EnsureProportionAtLeast<_3, _5, AccountId, CouncilCollective>, + >; + type Currency = Balances; + type TreasuryOutlet = Treasury; + type RewardCap = RewardCap; + type UsersOutlet = UsersModule; + type UserCollateral = UserCollateral; + type StringLimit = StringLimit; +} impl orml_tokens::Config for Runtime { @@ -554,8 +575,9 @@ construct_runtime!( CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 32, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 33, - // Template + // Chocolate TemplatePallet: pallet_template::{Pallet, Call, Storage, Event} = 40, + ChocolateModule: pallet_chocolate::{Pallet, Call, Config, Storage, Event}, // Orml Currencies: orml_currencies::{Pallet, Call} = 41, @@ -576,6 +598,7 @@ mod benches { [pallet_timestamp, Timestamp] [pallet_collator_selection, CollatorSelection] [cumulus_pallet_xcmp_queue, XcmpQueue] + [pallet_chocolate, ChocolateModule] ); } From 6e1835c7b0a63a4f5c0139548a7dbf2102fd859a Mon Sep 17 00:00:00 2001 From: Islam Date: Fri, 8 Jul 2022 22:19:02 +0000 Subject: [PATCH 24/36] feat(migration): Add users pallet, and chocolate pallet to runtime Pallet collective not yet added --- Cargo.lock | 20 +++++++ pallets/chocolate/Cargo.toml | 4 +- pallets/chocolate/src/lib.rs | 2 +- pallets/chocolate/src/mock.rs | 24 +++++++- pallets/users/Cargo.toml | 49 +++++++++++++++ pallets/users/src/lib.rs | 108 ++++++++++++++++++++++++++++++++++ primitives/src/projects.rs | 17 +++--- runtime/Cargo.toml | 10 +++- runtime/src/lib.rs | 61 ++++++++++++------- 9 files changed, 257 insertions(+), 38 deletions(-) create mode 100644 pallets/users/Cargo.toml create mode 100644 pallets/users/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 36f58e2..909686c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5292,6 +5292,7 @@ dependencies = [ "orml-utilities", "pallet-balances", "pallet-treasury", + "pallet-users", "parity-scale-codec", "scale-info", "serde", @@ -5936,6 +5937,23 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-users" +version = "0.1.0" +dependencies = [ + "chocolate-primitives", + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-utility" version = "4.0.0-dev" @@ -6109,6 +6127,7 @@ dependencies = [ "pallet-aura", "pallet-authorship", "pallet-balances", + "pallet-chocolate", "pallet-collator-selection", "pallet-session", "pallet-sudo", @@ -6116,6 +6135,7 @@ dependencies = [ "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", + "pallet-users", "pallet-xcm", "parachain-info", "parity-scale-codec", diff --git a/pallets/chocolate/Cargo.toml b/pallets/chocolate/Cargo.toml index 161eb03..0beebfc 100644 --- a/pallets/chocolate/Cargo.toml +++ b/pallets/chocolate/Cargo.toml @@ -43,7 +43,7 @@ pallet-treasury = { git = "https://github.com/paritytech/substrate", default-fea pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } # Chocolate. For Tests. -# pallet-users = { path="../pallets/pallet-users", default-features = false } +pallet-users = { path="../users", default-features = false } [features] default = ['std'] @@ -59,6 +59,6 @@ std = [ 'frame-benchmarking/std', # added 'chocolate-primitives/std', - # 'pallet-users/std', + 'pallet-users/std', ] try-runtime = ['frame-support/try-runtime'] diff --git a/pallets/chocolate/src/lib.rs b/pallets/chocolate/src/lib.rs index 2df1e55..a4f21be 100644 --- a/pallets/chocolate/src/lib.rs +++ b/pallets/chocolate/src/lib.rs @@ -275,7 +275,7 @@ pub mod pallet { impl ProjectIO for Pallet { type UserID = T::AccountId; type Balance = BalanceOf; - type StringLen = T::StringLimit; + type StringLimit = T::StringLimit; /// does existence checks for us to see if the project owner can release required reward+liveness req safely fn can_reward(who: &Self::UserID) -> bool { let existential = T::Currency::minimum_balance(); diff --git a/pallets/chocolate/src/mock.rs b/pallets/chocolate/src/mock.rs index e4d1f5f..bc0967e 100644 --- a/pallets/chocolate/src/mock.rs +++ b/pallets/chocolate/src/mock.rs @@ -1,7 +1,9 @@ use crate as pallet_chocolate; -use frame_support::{parameter_types,traits::GenesisBuild}; +use codec::{Encode, Decode, MaxEncodedLen}; +use frame_support::{parameter_types,traits::{GenesisBuild, Get}, RuntimeDebug}; use frame_system as system; use pallet_users; +use scale_info::TypeInfo; use sp_core::H256; use sp_runtime::{ testing::Header, @@ -9,6 +11,11 @@ use sp_runtime::{ BuildStorage, }; + +#[cfg(feature = "std")] +pub use serde::{Deserialize, Serialize}; + + type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; use chocolate_primitives::projects::{Reason, Status}; @@ -57,6 +64,7 @@ impl system::Config for Test { type SystemWeightInfo = (); type SS58Prefix = SS58Prefix; type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } parameter_types! { @@ -84,10 +92,22 @@ impl pallet_balances::Config for Test { impl pallet_users::Config for Test { type Event = Event; } + +pub const STRING_LIMIT: u32 = 1_000_000_000; +#[derive( + Encode, Decode, Eq, PartialEq, Clone, RuntimeDebug, TypeInfo, MaxEncodedLen, PartialOrd, Ord, +)] +#[cfg_attr(feature = "std", derive(Deserialize, Serialize))] +pub struct StringLimit; + +impl Get for StringLimit { + fn get() -> u32 { + STRING_LIMIT + } +} parameter_types! { pub const Cap: u128 = 100; pub const UserCollateral: u128 = 10; - pub const StringLimit: u32 = 1_000_000_000; } // our configs start here impl pallet_chocolate::Config for Test { diff --git a/pallets/users/Cargo.toml b/pallets/users/Cargo.toml new file mode 100644 index 0000000..c3e85b1 --- /dev/null +++ b/pallets/users/Cargo.toml @@ -0,0 +1,49 @@ +[package] +authors = ['Kresna SHA888 '] +description = 'Substrate FRAME chocolate pallet for defining custom runtime logic.' +edition = '2021' +homepage = '' +license = 'Unlicense' +name = 'pallet-users' +publish = false +repository = 'https://github.com/Chocolate-Project/chocolate-node' +version = '0.1.0' +readme = 'README.md' + +[package.metadata.docs.rs] +targets = ['x86_64-unknown-linux-gnu'] + +[dependencies] +serde = { version = "1.0.132", optional=true } +codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } +scale-info = { version = "2.0.0", default-features = false, features = ["derive"] } + +# Substrate +frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.24" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } + +# Chocolate + +chocolate-primitives = { path="../../primitives", default-features = false } + +[dev-dependencies] + +# Substrate +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } + +[features] +default = ['std'] +runtime-benchmarks = ['frame-benchmarking'] +std = [ + 'codec/std', + 'sp-std/std', + 'frame-support/std', + 'frame-system/std', + 'frame-benchmarking/std', + 'chocolate-primitives/std', +] +try-runtime = ['frame-support/try-runtime'] \ No newline at end of file diff --git a/pallets/users/src/lib.rs b/pallets/users/src/lib.rs new file mode 100644 index 0000000..749cea7 --- /dev/null +++ b/pallets/users/src/lib.rs @@ -0,0 +1,108 @@ +//! This is part of Chocolate Project for Encode Club Polkadot Hackathon +//! Consider all of this part is a work in progress + +#![cfg_attr(not(feature = "std"), no_std)] + +pub use pallet::*; +// for vectors and all else. In v4.0, all the vec and other imports haave been swept under prelude +// use sp_std::prelude::*; +// this uses vec from prelude +// use sp_std::vec::Vec; +// this isn't accessible in the child modl pallet. +// #[cfg(test)] +// mod mock; + +// #[cfg(test)] +// mod tests; + +// #[cfg(feature = "runtime-benchmarks")] +// mod benchmarking; + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use chocolate_primitives::users::*; + use frame_support::{dispatch::DispatchResult, pallet_prelude::*}; + use frame_system::pallet_prelude::*; + #[pallet::config] + pub trait Config: frame_system::Config { + type Event: From> + IsType<::Event>; + } + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(_); + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + SomethingStored(u32, T::AccountId), + UserCreated(T::AccountId), + } + + #[pallet::storage] + #[pallet::getter(fn users)] + /// users store + pub type Users = StorageMap<_, Blake2_128Concat, T::AccountId, User>; + + #[pallet::error] + pub enum Error { + /// No Value + NoneValue, + /// Storage is overflow + StorageOverflow, + /// User already exists + UserAlreadyExists, + } + + #[pallet::call] + impl Pallet { + // use base weight then add on any additional operations + /// Signed transaction to create user + #[pallet::weight(0 + T::DbWeight::get().writes(1))] + pub fn make_user(origin: OriginFor) -> DispatchResult { + let who = ensure_signed(origin)?; + + ensure!(!Users::::contains_key(&who), Error::::UserAlreadyExists); + >::insert(&who, User { rank_points: 0, project_id: Option::None }); + + Self::deposit_event(Event::UserCreated(who)); + + Ok(()) + } + } + impl UserIO for Pallet { + fn get_user_by_id(id: &T::AccountId) -> Option { + self::Users::::get(id) + } + fn check_owns_project(id: &T::AccountId) -> bool { + let user = self::Users::::get(id).unwrap_or_default(); + user.project_id.is_some() + } + fn check_user_exists(id: &T::AccountId) -> bool { + self::Users::::contains_key(id) + } + fn get_or_create_default(id: &T::AccountId) -> User { + let user_exists = Self::check_user_exists(&id); + let user = Self::get_user_by_id(&id).unwrap_or_default(); + if !user_exists { + self::Users::::insert(&id, user.clone()); + } + user + } + fn set_user(id: &T::AccountId, user: User) -> () { + if Self::check_user_exists(id) { + return (); + } + >::insert(id, user); + () + } + fn update_user(id: &T::AccountId, user: User) -> DispatchResult { + if !Self::check_user_exists(id) { + return Err(DispatchError::CannotLookup); + }; + >::mutate(id, |u| *u = Some(user)); + Ok(()) + } + } +} diff --git a/primitives/src/projects.rs b/primitives/src/projects.rs index 4d4a998..f2189cb 100644 --- a/primitives/src/projects.rs +++ b/primitives/src/projects.rs @@ -2,11 +2,10 @@ use frame_support::{ dispatch::DispatchResult, sp_runtime::traits::{AtLeast32BitUnsigned,Zero}, traits::Get, BoundedVec, - RuntimeDebug, pallet_prelude::{Member, MaybeSerializeDeserialize}, Parameter, + RuntimeDebug, }; use frame_system::Config; use scale_info::TypeInfo; - /// A simple u32 pub type ProjectID = u32; /// Index for reviews , use to link to project @@ -108,8 +107,7 @@ impl Default for Status { /// Default reason - storage req impl Default for Reason where -StringLen: Get, - + StringLen: Get, { fn default() -> Self { Reason::PassedRequirements @@ -180,23 +178,24 @@ where pub trait ProjectIO { type UserID; type Balance: AtLeast32BitUnsigned; - type StringLen: Get + Member + Parameter + MaybeSerializeDeserialize + Clone; + type StringLimit: Get; /// Checks: /// If the projects' reward value reflects what is reserved, excluding existential value fn check_reward( - project: &Project, + project: &Project, ) -> DispatchResult; /// Check if the project owner can offer up hardcoded amount as init. fn can_reward(project: &Self::UserID) -> bool; /// Reserve an initial amount for use as reward fn reserve_reward( - project: &mut Project, + project: &mut Project, ) -> DispatchResult; /// Reward the user with an amount and effect edits on the struct level. (Exposes amount in free balance for next step (transfer)) /// Assumed to be executed right before the final balance transfer - /// Note: If any failure happens after, reward may be lost. + /// # Note: + /// If any failure happens after, reward may be lost. fn reward( - project: &mut Project, + project: &mut Project, amount: Self::Balance, ) -> DispatchResult; } diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 6ea5ca7..5e257a1 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -24,6 +24,8 @@ smallvec = "1.6.1" # Local pallet-template = { path = "../pallets/template", default-features = false } +pallet-chocolate = { path = "../pallets/chocolate", default-features = false } +pallet-users = { path = "../pallets/users", default-features = false } # ORML @@ -131,9 +133,11 @@ std = [ "xcm-builder/std", "xcm-executor/std", "xcm/std", - 'orml-currencies/std', - 'orml-tokens/std', - 'orml-traits/std', + "orml-currencies/std", + "orml-tokens/std", + "orml-traits/std", + "pallet-chocolate/std", + "pallet-users/std", ] runtime-benchmarks = [ diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index d2373eb..7534adc 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -165,6 +165,20 @@ pub enum CurrencyId { BTC, } +pub const STRING_LIMIT: u32 = 1_000_000_000; +/// The maximum length of a name or symbol stored on-chain. +#[derive( + Encode, Decode, Eq, PartialEq, Clone, RuntimeDebug, TypeInfo, MaxEncodedLen, PartialOrd, Ord, +)] +#[cfg_attr(feature = "std", derive(Deserialize, Serialize))] +pub struct StringLimit; + +impl Get for StringLimit { + fn get() -> u32 { + STRING_LIMIT + } +} + pub type Amount = i128; /// Identifier for a named reserve in orml tokens @@ -483,26 +497,6 @@ impl pallet_template::Config for Runtime { type Event = Event; type Currency = Currencies; } -parameter_types! { - pub const RewardCap: Balance = 50 * HECTOUNIT; - pub const UserCollateral: Balance = 10 * HECTOUNIT; - pub const StringLimit: u32 = 1_000_000_000_000; -} -/// Configure the pallet-chocolate in pallets/chocolate. -impl pallet_chocolate::Config for Runtime { - type Event = Event; - type ApprovedOrigin = EnsureOneOf< - AccountId, - EnsureRoot, - pallet_collective::EnsureProportionAtLeast<_3, _5, AccountId, CouncilCollective>, - >; - type Currency = Balances; - type TreasuryOutlet = Treasury; - type RewardCap = RewardCap; - type UsersOutlet = UsersModule; - type UserCollateral = UserCollateral; - type StringLimit = StringLimit; -} impl orml_tokens::Config for Runtime { @@ -543,6 +537,30 @@ impl orml_currencies::Config for Runtime { type WeightInfo = (); } +parameter_types! { + pub const RewardCap: Balance = 50 * HECTOUNIT; + pub const UserCollateral: Balance = 10 * HECTOUNIT; +} +/// Configure the pallet-chocolate in pallets/chocolate. +impl pallet_chocolate::Config for Runtime { + type Event = Event; + type ApprovedOrigin = EnsureOneOf< + AccountId, + EnsureRoot, + pallet_collective::EnsureProportionAtLeast<_3, _5, AccountId, CouncilCollective>, + >; + type Currency = Balances; + type TreasuryOutlet = Treasury; + type RewardCap = RewardCap; + type UsersOutlet = UsersModule; + type UserCollateral = UserCollateral; + type StringLimit = StringLimit; +} +/// Configure the pallet-users in pallets/users. +impl pallet_users::Config for Runtime { + type Event = Event; +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -577,7 +595,8 @@ construct_runtime!( // Chocolate TemplatePallet: pallet_template::{Pallet, Call, Storage, Event} = 40, - ChocolateModule: pallet_chocolate::{Pallet, Call, Config, Storage, Event}, + UsersModule: pallet_users::{Pallet, Call, Storage, Event} = 43, + ChocolateModule: pallet_chocolate::{Pallet, Call, Config, Storage, Event} = 44, // Orml Currencies: orml_currencies::{Pallet, Call} = 41, From 12e7eb6b7d63e28a9481930420027556ddccff1b Mon Sep 17 00:00:00 2001 From: Islam Date: Sun, 10 Jul 2022 14:29:58 +0000 Subject: [PATCH 25/36] feat(migration): Add treasury,council, users to runtime, fix user module genesis Next project id was assigned in extrinsic instead of current. --- Cargo.lock | 7 ++ node/Cargo.toml | 1 + node/src/chain_spec.rs | 24 +++++- pallets/chocolate/Cargo.toml | 7 +- pallets/chocolate/src/lib.rs | 2 +- pallets/template/Cargo.toml | 7 ++ primitives/src/lib.rs | 2 + primitives/src/projects.rs | 3 +- primitives/src/users.rs | 1 - runtime/Cargo.toml | 97 +++++++++++++------------ runtime/src/lib.rs | 137 ++++++++++++++++++++++++++++++++--- 11 files changed, 222 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 909686c..04bf0d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5831,6 +5831,8 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "orml-currencies", + "orml-tokens", "orml-traits", "orml-utilities", "parity-scale-codec", @@ -6037,6 +6039,7 @@ dependencies = [ name = "parachain-template-node" version = "0.1.0" dependencies = [ + "chocolate-primitives", "clap", "cumulus-client-cli", "cumulus-client-collator", @@ -6129,12 +6132,15 @@ dependencies = [ "pallet-balances", "pallet-chocolate", "pallet-collator-selection", + "pallet-collective", + "pallet-elections-phragmen", "pallet-session", "pallet-sudo", "pallet-template", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", "pallet-users", "pallet-xcm", "parachain-info", @@ -6156,6 +6162,7 @@ dependencies = [ "sp-std", "sp-transaction-pool", "sp-version", + "static_assertions", "substrate-wasm-builder", "xcm", "xcm-builder", diff --git a/node/Cargo.toml b/node/Cargo.toml index c51360c..659741c 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -24,6 +24,7 @@ jsonrpsee = { version = "0.13.1", features = ["server"] } # Local parachain-template-runtime = { path = "../runtime" } +chocolate-primitives = { path="../primitives", default-features = false } # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.24" } diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index b520cec..6f8f0e4 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -1,11 +1,11 @@ use cumulus_primitives_core::ParaId; -use parachain_template_runtime::{AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT, CurrencyId}; +use parachain_template_runtime::{AccountId, AuraId, Signature, EXISTENTIAL_DEPOSIT, CurrencyId, UNIT, Balance}; use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::ChainType; use serde::{Deserialize, Serialize}; use sp_core::{sr25519, Pair, Public}; use sp_runtime::traits::{IdentifyAccount, Verify}; - +use chocolate_primitives::projects::{Status,Reason}; /// Specialized `ChainSpec` for the normal parachain runtime. pub type ChainSpec = sc_service::GenericChainSpec; @@ -182,6 +182,11 @@ fn testnet_genesis( endowed_accounts: Vec, id: ParaId, ) -> parachain_template_runtime::GenesisConfig { + let num_endowed_accounts = endowed_accounts.len(); + + const ENDOWMENT: Balance = 10u128.pow(9) * UNIT; + const STASH: Balance = ENDOWMENT / 1000; + parachain_template_runtime::GenesisConfig { system: parachain_template_runtime::SystemConfig { code: parachain_template_runtime::WASM_BINARY @@ -189,7 +194,7 @@ fn testnet_genesis( .to_vec(), }, balances: parachain_template_runtime::BalancesConfig { - balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(), + balances: endowed_accounts.iter().cloned().map(|k| (k, ENDOWMENT)).collect(), }, parachain_info: parachain_template_runtime::ParachainInfoConfig { parachain_id: id }, collator_selection: parachain_template_runtime::CollatorSelectionConfig { @@ -263,5 +268,18 @@ fn testnet_genesis( ] }, }, + phragmen_election: parachain_template_runtime::PhragmenElectionConfig { + // configure all members to have an initial 'stash' backing, or elect them + // - These map to our default members of Council Collective - If not changed, council remains constant for n period + // Elect only half endowed accounts initially - Alice and Bob - Backed with 1M each - Based on 12 Decimal choc. + members: endowed_accounts + .iter() + .take((num_endowed_accounts + 1) / 2) + .cloned() + .map(|member| (member, STASH)) + .collect(), + }, + council: parachain_template_runtime::CouncilConfig::default(), + treasury: Default::default(), } } diff --git a/pallets/chocolate/Cargo.toml b/pallets/chocolate/Cargo.toml index 0beebfc..4826e68 100644 --- a/pallets/chocolate/Cargo.toml +++ b/pallets/chocolate/Cargo.toml @@ -18,6 +18,9 @@ serde = { version = "1.0.132", optional=true } codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] } +# Local +chocolate-primitives = { path="../../primitives", default-features = false } + # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.24" } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } @@ -29,10 +32,6 @@ sp-std = { git = "https://github.com/paritytech/substrate", default-features = f orml-traits = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } orml-utilities = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } -# Chocolate - -chocolate-primitives = { path="../../primitives", default-features = false } - [dev-dependencies] # Substrate diff --git a/pallets/chocolate/src/lib.rs b/pallets/chocolate/src/lib.rs index a4f21be..fb84633 100644 --- a/pallets/chocolate/src/lib.rs +++ b/pallets/chocolate/src/lib.rs @@ -172,7 +172,7 @@ pub mod pallet { let mut project = ProjectAl::::new(who.clone(), project_meta.clone()); // FALLIBLE MUTATIONS Pallet::::reserve_reward(&mut project)?; - user.project_id = Some(new_index); + user.project_id = Some(index); // STORAGE MUTATIONS >::insert(index, project); >::put(new_index); diff --git a/pallets/template/Cargo.toml b/pallets/template/Cargo.toml index 039a0bc..7a71251 100644 --- a/pallets/template/Cargo.toml +++ b/pallets/template/Cargo.toml @@ -24,6 +24,7 @@ frame-system = { git = "https://github.com/paritytech/substrate", default-featur orml-traits = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } orml-utilities = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } + [dev-dependencies] serde = { version = "1.0.132" } @@ -32,6 +33,10 @@ sp-core = { git = "https://github.com/paritytech/substrate", default-features = sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +# ORML +orml-currencies = {git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } +orml-tokens = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } + [features] default = ["std"] runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] @@ -43,5 +48,7 @@ std = [ "frame-system/std", "orml-traits/std", "orml-utilities/std", + "orml-currencies/std", + "orml-tokens/std", ] try-runtime = [ "frame-support/try-runtime" ] \ No newline at end of file diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 4587dff..c314f80 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -1,3 +1,5 @@ +#![cfg_attr(not(feature = "std"), no_std)] + pub mod projects; pub mod users; \ No newline at end of file diff --git a/primitives/src/projects.rs b/primitives/src/projects.rs index f2189cb..7b5d09a 100644 --- a/primitives/src/projects.rs +++ b/primitives/src/projects.rs @@ -1,4 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] use frame_support::{ dispatch::DispatchResult, sp_runtime::traits::{AtLeast32BitUnsigned,Zero}, traits::Get, BoundedVec, @@ -62,7 +61,7 @@ pub enum Status { #[derive( Encode, Decode, Eq, PartialEq, Clone, RuntimeDebug, TypeInfo, MaxEncodedLen, PartialOrd, Ord, )] -#[derive(Deserialize, Serialize)] +#[cfg_attr(feature = "std", derive(Deserialize, Serialize))] pub enum Reason where StringLen: Get, diff --git a/primitives/src/users.rs b/primitives/src/users.rs index 47fc458..c7c1289 100644 --- a/primitives/src/users.rs +++ b/primitives/src/users.rs @@ -1,4 +1,3 @@ -#![cfg_attr(not(feature = "std"), no_std)] use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{dispatch::{ DispatchResult}, RuntimeDebug}; diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 5e257a1..dc8749d 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -21,6 +21,7 @@ log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } serde = { version = "1.0.137", optional = true, features = ["derive"] } smallvec = "1.6.1" +static_assertions = "1.1.0" # Local pallet-template = { path = "../pallets/template", default-features = false } @@ -49,6 +50,9 @@ pallet-sudo = { git = "https://github.com/paritytech/substrate", default-feature pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +pallet-treasury = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +pallet-collective = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } @@ -88,56 +92,59 @@ default = [ "std", ] std = [ - "codec/std", - "log/std", - "scale-info/std", - "serde", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-dmp-queue/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-core/std", - "cumulus-primitives-timestamp/std", - "cumulus-primitives-utility/std", - "frame-executive/std", - "frame-support/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "pallet-aura/std", - "pallet-authorship/std", - "pallet-balances/std", - "pallet-collator-selection/std", - "pallet-session/std", - "pallet-sudo/std", - "pallet-template/std", - "pallet-timestamp/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-xcm/std", - "parachain-info/std", - "polkadot-parachain/std", - "polkadot-runtime-common/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-core/std", - "sp-inherents/std", - "sp-io/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", - "xcm-builder/std", - "xcm-executor/std", - "xcm/std", + "codec/std", + "log/std", + "scale-info/std", + "serde", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-dmp-queue/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-core/std", + "cumulus-primitives-timestamp/std", + "cumulus-primitives-utility/std", + "frame-executive/std", + "frame-support/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "pallet-aura/std", + "pallet-authorship/std", + "pallet-balances/std", + "pallet-collator-selection/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-template/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-xcm/std", + "parachain-info/std", + "polkadot-parachain/std", + "polkadot-runtime-common/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", "orml-currencies/std", "orml-tokens/std", "orml-traits/std", "pallet-chocolate/std", "pallet-users/std", + "pallet-treasury/std", + "pallet-collective/std", + "pallet-elections-phragmen/std", ] runtime-benchmarks = [ diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 7534adc..0fc53ee 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -17,21 +17,25 @@ use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use smallvec::smallvec; use sp_api::impl_runtime_apis; -use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; +use sp_core::{ + crypto::KeyTypeId, + OpaqueMetadata +}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify}, transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, MultiSignature, + ApplyExtrinsicResult, MultiSignature,Percent }; use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; +use static_assertions::const_assert; use frame_support::{ construct_runtime, parameter_types, - traits::Everything, + traits::{Everything,EnsureOneOf,Get,LockIdentifier}, weights::{ constants::WEIGHT_PER_SECOND, ConstantMultiplier, DispatchClass, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, @@ -53,7 +57,7 @@ use serde::{Deserialize, Serialize}; pub use sp_runtime::BuildStorage; // Polkadot imports -use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; +use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate, impls::DealWithFees}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; @@ -179,6 +183,12 @@ impl Get for StringLimit { } } +// Note: This could be later moved into a constants file - Separating time and currency, and importing primitives from node-primitives. Or here. + +pub const fn deposit(items: u32, bytes: u32) -> Balance { + items as Balance * 15 * UNIT + (bytes as Balance) * 6 * UNIT +} + pub type Amount = i128; /// Identifier for a named reserve in orml tokens @@ -292,6 +302,11 @@ parameter_types! { pub const SS58Prefix: u16 = 42; } +type MoreThanHalfCouncil = EnsureOneOf< + EnsureRoot, + pallet_collective::EnsureProportionMoreThan, +>; + // Configure FRAME pallets to include in runtime. impl frame_system::Config for Runtime { @@ -394,7 +409,7 @@ parameter_types! { } impl pallet_transaction_payment::Config for Runtime { - type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter>; type WeightToFee = WeightToFee; type LengthToFee = ConstantMultiplier; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; @@ -544,11 +559,7 @@ parameter_types! { /// Configure the pallet-chocolate in pallets/chocolate. impl pallet_chocolate::Config for Runtime { type Event = Event; - type ApprovedOrigin = EnsureOneOf< - AccountId, - EnsureRoot, - pallet_collective::EnsureProportionAtLeast<_3, _5, AccountId, CouncilCollective>, - >; + type ApprovedOrigin = ApproveOrigin; type Currency = Balances; type TreasuryOutlet = Treasury; type RewardCap = RewardCap; @@ -561,6 +572,104 @@ impl pallet_users::Config for Runtime { type Event = Event; } +// Configure the council and its features +parameter_types! { + pub const CouncilMotionDuration: BlockNumber = 5 * DAYS; + pub const CouncilMaxProposals: u32 = 100; + pub const CouncilMaxMembers: u32 = 100; +} + +type CouncilCollective = pallet_collective::Instance1; +impl pallet_collective::Config for Runtime { + type Origin = Origin; + type Proposal = Call; + type Event = Event; + type MotionDuration = CouncilMotionDuration; + type MaxProposals = CouncilMaxProposals; + type MaxMembers = CouncilMaxMembers; + type DefaultVote = pallet_collective::PrimeDefaultVote; + type WeightInfo = pallet_collective::weights::SubstrateWeight; +} + +// council election method configuration +parameter_types! { + pub const CandidacyBond: Balance = 10 * HECTOUNIT; + // 1 storage item created, key size is 32 bytes, value size is 16+16. + pub const VotingBondBase: Balance = deposit(1, 64); + // additional data per vote is 32 bytes (account id). + pub const VotingBondFactor: Balance = deposit(0, 32); + pub const TermDuration: BlockNumber = 7 * DAYS; + pub const DesiredMembers: u32 = 13; + pub const DesiredRunnersUp: u32 = 7; + pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect"; +} + +// Make sure that there are no more than `MaxMembers` members elected via elections-phragmen. +const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); + +impl pallet_elections_phragmen::Config for Runtime { + type Event = Event; + type PalletId = ElectionsPhragmenPalletId; + type Currency = Balances; + type ChangeMembers = Council; + // NOTE: this implies that council's genesis members cannot be set directly and must come from + // this module. - Genesis election=Council + type InitializeMembers = Council; + type CurrencyToVote = frame_support::traits::U128CurrencyToVote; + type CandidacyBond = CandidacyBond; + type VotingBondBase = VotingBondBase; + type VotingBondFactor = VotingBondFactor; + type LoserCandidate = Treasury; + type KickedMember = Treasury; + type DesiredMembers = DesiredMembers; + type DesiredRunnersUp = DesiredRunnersUp; + type TermDuration = TermDuration; + type WeightInfo = pallet_elections_phragmen::weights::SubstrateWeight; +} + +// treasury config. To-Do: Impl SpendFund trait on reviews and give treasury money on start. +parameter_types! { + pub const ProposalBond: Permill = Permill::from_percent(5); + pub const ProposalBondMinimum: Balance = 1 * HECTOUNIT; + pub const ProposalBondMaximum: Balance = 5 * HECTOUNIT; + pub const SpendPeriod: BlockNumber = 1 * DAYS; + pub const Burn: Permill = Permill::from_percent(50); + pub const TipCountdown: BlockNumber = 1 * DAYS; + pub const TipFindersFee: Percent = Percent::from_percent(20); + pub const TipReportDepositBase: Balance = 1 * HECTOUNIT; + pub const DataDepositPerByte: Balance = 1 * UNIT; + pub const BountyDepositBase: Balance = 1 * HECTOUNIT; + pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS; + pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); + pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS; + pub const MaximumReasonLength: u32 = 16384; + pub const BountyCuratorDeposit: Permill = Permill::from_percent(50); + pub const BountyValueMinimum: Balance = 5 * HECTOUNIT; + pub const MaxApprovals: u32 = 100; +} + +type ApproveOrigin = EnsureOneOf< + EnsureRoot, + pallet_collective::EnsureProportionAtLeast, +>; + +impl pallet_treasury::Config for Runtime { + type Currency = Balances; + type ApproveOrigin = ApproveOrigin; + type RejectOrigin = MoreThanHalfCouncil; + type Event = Event; + type OnSlash = Treasury; + type ProposalBond = ProposalBond; + type ProposalBondMinimum = ProposalBondMinimum; + type ProposalBondMaximum = ProposalBondMaximum; + type SpendPeriod = SpendPeriod; + type Burn = Burn; + type PalletId = TreasuryPalletId; + type BurnDestination = (); + type WeightInfo = pallet_treasury::weights::SubstrateWeight; + type SpendFunds = (); + type MaxApprovals = MaxApprovals; +} // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -597,6 +706,11 @@ construct_runtime!( TemplatePallet: pallet_template::{Pallet, Call, Storage, Event} = 40, UsersModule: pallet_users::{Pallet, Call, Storage, Event} = 43, ChocolateModule: pallet_chocolate::{Pallet, Call, Config, Storage, Event} = 44, + // TREASURY + Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config}, + Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event}, + // elections implemented for council. + PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config}, // Orml Currencies: orml_currencies::{Pallet, Call} = 41, @@ -618,6 +732,9 @@ mod benches { [pallet_collator_selection, CollatorSelection] [cumulus_pallet_xcmp_queue, XcmpQueue] [pallet_chocolate, ChocolateModule] + [pallet_elections_phragmen, PhragmenElection] + [pallet_collective, Council] + [pallet_treasury, Treasury] ); } From 4444788c17ef407bf2c38cfd0cf82346971aee6a Mon Sep 17 00:00:00 2001 From: Islam Date: Sun, 10 Jul 2022 15:03:04 +0000 Subject: [PATCH 26/36] feat(migration): Update stringlimit, try to include typeinfo on Project.reward Balance type on project struct not recognised (minor): https://stackoverflow.com/q/64210673/16071410 , ran format Document on files String Limit is now 1016. (4 Bytes * 254 chars) --- pallets/chocolate/src/lib.rs | 9 +++--- primitives/src/projects.rs | 28 ++++++++--------- runtime/src/lib.rs | 61 +++++++++++++++++++++--------------- 3 files changed, 53 insertions(+), 45 deletions(-) diff --git a/pallets/chocolate/src/lib.rs b/pallets/chocolate/src/lib.rs index fb84633..9b9cce4 100644 --- a/pallets/chocolate/src/lib.rs +++ b/pallets/chocolate/src/lib.rs @@ -70,7 +70,7 @@ pub mod pallet { /// type alias for project pub type ProjectAl = Project<::AccountId, BalanceOf, ::StringLimit>; - /// Type alias for balance, binding T::Currency to Currency::AccountId and then extracting from that Balance. Accessible via T::BalanceOf. T is frame_System. + /// Type alias for balance, binding T::Currency to Currency::AccountId and then extracting from that Balance. Accessible via T::BalanceOf. pub type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; /// Type alias for reason @@ -109,16 +109,15 @@ pub mod pallet { /// Event documentation should end with an array that provides descriptive names for event /// parameters. [something, who] SomethingStored(u32, T::AccountId), - /// parameters. [owner,cid,project_id] + /// parameters. [owner, cid, project_id] ProjectCreated(T::AccountId, BoundedVec, ProjectID), - /// parameters. [owner,project_id] + /// parameters. [owner, project_id] ReviewCreated(T::AccountId, ProjectID), - /// parameters [owner,id] + /// parameters [owner, project_id] ReviewAccepted(T::AccountId, ProjectID), /// Minted [amount] Minted(BalanceOf), } - // ----^edit // Errors inform users that something went wrong. #[pallet::error] pub enum Error { diff --git a/primitives/src/projects.rs b/primitives/src/projects.rs index 7b5d09a..85e79d1 100644 --- a/primitives/src/projects.rs +++ b/primitives/src/projects.rs @@ -1,7 +1,8 @@ - use frame_support::{ - dispatch::DispatchResult, sp_runtime::traits::{AtLeast32BitUnsigned,Zero}, traits::Get, BoundedVec, - RuntimeDebug, + dispatch::DispatchResult, + sp_runtime::traits::Zero, + traits::{Get,tokens::Balance as BalanceTrait}, + BoundedVec, RuntimeDebug, }; use frame_system::Config; use scale_info::TypeInfo; @@ -25,7 +26,7 @@ where /// A snapshot of the user's rank at the time of review pub point_snapshot: u32, /// Score of a review - pub review_score: u8 + pub review_score: u8, } /// The metadata of a project. @@ -64,7 +65,7 @@ pub enum Status { #[cfg_attr(feature = "std", derive(Deserialize, Serialize))] pub enum Reason where -StringLen: Get, + StringLen: Get, { /// Custom reason to encapsulate further things like marketCap and other details Other(BoundedVec), @@ -91,8 +92,7 @@ StringLen: Get, )] pub struct ProposalStatus where -StringLen: Get, - + StringLen: Get, { pub status: Status, pub reason: Reason, @@ -128,7 +128,7 @@ where )] pub struct Project where - Balance: AtLeast32BitUnsigned, + Balance: BalanceTrait, StringLen: Get, { /// The owner of the project @@ -146,12 +146,12 @@ where /// The total review scores for a project pub total_review_score: u64, /// The number of reviews submitted - pub number_of_reviews: u32 + pub number_of_reviews: u32, } impl Project where - Balance: AtLeast32BitUnsigned, + Balance: BalanceTrait, StringLen: Get, { /// Set useful defaults. @@ -164,11 +164,11 @@ where reward: Zero::zero(), proposal_status: ProposalStatus { status: Default::default(), - reason: Default::default() + reason: Default::default(), }, total_user_scores: Zero::zero(), number_of_reviews: Zero::zero(), - total_review_score: Zero::zero() + total_review_score: Zero::zero(), } } } @@ -176,7 +176,7 @@ where /// - reserve some token for rewarding its reviewers. pub trait ProjectIO { type UserID; - type Balance: AtLeast32BitUnsigned; + type Balance: BalanceTrait; type StringLimit: Get; /// Checks: /// If the projects' reward value reflects what is reserved, excluding existential value @@ -191,7 +191,7 @@ pub trait ProjectIO { ) -> DispatchResult; /// Reward the user with an amount and effect edits on the struct level. (Exposes amount in free balance for next step (transfer)) /// Assumed to be executed right before the final balance transfer - /// # Note: + /// # Note: /// If any failure happens after, reward may be lost. fn reward( project: &mut Project, diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 0fc53ee..8637c06 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -17,15 +17,12 @@ use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use smallvec::smallvec; use sp_api::impl_runtime_apis; -use sp_core::{ - crypto::KeyTypeId, - OpaqueMetadata -}; +use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify}, transaction_validity::{TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, MultiSignature,Percent + ApplyExtrinsicResult, MultiSignature, Percent, }; use sp_std::prelude::*; #[cfg(feature = "std")] @@ -35,7 +32,7 @@ use static_assertions::const_assert; use frame_support::{ construct_runtime, parameter_types, - traits::{Everything,EnsureOneOf,Get,LockIdentifier}, + traits::{EnsureOneOf, Everything, Get, LockIdentifier}, weights::{ constants::WEIGHT_PER_SECOND, ConstantMultiplier, DispatchClass, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, @@ -57,13 +54,13 @@ use serde::{Deserialize, Serialize}; pub use sp_runtime::BuildStorage; // Polkadot imports -use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate, impls::DealWithFees}; +use polkadot_runtime_common::{impls::DealWithFees, BlockHashCount, SlowAdjustingFeeUpdate}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; // Orml imports -use orml_traits::parameter_type_with_key; use orml_currencies::BasicCurrencyAdapter; +use orml_traits::parameter_type_with_key; // XCM Imports use xcm::latest::prelude::BodyId; @@ -160,7 +157,19 @@ impl WeightToFeePolynomial for WeightToFee { } } -#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, RuntimeDebug,TypeInfo, MaxEncodedLen, PartialOrd, Ord)] +#[derive( + Encode, + Decode, + Eq, + PartialEq, + Copy, + Clone, + RuntimeDebug, + TypeInfo, + MaxEncodedLen, + PartialOrd, + Ord, +)] #[cfg_attr(feature = "std", derive(Serialize, Deserialize))] pub enum CurrencyId { Native, @@ -169,17 +178,18 @@ pub enum CurrencyId { BTC, } -pub const STRING_LIMIT: u32 = 1_000_000_000; +/// String Limit, currently configured to: 254 full-length (4-byte) utf-8 encoded chars. +pub const STRING_LIMIT_VALUE: u32 = 1_016; /// The maximum length of a name or symbol stored on-chain. #[derive( Encode, Decode, Eq, PartialEq, Clone, RuntimeDebug, TypeInfo, MaxEncodedLen, PartialOrd, Ord, )] #[cfg_attr(feature = "std", derive(Deserialize, Serialize))] -pub struct StringLimit; +pub struct StringLimit; -impl Get for StringLimit { +impl Get for StringLimit { fn get() -> u32 { - STRING_LIMIT + STRING_LIMIT_VALUE } } @@ -247,7 +257,7 @@ pub const HOURS: BlockNumber = MINUTES * 60; pub const DAYS: BlockNumber = HOURS * 24; // Unit = the base number of indivisible units for balances -pub const HECTOUNIT: Balance = 100 * UNIT; +pub const HECTOUNIT: Balance = 100 * UNIT; pub const UNIT: Balance = 1_000_000_000_000; pub const MILLIUNIT: Balance = 1_000_000_000; pub const MICROUNIT: Balance = 1_000_000; @@ -302,9 +312,9 @@ parameter_types! { pub const SS58Prefix: u16 = 42; } -type MoreThanHalfCouncil = EnsureOneOf< +type MoreThanHalfCouncil = EnsureOneOf< EnsureRoot, - pallet_collective::EnsureProportionMoreThan, + pallet_collective::EnsureProportionMoreThan, >; // Configure FRAME pallets to include in runtime. @@ -409,7 +419,8 @@ parameter_types! { } impl pallet_transaction_payment::Config for Runtime { - type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter>; + type OnChargeTransaction = + pallet_transaction_payment::CurrencyAdapter>; type WeightToFee = WeightToFee; type LengthToFee = ConstantMultiplier; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; @@ -510,10 +521,9 @@ impl pallet_collator_selection::Config for Runtime { /// Configure the pallet template in pallets/template. impl pallet_template::Config for Runtime { type Event = Event; - type Currency = Currencies; + type Currency = Currencies; } - impl orml_tokens::Config for Runtime { type Event = Event; type Balance = Balance; @@ -525,16 +535,15 @@ impl orml_tokens::Config for Runtime { type OnNewTokenAccount = (); type OnKilledTokenAccount = (); // Shared with balances. - type MaxLocks = MaxLocks; - type MaxReserves = MaxReserves; + type MaxLocks = MaxLocks; + type MaxReserves = MaxReserves; type ReserveIdentifier = ReserveIdentifier; - type DustRemovalWhitelist = DustRemovalWhitelist; + type DustRemovalWhitelist = DustRemovalWhitelist; } - parameter_type_with_key! { pub ExistentialDeposits: |_currency_id: CurrencyId| -> Balance { - match _currency_id { + match _currency_id { CurrencyId::Native => 1000, _ => 2 } @@ -565,7 +574,7 @@ impl pallet_chocolate::Config for Runtime { type RewardCap = RewardCap; type UsersOutlet = UsersModule; type UserCollateral = UserCollateral; - type StringLimit = StringLimit; + type StringLimit = StringLimit; } /// Configure the pallet-users in pallets/users. impl pallet_users::Config for Runtime { @@ -650,7 +659,7 @@ parameter_types! { type ApproveOrigin = EnsureOneOf< EnsureRoot, - pallet_collective::EnsureProportionAtLeast, + pallet_collective::EnsureProportionAtLeast, >; impl pallet_treasury::Config for Runtime { From cd055719d2ddab56de246057f825bc6caea138b1 Mon Sep 17 00:00:00 2001 From: Islam Date: Mon, 11 Jul 2022 15:33:00 +0000 Subject: [PATCH 27/36] feat(multi): Scaffold out pallet-minting --- Cargo.lock | 19 ++++ pallets/minting/Cargo.toml | 54 ++++++++++ pallets/minting/README.md | 5 + pallets/minting/src/benchmarking.rs | 20 ++++ pallets/minting/src/lib.rs | 159 ++++++++++++++++++++++++++++ pallets/minting/src/mock.rs | 65 ++++++++++++ pallets/minting/src/tests.rs | 20 ++++ 7 files changed, 342 insertions(+) create mode 100644 pallets/minting/Cargo.toml create mode 100644 pallets/minting/README.md create mode 100644 pallets/minting/src/benchmarking.rs create mode 100644 pallets/minting/src/lib.rs create mode 100644 pallets/minting/src/mock.rs create mode 100644 pallets/minting/src/tests.rs diff --git a/Cargo.lock b/Cargo.lock index 04bf0d7..98147d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5517,6 +5517,25 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-minting" +version = "0.1.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "orml-currencies", + "orml-tokens", + "orml-traits", + "orml-utilities", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", +] + [[package]] name = "pallet-mmr" version = "4.0.0-dev" diff --git a/pallets/minting/Cargo.toml b/pallets/minting/Cargo.toml new file mode 100644 index 0000000..7109f24 --- /dev/null +++ b/pallets/minting/Cargo.toml @@ -0,0 +1,54 @@ +[package] +name = "pallet-minting" +authors = ["Anonymous"] +description = "FRAME pallet template for defining custom runtime logic." +version = "0.1.0" +license = "Unlicense" +homepage = "https://substrate.io" +repository = "https://github.com/paritytech/substrate/" +edition = "2021" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"], default-features = false } +scale-info = { version = "2.0.0", default-features = false, features = ["derive"] } + +# Substrate +frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.24" } +frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } + +# ORML +orml-traits = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } +orml-utilities = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } + + +[dev-dependencies] +serde = { version = "1.0.132" } + +# Substrate +sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } + +# ORML +orml-currencies = {git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } +orml-tokens = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } + +[features] +default = ["std"] +runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] +std = [ + "codec/std", + "scale-info/std", + "frame-benchmarking/std", + "frame-support/std", + "frame-system/std", + "orml-traits/std", + "orml-utilities/std", + "orml-currencies/std", + "orml-tokens/std", +] +try-runtime = [ "frame-support/try-runtime" ] \ No newline at end of file diff --git a/pallets/minting/README.md b/pallets/minting/README.md new file mode 100644 index 0000000..d505d0b --- /dev/null +++ b/pallets/minting/README.md @@ -0,0 +1,5 @@ +### Minting pallet + +License: Unlicense + +This pallet handles all logic around minting until currencies provide better API for it. It Basically enables the council (or other authority) to mint a specific amount to the treasury via a single call. diff --git a/pallets/minting/src/benchmarking.rs b/pallets/minting/src/benchmarking.rs new file mode 100644 index 0000000..fea9e65 --- /dev/null +++ b/pallets/minting/src/benchmarking.rs @@ -0,0 +1,20 @@ +//! Benchmarking setup for pallet-template + +use super::*; + +#[allow(unused)] +use crate::Pallet as Template; +use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller}; +use frame_system::RawOrigin; + +benchmarks! { + do_something { + let s in 0 .. 100; + let caller: T::AccountId = whitelisted_caller(); + }: _(RawOrigin::Signed(caller), s) + verify { + assert_eq!(Something::::get(), Some(s)); + } +} + +impl_benchmark_test_suite!(Template, crate::mock::new_test_ext(), crate::mock::Test,); diff --git a/pallets/minting/src/lib.rs b/pallets/minting/src/lib.rs new file mode 100644 index 0000000..66c1ef6 --- /dev/null +++ b/pallets/minting/src/lib.rs @@ -0,0 +1,159 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use orml_traits::{MultiCurrency, MultiReservableCurrency,arithmetic::Zero, BalanceStatus}; +use orml_utilities::with_transaction_result; + +/// Edit this file to define custom logic or remove it if it is not needed. +/// Learn more about FRAME and the core library of Substrate FRAME pallets: +/// +pub use pallet::*; + +#[cfg(test)] +mod mock; + +#[cfg(test)] +mod tests; + +#[cfg(feature = "runtime-benchmarks")] +mod benchmarking; + + +type BalanceOf = + <::Currency as MultiCurrency<::AccountId>>::Balance; +type CurrencyIdOf = + <::Currency as MultiCurrency<::AccountId>>::CurrencyId; + + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use frame_support::{dispatch::DispatchResultWithPostInfo,ensure, pallet_prelude::*}; + use frame_system::pallet_prelude::*; + + /// Configure the pallet by specifying the parameters and types on which it depends. + #[pallet::config] + pub trait Config: frame_system::Config { + /// Because this pallet emits events, it depends on the runtime's definition of an event. + type Event: From> + IsType<::Event>; + /// Currency + type Currency: MultiReservableCurrency; + } + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(_); + + // The pallet's runtime storage items. + // https://docs.substrate.io/v3/runtime/storage + #[pallet::storage] + #[pallet::getter(fn something)] + // Learn more about declaring storage items: + // https://docs.substrate.io/v3/runtime/storage#declaring-storage-items + pub type Something = StorageValue<_, u32>; + + // Pallets use events to inform users when important changes are made. + // https://docs.substrate.io/v3/runtime/events-and-errors + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + /// Event documentation should end with an array that provides descriptive names for event + /// parameters. [something, who] + SomethingStored(u32, T::AccountId), + } + + // Errors inform users that something went wrong. + #[pallet::error] + pub enum Error { + /// Error names should be descriptive. + NoneValue, + /// Errors should have helpful documentation associated with them. + StorageOverflow, + /// Insufficeint balance to unreserve + InsufficientBalance, + } + + #[pallet::hooks] + impl Hooks> for Pallet {} + + // Dispatchable functions allows users to interact with the pallet and invoke state changes. + // These functions materialize as "extrinsics", which are often compared to transactions. + // Dispatchable functions must be annotated with a weight and must return a DispatchResult. + #[pallet::call] + impl Pallet { + /// An example dispatchable that takes a singles value as a parameter, writes the value to + /// storage and emits an event. This function must be dispatched by a signed extrinsic. + #[pallet::weight(10_000 + T::DbWeight::get().writes(1))] + pub fn do_something(origin: OriginFor, something: u32) -> DispatchResultWithPostInfo { + // Check that the extrinsic was signed and get the signer. + // This function will return an error if the extrinsic is not signed. + // https://docs.substrate.io/v3/runtime/origins + let who = ensure_signed(origin)?; + + // Update storage. + >::put(something); + + // Emit an event. + Self::deposit_event(Event::SomethingStored(something, who)); + // Return a successful DispatchResultWithPostInfo + Ok(().into()) + } + /// Reserves some amount of generic assets for the roigin + #[pallet::weight(10_000)] + pub fn test_res (origin: OriginFor, currency_id: CurrencyIdOf, amount: BalanceOf) ->DispatchResultWithPostInfo{ + let who = ensure_signed(origin)?; + T::Currency::reserve(currency_id,&who, amount)?; + Ok(().into()) + } + /// UnReserves some amount of generic assets for the roigin + #[pallet::weight(10_000)] + pub fn test_unres (origin: OriginFor, currency_id: CurrencyIdOf, amount: BalanceOf) -> DispatchResult { + let who = ensure_signed(origin)?; + with_transaction_result(|| { + + let remainder = T::Currency::unreserve(currency_id,&who, amount); + ensure!(remainder.is_zero(),Error::::InsufficientBalance); + + Ok(().into()) + }) + + } + + /// UnReserves some amount of generic assets for the origin and transfers it to some other account. In choc, this is same account. + /// Pure unreserve could also work. Just showing that this is possible. + #[pallet::weight(10_000)] + pub fn test_unres_to (origin: OriginFor, currency_id: CurrencyIdOf,to: T::AccountId, amount: BalanceOf) -> DispatchResult { + let who = ensure_signed(origin)?; + + // A transaction can either succeed and commit, or fail and rollback. This helps avoid prelim. checks. Tradeoffs? + with_transaction_result(|| { + let remainder = T::Currency::repatriate_reserved(currency_id,&who, &to, amount, BalanceStatus::Free)?; + + // Never use this check with the same account, else transaction will fail with remainder balance returned. + // Use unreserve instead + ensure!(remainder.is_zero(),Error::::InsufficientBalance); + + Ok(().into()) + }) + + + } + /// An example dispatchable that may throw a custom error. + #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))] + pub fn cause_error(origin: OriginFor) -> DispatchResultWithPostInfo { + let _who = ensure_signed(origin)?; + + // Read a value from storage. + match >::get() { + // Return an error if the value has not been set. + None => Err(Error::::NoneValue)?, + Some(old) => { + // Increment the value read from storage; will error in the event of overflow. + let new = old.checked_add(1).ok_or(Error::::StorageOverflow)?; + // Update the value in storage with the incremented result. + >::put(new); + Ok(().into()) + }, + } + } + } +} diff --git a/pallets/minting/src/mock.rs b/pallets/minting/src/mock.rs new file mode 100644 index 0000000..006dcff --- /dev/null +++ b/pallets/minting/src/mock.rs @@ -0,0 +1,65 @@ +use crate as pallet_template; +use frame_support::{parameter_types, traits::Everything}; +use frame_system as system; +use sp_core::H256; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, +}; + +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +// Configure a mock runtime to test the pallet. +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Config, Storage, Event}, + TemplateModule: pallet_template::{Pallet, Call, Storage, Event}, + } +); + +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const SS58Prefix: u8 = 42; +} + +impl system::Config for Test { + type BaseCallFilter = Everything; + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type Origin = Origin; + type Call = Call; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Header = Header; + type Event = Event; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = (); + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = SS58Prefix; + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +impl pallet_template::Config for Test { + type Event = Event; + type Currency = Currencies; +} + +// Build genesis storage according to the mock runtime. +pub fn new_test_ext() -> sp_io::TestExternalities { + system::GenesisConfig::default().build_storage::().unwrap().into() +} diff --git a/pallets/minting/src/tests.rs b/pallets/minting/src/tests.rs new file mode 100644 index 0000000..2205658 --- /dev/null +++ b/pallets/minting/src/tests.rs @@ -0,0 +1,20 @@ +use crate::{mock::*, Error}; +use frame_support::{assert_noop, assert_ok}; + +#[test] +fn it_works_for_default_value() { + new_test_ext().execute_with(|| { + // Dispatch a signed extrinsic. + assert_ok!(TemplateModule::do_something(Origin::signed(1), 42)); + // Read pallet storage and assert an expected result. + assert_eq!(TemplateModule::something(), Some(42)); + }); +} + +#[test] +fn correct_error_for_none_value() { + new_test_ext().execute_with(|| { + // Ensure the expected error is thrown when no value is present. + assert_noop!(TemplateModule::cause_error(Origin::signed(1)), Error::::NoneValue); + }); +} From db0f56ab5bdac3e714d2b5950fe7838af7514018 Mon Sep 17 00:00:00 2001 From: Islam Date: Mon, 11 Jul 2022 16:13:10 +0000 Subject: [PATCH 28/36] feat(multi): Extract minting logic, add minting pallet to runtime --- Cargo.lock | 5 +- multi.md | 7 ++ node/src/chain_spec.rs | 3 + pallets/minting/Cargo.toml | 11 --- pallets/minting/src/lib.rs | 158 +++++++++++++---------------------- pallets/minting/src/mock.rs | 10 ++- pallets/minting/src/tests.rs | 4 - runtime/Cargo.toml | 3 + runtime/src/lib.rs | 25 ++++-- 9 files changed, 94 insertions(+), 132 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 98147d2..73ab203 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5524,10 +5524,6 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "orml-currencies", - "orml-tokens", - "orml-traits", - "orml-utilities", "parity-scale-codec", "scale-info", "serde", @@ -6153,6 +6149,7 @@ dependencies = [ "pallet-collator-selection", "pallet-collective", "pallet-elections-phragmen", + "pallet-minting", "pallet-session", "pallet-sudo", "pallet-template", diff --git a/multi.md b/multi.md index 53424cb..a97a058 100644 --- a/multi.md +++ b/multi.md @@ -19,3 +19,10 @@ To integrate the multiassets pallet into chocolate with: * A simple extrinsic that unreserves the same generic asset in the template pallet, and test that it is unreserved as expected. * Both extrinsics will be paid in the native token, test that it fails if the user doesn't have sufficient balance. +## Imbalances and deposits + +Method: https://github.com/open-web3-stack/open-runtime-module-library/blob/52ec52b733b3fc326d8e7104ff414d7e3c3b8b06/currencies/src/lib.rs#L659 +Not useful though. No minting. Define in genesis. +```rs +BasicReservableCurrency::deposit() +``` \ No newline at end of file diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 6f8f0e4..f41aca7 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -281,5 +281,8 @@ fn testnet_genesis( }, council: parachain_template_runtime::CouncilConfig::default(), treasury: Default::default(), + minting_module: { + init_mint: 5000 * UNIT + } } } diff --git a/pallets/minting/Cargo.toml b/pallets/minting/Cargo.toml index 7109f24..8d0a9da 100644 --- a/pallets/minting/Cargo.toml +++ b/pallets/minting/Cargo.toml @@ -20,10 +20,6 @@ frame-benchmarking = { git = "https://github.com/paritytech/substrate", default- frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } -# ORML -orml-traits = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } -orml-utilities = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } - [dev-dependencies] serde = { version = "1.0.132" } @@ -33,9 +29,6 @@ sp-core = { git = "https://github.com/paritytech/substrate", default-features = sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.24" } -# ORML -orml-currencies = {git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } -orml-tokens = { git="https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch="polkadot-v0.9.24" } [features] default = ["std"] @@ -46,9 +39,5 @@ std = [ "frame-benchmarking/std", "frame-support/std", "frame-system/std", - "orml-traits/std", - "orml-utilities/std", - "orml-currencies/std", - "orml-tokens/std", ] try-runtime = [ "frame-support/try-runtime" ] \ No newline at end of file diff --git a/pallets/minting/src/lib.rs b/pallets/minting/src/lib.rs index 66c1ef6..638a4d5 100644 --- a/pallets/minting/src/lib.rs +++ b/pallets/minting/src/lib.rs @@ -1,7 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] -use orml_traits::{MultiCurrency, MultiReservableCurrency,arithmetic::Zero, BalanceStatus}; -use orml_utilities::with_transaction_result; /// Edit this file to define custom logic or remove it if it is not needed. /// Learn more about FRAME and the core library of Substrate FRAME pallets: @@ -18,142 +16,100 @@ mod tests; mod benchmarking; -type BalanceOf = - <::Currency as MultiCurrency<::AccountId>>::Balance; -type CurrencyIdOf = - <::Currency as MultiCurrency<::AccountId>>::CurrencyId; #[frame_support::pallet] pub mod pallet { - use super::*; - use frame_support::{dispatch::DispatchResultWithPostInfo,ensure, pallet_prelude::*}; + use frame_support::{traits::{Currency, OnUnbalanced, Imbalance},sp_runtime::traits::Zero, pallet_prelude::*}; use frame_system::pallet_prelude::*; - /// Configure the pallet by specifying the parameters and types on which it depends. + use super::*; + #[pallet::config] pub trait Config: frame_system::Config { /// Because this pallet emits events, it depends on the runtime's definition of an event. type Event: From> + IsType<::Event>; /// Currency - type Currency: MultiReservableCurrency; + type Currency: Currency; + /// * Treasury outlet: A type with bounds to move slashed funds to the treasury. + type TreasuryOutlet: OnUnbalanced>; + /// Origins that must approve to use the pallet - Should be implemented properly by provider. + type ApproveOrigin: EnsureOrigin; } + + type BalanceOf = + <::Currency as Currency<::AccountId>>::Balance; + + pub type NegativeImbalanceOf = <::Currency as Currency< + ::AccountId, + >>::NegativeImbalance; #[pallet::pallet] #[pallet::generate_store(pub(super) trait Store)] pub struct Pallet(_); + - // The pallet's runtime storage items. - // https://docs.substrate.io/v3/runtime/storage - #[pallet::storage] - #[pallet::getter(fn something)] - // Learn more about declaring storage items: - // https://docs.substrate.io/v3/runtime/storage#declaring-storage-items - pub type Something = StorageValue<_, u32>; - - // Pallets use events to inform users when important changes are made. - // https://docs.substrate.io/v3/runtime/events-and-errors #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { - /// Event documentation should end with an array that provides descriptive names for event - /// parameters. [something, who] - SomethingStored(u32, T::AccountId), + /// Parameters. [Amount] + Minted(BalanceOf), } - // Errors inform users that something went wrong. #[pallet::error] pub enum Error { - /// Error names should be descriptive. - NoneValue, - /// Errors should have helpful documentation associated with them. - StorageOverflow, - /// Insufficeint balance to unreserve - InsufficientBalance, + /// Mint Must be called from a root or equivalent origin + InvalidOrigin, } #[pallet::hooks] impl Hooks> for Pallet {} - // Dispatchable functions allows users to interact with the pallet and invoke state changes. - // These functions materialize as "extrinsics", which are often compared to transactions. - // Dispatchable functions must be annotated with a weight and must return a DispatchResult. - #[pallet::call] + #[pallet::call] impl Pallet { - /// An example dispatchable that takes a singles value as a parameter, writes the value to - /// storage and emits an event. This function must be dispatched by a signed extrinsic. - #[pallet::weight(10_000 + T::DbWeight::get().writes(1))] - pub fn do_something(origin: OriginFor, something: u32) -> DispatchResultWithPostInfo { - // Check that the extrinsic was signed and get the signer. - // This function will return an error if the extrinsic is not signed. - // https://docs.substrate.io/v3/runtime/origins - let who = ensure_signed(origin)?; - - // Update storage. - >::put(something); - - // Emit an event. - Self::deposit_event(Event::SomethingStored(something, who)); - // Return a successful DispatchResultWithPostInfo - Ok(().into()) - } - /// Reserves some amount of generic assets for the roigin #[pallet::weight(10_000)] - pub fn test_res (origin: OriginFor, currency_id: CurrencyIdOf, amount: BalanceOf) ->DispatchResultWithPostInfo{ - let who = ensure_signed(origin)?; - T::Currency::reserve(currency_id,&who, amount)?; - Ok(().into()) + pub fn mint(origin: OriginFor, x: BalanceOf) -> DispatchResult { + // call its ensure origin - doesn't return origin. Only checks + T::ApproveOrigin::ensure_origin(origin)?; + let imbalance = T::Currency::issue(x); + let minted = imbalance.peek(); + Self::do_mint(imbalance); + Self::deposit_event(Event::Minted(minted)); + Ok(()) } - /// UnReserves some amount of generic assets for the roigin - #[pallet::weight(10_000)] - pub fn test_unres (origin: OriginFor, currency_id: CurrencyIdOf, amount: BalanceOf) -> DispatchResult { - let who = ensure_signed(origin)?; - with_transaction_result(|| { - - let remainder = T::Currency::unreserve(currency_id,&who, amount); - ensure!(remainder.is_zero(),Error::::InsufficientBalance); - - Ok(().into()) - }) - + } + impl Pallet { + /// Function to take negative imbalance to the treasury, expected to be called after creating one e.g through T::Currency::issue() + pub fn do_mint(amount: NegativeImbalanceOf) { + T::TreasuryOutlet::on_unbalanced(amount); } + } - /// UnReserves some amount of generic assets for the origin and transfers it to some other account. In choc, this is same account. - /// Pure unreserve could also work. Just showing that this is possible. - #[pallet::weight(10_000)] - pub fn test_unres_to (origin: OriginFor, currency_id: CurrencyIdOf,to: T::AccountId, amount: BalanceOf) -> DispatchResult { - let who = ensure_signed(origin)?; - - // A transaction can either succeed and commit, or fail and rollback. This helps avoid prelim. checks. Tradeoffs? - with_transaction_result(|| { - let remainder = T::Currency::repatriate_reserved(currency_id,&who, &to, amount, BalanceStatus::Free)?; - - // Never use this check with the same account, else transaction will fail with remainder balance returned. - // Use unreserve instead - ensure!(remainder.is_zero(),Error::::InsufficientBalance); - Ok(().into()) - }) + /// Genesis config for the minting pallet. Use to mint an initial amount to treasury + /// E.g Use: Token sales. + #[pallet::genesis_config] + pub struct GenesisConfig { + /// Amount to mint + pub init_mint: BalanceOf, + } - + /// By default, nothing. + #[cfg(feature = "std")] + impl Default for GenesisConfig { + fn default() -> Self { + Self { init_mint: Zero::zero() } } - /// An example dispatchable that may throw a custom error. - #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))] - pub fn cause_error(origin: OriginFor) -> DispatchResultWithPostInfo { - let _who = ensure_signed(origin)?; - - // Read a value from storage. - match >::get() { - // Return an error if the value has not been set. - None => Err(Error::::NoneValue)?, - Some(old) => { - // Increment the value read from storage; will error in the event of overflow. - let new = old.checked_add(1).ok_or(Error::::StorageOverflow)?; - // Update the value in storage with the incremented result. - >::put(new); - Ok(().into()) - }, - } + } + + #[pallet::genesis_build] + impl GenesisBuild for GenesisConfig { + fn build(&self) { + // Repeat mint call, without origin check + let imbalance = T::Currency::issue(self.init_mint); + let minted = imbalance.peek(); + >::do_mint(imbalance); + >::deposit_event(Event::Minted(minted)); } } } diff --git a/pallets/minting/src/mock.rs b/pallets/minting/src/mock.rs index 006dcff..9846ee9 100644 --- a/pallets/minting/src/mock.rs +++ b/pallets/minting/src/mock.rs @@ -1,4 +1,4 @@ -use crate as pallet_template; +use crate as pallet_minting; use frame_support::{parameter_types, traits::Everything}; use frame_system as system; use sp_core::H256; @@ -18,7 +18,7 @@ frame_support::construct_runtime!( UncheckedExtrinsic = UncheckedExtrinsic, { System: frame_system::{Pallet, Call, Config, Storage, Event}, - TemplateModule: pallet_template::{Pallet, Call, Storage, Event}, + MintingModule: pallet_minting::{Pallet, Call, Storage, Event}, } ); @@ -54,9 +54,11 @@ impl system::Config for Test { type MaxConsumers = frame_support::traits::ConstU32<16>; } -impl pallet_template::Config for Test { +impl pallet_minting::Config for Test { type Event = Event; - type Currency = Currencies; + type Currency = Balances; + type TreasuryOutlet = Treasury; + type ApproveOrigin = ApproveOrigin; } // Build genesis storage according to the mock runtime. diff --git a/pallets/minting/src/tests.rs b/pallets/minting/src/tests.rs index 2205658..99f66a5 100644 --- a/pallets/minting/src/tests.rs +++ b/pallets/minting/src/tests.rs @@ -5,9 +5,6 @@ use frame_support::{assert_noop, assert_ok}; fn it_works_for_default_value() { new_test_ext().execute_with(|| { // Dispatch a signed extrinsic. - assert_ok!(TemplateModule::do_something(Origin::signed(1), 42)); - // Read pallet storage and assert an expected result. - assert_eq!(TemplateModule::something(), Some(42)); }); } @@ -15,6 +12,5 @@ fn it_works_for_default_value() { fn correct_error_for_none_value() { new_test_ext().execute_with(|| { // Ensure the expected error is thrown when no value is present. - assert_noop!(TemplateModule::cause_error(Origin::signed(1)), Error::::NoneValue); }); } diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index dc8749d..f4273b4 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -27,6 +27,7 @@ static_assertions = "1.1.0" pallet-template = { path = "../pallets/template", default-features = false } pallet-chocolate = { path = "../pallets/chocolate", default-features = false } pallet-users = { path = "../pallets/users", default-features = false } +pallet-minting = { path = "../pallets/minting", default-features = false } # ORML @@ -145,6 +146,8 @@ std = [ "pallet-treasury/std", "pallet-collective/std", "pallet-elections-phragmen/std", + "pallet-minting/std", + ] runtime-benchmarks = [ diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 8637c06..676d6b1 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -679,6 +679,14 @@ impl pallet_treasury::Config for Runtime { type SpendFunds = (); type MaxApprovals = MaxApprovals; } + +impl pallet_minting::Config for Runtime { + type Event = Event; + type Currency = Balances; + type TreasuryOutlet = Treasury; + type ApproveOrigin = ApproveOrigin; +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -715,15 +723,15 @@ construct_runtime!( TemplatePallet: pallet_template::{Pallet, Call, Storage, Event} = 40, UsersModule: pallet_users::{Pallet, Call, Storage, Event} = 43, ChocolateModule: pallet_chocolate::{Pallet, Call, Config, Storage, Event} = 44, + MintingModule: pallet_minting::{Pallet, Call, Config, Storage, Event} = 48, // TREASURY - Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config}, - Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event}, - // elections implemented for council. - PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config}, - - // Orml - Currencies: orml_currencies::{Pallet, Call} = 41, - Tokens: orml_tokens::{Pallet, Storage, Event, Config} = 42, + Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 51, + Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 52, + PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 53, + + // Orml multitokens + Currencies: orml_currencies::{Pallet, Call} = 61, + Tokens: orml_tokens::{Pallet, Storage, Event, Config} = 62, } ); @@ -744,6 +752,7 @@ mod benches { [pallet_elections_phragmen, PhragmenElection] [pallet_collective, Council] [pallet_treasury, Treasury] + [pallet_minting, Minting] ); } From b211b738ebdb20222e924aba8745f2debf3043f7 Mon Sep 17 00:00:00 2001 From: Islam Date: Mon, 11 Jul 2022 16:32:15 +0000 Subject: [PATCH 29/36] feat(multi): Remove all minting in chocolate-pallet Includes minting to treasury, minting to balance of initial users All init_users args to chocolate pallet genesis must have enough balance to perform create_project and create_review extrinsics (for create_review, multiple times) --- node/src/chain_spec.rs | 2 +- pallets/chocolate/src/lib.rs | 53 +++++++---------------------------- pallets/chocolate/src/mock.rs | 1 - runtime/src/lib.rs | 1 - 4 files changed, 11 insertions(+), 46 deletions(-) diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index f41aca7..51ec856 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -281,7 +281,7 @@ fn testnet_genesis( }, council: parachain_template_runtime::CouncilConfig::default(), treasury: Default::default(), - minting_module: { + minting_module: parachain_template_runtime::MintingModuleConfig { init_mint: 5000 * UNIT } } diff --git a/pallets/chocolate/src/lib.rs b/pallets/chocolate/src/lib.rs index 9b9cce4..3057ca8 100644 --- a/pallets/chocolate/src/lib.rs +++ b/pallets/chocolate/src/lib.rs @@ -30,7 +30,7 @@ pub mod pallet { ArithmeticError, }, traits::{ - Currency, ExistenceRequirement::KeepAlive, Imbalance, OnUnbalanced, ReservableCurrency, + Currency, ExistenceRequirement::KeepAlive, ReservableCurrency, }, }; use frame_system::{pallet_prelude::*, Origin}; @@ -46,14 +46,12 @@ pub mod pallet { type ApprovedOrigin: EnsureOrigin; /// The currency trait, associated to the pallet. All methods accessible from T::Currency* type Currency: Currency + ReservableCurrency; - /// * Treasury outlet: A type with bounds to move slashed funds to the treasury. - type TreasuryOutlet: OnUnbalanced>; - /// This is it! The user pallet. A type with bounds to access the user module. + /// The user pallet. A type with bounds to access the user module. type UsersOutlet: UserIO; /// * Reward Cap: Max reward projects can place on themselves. Interestingly, this also serves as their stake amount. #[pallet::constant] type RewardCap: Get>; - /// Hard coded collateral amount for the Users + /// Collateral amount for the Users #[pallet::constant] type UserCollateral: Get>; /// The maximum length of a name or symbol stored on-chain. @@ -61,9 +59,6 @@ pub mod pallet { type StringLimit: Get + Member + Parameter + MaybeSerializeDeserialize + Clone; } // ------------------------------------------------------------Type aliases ---------------------\ - pub type NegativeImbalanceOf = <::Currency as Currency< - ::AccountId, - >>::NegativeImbalance; /// type alias for review - this is the base struct, like the 2nd part of Balancesof pub type ReviewAl = Review<::AccountId, ::StringLimit>; @@ -115,8 +110,6 @@ pub mod pallet { ReviewCreated(T::AccountId, ProjectID), /// parameters [owner, project_id] ReviewAccepted(T::AccountId, ProjectID), - /// Minted [amount] - Minted(BalanceOf), } // Errors inform users that something went wrong. #[pallet::error] @@ -259,16 +252,6 @@ pub mod pallet { Self::deposit_event(Event::ReviewCreated(user_id, project_id)); Ok(()) } - #[pallet::weight(10_000)] - pub fn mint(origin: OriginFor, x: BalanceOf) -> DispatchResult { - // call its ensure origin - doesn't return origin. Only checks - T::ApprovedOrigin::ensure_origin(origin)?; - let imbalance = T::Currency::issue(x); - let minted = imbalance.peek(); - Self::do_mint(imbalance); - Self::deposit_event(Event::Minted(minted)); - Ok(()) - } } impl ProjectIO for Pallet { @@ -432,10 +415,6 @@ pub mod pallet { T::Currency::reserve(&id, reserve)?; Ok(()) } - /// Function to take negative imbalance to the treasury, expected to be called after creating one e.g through T::Currency::issue() - pub fn do_mint(amount: NegativeImbalanceOf) { - T::TreasuryOutlet::on_unbalanced(amount); - } /// Create a project from required data - only for genesis /// Assumes user has already been craeted. @@ -485,6 +464,9 @@ pub mod pallet { pub struct GenesisConfig { /// Get the parameters for the init projects function pub init_projects: Vec<(Status, ReasonOf)>, + /// Initial users to use to init projects. + /// All accounts used should be endowed with initial balance, atleast enough to handle reserve + /// Zip may mean users are matched up with projects by index pub init_users: Vec, } /// By default a generic project or known projects will be shown - polkadot & sisters @@ -498,13 +480,14 @@ pub mod pallet { #[pallet::genesis_build] impl GenesisBuild for GenesisConfig { + // Genesis build: Creates mock reviews for testing. fn build(&self) { // Create users. let iter_users = (&self.init_users).iter(); for id in iter_users.clone() { T::UsersOutlet::set_user(id, Default::default()); } - // setup a counter to serve as project index + let meta: Vec> = constants::project::METADATA .iter() .map(|each| each.to_vec().try_into().expect("Metadata should be within StringLimit")) @@ -515,6 +498,7 @@ pub mod pallet { .map(|((s, r), accnt)| (accnt, s.clone(), r.clone())) .collect(); let zipped = (init_projects_w_users).into_iter().zip(meta.iter()); + // create project from associated metadata in zip. for each in zipped { let (project_ref, meta_ref) = each; @@ -526,29 +510,12 @@ pub mod pallet { .filter(|id| acnt.ne(id)) .map(|long| long.clone()) .collect(); - // Give filtered ids and main acnt enough funds to pay for reward. - // (Hack). More formal ways should be decided upon. - - let two = BalanceOf::::from(2u32); - let minimum = T::Currency::minimum_balance(); - let amnt_issue = T::RewardCap::get().saturating_mul(two).saturating_add(minimum); - let amnt_issue2 = - T::UserCollateral::get().saturating_mul(two).saturating_add(minimum); - let total = amnt_issue.saturating_add(amnt_issue2).saturating_mul(two); - let imbalance = T::Currency::issue(total.clone()); - T::Currency::resolve_creating(&acnt, imbalance); - filtered_ids - .iter() - .for_each(|id| T::Currency::resolve_creating(id, T::Currency::issue(total))); // create reviews and projects and store. - Pallet::::initialize_project(acnt.clone(), meta_cid, stat, reas); Pallet::::initialize_reviews(filtered_ids); } - // Fill the treasury - A little hack. - let imbalance = T::Currency::issue(T::RewardCap::get()); - Pallet::::do_mint(imbalance); + } } } diff --git a/pallets/chocolate/src/mock.rs b/pallets/chocolate/src/mock.rs index bc0967e..5f74ba2 100644 --- a/pallets/chocolate/src/mock.rs +++ b/pallets/chocolate/src/mock.rs @@ -116,7 +116,6 @@ impl pallet_chocolate::Config for Test { type ApprovedOrigin = frame_system::EnsureRoot; // this is simply a pointer to the true implementor,and creator of the currency trait...the balances pallet type Currency = Balances; - type TreasuryOutlet = (); type RewardCap = Cap; type UsersOutlet = UsersModule; type UserCollateral = UserCollateral; diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 676d6b1..0a84a47 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -570,7 +570,6 @@ impl pallet_chocolate::Config for Runtime { type Event = Event; type ApprovedOrigin = ApproveOrigin; type Currency = Balances; - type TreasuryOutlet = Treasury; type RewardCap = RewardCap; type UsersOutlet = UsersModule; type UserCollateral = UserCollateral; From 59757a68587c1057884f11e9ce360daf818d503a Mon Sep 17 00:00:00 2001 From: Islam Date: Mon, 11 Jul 2022 22:37:09 +0000 Subject: [PATCH 30/36] feat(multi): Add multi assets to chocolate module Replaced calls to Currency with multicurrency in pallet and changed pallet indices in runtime. Also Updated chainspec to bring balances to requirement Genesis config is broken for non native tokens for some reason, initial balance isn't being picked up in currencies when running `create_review` on genesis. Works fine afterwards though --- node/src/chain_spec.rs | 32 +++---- pallets/chocolate/src/lib.rs | 159 ++++++++++++++++++++--------------- pallets/minting/src/lib.rs | 29 +++---- primitives/src/lib.rs | 15 +++- primitives/src/projects.rs | 53 ++++-------- primitives/src/users.rs | 6 +- runtime/src/lib.rs | 23 ++--- 7 files changed, 168 insertions(+), 149 deletions(-) diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 51ec856..9b5c8a6 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -228,8 +228,8 @@ fn testnet_genesis( .iter() .flat_map(|x| { vec![ - (x.clone(), CurrencyId::DOT, 10u128.pow(16)), - (x.clone(), CurrencyId::BTC, 10u128.pow(16)), + (x.clone(), CurrencyId::DOT, ENDOWMENT), + (x.clone(), CurrencyId::BTC, ENDOWMENT), ] }) .collect(), @@ -239,7 +239,6 @@ fn testnet_genesis( chocolate_module: parachain_template_runtime::ChocolateModuleConfig { init_projects: { let ps_req = Reason::PassedRequirements; - // use a static list for accounts vec![ (Status::Accepted, ps_req.clone()), (Status::Rejected, Reason::Malicious), @@ -252,19 +251,22 @@ fn testnet_genesis( ] }, init_users: { + // use a static list for accounts + // Update init_projects and token alloc in multiassets when updating this. + // FIXME: Panics when this is anything other than Native vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Dave"), - get_account_id_from_seed::("Eve"), - get_account_id_from_seed::("Ferdie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), - get_account_id_from_seed::("Ferdie//stash"), + (get_account_id_from_seed::("Alice"), CurrencyId::Native), + (get_account_id_from_seed::("Bob"), CurrencyId::Native), + (get_account_id_from_seed::("Charlie"), CurrencyId::Native), + (get_account_id_from_seed::("Dave"), CurrencyId::Native), + (get_account_id_from_seed::("Eve"), CurrencyId::Native), + (get_account_id_from_seed::("Ferdie"), CurrencyId::Native), + (get_account_id_from_seed::("Alice//stash"), CurrencyId::Native), + (get_account_id_from_seed::("Bob//stash"), CurrencyId::Native), + (get_account_id_from_seed::("Charlie//stash"), CurrencyId::Native), + (get_account_id_from_seed::("Dave//stash"), CurrencyId::Native), + (get_account_id_from_seed::("Eve//stash"), CurrencyId::Native), + (get_account_id_from_seed::("Ferdie//stash"), CurrencyId::Native), ] }, }, diff --git a/pallets/chocolate/src/lib.rs b/pallets/chocolate/src/lib.rs index 3057ca8..c65fa32 100644 --- a/pallets/chocolate/src/lib.rs +++ b/pallets/chocolate/src/lib.rs @@ -29,13 +29,10 @@ pub mod pallet { traits::{CheckedDiv, Saturating}, ArithmeticError, }, - traits::{ - Currency, ExistenceRequirement::KeepAlive, ReservableCurrency, - }, }; use frame_system::{pallet_prelude::*, Origin}; - use sp_std::str; - use sp_std::vec::Vec; + use orml_traits::{MultiCurrency, MultiReservableCurrency}; + use sp_std::{borrow::ToOwned, str, vec::Vec}; // Include the ApprovedOrigin type here, and the method to get treasury id, then mint with currencymodule /// Configure the pallet by specifying the parameters and types on which it depends. #[pallet::config] @@ -44,8 +41,8 @@ pub mod pallet { type Event: From> + IsType<::Event>; /// Origins that must approve to use the pallet - Should be implemented properly by provider. type ApprovedOrigin: EnsureOrigin; - /// The currency trait, associated to the pallet. All methods accessible from T::Currency* - type Currency: Currency + ReservableCurrency; + /// The currency trait, bound to a multicurrency to accept different tokens. Named currency for (hopeful) interop. + type Currency: MultiCurrency + MultiReservableCurrency; /// The user pallet. A type with bounds to access the user module. type UsersOutlet: UserIO; /// * Reward Cap: Max reward projects can place on themselves. Interestingly, this also serves as their stake amount. @@ -57,21 +54,27 @@ pub mod pallet { /// The maximum length of a name or symbol stored on-chain. #[pallet::constant] type StringLimit: Get + Member + Parameter + MaybeSerializeDeserialize + Clone; + /// Native currency to be used in settling rewards + type GetNativeCurrencyId: Get>; } // ------------------------------------------------------------Type aliases ---------------------\ /// type alias for review - this is the base struct, like the 2nd part of Balancesof pub type ReviewAl = - Review<::AccountId, ::StringLimit>; + Review<::AccountId, ::StringLimit, CurrencyIdOf>; /// type alias for project pub type ProjectAl = Project<::AccountId, BalanceOf, ::StringLimit>; /// Type alias for balance, binding T::Currency to Currency::AccountId and then extracting from that Balance. Accessible via T::BalanceOf. pub type BalanceOf = - <::Currency as Currency<::AccountId>>::Balance; + <::Currency as MultiCurrency<::AccountId>>::Balance; /// Type alias for reason pub type ReasonOf = Reason<::StringLimit>; /// Type Alias for Bounded Vec pub type BoundedVecOf = BoundedVec::StringLimit>; + /// Currency Id for pallet + pub type CurrencyIdOf = <::Currency as MultiCurrency< + ::AccountId, + >>::CurrencyId; #[pallet::pallet] #[pallet::generate_store(pub(super) trait Store)] @@ -178,6 +181,7 @@ pub mod pallet { origin: OriginFor, review_meta: (u8, BoundedVecOf), project_id: ProjectID, + collateral_currency_id: CurrencyIdOf, ) -> DispatchResult { let who = ensure_signed(origin)?; // CHECKS & Inits @@ -186,9 +190,9 @@ pub mod pallet { ensure!(!>::contains_key(&who, project_id), Error::::DuplicateReview); ensure!(this_project.owner_id.ne(&who), Error::::OwnerReviewedProject); ensure!(review_meta.0 <= 5 && review_meta.0 >= 1, Error::::ReviewScoreOutOfRange); - let reserve = Pallet::::can_collateralise(&who)?; + let reserve = Pallet::::can_collateralise(collateral_currency_id, &who)?; // Fallible MUTATIONS - Pallet::::collateralise(&who, reserve)?; + Pallet::::collateralise(collateral_currency_id, &who, reserve)?; let user = T::UsersOutlet::get_or_create_default(&who); this_project.total_user_scores = this_project.total_user_scores.saturating_add(user.rank_points); @@ -206,6 +210,7 @@ pub mod pallet { }, point_snapshot: user.rank_points, review_score: review_meta.0, + collateral_currency_id, }, ); >::mutate(project_id, |project| { @@ -233,7 +238,10 @@ pub mod pallet { // CHECKS let is_proposed = review.proposal_status.status.eq(&Status::Proposed); ensure!(is_proposed, Error::::AcceptingNotProposed); - ensure!(Pallet::::check_collateral(&user_id), Error::::InconsistentCollateral); + ensure!( + Pallet::::check_collateral(review.collateral_currency_id, &user_id), + Error::::InconsistentCollateral + ); Pallet::::check_reward(&project)?; // MUTATIONS - Fallible Pallet::::reward_user(&user_id, &mut project, &review)?; @@ -258,47 +266,45 @@ pub mod pallet { type UserID = T::AccountId; type Balance = BalanceOf; type StringLimit = T::StringLimit; - /// does existence checks for us to see if the project owner can release required reward+liveness req safely + fn can_reward(who: &Self::UserID) -> bool { - let existential = T::Currency::minimum_balance(); + // Reward in native currency, for now. + let currency_id = T::GetNativeCurrencyId::get(); + let existential = T::Currency::minimum_balance(currency_id); let mut amount = T::RewardCap::get(); - let reserved = T::Currency::reserved_balance(who); - // modulo test two + let reserved = T::Currency::reserved_balance(currency_id, who); + // Include existential deposit when removing to avoid dropping reserve acnt. (Most important if having multiple projects. ) + // To be solved by: ProjectAdmin account only having one project if (reserved % amount) < existential { amount = amount.saturating_add(existential); } - T::Currency::can_reserve(who, amount) + T::Currency::can_reserve(currency_id, who, amount) } - /// Performs the necessary checks on the project's side to ensure that they can reward the user - /// At this instance - /// - /// - checks if the project's advertised reward is same as reserved balance - /// - checks if the project has enough free balance to safely transfer reward after release to the user + fn check_reward(project_struct: &ProjectAl) -> DispatchResult { // If the reward is what is reserved + existential - let reserve = T::Currency::reserved_balance(&project_struct.owner_id); // If we had the reward, taking the modulo with reward cap would yield what we have?? - let existential = T::Currency::minimum_balance(); + let currency_id = T::GetNativeCurrencyId::get(); + let reserve = T::Currency::reserved_balance(currency_id, &project_struct.owner_id); // If we had the reward, taking the modulo with reward cap would yield what we have?? + let existential = T::Currency::minimum_balance(currency_id); // assume reserve to be a superset of our reward. let is_sufficient = reserve >= (project_struct.reward.saturating_add(existential)); ensure!(is_sufficient, Error::::RewardInconsistent); // ensure free balance too for the next step - let free_balance = T::Currency::free_balance(&project_struct.owner_id); + let free_balance = T::Currency::free_balance(currency_id, &project_struct.owner_id); ensure!(free_balance >= existential, Error::::InsufficientBalance); Ok(()) } - /// Reserve some reward and possibly + liveness req as we initialise the project - /// # Fallible - /// does no checks for ability to reserve. - /// (When safe, move from mut to immut) + fn reserve_reward(project_struct: &mut ProjectAl) -> DispatchResult { - let existential = T::Currency::minimum_balance(); + let currency_id = T::GetNativeCurrencyId::get(); + let existential = T::Currency::minimum_balance(currency_id); let mut amount = T::RewardCap::get(); - let reserved = T::Currency::reserved_balance(&project_struct.owner_id); + let reserved = T::Currency::reserved_balance(currency_id, &project_struct.owner_id); // modulo test two if (reserved % amount) < existential { amount = amount.saturating_add(existential); } - T::Currency::reserve(&project_struct.owner_id, amount)?; + T::Currency::reserve(currency_id, &project_struct.owner_id, amount)?; project_struct.reward = T::RewardCap::get(); Ok(()) } @@ -311,13 +317,16 @@ pub mod pallet { /// with expect if we can't rollback, and returns dispatch error for inconsistent reward. /// **Requires** : check_reward , check_collateral, (caller) reward_user (In context of accept reward) fn reward(project_struct: &mut ProjectAl, amount: Self::Balance) -> DispatchResult { + let currency_id = T::GetNativeCurrencyId::get(); // MUTATIONS - let _missing_reward = T::Currency::unreserve(&project_struct.owner_id, amount); + let _missing_reward = + T::Currency::unreserve(currency_id, &project_struct.owner_id, amount); if _missing_reward > BalanceOf::::from(0u32) { // assuming our can_unreserve failed // rollback ---- // It Should be enough to rollback following our initial unreserve T::Currency::reserve( + currency_id, &project_struct.owner_id, amount.saturating_sub(_missing_reward), )?; @@ -334,27 +343,30 @@ pub mod pallet { /// checks if the user's collateral is complete and sufficient for the rewarding process. /// Assumed to be used in context where we'll be using this collateral balance immediately. /// E.g for rewarding - pub fn check_collateral(who: &T::AccountId) -> bool { + pub fn check_collateral(currency_id: CurrencyIdOf, who: &T::AccountId) -> bool { let collateral = T::UserCollateral::get(); - let existential_deposit = T::Currency::minimum_balance(); - let reserve = T::Currency::reserved_balance(who); + let existential_deposit = T::Currency::minimum_balance(currency_id); + let reserve = T::Currency::reserved_balance(currency_id, who); reserve >= (collateral.saturating_add(existential_deposit)) } /// Release the collateral held by the account. Should only be called in the context of acceptance. /// Does no checks. Assumes the state is as required. /// /// **Requires** : check_collateral. Calls currency::unreserve - pub fn release_collateral(who: &T::AccountId) { - T::Currency::unreserve(&who, T::UserCollateral::get()); + pub fn release_collateral(currency_id: CurrencyIdOf, who: &T::AccountId) { + T::Currency::unreserve(currency_id, &who, T::UserCollateral::get()); } /// Reward the user for their contribution to the project. Assumed to be called after acceptance. /// /// **requires**: check_reward and check_collateral + /// # Note + /// Transfer when rewarding may lead to reaping of one of the involved accounts pub fn reward_user( who: &T::AccountId, project: &mut ProjectAl, review: &ReviewAl, ) -> DispatchResult { + let native_currency = T::GetNativeCurrencyId::get(); let reward = project.reward.clone(); let mut user = T::UsersOutlet::get_user_by_id(&who).ok_or(Error::::NoneValue)?; // Reward calc @@ -381,10 +393,10 @@ pub mod pallet { // Mutations - Fallible. Expect: All of these to rollback changes if they fail. user.rank_points = user.rank_points.saturating_add(1); Pallet::::reward(project, reward_fraction)?; - T::Currency::transfer(&project.owner_id, who, reward_fraction, KeepAlive)?; + T::Currency::transfer(native_currency, &project.owner_id, who, reward_fraction)?; T::UsersOutlet::update_user(&who, user)?; // Mutations - Infallible - Pallet::::release_collateral(who); + Pallet::::release_collateral(review.collateral_currency_id, who); Ok(()) } /// Check if a **user** can serve up the required collateral @@ -392,15 +404,18 @@ pub mod pallet { /// includes existential requirement for reserved balance if it doesn't already exist. /// /// Returns the amount of collateral after performing checks - pub fn can_collateralise(id: &T::AccountId) -> Result, DispatchError> { + pub fn can_collateralise( + currency_id: CurrencyIdOf, + id: &T::AccountId, + ) -> Result, DispatchError> { let mut reserve = T::UserCollateral::get(); // check if existential deposit already exists in reserve, add to balance to reserve if not - let existential_deposit = T::Currency::minimum_balance(); - let reserved = T::Currency::reserved_balance(id); + let existential_deposit = T::Currency::minimum_balance(currency_id); + let reserved = T::Currency::reserved_balance(currency_id, id); if (reserved % reserve) < existential_deposit { reserve = reserve.saturating_add(existential_deposit); } - let can_reserve = T::Currency::can_reserve(id, reserve); + let can_reserve = T::Currency::can_reserve(currency_id, id, reserve); if can_reserve { Ok(reserve) } else { @@ -411,8 +426,12 @@ pub mod pallet { /// /// Assumes checks have already been made for the specified amount. /// Requires `can_collateralise` - pub fn collateralise(id: &T::AccountId, reserve: BalanceOf) -> DispatchResult { - T::Currency::reserve(&id, reserve)?; + pub fn collateralise( + collateral_currency_id: CurrencyIdOf, + id: &T::AccountId, + reserve: BalanceOf, + ) -> DispatchResult { + T::Currency::reserve(collateral_currency_id, &id, reserve)?; Ok(()) } @@ -438,23 +457,30 @@ pub mod pallet { >::insert(index, project.clone()); project } - /// Create a set of reviews from a set of ids as needed and places them in storage - pub fn initialize_reviews(acnt_ids: Vec) { - let proj = >::get().unwrap_or_default(); - let project_id = proj.saturating_sub(1); - let acnt_ids_iter = acnt_ids.iter(); + /// Initialise the reviews from genesis by calling create_review with the args provided + pub fn initialize_reviews(acnts: Vec<(T::AccountId, CurrencyIdOf)>) { + let next_proj = >::get().unwrap_or_default(); + let project_id = next_proj.saturating_sub(1); + let acnts_iter = acnts.iter(); // intialize review contents with their ids - for (rev, id) in constants::project::REVS.iter().zip(acnt_ids_iter.clone()) { + for (rev, acnt) in constants::project::REVS.iter().zip(acnts_iter.clone()) { + let (id, currency_id) = acnt; let dispatch = Pallet::::create_review( Origin::::Signed(id.clone()).into(), - (rev.0, rev.1.to_vec().try_into().expect("Metadata should be within StringLimit")), + ( + rev.0, + rev.1.to_vec().try_into().expect("Metadata should be within StringLimit"), + ), project_id, + currency_id.to_owned(), ); assert_ok!(dispatch); } // Accept the reviews. - for (_, id) in constants::project::REVS.iter().zip(acnt_ids_iter){ - let dispatch2 =Pallet::::accept_review(Origin::::Root.into(), id.clone(), project_id); + for (_, acnt) in constants::project::REVS.iter().zip(acnts_iter) { + let (id, _) = acnt; + let dispatch2 = + Pallet::::accept_review(Origin::::Root.into(), id.clone(), project_id); assert_ok!(dispatch2); } } @@ -465,9 +491,9 @@ pub mod pallet { /// Get the parameters for the init projects function pub init_projects: Vec<(Status, ReasonOf)>, /// Initial users to use to init projects. - /// All accounts used should be endowed with initial balance, atleast enough to handle reserve + /// All accounts used should be endowed with initial balance of the specified currencyId, atleast enough to handle reserve /// Zip may mean users are matched up with projects by index - pub init_users: Vec, + pub init_users: Vec<(T::AccountId, CurrencyIdOf)>, } /// By default a generic project or known projects will be shown - polkadot & sisters #[cfg(feature = "std")] @@ -483,19 +509,21 @@ pub mod pallet { // Genesis build: Creates mock reviews for testing. fn build(&self) { // Create users. - let iter_users = (&self.init_users).iter(); + let iter_users = (&self.init_users).iter().map(|acnt| acnt.0.clone()); for id in iter_users.clone() { - T::UsersOutlet::set_user(id, Default::default()); + T::UsersOutlet::set_user(&id, Default::default()); } let meta: Vec> = constants::project::METADATA .iter() - .map(|each| each.to_vec().try_into().expect("Metadata should be within StringLimit")) + .map(|each| { + each.to_vec().try_into().expect("Metadata should be within StringLimit") + }) .collect(); let init_projects_w_users: Vec<_> = (&self.init_projects) .into_iter() .zip(iter_users) - .map(|((s, r), accnt)| (accnt, s.clone(), r.clone())) + .map(|((s, r), accnt)| (accnt.clone(), s.clone(), r.clone())) .collect(); let zipped = (init_projects_w_users).into_iter().zip(meta.iter()); @@ -504,18 +532,17 @@ pub mod pallet { let (project_ref, meta_ref) = each; let meta_cid = meta_ref.to_owned(); let (acnt, stat, reas) = project_ref.to_owned(); - // Filter ids so generated reviews do not include project owner - let filtered_ids: Vec<_> = (&self.init_users) + // Filter acnts so generated reviews do not include project owner + let filtered_acnts: Vec<_> = (&self.init_users) .iter() - .filter(|id| acnt.ne(id)) + .filter(|(id, _)| acnt.ne(id)) .map(|long| long.clone()) .collect(); // create reviews and projects and store. Pallet::::initialize_project(acnt.clone(), meta_cid, stat, reas); - Pallet::::initialize_reviews(filtered_ids); + Pallet::::initialize_reviews(filtered_acnts); } - } } } diff --git a/pallets/minting/src/lib.rs b/pallets/minting/src/lib.rs index 638a4d5..1020751 100644 --- a/pallets/minting/src/lib.rs +++ b/pallets/minting/src/lib.rs @@ -1,6 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] - /// Edit this file to define custom logic or remove it if it is not needed. /// Learn more about FRAME and the core library of Substrate FRAME pallets: /// @@ -15,16 +14,18 @@ mod tests; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; - - - #[frame_support::pallet] pub mod pallet { - use frame_support::{traits::{Currency, OnUnbalanced, Imbalance},sp_runtime::traits::Zero, pallet_prelude::*}; - use frame_system::pallet_prelude::*; + use frame_support::{ + assert_ok, + pallet_prelude::*, + sp_runtime::traits::Zero, + traits::{Currency, Imbalance, OnUnbalanced}, + }; + use frame_system::{pallet_prelude::*, Origin}; use super::*; - + #[pallet::config] pub trait Config: frame_system::Config { /// Because this pallet emits events, it depends on the runtime's definition of an event. @@ -36,10 +37,10 @@ pub mod pallet { /// Origins that must approve to use the pallet - Should be implemented properly by provider. type ApproveOrigin: EnsureOrigin; } - + type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; - + pub type NegativeImbalanceOf = <::Currency as Currency< ::AccountId, >>::NegativeImbalance; @@ -47,7 +48,6 @@ pub mod pallet { #[pallet::pallet] #[pallet::generate_store(pub(super) trait Store)] pub struct Pallet(_); - #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] @@ -65,7 +65,7 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet {} - #[pallet::call] + #[pallet::call] impl Pallet { #[pallet::weight(10_000)] pub fn mint(origin: OriginFor, x: BalanceOf) -> DispatchResult { @@ -85,7 +85,6 @@ pub mod pallet { } } - /// Genesis config for the minting pallet. Use to mint an initial amount to treasury /// E.g Use: Token sales. #[pallet::genesis_config] @@ -106,10 +105,8 @@ pub mod pallet { impl GenesisBuild for GenesisConfig { fn build(&self) { // Repeat mint call, without origin check - let imbalance = T::Currency::issue(self.init_mint); - let minted = imbalance.peek(); - >::do_mint(imbalance); - >::deposit_event(Event::Minted(minted)); + let dispatch = >::mint(Origin::::Root.into(), self.init_mint); + assert_ok!(dispatch); } } } diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index c314f80..7e8d57e 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -1,5 +1,18 @@ #![cfg_attr(not(feature = "std"), no_std)] -pub mod projects; +// TL-imports to make mod lives easier. +use frame_support::{ + dispatch::DispatchResult, + sp_runtime::traits::Zero, + traits::{Get,tokens::Balance as BalanceTrait}, + BoundedVec, RuntimeDebug, +}; +use frame_system::Config; +use scale_info::TypeInfo; +use codec::{Decode, Encode, MaxEncodedLen}; +#[cfg(feature = "std")] +use serde::{Deserialize, Serialize}; + +pub mod projects; pub mod users; \ No newline at end of file diff --git a/primitives/src/projects.rs b/primitives/src/projects.rs index 85e79d1..847b811 100644 --- a/primitives/src/projects.rs +++ b/primitives/src/projects.rs @@ -1,21 +1,14 @@ -use frame_support::{ - dispatch::DispatchResult, - sp_runtime::traits::Zero, - traits::{Get,tokens::Balance as BalanceTrait}, - BoundedVec, RuntimeDebug, -}; -use frame_system::Config; -use scale_info::TypeInfo; +use super::*; + /// A simple u32 pub type ProjectID = u32; /// Index for reviews , use to link to project pub type ReviewID = u64; -use codec::{Decode, Encode, MaxEncodedLen}; #[derive( Encode, Decode, Eq, PartialEq, Clone, RuntimeDebug, TypeInfo, MaxEncodedLen, PartialOrd, Ord, )] -pub struct Review +pub struct Review where StringLen: Get, { @@ -27,13 +20,13 @@ where pub point_snapshot: u32, /// Score of a review pub review_score: u8, + /// Currency the user provided for collateral + pub collateral_currency_id: CurrencyIdAlias, } /// The metadata of a project. type MetaData = BoundedVec; -#[cfg(feature = "std")] -pub use serde::{Deserialize, Serialize}; /// The status of the proposal #[derive( @@ -139,7 +132,9 @@ where metadata: MetaData, /// the status of the project's proposal in the council - default proposed. pub proposal_status: ProposalStatus, - /// A reward value for the project ---------_switch to idea of named reserve hash - (default: Reward). + /// A reward value for the project. + /// Users are rewarded in native currency + /// Todo: Remove reward amount tracking here and simplify reward logic by using constant value pub reward: Balance, /// A sum of all the points of users who wrote a review for the project. Saturate when u32::MAX. pub total_user_scores: u32, @@ -178,14 +173,21 @@ pub trait ProjectIO { type UserID; type Balance: BalanceTrait; type StringLimit: Get; - /// Checks: - /// If the projects' reward value reflects what is reserved, excluding existential value + /// Performs the necessary checks on the project's side to ensure that they can reward the user + /// At this instance + /// + /// - checks if the project's advertised reward is same as reserved balance + /// - checks if the project has enough free balance to safely transfer reward after release to the user fn check_reward( project: &Project, ) -> DispatchResult; - /// Check if the project owner can offer up hardcoded amount as init. + /// Check if the project owner can offer up reward amount when intialising. fn can_reward(project: &Self::UserID) -> bool; /// Reserve an initial amount for use as reward + /// Reserve some reward and possibly + liveness req as we initialise the project + /// # Fallible + /// does no checks for ability to reserve. + /// (When safe, move from mut to immut) fn reserve_reward( project: &mut Project, ) -> DispatchResult; @@ -198,22 +200,3 @@ pub trait ProjectIO { amount: Self::Balance, ) -> DispatchResult; } -/// Easy way of differentaiting the two. We'll need this. -#[derive( - Encode, - Decode, - Eq, - PartialEq, - Copy, - Clone, - RuntimeDebug, - TypeInfo, - MaxEncodedLen, - PartialOrd, - Ord, -)] -#[cfg_attr(feature = "std", derive(Deserialize, Serialize))] -pub enum EntityKind { - Project, - User, -} diff --git a/primitives/src/users.rs b/primitives/src/users.rs index c7c1289..ed8af35 100644 --- a/primitives/src/users.rs +++ b/primitives/src/users.rs @@ -1,8 +1,4 @@ - -use codec::{Decode, Encode, MaxEncodedLen}; -use frame_support::{dispatch::{ DispatchResult}, RuntimeDebug}; -use frame_system::Config; -use scale_info::TypeInfo; +use super::*; #[derive( Encode, diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 0a84a47..ee68a3d 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -544,8 +544,8 @@ impl orml_tokens::Config for Runtime { parameter_type_with_key! { pub ExistentialDeposits: |_currency_id: CurrencyId| -> Balance { match _currency_id { - CurrencyId::Native => 1000, - _ => 2 + CurrencyId::Native => EXISTENTIAL_DEPOSIT, + _ => EXISTENTIAL_DEPOSIT } }; } @@ -569,11 +569,12 @@ parameter_types! { impl pallet_chocolate::Config for Runtime { type Event = Event; type ApprovedOrigin = ApproveOrigin; - type Currency = Balances; + type Currency = Currencies; type RewardCap = RewardCap; type UsersOutlet = UsersModule; type UserCollateral = UserCollateral; type StringLimit = StringLimit; + type GetNativeCurrencyId = GetNativeCurrencyId; } /// Configure the pallet-users in pallets/users. impl pallet_users::Config for Runtime { @@ -720,17 +721,17 @@ construct_runtime!( // Chocolate TemplatePallet: pallet_template::{Pallet, Call, Storage, Event} = 40, - UsersModule: pallet_users::{Pallet, Call, Storage, Event} = 43, - ChocolateModule: pallet_chocolate::{Pallet, Call, Config, Storage, Event} = 44, - MintingModule: pallet_minting::{Pallet, Call, Config, Storage, Event} = 48, + UsersModule: pallet_users::{Pallet, Call, Storage, Event} = 41, + ChocolateModule: pallet_chocolate::{Pallet, Call, Config, Storage, Event} = 42, + MintingModule: pallet_minting::{Pallet, Call, Config, Storage, Event} = 43, // TREASURY - Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 51, - Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 52, - PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 53, + Council: pallet_collective::::{Pallet, Call, Storage, Origin, Event, Config} = 50, + Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event} = 51, + PhragmenElection: pallet_elections_phragmen::{Pallet, Call, Storage, Event, Config} = 52, // Orml multitokens - Currencies: orml_currencies::{Pallet, Call} = 61, - Tokens: orml_tokens::{Pallet, Storage, Event, Config} = 62, + Currencies: orml_currencies::{Pallet, Call} = 60, + Tokens: orml_tokens::{Pallet, Storage, Event, Config} = 61, } ); From 4050e20ea3181a6f8afdebc59f1208cde9a1f435 Mon Sep 17 00:00:00 2001 From: Islam Date: Sat, 13 Aug 2022 09:57:45 +0000 Subject: [PATCH 31/36] feat(accept-pr): Add extrinsic --- pallets/chocolate/src/lib.rs | 37 +++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/pallets/chocolate/src/lib.rs b/pallets/chocolate/src/lib.rs index c65fa32..5b5c68c 100644 --- a/pallets/chocolate/src/lib.rs +++ b/pallets/chocolate/src/lib.rs @@ -113,6 +113,8 @@ pub mod pallet { ReviewCreated(T::AccountId, ProjectID), /// parameters [owner, project_id] ReviewAccepted(T::AccountId, ProjectID), + /// Parameters [project_id] + ProjectAccepted(ProjectID), } // Errors inform users that something went wrong. #[pallet::error] @@ -148,7 +150,6 @@ pub mod pallet { impl Pallet { /// Create a project /// - /// - O(1). /// - Init: Index starts at 1 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,3))] pub fn create_project( @@ -260,6 +261,31 @@ pub mod pallet { Self::deposit_event(Event::ReviewCreated(user_id, project_id)); Ok(()) } + + /// Moves a project to the accepted state. + /// Must be called by Root-like (Council or CES). + #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))] + pub fn accept_project( + origin: OriginFor, + project_id: ProjectID, + ) -> DispatchResult { + T::ApprovedOrigin::ensure_origin(origin)?; + // VALUES + let mut project = >::get(project_id).ok_or(Error::::NoProjectWithId)?; + let is_proposed = project.proposal_status.status.eq(&Status::Proposed); + // CHECKS + ensure!(is_proposed, Error::::AcceptingNotProposed); + Pallet::::check_reward(&project)?; + // MUTATIONS + project.proposal_status.status = Status::Accepted; + project.proposal_status.reason = Reason::PassedRequirements; + + >::mutate(project_id, |p| { + *p = Option::Some(project); + }); + Self::deposit_event(Event::ProjectAccepted(project_id)); + Ok(()) + } } impl ProjectIO for Pallet { @@ -308,14 +334,7 @@ pub mod pallet { project_struct.reward = T::RewardCap::get(); Ok(()) } - /// * Releases an amount from the reward reserved with the project - /// Assumed to be called in the context of rewarding the user wherein amount - /// is the final reward calculated. - /// * **Does no checks**. Assumes specific state of review and project . i.e default Proposed and Accepted states respectively. - /// * Since unreserve doesn't have an expect block, if there is remaining balance, we assume error and rollback - /// # Panics! - /// with expect if we can't rollback, and returns dispatch error for inconsistent reward. - /// **Requires** : check_reward , check_collateral, (caller) reward_user (In context of accept reward) + fn reward(project_struct: &mut ProjectAl, amount: Self::Balance) -> DispatchResult { let currency_id = T::GetNativeCurrencyId::get(); // MUTATIONS From f11daecada42f3bf2a9f961ccaf8c4d1d31e8587 Mon Sep 17 00:00:00 2001 From: Islam Date: Sat, 13 Aug 2022 11:48:50 +0000 Subject: [PATCH 32/36] build(accept-pr): Use release build for setup --- .github/dockerfiles/Dockerfile.collator | 2 +- scripts/prep-collator.sh | 12 ++++++------ scripts/start-collator.sh | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/dockerfiles/Dockerfile.collator b/.github/dockerfiles/Dockerfile.collator index efc724e..b8ec406 100644 --- a/.github/dockerfiles/Dockerfile.collator +++ b/.github/dockerfiles/Dockerfile.collator @@ -7,7 +7,7 @@ USER ${USER}:${GROUP} EXPOSE 30333 9933 9944 -ARG COLLATOR_BIN=./target/debug/parachain-collator +ARG COLLATOR_BIN=./target/release/parachain-collator COPY ${COLLATOR_BIN} /usr/local/bin diff --git a/scripts/prep-collator.sh b/scripts/prep-collator.sh index 78e0ec4..a69d989 100755 --- a/scripts/prep-collator.sh +++ b/scripts/prep-collator.sh @@ -2,8 +2,8 @@ # Prep bins for docker function prepBins { - cargo build - find target/debug -type f ! -name parachain-collator -exec rm {} + + cargo build --release + find target/release -type f ! -name parachain-collator -exec rm {} + docker build --pull --rm -f ".github/dockerfiles/Dockerfile.collator" -t chocnet/parachain-collator "." } @@ -11,10 +11,10 @@ function prepBins { # Export chain spec, etc to ch_spec dir. function exportChainSpec { mkdir -p ch_spec - ./target/debug/parachain-collator build-spec --disable-default-bootnode > ch_spec/rococo-local-parachain-plain.json - ./target/debug/parachain-collator build-spec --chain ch_spec/rococo-local-parachain-plain.json --raw --disable-default-bootnode > ch_spec/rococo-local-parachain-2000-raw.json - ./target/debug/parachain-collator export-genesis-wasm --chain ch_spec/rococo-local-parachain-2000-raw.json > ch_spec/para-2000-wasm - ./target/debug/parachain-collator export-genesis-state --chain ch_spec/rococo-local-parachain-2000-raw.json > ch_spec/para-2000-genesis + ./target/release/parachain-collator build-spec --disable-default-bootnode > ch_spec/rococo-local-parachain-plain.json + ./target/release/parachain-collator build-spec --chain ch_spec/rococo-local-parachain-plain.json --raw --disable-default-bootnode > ch_spec/rococo-local-parachain-2000-raw.json + ./target/release/parachain-collator export-genesis-wasm --chain ch_spec/rococo-local-parachain-2000-raw.json > ch_spec/para-2000-wasm + ./target/release/parachain-collator export-genesis-state --chain ch_spec/rococo-local-parachain-2000-raw.json > ch_spec/para-2000-genesis gp sync-done collator } diff --git a/scripts/start-collator.sh b/scripts/start-collator.sh index d5fd3e9..ae7a197 100755 --- a/scripts/start-collator.sh +++ b/scripts/start-collator.sh @@ -1,7 +1,7 @@ #!/bin/bash # Run node1 -./target/debug/parachain-collator \ +./target/release/parachain-collator \ --alice \ --collator \ --force-authoring \ From 1b0956bd6819232f52ce3beb3c603a702cc1c399 Mon Sep 17 00:00:00 2001 From: Islam Date: Sat, 13 Aug 2022 11:59:04 +0000 Subject: [PATCH 33/36] build(accept-pr): Use polkadot bin --- .github/dockerfiles/Dockerfile.gitpod-base | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/dockerfiles/Dockerfile.gitpod-base b/.github/dockerfiles/Dockerfile.gitpod-base index 56a2826..2614d6d 100644 --- a/.github/dockerfiles/Dockerfile.gitpod-base +++ b/.github/dockerfiles/Dockerfile.gitpod-base @@ -21,18 +21,11 @@ ARG USER=gitpod ARG GROUP=gitpod USER ${USER}:${GROUP} -RUN mkdir /home/${USER}/relay -WORKDIR /home/${USER}/relay -# Clone the Polkadot Repository -# Build the relay chain Node -# Checkout the proper commit -# Check if the help page prints to ensure the node is built correctly -ARG BIN="polkadot" -RUN git clone https://github.com/paritytech/polkadot.git && \ - cd polkadot && \ - git checkout release-v0.9.24 && \ - cargo build --release && \ - ./target/release/${BIN} --help && \ - find target -type f ! -name ${BIN} -exec rm {} + +RUN mkdir -p /home/${USER}/relay/polkadot/target/release +WORKDIR /home/${USER}/relay/polkadot/target/release + +# Download latest polkadot release +ARG VER="v0.9.24" +RUN wget https://github.com/paritytech/polkadot/releases/download/${VER}/polkadot && chmod +x ./polkadot # Ease: -ENV POLKADOT_BIN=~/relay/polkadot/target/release/polkadot +ENV POLKADOT_BIN=/home/${USER}/relay/polkadot/target/release/polkadot From 11d64e1b148f824b6aff84a716b57215aaa27342 Mon Sep 17 00:00:00 2001 From: Islam Date: Sun, 28 Aug 2022 21:43:31 +0000 Subject: [PATCH 34/36] fix(multi): Remove genesis config, fix make user --- node/src/chain_spec.rs | 2 +- pallets/chocolate/src/lib.rs | 37 ++---------------------------------- pallets/users/src/lib.rs | 2 +- scripts/start-collator.sh | 1 + 4 files changed, 5 insertions(+), 37 deletions(-) diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 9b5c8a6..f0a35b7 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -253,7 +253,7 @@ fn testnet_genesis( init_users: { // use a static list for accounts // Update init_projects and token alloc in multiassets when updating this. - // FIXME: Panics when this is anything other than Native + // FIXME: Panics when this is anything other than Native with the old genesis config removed at ... , vec![ (get_account_id_from_seed::("Alice"), CurrencyId::Native), (get_account_id_from_seed::("Bob"), CurrencyId::Native), diff --git a/pallets/chocolate/src/lib.rs b/pallets/chocolate/src/lib.rs index 5b5c68c..cd153b3 100644 --- a/pallets/chocolate/src/lib.rs +++ b/pallets/chocolate/src/lib.rs @@ -527,41 +527,8 @@ pub mod pallet { impl GenesisBuild for GenesisConfig { // Genesis build: Creates mock reviews for testing. fn build(&self) { - // Create users. - let iter_users = (&self.init_users).iter().map(|acnt| acnt.0.clone()); - for id in iter_users.clone() { - T::UsersOutlet::set_user(&id, Default::default()); - } - - let meta: Vec> = constants::project::METADATA - .iter() - .map(|each| { - each.to_vec().try_into().expect("Metadata should be within StringLimit") - }) - .collect(); - let init_projects_w_users: Vec<_> = (&self.init_projects) - .into_iter() - .zip(iter_users) - .map(|((s, r), accnt)| (accnt.clone(), s.clone(), r.clone())) - .collect(); - let zipped = (init_projects_w_users).into_iter().zip(meta.iter()); - - // create project from associated metadata in zip. - for each in zipped { - let (project_ref, meta_ref) = each; - let meta_cid = meta_ref.to_owned(); - let (acnt, stat, reas) = project_ref.to_owned(); - // Filter acnts so generated reviews do not include project owner - let filtered_acnts: Vec<_> = (&self.init_users) - .iter() - .filter(|(id, _)| acnt.ne(id)) - .map(|long| long.clone()) - .collect(); - - // create reviews and projects and store. - Pallet::::initialize_project(acnt.clone(), meta_cid, stat, reas); - Pallet::::initialize_reviews(filtered_acnts); - } + // FIXME + // Genesis build has been removed. See https://github.com/chocolatenetwork/chocolate-parachain/pull/10. It is now a node script at https://github.com/chocolatenetwork/choc-js } } } diff --git a/pallets/users/src/lib.rs b/pallets/users/src/lib.rs index 749cea7..0ffca58 100644 --- a/pallets/users/src/lib.rs +++ b/pallets/users/src/lib.rs @@ -64,7 +64,7 @@ pub mod pallet { let who = ensure_signed(origin)?; ensure!(!Users::::contains_key(&who), Error::::UserAlreadyExists); - >::insert(&who, User { rank_points: 0, project_id: Option::None }); + >::insert(&who, User { rank_points: 1, project_id: Option::None }); Self::deposit_event(Event::UserCreated(who)); diff --git a/scripts/start-collator.sh b/scripts/start-collator.sh index ae7a197..95fc26a 100755 --- a/scripts/start-collator.sh +++ b/scripts/start-collator.sh @@ -8,6 +8,7 @@ --chain ch_spec/rococo-local-parachain-2000-raw.json \ --base-path /tmp/parachain/alice \ --port 40333 \ +--rpc-cors all \ --ws-port 8844 \ -- \ --execution wasm \ From b9e0a4f48ed97b273fd8e7a01735644800722d39 Mon Sep 17 00:00:00 2001 From: Islam Date: Mon, 29 Aug 2022 00:02:52 +0000 Subject: [PATCH 35/36] feat(multi): Block review creation if non native token is passed Reaon this doesn't apply to projects is what is being accepted as collateral in old v was the reward which should be in native token --- pallets/chocolate/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pallets/chocolate/src/lib.rs b/pallets/chocolate/src/lib.rs index cd153b3..6e80299 100644 --- a/pallets/chocolate/src/lib.rs +++ b/pallets/chocolate/src/lib.rs @@ -144,6 +144,8 @@ pub mod pallet { CheckedDivisionFailed, /// Review score is out of range 1-5 ReviewScoreOutOfRange, + /// Native token cannot be used as collateral. + NativeCollateral, } // Dispatchable functions must be annotated with a weight and must return a DispatchResult. #[pallet::call] @@ -185,12 +187,14 @@ pub mod pallet { collateral_currency_id: CurrencyIdOf, ) -> DispatchResult { let who = ensure_signed(origin)?; + let native_id = T::GetNativeCurrencyId::get(); // CHECKS & Inits let mut this_project = >::get(project_id).ok_or(Error::::NoProjectWithId)?; ensure!(!>::contains_key(&who, project_id), Error::::DuplicateReview); ensure!(this_project.owner_id.ne(&who), Error::::OwnerReviewedProject); ensure!(review_meta.0 <= 5 && review_meta.0 >= 1, Error::::ReviewScoreOutOfRange); + ensure!( collateral_currency_id != native_id, Error::::NativeCollateral); let reserve = Pallet::::can_collateralise(collateral_currency_id, &who)?; // Fallible MUTATIONS Pallet::::collateralise(collateral_currency_id, &who, reserve)?; From ba44c07a70428a6740c04378ef95ce791d31c840 Mon Sep 17 00:00:00 2001 From: Islam Date: Sat, 3 Sep 2022 05:49:09 +0000 Subject: [PATCH 36/36] Remove multiassets working doc --- multi.md | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 multi.md diff --git a/multi.md b/multi.md deleted file mode 100644 index a97a058..0000000 --- a/multi.md +++ /dev/null @@ -1,28 +0,0 @@ -## Goal: - -To integrate the multiassets pallet into chocolate with: - -1. CHOC as spending token for settling fees, etc -2. Any generic asset is available for reserve and the like in other pallets (drop-in replacement.). - -> Ideally, there should already be a way of integrating this pallet with specific ones that have actual value e.g DOT,KSM - -## Needs - -* Some partial migration of the chocolate-node (specifically, native token name: CHOC) - -## Testing: - -(As used in chocolate pallet) Reserve, unreserve balances. Fail TX if not enough native token. - -* A simple extrinsic that reserves a generic asset in the template pallet, and test that it is reserved as expected. -* A simple extrinsic that unreserves the same generic asset in the template pallet, and test that it is unreserved as expected. -* Both extrinsics will be paid in the native token, test that it fails if the user doesn't have sufficient balance. - -## Imbalances and deposits - -Method: https://github.com/open-web3-stack/open-runtime-module-library/blob/52ec52b733b3fc326d8e7104ff414d7e3c3b8b06/currencies/src/lib.rs#L659 -Not useful though. No minting. Define in genesis. -```rs -BasicReservableCurrency::deposit() -``` \ No newline at end of file