diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 000000000..b283a2801 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,31 @@ +# An auto defined `clippy` feature was introduced, +# but it was found to clash with user defined features, +# so was renamed to `cargo-clippy`. +# +# If you want standard clippy run: +# RUSTFLAGS= cargo clippy +[target.'cfg(feature = "cargo-clippy")'] +rustflags = [ + "-Aclippy::all", + "-Dclippy::correctness", + "-Aclippy::if-same-then-else", + "-Aclippy::clone-double-ref", + "-Dclippy::complexity", + "-Aclippy::zero-prefixed-literal", # 00_1000_000 + "-Aclippy::type_complexity", # raison d'etre + "-Aclippy::nonminimal-bool", # maybe + "-Aclippy::borrowed-box", # Reasonable to fix this one + "-Aclippy::too-many-arguments", # (Turning this on would lead to) + "-Aclippy::unnecessary_cast", # Types may change + "-Aclippy::identity-op", # One case where we do 0 + + "-Aclippy::useless_conversion", # Types may change + "-Aclippy::unit_arg", # styalistic. + "-Aclippy::option-map-unit-fn", # styalistic + "-Aclippy::bind_instead_of_map", # styalistic + "-Aclippy::erasing_op", # E.g. 0 * DOLLARS + "-Aclippy::eq_op", # In tests we test equality. + "-Aclippy::while_immutable_condition", # false positives + "-Aclippy::needless_option_as_deref", # false positives + "-Aclippy::derivable_impls", # false positives + "-Aclippy::stable_sort_primitive", # prefer stable sort +] diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml new file mode 100644 index 000000000..ab48497b9 --- /dev/null +++ b/.github/auto_assign.yml @@ -0,0 +1,12 @@ +addReviewers: true +addAssignees: author +reviewers: + - rakanalh + - MRamanenkau + - Raid5594 + - aie0 + - yahortsaryk + - khssnv +skipKeywords: + - wip +numberOfReviewers: 2 diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index db63d8d96..04af2420e 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -28,6 +28,9 @@ jobs: rustup update stable --no-self-update rustup target add wasm32-unknown-unknown + - name: Check TOML + uses: dprint/check@v2.2 + - name: Check Format run: | cargo fmt -- --check @@ -35,6 +38,10 @@ jobs: - name: Rust Cache uses: Swatinem/rust-cache@v2 + - name: Check with Clippy + run: | + cargo clippy --no-deps --all-targets --features runtime-benchmarks --workspace -- --deny warnings + - name: Check Build run: | SKIP_WASM_BUILD=1 cargo check --release diff --git a/.gitignore b/.gitignore index 90db35e94..ac9d585fc 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,8 @@ .DS_Store # The cache for docker container dependency -.cargo +.cargo/** +!/.cargo/config.toml # The cache for chain data in container .local @@ -19,5 +20,3 @@ # ddc-metrics-offchain-worker mock files pallets/ddc-metrics-offchain-worker/src/tests/test_data/ddc.contract -pallets/ddc-metrics-offchain-worker/src/tests/test_data/ddc.wasm -pallets/ddc-metrics-offchain-worker/src/tests/test_data/metadata.json diff --git a/Cargo.lock b/Cargo.lock index 204e0fe17..3c4da9583 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,34 +38,34 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aead" -version = "0.4.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ + "crypto-common", "generic-array 0.14.7", ] [[package]] name = "aes" -version = "0.7.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if", - "cipher 0.3.0", + "cipher", "cpufeatures", - "opaque-debug 0.3.0", ] [[package]] name = "aes-gcm" -version = "0.9.4" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ "aead", "aes", - "cipher 0.3.0", + "cipher", "ctr", "ghash", "subtle", @@ -77,7 +77,7 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.11", "once_cell", "version_check", ] @@ -209,17 +209,30 @@ dependencies = [ "futures-core", ] +[[package]] +name = "async-channel" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d37875bd9915b7d67c2f117ea2c30a0989874d0b2cb694fe25403c85763c0c9e" +dependencies = [ + "concurrent-queue", + "event-listener 3.1.0", + "event-listener-strategy", + "futures-core", + "pin-project-lite 0.2.13", +] + [[package]] name = "async-executor" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0" dependencies = [ - "async-lock", + "async-lock 2.8.0", "async-task", "concurrent-queue", "fastrand 2.0.1", - "futures-lite", + "futures-lite 1.13.0", "slab", ] @@ -229,12 +242,12 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-executor", "async-io 1.13.0", - "async-lock", + "async-lock 2.8.0", "blocking", - "futures-lite", + "futures-lite 1.13.0", "once_cell", ] @@ -244,11 +257,11 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ - "async-lock", + "async-lock 2.8.0", "autocfg", "cfg-if", "concurrent-queue", - "futures-lite", + "futures-lite 1.13.0", "log", "parking", "polling 2.8.0", @@ -260,15 +273,15 @@ dependencies = [ [[package]] name = "async-io" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10da8f3146014722c89e7859e1d7bb97873125d7346d10ca642ffab794355828" +checksum = "41ed9d5715c2d329bf1b4da8d60455b99b187f27ba726df2883799af9af60997" dependencies = [ - "async-lock", + "async-lock 3.1.0", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite", + "futures-lite 2.0.1", "parking", "polling 3.3.0", "rustix 0.38.21", @@ -287,6 +300,17 @@ dependencies = [ "event-listener 2.5.3", ] +[[package]] +name = "async-lock" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb2ab2aa8a746e221ab826c73f48bc6ba41be6763f0855cb249eb6d154cf1d7" +dependencies = [ + "event-listener 3.1.0", + "event-listener-strategy", + "pin-project-lite 0.2.13", +] + [[package]] name = "async-process" version = "1.8.1" @@ -294,12 +318,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88" dependencies = [ "async-io 1.13.0", - "async-lock", + "async-lock 2.8.0", "async-signal", "blocking", "cfg-if", - "event-listener 3.0.1", - "futures-lite", + "event-listener 3.1.0", + "futures-lite 1.13.0", "rustix 0.38.21", "windows-sys 0.48.0", ] @@ -310,8 +334,8 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" dependencies = [ - "async-io 2.1.0", - "async-lock", + "async-io 2.2.0", + "async-lock 2.8.0", "atomic-waker", "cfg-if", "futures-core", @@ -328,16 +352,16 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-global-executor", "async-io 1.13.0", - "async-lock", + "async-lock 2.8.0", "async-process", "crossbeam-utils", "futures-channel", "futures-core", "futures-io", - "futures-lite", + "futures-lite 1.13.0", "gloo-timers", "kv-log-macro", "log", @@ -378,7 +402,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -510,7 +534,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -632,16 +656,16 @@ dependencies = [ [[package]] name = "blocking" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" +checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ - "async-channel", - "async-lock", + "async-channel 2.1.0", + "async-lock 3.1.0", "async-task", "fastrand 2.0.1", "futures-io", - "futures-lite", + "futures-lite 2.0.1", "piper", "tracing", ] @@ -654,9 +678,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bstr" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" +checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" dependencies = [ "memchr", "serde", @@ -754,11 +778,10 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "0f8e7c90afad890484a21653d08b6e209ae34770fb5ee298f9c699fcc1e5c856" dependencies = [ - "jobserver", "libc", ] @@ -768,7 +791,6 @@ version = "4.8.1" dependencies = [ "cere-cli", "sc-cli", - "ss58-registry", "substrate-build-script-utils", ] @@ -794,7 +816,6 @@ dependencies = [ "cere-dev-runtime", "cere-runtime", "frame-benchmarking", - "frame-benchmarking-cli", "frame-system", "frame-system-rpc-runtime-api", "node-primitives", @@ -810,10 +831,8 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-consensus-babe", - "sp-core", "sp-finality-grandpa", "sp-inherents", - "sp-keyring", "sp-offchain", "sp-runtime", "sp-session", @@ -890,7 +909,6 @@ dependencies = [ "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", - "pallet-transaction-storage", "pallet-treasury", "pallet-utility", "pallet-vesting", @@ -919,7 +937,6 @@ name = "cere-dev-runtime-constants" version = "4.8.1" dependencies = [ "node-primitives", - "sp-runtime", ] [[package]] @@ -1015,7 +1032,6 @@ dependencies = [ "pallet-tips", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", - "pallet-transaction-storage", "pallet-treasury", "pallet-utility", "pallet-vesting", @@ -1054,7 +1070,6 @@ name = "cere-runtime-constants" version = "4.8.1" dependencies = [ "node-primitives", - "sp-runtime", ] [[package]] @@ -1066,17 +1081,14 @@ dependencies = [ "cere-dev-runtime-constants", "cere-rpc", "cere-runtime", - "cere-runtime-constants", "futures", "jsonrpsee", "node-primitives", "pallet-im-online", - "parity-scale-codec", "rand 0.8.5", "sc-authority-discovery", "sc-basic-authorship", "sc-chain-spec", - "sc-cli", "sc-client-api", "sc-consensus", "sc-consensus-babe", @@ -1097,7 +1109,6 @@ dependencies = [ "sp-authority-discovery", "sp-authorship", "sp-blockchain", - "sp-consensus", "sp-consensus-babe", "sp-core", "sp-finality-grandpa", @@ -1139,25 +1150,24 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chacha20" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ "cfg-if", - "cipher 0.3.0", + "cipher", "cpufeatures", - "zeroize", ] [[package]] name = "chacha20poly1305" -version = "0.9.1" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" dependencies = [ "aead", "chacha20", - "cipher 0.3.0", + "cipher", "poly1305", "zeroize", ] @@ -1189,15 +1199,6 @@ dependencies = [ "unsigned-varint", ] -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array 0.14.7", -] - [[package]] name = "cipher" version = "0.4.4" @@ -1206,6 +1207,7 @@ checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ "crypto-common", "inout", + "zeroize", ] [[package]] @@ -1513,6 +1515,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array 0.14.7", + "rand_core 0.6.4", "typenum", ] @@ -1548,11 +1551,11 @@ dependencies = [ [[package]] name = "ctr" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher 0.3.0", + "cipher", ] [[package]] @@ -1616,7 +1619,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1661,12 +1664,8 @@ name = "ddc-traits" version = "0.1.0" dependencies = [ "ddc-primitives", - "frame-support", "frame-system", - "sp-core", "sp-runtime", - "sp-staking", - "sp-std", ] [[package]] @@ -1916,7 +1915,7 @@ checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1934,9 +1933,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" dependencies = [ "humantime", "is-terminal", @@ -1970,9 +1969,9 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" dependencies = [ "libc", "windows-sys 0.48.0", @@ -1996,15 +1995,25 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" -version = "3.0.1" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cec0252c2afff729ee6f00e903d479fba81784c8e2bd77447673471fdfaea1" +checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2" dependencies = [ "concurrent-queue", "parking", "pin-project-lite 0.2.13", ] +[[package]] +name = "event-listener-strategy" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d96b852f1345da36d551b9473fa1e2b1eb5c5195585c6c018118bc92a8d91160" +dependencies = [ + "event-listener 3.1.0", + "pin-project-lite 0.2.13", +] + [[package]] name = "exit-future" version = "0.2.0" @@ -2062,9 +2071,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a481586acf778f1b1455424c343f71124b048ffa5f4fc3f8f6ae9dc432dcb3c7" +checksum = "f69037fe1b785e84986b4f2cbcf647381876a00671d25ceef715d7812dd7e1dd" [[package]] name = "file-per-thread-logger" @@ -2072,7 +2081,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84f2e425d9790201ba4af4630191feac6dcc98765b118d4d18e91d23c2353866" dependencies = [ - "env_logger 0.10.0", + "env_logger 0.10.1", "log", ] @@ -2506,6 +2515,16 @@ dependencies = [ "waker-fn", ] +[[package]] +name = "futures-lite" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb" +dependencies = [ + "futures-core", + "pin-project-lite 0.2.13", +] + [[package]] name = "futures-macro" version = "0.3.29" @@ -2514,7 +2533,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2617,9 +2636,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "libc", @@ -2628,9 +2647,9 @@ dependencies = [ [[package]] name = "ghash" -version = "0.4.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" +checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" dependencies = [ "opaque-debug 0.3.0", "polyval", @@ -2716,9 +2735,9 @@ dependencies = [ [[package]] name = "handlebars" -version = "4.4.0" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39b3bc2a8f715298032cf5087e58573809374b08160aa7d750582bdb82d2683" +checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225" dependencies = [ "log", "pest", @@ -2850,9 +2869,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", @@ -3149,15 +3168,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.65" @@ -3211,7 +3221,7 @@ checksum = "f3dc3e9cf2ba50b7b1d7d76a667619f82846caa39e8e8daa8a4962d74acaddca" dependencies = [ "anyhow", "arrayvec 0.7.4", - "async-lock", + "async-lock 2.8.0", "async-trait", "beef", "futures-channel", @@ -3394,9 +3404,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libloading" @@ -3433,7 +3443,7 @@ dependencies = [ "bytes", "futures", "futures-timer", - "getrandom 0.2.10", + "getrandom 0.2.11", "instant", "lazy_static", "libp2p-autonat", @@ -3939,6 +3949,17 @@ dependencies = [ "yamux", ] +[[package]] +name = "libredox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall 0.4.1", +] + [[package]] name = "librocksdb-sys" version = "0.6.3+6.28.2" @@ -4052,27 +4073,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" - -[[package]] -name = "lite-json" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0e787ffe1153141a0f6f6d759fdf1cc34b1226e088444523812fd412a5cca2" -dependencies = [ - "lite-parser", -] - -[[package]] -name = "lite-parser" -version = "0.2.0" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d5f9dc37c52d889a21fd701983d02bb6a84f852c5140a6c80ef4557f7dc29e" -dependencies = [ - "paste", -] +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "lock_api" @@ -4789,16 +4792,13 @@ dependencies = [ name = "pallet-chainbridge" version = "4.8.1" dependencies = [ - "frame-benchmarking", "frame-support", "frame-system", - "lite-json", "pallet-balances", "parity-scale-codec", "scale-info", "sp-core", "sp-io", - "sp-keystore", "sp-runtime", "sp-std", ] @@ -4928,18 +4928,14 @@ version = "4.8.1" dependencies = [ "ddc-primitives", "ddc-traits", - "frame-benchmarking", "frame-support", "frame-system", - "log", "pallet-contracts", "pallet-ddc-nodes", "parity-scale-codec", "scale-info", "sp-core", - "sp-io", "sp-runtime", - "sp-staking", "sp-std", "sp-tracing", "substrate-test-utils", @@ -4956,9 +4952,7 @@ dependencies = [ "log", "parity-scale-codec", "scale-info", - "sp-io", "sp-runtime", - "sp-staking", "sp-std", "substrate-test-utils", ] @@ -4972,7 +4966,6 @@ dependencies = [ "frame-system", "hex", "hex-literal", - "lite-json", "pallet-balances", "pallet-contracts", "pallet-randomness-collective-flip", @@ -4980,7 +4973,6 @@ dependencies = [ "parity-scale-codec", "pretty_assertions", "scale-info", - "serde", "serde_json 1.0.44", "sp-core", "sp-io", @@ -4994,16 +4986,13 @@ name = "pallet-ddc-nodes" version = "4.8.1" dependencies = [ "ddc-primitives", - "frame-benchmarking", + "ddc-traits", "frame-support", "frame-system", - "log", "parity-scale-codec", "scale-info", "sp-core", - "sp-io", "sp-runtime", - "sp-staking", "sp-std", "sp-tracing", "substrate-test-utils", @@ -5040,7 +5029,6 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "log", "pallet-balances", "pallet-timestamp", "parity-scale-codec", @@ -5048,7 +5036,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-staking", "sp-std", "sp-tracing", "substrate-test-utils", @@ -5129,7 +5116,6 @@ dependencies = [ name = "pallet-erc20" version = "4.8.1" dependencies = [ - "frame-benchmarking", "frame-support", "frame-system", "pallet-balances", @@ -5137,7 +5123,6 @@ dependencies = [ "pallet-erc721", "parity-scale-codec", "scale-info", - "serde", "sp-arithmetic", "sp-core", "sp-io", @@ -5149,14 +5134,12 @@ dependencies = [ name = "pallet-erc721" version = "4.8.1" dependencies = [ - "frame-benchmarking", "frame-support", "frame-system", "pallet-balances", "pallet-chainbridge", "parity-scale-codec", "scale-info", - "serde", "sp-core", "sp-io", "sp-runtime", @@ -5617,24 +5600,6 @@ dependencies = [ "sp-runtime", ] -[[package]] -name = "pallet-transaction-storage" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "frame-support", - "frame-system", - "log", - "pallet-balances", - "parity-scale-codec", - "scale-info", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-std", - "sp-transaction-storage-proof", -] - [[package]] name = "pallet-treasury" version = "4.0.0-dev" @@ -5898,7 +5863,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -5939,7 +5904,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -6032,9 +5997,9 @@ dependencies = [ [[package]] name = "poly1305" -version = "0.7.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" dependencies = [ "cpufeatures", "opaque-debug 0.3.0", @@ -6043,9 +6008,9 @@ dependencies = [ [[package]] name = "polyval" -version = "0.5.3" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" dependencies = [ "cfg-if", "cpufeatures", @@ -6088,7 +6053,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -6407,7 +6372,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.11", ] [[package]] @@ -6502,12 +6467,12 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ - "getrandom 0.2.10", - "redox_syscall 0.2.16", + "getrandom 0.2.11", + "libredox", "thiserror", ] @@ -6528,7 +6493,7 @@ checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -6647,7 +6612,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" dependencies = [ "cc", - "getrandom 0.2.10", + "getrandom 0.2.11", "libc", "spin 0.9.8", "untrusted 0.9.0", @@ -6666,13 +6631,13 @@ dependencies = [ [[package]] name = "rpassword" -version = "7.2.0" +version = "7.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6678cf63ab3491898c0d021b493c94c9b221d91295294a2a5746eacbe5928322" +checksum = "80472be3c897911d0137b2d2b9055faf6eeac5b14e324073d83bc17b191d7e3f" dependencies = [ "libc", "rtoolbox", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -6692,12 +6657,12 @@ dependencies = [ [[package]] name = "rtoolbox" -version = "0.0.1" +version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034e22c514f5c0cb8a10ff341b9b048b5ceb21591f31c8f44c43b960f9b3524a" +checksum = "c247d24e63230cdb56463ae328478bd5eac8b8faa8c69461a77e8e323afac90e" dependencies = [ "libc", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -6757,7 +6722,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" dependencies = [ "bitflags 1.3.2", - "errno 0.3.5", + "errno 0.3.6", "io-lifetimes 1.0.11", "libc", "linux-raw-sys 0.3.8", @@ -6771,9 +6736,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ "bitflags 2.4.1", - "errno 0.3.5", + "errno 0.3.6", "libc", - "linux-raw-sys 0.4.10", + "linux-raw-sys 0.4.11", "windows-sys 0.48.0", ] @@ -6803,9 +6768,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ "base64 0.21.5", ] @@ -6848,7 +6813,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" dependencies = [ - "cipher 0.4.4", + "cipher", ] [[package]] @@ -8064,22 +8029,22 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.190" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.190" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -8234,9 +8199,9 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "smallvec" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "snap" @@ -8246,16 +8211,16 @@ checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "snow" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9d1425eb528a21de2755c75af4c9b5d57f50a0d4c3b7f1828a4cd03f8ba155" +checksum = "58021967fd0a5eeeb23b08df6cc244a4d4a5b4aec1d27c9e02fad1a58b4cd74e" dependencies = [ "aes-gcm", "blake2", "chacha20poly1305", "curve25519-dalek 4.1.1", "rand_core 0.6.4", - "ring 0.16.20", + "ring 0.17.5", "rustc_version 0.4.0", "sha2 0.10.8", "subtle", @@ -9021,9 +8986,9 @@ dependencies = [ [[package]] name = "ss58-registry" -version = "1.43.0" +version = "1.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6915280e2d0db8911e5032a5c275571af6bdded2916abd691a659be25d3439" +checksum = "35935738370302d5e33963665b77541e4b990a3e919ec904c837a56cfc891de1" dependencies = [ "Inflector", "num-format", @@ -9248,9 +9213,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -9347,7 +9312,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -9422,9 +9387,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", @@ -9441,13 +9406,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -9521,7 +9486,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -9771,11 +9736,11 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "universal-hash" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" dependencies = [ - "generic-array 0.14.7", + "crypto-common", "subtle", ] @@ -9908,7 +9873,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-shared", ] @@ -9942,7 +9907,7 @@ checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -10557,7 +10522,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 47199eef4..aa71105e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,15 +4,14 @@ path = "src/main.rs" [package] name = "cere" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" version = "4.8.1" -edition = "2021" build = "build.rs" +edition = "2021" +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] -cere-cli = { path = "cli", features = [ "cere-dev-native" ] } +cere-cli = { path = "cli", features = ["cere-dev-native"] } sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -ss58-registry = { version = "1.38.0", default-features = false } [build-dependencies] substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 77f4d290d..648c6e2fa 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -13,15 +13,15 @@ crate-type = ["cdylib", "rlib"] [dependencies] clap = { version = "3.1", features = ["derive"], optional = true } +frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" } sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" } sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" } -frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" } -try-runtime-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true , branch = "polkadot-v0.9.30" } +try-runtime-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" } url = "2.4.1" # Local -cere-service = { path = "../node/service", default-features = false, optional = true } cere-client = { path = "../node/client", optional = true } +cere-service = { path = "../node/service", default-features = false, optional = true } [build-dependencies] substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } @@ -29,12 +29,12 @@ substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/pa [features] default = ["cli", "cere-native"] cli = [ - "clap", - "sc-cli", - "sc-service", - "frame-benchmarking-cli", - "try-runtime-cli", - "cere-client", + "clap", + "sc-cli", + "sc-service", + "frame-benchmarking-cli", + "try-runtime-cli", + "cere-client", ] runtime-benchmarks = ["cere-service/runtime-benchmarks"] try-runtime = ["cere-service/try-runtime"] diff --git a/cli/src/command.rs b/cli/src/command.rs index 9865ccf85..665ba9d31 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -67,7 +67,7 @@ impl SubstrateCli for Cli { #[cfg(feature = "cere-native")] { - return &cere_service::cere_runtime::VERSION + &cere_service::cere_runtime::VERSION } #[cfg(not(feature = "cere-native"))] @@ -161,17 +161,17 @@ pub fn run() -> sc_cli::Result<()> { #[cfg(feature = "cere-dev-native")] if chain_spec.is_cere_dev() { - return Ok(runner.sync_run(|config| { + return runner.sync_run(|config| { cmd.run::(config) - })?) + }) } // else we assume it is Cere #[cfg(feature = "cere-native")] { - return Ok(runner.sync_run(|config| { + runner.sync_run(|config| { cmd.run::(config) - })?) + }) } #[cfg(not(feature = "cere-native"))] diff --git a/dprint.json b/dprint.json new file mode 100644 index 000000000..82c59d3ee --- /dev/null +++ b/dprint.json @@ -0,0 +1,11 @@ +{ + "includes": [ + "**/*.{toml}" + ], + "excludes": [ + "**/target" + ], + "plugins": [ + "https://plugins.dprint.dev/toml-0.5.3.wasm" + ] + } \ No newline at end of file diff --git a/node/client/Cargo.toml b/node/client/Cargo.toml index dbafa5fa8..e310ce7d1 100644 --- a/node/client/Cargo.toml +++ b/node/client/Cargo.toml @@ -4,37 +4,34 @@ version = "4.8.1" edition = "2021" [dependencies] -sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } node-primitives = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-contracts-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-authority-discovery = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-contracts-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-offchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-storage = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-inherents = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-offchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-storage = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-keyring = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } # Local -cere-runtime = { path = "../../runtime/cere", optional = true } cere-dev-runtime = { path = "../../runtime/cere-dev", optional = true } +cere-runtime = { path = "../../runtime/cere", optional = true } [features] default = ["cere"] diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index d444e3244..dbde60843 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -4,69 +4,62 @@ version = "4.8.1" edition = "2021" [dependencies] -codec = { package = "parity-scale-codec", version = "3.1.5" } -serde = { version = "1.0.136", features = ["derive"] } -rand = "0.8" futures = "0.3.21" jsonrpsee = { version = "0.15.1", features = ["server"] } - -sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } -sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } -sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-authority-discovery = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +node-primitives = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-im-online = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-sysinfo = { version = "6.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +rand = "0.8" +sc-authority-discovery = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-basic-authorship = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-consensus-uncles = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-authority-discovery = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } +sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-network = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-transaction-storage-proof = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-authorship = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-sync-state-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-basic-authorship = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -node-primitives = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } +sc-sync-state-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-sysinfo = { version = "6.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +serde = { version = "1.0.136", features = ["derive"] } sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-trie = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-authority-discovery = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-authorship = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-transaction-storage-proof = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-trie = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } # Local cere-client = { path = "../client", default-features = false, optional = true } -cere-rpc = { path = "../../rpc" } - -cere-runtime-constants = { path = "../../runtime/cere/constants", optional = true } cere-dev-runtime-constants = { path = "../../runtime/cere-dev/constants", optional = true } +cere-rpc = { path = "../../rpc" } -cere-runtime = { path = "../../runtime/cere", optional = true } cere-dev-runtime = { path = "../../runtime/cere-dev", optional = true } - +cere-runtime = { path = "../../runtime/cere", optional = true } [features] default = ["cere-native"] -cere-native = [ "cere-runtime", "cere-runtime-constants", "cere-client/cere" ] -cere-dev-native = [ "cere-dev-runtime", "cere-dev-runtime-constants", "cere-client/cere-dev" ] +cere-native = ["cere-runtime", "cere-client/cere"] +cere-dev-native = ["cere-dev-runtime", "cere-dev-runtime-constants", "cere-client/cere-dev"] runtime-benchmarks = [ - "cere-runtime/runtime-benchmarks", - "cere-dev-runtime/runtime-benchmarks", - "sc-service/runtime-benchmarks", + "cere-runtime/runtime-benchmarks", + "cere-dev-runtime/runtime-benchmarks", + "sc-service/runtime-benchmarks", ] try-runtime = [ - "cere-runtime/try-runtime", - "cere-dev-runtime/try-runtime", + "cere-runtime/try-runtime", + "cere-dev-runtime/try-runtime", ] diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 6988b5641..ee62d08d1 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -88,7 +88,7 @@ where let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::( - &config, + config, telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), executor, )?; @@ -103,6 +103,7 @@ where Ok(Basics { task_manager, client, backend, keystore_container, telemetry }) } +#[allow(clippy::type_complexity)] fn new_partial( config: &Configuration, Basics { task_manager, backend, client, keystore_container, telemetry }: Basics< @@ -287,7 +288,7 @@ pub fn build_full( #[cfg(feature = "cere-native")] { - return new_full::( + new_full::( config, disable_hardware_benchmarks, enable_ddc_validation, @@ -347,7 +348,7 @@ where { let hwbench = if !disable_hardware_benchmarks { config.database.path().map(|database_path| { - let _ = std::fs::create_dir_all(&database_path); + let _ = std::fs::create_dir_all(database_path); sc_sysinfo::gather_hwbench(Some(database_path)) }) } else { @@ -461,7 +462,7 @@ where let proposer = sc_basic_authorship::ProposerFactory::new( task_manager.spawn_handle(), client.clone(), - transaction_pool.clone(), + transaction_pool, prometheus_registry.as_ref(), telemetry.as_ref().map(|x| x.handle()), ); @@ -628,6 +629,7 @@ macro_rules! chain_ops { }}; } +#[allow(clippy::type_complexity)] pub fn new_chain_ops( config: &Configuration, ) -> Result< @@ -646,7 +648,7 @@ pub fn new_chain_ops( #[cfg(feature = "cere-native")] { - return chain_ops!(config; cere_runtime, CereExecutorDispatch, Cere) + chain_ops!(config; cere_runtime, CereExecutorDispatch, Cere) } #[cfg(not(feature = "cere-native"))] diff --git a/pallets/chainbridge/Cargo.toml b/pallets/chainbridge/Cargo.toml index de714f861..617e76b9b 100644 --- a/pallets/chainbridge/Cargo.toml +++ b/pallets/chainbridge/Cargo.toml @@ -3,11 +3,11 @@ name = "pallet-chainbridge" version = "4.8.1" authors = ["Parity Technologies "] edition = "2021" -license = "Unlicense" homepage = "https://substrate.io" +license = "Unlicense" +readme = "README.md" repository = "https://github.com/paritytech/substrate/" description = "" -readme = "README.md" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] @@ -16,30 +16,22 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -lite-json = { version = "0.2.0", default-features = false } -sp-keystore = { version = "0.12.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } - -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } [features] default = ["std"] std = [ - "codec/std", - "sp-runtime/std", - "frame-benchmarking/std", - "frame-support/std", - "frame-system/std", - "pallet-balances/std", - "sp-io/std", - "sp-std/std", - "sp-core/std", - "lite-json/std", - "sp-keystore", + "codec/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", + "pallet-balances/std", + "sp-io/std", + "sp-std/std", + "sp-core/std", ] -runtime-benchmarks = ["frame-benchmarking"] diff --git a/pallets/chainbridge/src/lib.rs b/pallets/chainbridge/src/lib.rs index 1e48b4a7d..9972be688 100644 --- a/pallets/chainbridge/src/lib.rs +++ b/pallets/chainbridge/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::all)] // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] @@ -36,7 +37,7 @@ pub fn derive_resource_id(chain: u8, id: &[u8]) -> ResourceId { for i in 0..range { r_id[30 - i] = id[range - 1 - i]; // Ensure left padding for eth compatibility } - return r_id + r_id } #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)] @@ -76,7 +77,7 @@ impl ProposalVotes { /// Returns true if `who` has voted for or against the proposal fn has_voted(&self, who: &A) -> bool { - self.votes_for.contains(&who) || self.votes_against.contains(&who) + self.votes_for.contains(who) || self.votes_against.contains(who) } /// Return true if the expiry time has been reached @@ -294,7 +295,7 @@ decl_module! { /// # /// - weight of proposed call, regardless of whether execution is performed /// # - #[weight = (call.get_dispatch_info().weight + Weight::from_ref_time(195_000_000 as u64), call.get_dispatch_info().class, Pays::Yes)] + #[weight = (call.get_dispatch_info().weight + Weight::from_ref_time(195_000_000_u64), call.get_dispatch_info().class, Pays::Yes)] pub fn acknowledge_proposal(origin, nonce: DepositNonce, src_id: ChainId, r_id: ResourceId, call: Box<::Proposal>) -> DispatchResult { let who = ensure_signed(origin)?; ensure!(Self::is_relayer(&who), Error::::MustBeRelayer); @@ -327,7 +328,7 @@ decl_module! { /// # /// - weight of proposed call, regardless of whether execution is performed /// # - #[weight = (prop.get_dispatch_info().weight + Weight::from_ref_time(195_000_000 as u64), prop.get_dispatch_info().class, Pays::Yes)] + #[weight = (prop.get_dispatch_info().weight + Weight::from_ref_time(195_000_000_u64), prop.get_dispatch_info().class, Pays::Yes)] pub fn eval_vote_state(origin, nonce: DepositNonce, src_id: ChainId, prop: Box<::Proposal>) -> DispatchResult { ensure_signed(origin)?; @@ -357,12 +358,12 @@ impl Module { /// Asserts if a resource is registered pub fn resource_exists(id: ResourceId) -> bool { - return Self::resources(id) != None + Self::resources(id).is_some() } /// Checks if a chain exists as a whitelisted destination pub fn chain_whitelisted(id: ChainId) -> bool { - return Self::chains(id) != None + Self::chains(id).is_some() } /// Increments the deposit nonce for the specified chain ID @@ -400,7 +401,7 @@ impl Module { ensure!(id != T::ChainId::get(), Error::::InvalidChainId); // Cannot whitelist with an existing entry ensure!(!Self::chain_whitelisted(id), Error::::ChainAlreadyWhitelisted); - ::insert(&id, 0); + ::insert(id, 0); Self::deposit_event(RawEvent::ChainWhitelisted(id)); Ok(()) } @@ -451,13 +452,13 @@ impl Module { if in_favour { votes.votes_for.push(who.clone()); - Self::deposit_event(RawEvent::VoteFor(src_id, nonce, who.clone())); + Self::deposit_event(RawEvent::VoteFor(src_id, nonce, who)); } else { votes.votes_against.push(who.clone()); - Self::deposit_event(RawEvent::VoteAgainst(src_id, nonce, who.clone())); + Self::deposit_event(RawEvent::VoteAgainst(src_id, nonce, who)); } - >::insert(src_id, (nonce, prop.clone()), votes.clone()); + >::insert(src_id, (nonce, prop), votes.clone()); Ok(()) } diff --git a/pallets/chainbridge/src/mock.rs b/pallets/chainbridge/src/mock.rs index 5e22f6e92..2a3fd20b5 100644 --- a/pallets/chainbridge/src/mock.rs +++ b/pallets/chainbridge/src/mock.rs @@ -152,6 +152,6 @@ pub fn assert_events(mut expected: Vec) { for evt in expected { let next = actual.pop().expect("event expected"); - assert_eq!(next, evt.into(), "Events don't match (actual,expected)"); + assert_eq!(next, evt, "Events don't match (actual,expected)"); } } diff --git a/pallets/chainbridge/src/tests.rs b/pallets/chainbridge/src/tests.rs index bd0ae5a03..ce0e308c0 100644 --- a/pallets/chainbridge/src/tests.rs +++ b/pallets/chainbridge/src/tests.rs @@ -137,50 +137,50 @@ fn asset_transfer_success() { let token_id = vec![1, 2, 3, 4]; let method = "Erc20.transfer".as_bytes().to_vec(); - assert_ok!(Bridge::set_resource(RuntimeOrigin::root(), resource_id, method.clone())); + assert_ok!(Bridge::set_resource(RuntimeOrigin::root(), resource_id, method)); assert_ok!(Bridge::set_threshold(RuntimeOrigin::root(), TEST_THRESHOLD,)); - assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), dest_id.clone())); + assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), dest_id)); assert_ok!(Bridge::transfer_fungible( - dest_id.clone(), - resource_id.clone(), + dest_id, + resource_id, to.clone(), amount.into() )); assert_events(vec![ - RuntimeEvent::Bridge(RawEvent::ChainWhitelisted(dest_id.clone())), + RuntimeEvent::Bridge(RawEvent::ChainWhitelisted(dest_id)), RuntimeEvent::Bridge(RawEvent::FungibleTransfer( - dest_id.clone(), + dest_id, 1, - resource_id.clone(), + resource_id, amount.into(), to.clone(), )), ]); assert_ok!(Bridge::transfer_nonfungible( - dest_id.clone(), - resource_id.clone(), + dest_id, + resource_id, token_id.clone(), to.clone(), metadata.clone() )); assert_events(vec![RuntimeEvent::Bridge(RawEvent::NonFungibleTransfer( - dest_id.clone(), + dest_id, 2, - resource_id.clone(), + resource_id, token_id, - to.clone(), + to, metadata.clone(), ))]); assert_ok!(Bridge::transfer_generic( - dest_id.clone(), - resource_id.clone(), + dest_id, + resource_id, metadata.clone() )); assert_events(vec![RuntimeEvent::Bridge(RawEvent::GenericTransfer( - dest_id.clone(), + dest_id, 3, resource_id, metadata, @@ -197,13 +197,13 @@ fn asset_transfer_invalid_resource_id() { let amount = 100; assert_ok!(Bridge::set_threshold(RuntimeOrigin::root(), TEST_THRESHOLD,)); - assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), dest_id.clone())); + assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), dest_id)); assert_noop!( Bridge::transfer_fungible( - dest_id.clone(), - resource_id.clone(), - to.clone(), + dest_id, + resource_id, + to, amount.into() ), Error::::ResourceDoesNotExist @@ -211,8 +211,8 @@ fn asset_transfer_invalid_resource_id() { assert_noop!( Bridge::transfer_nonfungible( - dest_id.clone(), - resource_id.clone(), + dest_id, + resource_id, vec![], vec![], vec![] @@ -221,7 +221,7 @@ fn asset_transfer_invalid_resource_id() { ); assert_noop!( - Bridge::transfer_generic(dest_id.clone(), resource_id.clone(), vec![]), + Bridge::transfer_generic(dest_id, resource_id, vec![]), Error::::ResourceDoesNotExist ); }) @@ -234,21 +234,21 @@ fn asset_transfer_invalid_chain() { let bad_dest_id = 3; let resource_id = [4; 32]; - assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), chain_id.clone())); - assert_events(vec![RuntimeEvent::Bridge(RawEvent::ChainWhitelisted(chain_id.clone()))]); + assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), chain_id)); + assert_events(vec![RuntimeEvent::Bridge(RawEvent::ChainWhitelisted(chain_id))]); assert_noop!( - Bridge::transfer_fungible(bad_dest_id, resource_id.clone(), vec![], U256::zero()), + Bridge::transfer_fungible(bad_dest_id, resource_id, vec![], U256::zero()), Error::::ChainNotWhitelisted ); assert_noop!( - Bridge::transfer_nonfungible(bad_dest_id, resource_id.clone(), vec![], vec![], vec![]), + Bridge::transfer_nonfungible(bad_dest_id, resource_id, vec![], vec![], vec![]), Error::::ChainNotWhitelisted ); assert_noop!( - Bridge::transfer_generic(bad_dest_id, resource_id.clone(), vec![]), + Bridge::transfer_generic(bad_dest_id, resource_id, vec![]), Error::::ChainNotWhitelisted ); }) @@ -310,7 +310,7 @@ fn create_sucessful_proposal() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], @@ -327,7 +327,7 @@ fn create_sucessful_proposal() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![RELAYER_B], @@ -344,7 +344,7 @@ fn create_sucessful_proposal() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal)).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A, RELAYER_C], votes_against: vec![RELAYER_B], @@ -380,7 +380,7 @@ fn create_unsucessful_proposal() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], @@ -397,7 +397,7 @@ fn create_unsucessful_proposal() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![RELAYER_B], @@ -414,7 +414,7 @@ fn create_unsucessful_proposal() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal)).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![RELAYER_B, RELAYER_C], @@ -452,7 +452,7 @@ fn execute_after_threshold_change() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], @@ -472,7 +472,7 @@ fn execute_after_threshold_change() { Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal)).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], @@ -510,7 +510,7 @@ fn proposal_expires() { r_id, Box::new(proposal.clone()) )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], @@ -535,7 +535,7 @@ fn proposal_expires() { ); // Proposal state should remain unchanged - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal.clone())).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], @@ -554,7 +554,7 @@ fn proposal_expires() { ), Error::::ProposalExpired ); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let prop = Bridge::votes(src_id, (prop_id, proposal)).unwrap(); let expected = ProposalVotes { votes_for: vec![RELAYER_A], votes_against: vec![], diff --git a/pallets/ddc-clusters/Cargo.toml b/pallets/ddc-clusters/Cargo.toml index 62f59dd67..7bd5018b4 100644 --- a/pallets/ddc-clusters/Cargo.toml +++ b/pallets/ddc-clusters/Cargo.toml @@ -7,18 +7,13 @@ edition = "2021" codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } ddc-primitives = { version = "0.1.0", default-features = false, path = "../../primitives" } ddc-traits = { version = "0.1.0", default-features = false, path = "../../traits" } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -log = { version = "0.4.17", default-features = false } +pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-ddc-nodes = { version = "4.7.0", default-features = false, path = "../ddc-nodes" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } -pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-ddc-nodes = { version = "4.7.0", default-features = false, path = "../ddc-nodes" } [dev-dependencies] sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -32,14 +27,10 @@ std = [ "ddc-primitives/std", "frame-support/std", "frame-system/std", - "frame-benchmarking/std", "pallet-contracts/std", "pallet-ddc-nodes/std", "scale-info/std", "sp-core/std", - "sp-io/std", "sp-runtime/std", - "sp-staking/std", "sp-std/std", ] -runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] diff --git a/pallets/ddc-clusters/src/lib.rs b/pallets/ddc-clusters/src/lib.rs index ee410b7db..121640d84 100644 --- a/pallets/ddc-clusters/src/lib.rs +++ b/pallets/ddc-clusters/src/lib.rs @@ -16,7 +16,7 @@ #![feature(is_some_and)] // ToDo: delete at rustc > 1.70 use crate::{ - cluster::{Cluster, ClusterError, ClusterGovParams, ClusterParams}, + cluster::{Cluster, ClusterGovParams, ClusterParams}, node_provider_auth::{NodeProviderAuthContract, NodeProviderAuthContractError}, }; use ddc_primitives::{ClusterId, ClusterPricingParams, NodePubKey, NodeType}; @@ -124,17 +124,13 @@ pub mod pallet { cluster_gov_params: ClusterGovParams, T::BlockNumber>, ) -> DispatchResult { ensure_root(origin)?; // requires Governance approval - let cluster = Cluster::new( - cluster_id.clone(), - cluster_manager_id, - cluster_reserve_id, - cluster_params, - ) - .map_err(|e: ClusterError| Into::>::into(ClusterError::from(e)))?; - ensure!(!Clusters::::contains_key(&cluster_id), Error::::ClusterAlreadyExists); - - Clusters::::insert(cluster_id.clone(), cluster); - ClustersGovParams::::insert(cluster_id.clone(), cluster_gov_params); + let cluster = + Cluster::new(cluster_id, cluster_manager_id, cluster_reserve_id, cluster_params) + .map_err(Into::>::into)?; + ensure!(!Clusters::::contains_key(cluster_id), Error::::ClusterAlreadyExists); + + Clusters::::insert(cluster_id, cluster); + ClustersGovParams::::insert(cluster_id, cluster_gov_params); Self::deposit_event(Event::::ClusterCreated { cluster_id }); Ok(()) @@ -148,7 +144,7 @@ pub mod pallet { ) -> DispatchResult { let caller_id = ensure_signed(origin)?; let cluster = - Clusters::::try_get(&cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; + Clusters::::try_get(cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; ensure!(cluster.manager_id == caller_id, Error::::OnlyClusterManager); // Node with this node with this public key exists. @@ -158,12 +154,12 @@ pub mod pallet { // Sufficient funds are locked at the DDC Staking module. let has_stake = T::StakingVisitor::node_has_stake(&node_pub_key, &cluster_id) - .map_err(|e| Into::>::into(StakingVisitorError::from(e)))?; + .map_err(Into::>::into)?; ensure!(has_stake, Error::::NodeHasNoStake); // Candidate is not planning to pause operations any time soon. let is_chilling = T::StakingVisitor::node_is_chilling(&node_pub_key) - .map_err(|e| Into::>::into(StakingVisitorError::from(e)))?; + .map_err(Into::>::into)?; ensure!(!is_chilling, Error::::NodeChillingIsProhibited); // Cluster extension smart contract allows joining. @@ -174,16 +170,16 @@ pub mod pallet { let is_authorized = auth_contract .is_authorized( node.get_provider_id().to_owned(), - node.get_pub_key().to_owned(), + node.get_pub_key(), node.get_type(), ) - .map_err(|e| Into::>::into(NodeProviderAuthContractError::from(e)))?; + .map_err(Into::>::into)?; ensure!(is_authorized, Error::::NodeIsNotAuthorized); // Add node to the cluster. - node.set_cluster_id(Some(cluster_id.clone())); + node.set_cluster_id(Some(cluster_id)); T::NodeRepository::update(node).map_err(|_| Error::::AttemptToAddNonExistentNode)?; - ClustersNodes::::insert(cluster_id.clone(), node_pub_key.clone(), true); + ClustersNodes::::insert(cluster_id, node_pub_key.clone(), true); Self::deposit_event(Event::::ClusterNodeAdded { cluster_id, node_pub_key }); Ok(()) @@ -197,7 +193,7 @@ pub mod pallet { ) -> DispatchResult { let caller_id = ensure_signed(origin)?; let cluster = - Clusters::::try_get(&cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; + Clusters::::try_get(cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; ensure!(cluster.manager_id == caller_id, Error::::OnlyClusterManager); let mut node = T::NodeRepository::get(node_pub_key.clone()) .map_err(|_| Error::::AttemptToRemoveNonExistentNode)?; @@ -205,7 +201,7 @@ pub mod pallet { node.set_cluster_id(None); T::NodeRepository::update(node) .map_err(|_| Error::::AttemptToRemoveNonExistentNode)?; - ClustersNodes::::remove(cluster_id.clone(), node_pub_key.clone()); + ClustersNodes::::remove(cluster_id, node_pub_key.clone()); Self::deposit_event(Event::::ClusterNodeRemoved { cluster_id, node_pub_key }); Ok(()) @@ -220,12 +216,10 @@ pub mod pallet { ) -> DispatchResult { let caller_id = ensure_signed(origin)?; let mut cluster = - Clusters::::try_get(&cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; + Clusters::::try_get(cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; ensure!(cluster.manager_id == caller_id, Error::::OnlyClusterManager); - cluster - .set_params(cluster_params) - .map_err(|e: ClusterError| Into::>::into(ClusterError::from(e)))?; - Clusters::::insert(cluster_id.clone(), cluster); + cluster.set_params(cluster_params).map_err(Into::>::into)?; + Clusters::::insert(cluster_id, cluster); Self::deposit_event(Event::::ClusterParamsSet { cluster_id }); Ok(()) @@ -240,8 +234,8 @@ pub mod pallet { ) -> DispatchResult { ensure_root(origin)?; // requires Governance approval let _cluster = - Clusters::::try_get(&cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; - ClustersGovParams::::insert(cluster_id.clone(), cluster_gov_params); + Clusters::::try_get(cluster_id).map_err(|_| Error::::ClusterDoesNotExist)?; + ClustersGovParams::::insert(cluster_id, cluster_gov_params); Self::deposit_event(Event::::ClusterGovParamsSet { cluster_id }); Ok(()) @@ -254,7 +248,7 @@ pub mod pallet { } fn ensure_cluster(cluster_id: &ClusterId) -> Result<(), ClusterVisitorError> { - Clusters::::get(&cluster_id) + Clusters::::get(cluster_id) .map(|_| ()) .ok_or(ClusterVisitorError::ClusterDoesNotExist) } diff --git a/pallets/ddc-customers/Cargo.toml b/pallets/ddc-customers/Cargo.toml index 48cdf287f..89faf08a5 100644 --- a/pallets/ddc-customers/Cargo.toml +++ b/pallets/ddc-customers/Cargo.toml @@ -9,12 +9,10 @@ ddc-primitives = { version = "0.1.0", default-features = false, path = "../../pr ddc-traits = { version = "0.1.0", default-features = false, path = "../../traits" } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -log = { version = "0.4.17", default-features = false } [dev-dependencies] substrate-test-utils = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -27,8 +25,6 @@ std = [ "frame-support/std", "frame-system/std", "scale-info/std", - "sp-io/std", "sp-runtime/std", - "sp-staking/std", "sp-std/std", ] diff --git a/pallets/ddc-customers/src/lib.rs b/pallets/ddc-customers/src/lib.rs index e29902af8..94255b20c 100644 --- a/pallets/ddc-customers/src/lib.rs +++ b/pallets/ddc-customers/src/lib.rs @@ -342,7 +342,7 @@ pub mod pallet { Self::update_ledger_and_deposit(&owner, &ledger)?; - Self::deposit_event(Event::::Deposited(owner.clone(), extra)); + Self::deposit_event(Event::::Deposited(owner, extra)); Ok(()) } @@ -508,7 +508,7 @@ pub mod pallet { /// This is called: /// - after a `withdraw_unlocked_deposit()` call that frees all of a owner's locked balance. fn kill_owner(owner: &T::AccountId) -> DispatchResult { - >::remove(&owner); + >::remove(owner); frame_system::Pallet::::dec_consumers(owner); diff --git a/pallets/ddc-metrics-offchain-worker/Cargo.toml b/pallets/ddc-metrics-offchain-worker/Cargo.toml index 74747a397..d56726763 100644 --- a/pallets/ddc-metrics-offchain-worker/Cargo.toml +++ b/pallets/ddc-metrics-offchain-worker/Cargo.toml @@ -3,53 +3,49 @@ name = "pallet-ddc-metrics-offchain-worker" version = "4.8.1" authors = ["Parity Technologies "] edition = "2021" -license = "Unlicense" homepage = "https://substrate.dev" +license = "Unlicense" +readme = "README.md" repository = "https://github.com/paritytech/substrate/" description = "FRAME example pallet for offchain worker" -readme = "README.md" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies] +alt_serde = { version = "1", default-features = false, features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["full"] } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -serde = { version = "1.0.136", optional = true } -sp-keystore = { version = "0.12.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } +hex = { version = "0.4", default-features = false } +# pallet-contracts-rpc-runtime-api = { version = "0.8.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +hex-literal = "^0.3.1" +pallet-contracts = { version = '4.0.0-dev', default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +serde_json = { version = "1", default-features = false, git = "https://github.com/Cerebellum-Network/json", branch = "no-std-cere", features = ["alloc"] } sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-keystore = { version = "0.12.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-contracts = { version = '4.0.0-dev', default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -lite-json = { version = "0.2.0", default-features = false } -alt_serde = { version = "1", default-features = false, features = ["derive"] } -serde_json = { version = "1", default-features = false, git = "https://github.com/Cerebellum-Network/json", branch = "no-std-cere", features = ["alloc"] } -# pallet-contracts-rpc-runtime-api = { version = "0.8.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -hex-literal = "^0.3.1" -hex = { version = "0.4", default-features = false } -scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } [features] default = ["std"] std = [ - "codec/std", - "sp-keystore", - "frame-support/std", - "frame-system/std", - "serde", - "lite-json/std", - "sp-core/std", - "sp-io/std", - "sp-runtime/std", - "sp-std/std", - "pallet-contracts/std", - # "pallet-contracts-rpc-runtime-api/std", + "codec/std", + "sp-keystore", + "frame-support/std", + "frame-system/std", + "sp-core/std", + "sp-io/std", + "sp-runtime/std", + "sp-std/std", + "pallet-contracts/std", + # "pallet-contracts-rpc-runtime-api/std", ] [dev-dependencies] pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-randomness-collective-flip = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pretty_assertions = "0.6.1" diff --git a/pallets/ddc-metrics-offchain-worker/src/lib.rs b/pallets/ddc-metrics-offchain-worker/src/lib.rs index 991fdabb2..ffa2dfbb1 100644 --- a/pallets/ddc-metrics-offchain-worker/src/lib.rs +++ b/pallets/ddc-metrics-offchain-worker/src/lib.rs @@ -1,7 +1,7 @@ // Offchain worker for DDC metrics. // // Inspired from https://github.com/paritytech/substrate/tree/master/frame/example-offchain-worker - +#![allow(clippy::all)] #![cfg_attr(not(feature = "std"), no_std)] #[cfg(test)] @@ -19,7 +19,7 @@ use frame_system::offchain::{ }; use hex_literal::hex; -use pallet_contracts; + use sp_core::crypto::{KeyTypeId, UncheckedFrom}; use sp_runtime::{ offchain::{http, storage::StorageValueRef, Duration}, @@ -194,7 +194,7 @@ where }; let should_proceed = Self::check_if_should_proceed(block_number); - if should_proceed == false { + if !should_proceed { return Ok(()) } @@ -246,7 +246,7 @@ where let block_timestamp = sp_io::offchain::timestamp().unix_millis(); if day_end_ms < block_timestamp { - Self::finalize_metric_period(contract_address.clone(), &signer, day_start_ms).map_err( + Self::finalize_metric_period(contract_address, &signer, day_start_ms).map_err( |err| { error!("[OCW] Contract error occurred: {:?}", err); "could not call finalize_metric_period TX" @@ -304,11 +304,10 @@ where ); Err("Skipping") } else { - let block_interval_configured = Self::get_block_interval(); let mut block_interval = T::BlockInterval::get(); - if block_interval_configured.is_some() { + if let Some(block_interval_configured) = Self::get_block_interval() { block_interval = ::BlockNumber::from( - block_interval_configured.unwrap(), + block_interval_configured, ); } @@ -327,8 +326,8 @@ where fn get_start_of_day_ms() -> u64 { let now = sp_io::offchain::timestamp(); - let day_start_ms = (now.unix_millis() / MS_PER_DAY) * MS_PER_DAY; - day_start_ms + + (now.unix_millis() / MS_PER_DAY) * MS_PER_DAY } fn get_signer() -> ResultStr> { @@ -520,7 +519,7 @@ where account.id, p2p_id, is_online, ); - let call_data = Self::encode_report_ddn_status(&p2p_id, is_online); + let call_data = Self::encode_report_ddn_status(p2p_id, is_online); let contract_id_unl = <::Lookup as StaticLookup>::unlookup( contract_id.clone(), @@ -641,12 +640,12 @@ where "HTTP GET error" })?; - let parsed = serde_json::from_slice(&body).map_err(|err| { + + + serde_json::from_slice(&body).map_err(|err| { warn!("[OCW] Error while parsing JSON from {}: {:?}", url, err); "HTTP JSON parse error" - }); - - parsed + }) } fn http_get_request(http_url: &str) -> Result, http::Error> { @@ -753,7 +752,12 @@ impl MetricsAggregator { let existing_pubkey_index = self.0.iter().position(|one_result_obj| metric.app_id == one_result_obj.app_id); - if existing_pubkey_index.is_none() { + if let Some(existing_pubkey_index) = existing_pubkey_index { + // Add to metrics of an existing app. + self.0[existing_pubkey_index].storage_bytes += metric.storage_bytes; + self.0[existing_pubkey_index].wcu_used += metric.wcu_used; + self.0[existing_pubkey_index].rcu_used += metric.rcu_used; + } else { // New app. let new_metric_obj = Metric { app_id: metric.app_id.clone(), @@ -762,11 +766,6 @@ impl MetricsAggregator { rcu_used: metric.rcu_used, }; self.0.push(new_metric_obj); - } else { - // Add to metrics of an existing app. - self.0[existing_pubkey_index.unwrap()].storage_bytes += metric.storage_bytes; - self.0[existing_pubkey_index.unwrap()].wcu_used += metric.wcu_used; - self.0[existing_pubkey_index.unwrap()].rcu_used += metric.rcu_used; } } diff --git a/pallets/ddc-metrics-offchain-worker/src/tests/mod.rs b/pallets/ddc-metrics-offchain-worker/src/tests/mod.rs index a261b10c8..7480f8ea3 100644 --- a/pallets/ddc-metrics-offchain-worker/src/tests/mod.rs +++ b/pallets/ddc-metrics-offchain-worker/src/tests/mod.rs @@ -295,7 +295,7 @@ fn should_run_contract() { .unwrap(); let contract_exec_result = pallet_contracts::Pallet::::bare_call( - alice.clone(), + alice, contract_id, 0, Weight::from_ref_time(100_000_000_000), @@ -317,7 +317,7 @@ pub const CTOR_SELECTOR: [u8; 4] = hex!("9bae9d5e"); fn encode_constructor() -> Vec { let mut call_data = CTOR_SELECTOR.to_vec(); - let x = 0 as u128; + let x = 0_u128; for _ in 0..9 { x.encode_to(&mut call_data); } @@ -344,13 +344,13 @@ fn deploy_contract() -> AccountId { GAS_LIMIT, None, wasm.to_vec(), - contract_args.clone(), + contract_args, vec![], ) .unwrap(); // Configure worker with the contract address. - let contract_id = Contracts::contract_address(&alice, &wasm_hash, &vec![]); + let contract_id = Contracts::contract_address(&alice, &wasm_hash, &[]); pub const ADD_DDC_NODE_SELECTOR: [u8; 4] = hex!("11a9e1b9"); diff --git a/pallets/ddc-metrics-offchain-worker/src/tests/test_data/ddc.wasm b/pallets/ddc-metrics-offchain-worker/src/tests/test_data/ddc.wasm new file mode 100644 index 000000000..e69de29bb diff --git a/pallets/ddc-metrics-offchain-worker/src/tests/test_data/metadata.json b/pallets/ddc-metrics-offchain-worker/src/tests/test_data/metadata.json new file mode 100644 index 000000000..e69de29bb diff --git a/pallets/ddc-nodes/Cargo.toml b/pallets/ddc-nodes/Cargo.toml index 607ab47fa..a233a53c7 100644 --- a/pallets/ddc-nodes/Cargo.toml +++ b/pallets/ddc-nodes/Cargo.toml @@ -6,16 +6,12 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } ddc-primitives = { version = "0.1.0", default-features = false, path = "../../primitives" } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } +ddc-traits = { version = "0.1.0", default-features = false, path = "../../traits" } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } [dev-dependencies] sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -29,12 +25,8 @@ std = [ "ddc-primitives/std", "frame-support/std", "frame-system/std", - "frame-benchmarking/std", "scale-info/std", - "sp-io/std", "sp-runtime/std", - "sp-staking/std", "sp-std/std", "sp-core/std", ] -runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] diff --git a/pallets/ddc-nodes/src/cdn_node.rs b/pallets/ddc-nodes/src/cdn_node.rs index 5b3954953..eafe6cd27 100644 --- a/pallets/ddc-nodes/src/cdn_node.rs +++ b/pallets/ddc-nodes/src/cdn_node.rs @@ -1,4 +1,4 @@ -use crate::node::{Node, NodeError, NodeParams, NodeProps, NodePropsRef, NodePubKeyRef, NodeTrait}; +use crate::node::{NodeError, NodeParams, NodeProps, NodeTrait}; use codec::{Decode, Encode}; use ddc_primitives::{CDNNodePubKey, ClusterId, NodePubKey, NodeType}; use frame_support::{parameter_types, BoundedVec}; @@ -36,15 +36,44 @@ pub struct CDNNodeParams { pub p2p_port: u16, } +impl CDNNode { + pub fn new( + node_pub_key: NodePubKey, + provider_id: T::AccountId, + node_params: NodeParams, + ) -> Result { + match node_pub_key { + NodePubKey::CDNPubKey(pub_key) => match node_params { + NodeParams::CDNParams(node_params) => Ok(CDNNode:: { + provider_id, + pub_key, + cluster_id: None, + props: CDNNodeProps { + host: match node_params.host.try_into() { + Ok(vec) => vec, + Err(_) => return Err(NodeError::CDNHostLenExceedsLimit), + }, + http_port: node_params.http_port, + grpc_port: node_params.grpc_port, + p2p_port: node_params.p2p_port, + }, + }), + _ => Err(NodeError::InvalidCDNNodeParams), + }, + _ => Err(NodeError::InvalidCDNNodePubKey), + } + } +} + impl NodeTrait for CDNNode { - fn get_pub_key<'a>(&'a self) -> NodePubKeyRef<'a> { - NodePubKeyRef::CDNPubKeyRef(&self.pub_key) + fn get_pub_key(&self) -> NodePubKey { + NodePubKey::CDNPubKey(self.pub_key.clone()) } fn get_provider_id(&self) -> &T::AccountId { &self.provider_id } - fn get_props<'a>(&'a self) -> NodePropsRef<'a> { - NodePropsRef::CDNPropsRef(&self.props) + fn get_props(&self) -> NodeProps { + NodeProps::CDNProps(self.props.clone()) } fn set_props(&mut self, props: NodeProps) -> Result<(), NodeError> { self.props = match props { @@ -77,30 +106,4 @@ impl NodeTrait for CDNNode { fn get_type(&self) -> NodeType { NodeType::CDN } - fn new( - node_pub_key: NodePubKey, - provider_id: T::AccountId, - node_params: NodeParams, - ) -> Result, NodeError> { - match node_pub_key { - NodePubKey::CDNPubKey(pub_key) => match node_params { - NodeParams::CDNParams(node_params) => Ok(Node::CDN(CDNNode:: { - provider_id, - pub_key, - cluster_id: None, - props: CDNNodeProps { - host: match node_params.host.try_into() { - Ok(vec) => vec, - Err(_) => return Err(NodeError::CDNHostLenExceedsLimit), - }, - http_port: node_params.http_port, - grpc_port: node_params.grpc_port, - p2p_port: node_params.p2p_port, - }, - })), - _ => Err(NodeError::InvalidCDNNodeParams), - }, - _ => Err(NodeError::InvalidCDNNodePubKey), - } - } } diff --git a/pallets/ddc-nodes/src/lib.rs b/pallets/ddc-nodes/src/lib.rs index f0e881f7f..c655feb53 100644 --- a/pallets/ddc-nodes/src/lib.rs +++ b/pallets/ddc-nodes/src/lib.rs @@ -15,6 +15,7 @@ #![recursion_limit = "256"] use ddc_primitives::{CDNNodePubKey, ClusterId, NodePubKey, StorageNodePubKey}; +use ddc_traits::node::{NodeVisitor, NodeVisitorError}; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; use sp_std::prelude::*; @@ -83,8 +84,8 @@ pub mod pallet { ) -> DispatchResult { let caller_id = ensure_signed(origin)?; let node = Node::::new(node_pub_key.clone(), caller_id, node_params) - .map_err(|e| Into::>::into(NodeError::from(e)))?; - Self::create(node).map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + .map_err(Into::>::into)?; + Self::create(node).map_err(Into::>::into)?; Self::deposit_event(Event::::NodeCreated { node_pub_key }); Ok(()) } @@ -92,12 +93,10 @@ pub mod pallet { #[pallet::weight(10_000)] pub fn delete_node(origin: OriginFor, node_pub_key: NodePubKey) -> DispatchResult { let caller_id = ensure_signed(origin)?; - let node = Self::get(node_pub_key.clone()) - .map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + let node = Self::get(node_pub_key.clone()).map_err(Into::>::into)?; ensure!(node.get_provider_id() == &caller_id, Error::::OnlyNodeProvider); ensure!(node.get_cluster_id().is_none(), Error::::NodeIsAssignedToCluster); - Self::delete(node_pub_key.clone()) - .map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + Self::delete(node_pub_key.clone()).map_err(Into::>::into)?; Self::deposit_event(Event::::NodeDeleted { node_pub_key }); Ok(()) } @@ -109,12 +108,10 @@ pub mod pallet { node_params: NodeParams, ) -> DispatchResult { let caller_id = ensure_signed(origin)?; - let mut node = Self::get(node_pub_key.clone()) - .map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + let mut node = Self::get(node_pub_key.clone()).map_err(Into::>::into)?; ensure!(node.get_provider_id() == &caller_id, Error::::OnlyNodeProvider); - node.set_params(node_params) - .map_err(|e| Into::>::into(NodeError::from(e)))?; - Self::update(node).map_err(|e| Into::>::into(NodeRepositoryError::from(e)))?; + node.set_params(node_params).map_err(Into::>::into)?; + Self::update(node).map_err(Into::>::into)?; Self::deposit_event(Event::::NodeParamsChanged { node_pub_key }); Ok(()) } @@ -209,4 +206,14 @@ pub mod pallet { } } } + + impl NodeVisitor for Pallet { + fn get_cluster_id( + node_pub_key: &NodePubKey, + ) -> Result, NodeVisitorError> { + let node = + Self::get(node_pub_key.clone()).map_err(|_| NodeVisitorError::NodeDoesNotExist)?; + Ok(*node.get_cluster_id()) + } + } } diff --git a/pallets/ddc-nodes/src/node.rs b/pallets/ddc-nodes/src/node.rs index 25ab35f44..042d13be3 100644 --- a/pallets/ddc-nodes/src/node.rs +++ b/pallets/ddc-nodes/src/node.rs @@ -1,3 +1,5 @@ +#![allow(clippy::needless_lifetimes)] // ToDo + use crate::{ cdn_node::{CDNNode, CDNNodeParams, CDNNodeProps}, pallet::Error, @@ -5,7 +7,7 @@ use crate::{ ClusterId, }; use codec::{Decode, Encode}; -use ddc_primitives::{CDNNodePubKey, NodePubKey, NodeType, StorageNodePubKey}; +use ddc_primitives::{NodePubKey, NodeType}; use scale_info::TypeInfo; use sp_runtime::RuntimeDebug; @@ -29,47 +31,34 @@ pub enum NodeProps { CDNProps(CDNNodeProps), } -#[derive(Clone, RuntimeDebug, PartialEq)] -pub enum NodePubKeyRef<'a> { - StoragePubKeyRef(&'a StorageNodePubKey), - CDNPubKeyRef(&'a CDNNodePubKey), -} - -impl<'a> NodePubKeyRef<'a> { - pub fn to_owned(&self) -> NodePubKey { - match &self { - NodePubKeyRef::StoragePubKeyRef(pub_key_ref) => - NodePubKey::StoragePubKey((**pub_key_ref).clone()), - NodePubKeyRef::CDNPubKeyRef(pub_key_ref) => - NodePubKey::CDNPubKey((**pub_key_ref).clone()), - } - } -} - -#[derive(Clone, RuntimeDebug, PartialEq)] -pub enum NodePropsRef<'a> { - StoragePropsRef(&'a StorageNodeProps), - CDNPropsRef(&'a CDNNodeProps), -} - pub trait NodeTrait { - fn get_pub_key<'a>(&'a self) -> NodePubKeyRef<'a>; + fn get_pub_key(&self) -> NodePubKey; fn get_provider_id(&self) -> &T::AccountId; - fn get_props<'a>(&'a self) -> NodePropsRef<'a>; + fn get_props(&self) -> NodeProps; fn set_props(&mut self, props: NodeProps) -> Result<(), NodeError>; fn set_params(&mut self, props: NodeParams) -> Result<(), NodeError>; fn get_cluster_id(&self) -> &Option; fn set_cluster_id(&mut self, cluster_id: Option); fn get_type(&self) -> NodeType; - fn new( +} + +impl Node { + pub fn new( node_pub_key: NodePubKey, provider_id: T::AccountId, - params: NodeParams, - ) -> Result, NodeError>; + node_params: NodeParams, + ) -> Result { + match node_pub_key { + NodePubKey::StoragePubKey(_) => + StorageNode::new(node_pub_key, provider_id, node_params).map(|n| Node::Storage(n)), + NodePubKey::CDNPubKey(_) => + CDNNode::new(node_pub_key, provider_id, node_params).map(|n| Node::CDN(n)), + } + } } impl NodeTrait for Node { - fn get_pub_key<'a>(&'a self) -> NodePubKeyRef<'a> { + fn get_pub_key(&self) -> NodePubKey { match &self { Node::Storage(node) => node.get_pub_key(), Node::CDN(node) => node.get_pub_key(), @@ -81,7 +70,7 @@ impl NodeTrait for Node { Node::CDN(node) => node.get_provider_id(), } } - fn get_props<'a>(&'a self) -> NodePropsRef<'a> { + fn get_props(&self) -> NodeProps { match &self { Node::Storage(node) => node.get_props(), Node::CDN(node) => node.get_props(), @@ -117,17 +106,6 @@ impl NodeTrait for Node { Node::CDN(node) => node.get_type(), } } - fn new( - node_pub_key: NodePubKey, - provider_id: T::AccountId, - node_params: NodeParams, - ) -> Result, NodeError> { - match node_pub_key { - NodePubKey::StoragePubKey(_) => - StorageNode::new(node_pub_key, provider_id, node_params), - NodePubKey::CDNPubKey(_) => CDNNode::new(node_pub_key, provider_id, node_params), - } - } } pub enum NodeError { diff --git a/pallets/ddc-nodes/src/storage_node.rs b/pallets/ddc-nodes/src/storage_node.rs index 578afeb09..902739771 100644 --- a/pallets/ddc-nodes/src/storage_node.rs +++ b/pallets/ddc-nodes/src/storage_node.rs @@ -1,4 +1,4 @@ -use crate::node::{Node, NodeError, NodeParams, NodeProps, NodePropsRef, NodePubKeyRef, NodeTrait}; +use crate::node::{NodeError, NodeParams, NodeProps, NodeTrait}; use codec::{Decode, Encode}; use ddc_primitives::{ClusterId, NodePubKey, NodeType, StorageNodePubKey}; use frame_support::{parameter_types, BoundedVec}; @@ -36,15 +36,44 @@ pub struct StorageNodeParams { pub p2p_port: u16, } +impl StorageNode { + pub fn new( + node_pub_key: NodePubKey, + provider_id: T::AccountId, + node_params: NodeParams, + ) -> Result { + match node_pub_key { + NodePubKey::StoragePubKey(pub_key) => match node_params { + NodeParams::StorageParams(node_params) => Ok(StorageNode:: { + provider_id, + pub_key, + cluster_id: None, + props: StorageNodeProps { + host: match node_params.host.try_into() { + Ok(vec) => vec, + Err(_) => return Err(NodeError::StorageHostLenExceedsLimit), + }, + http_port: node_params.http_port, + grpc_port: node_params.grpc_port, + p2p_port: node_params.p2p_port, + }, + }), + _ => Err(NodeError::InvalidStorageNodeParams), + }, + _ => Err(NodeError::InvalidStorageNodePubKey), + } + } +} + impl NodeTrait for StorageNode { - fn get_pub_key<'a>(&'a self) -> NodePubKeyRef<'a> { - NodePubKeyRef::StoragePubKeyRef(&self.pub_key) + fn get_pub_key(&self) -> NodePubKey { + NodePubKey::StoragePubKey(self.pub_key.clone()) } fn get_provider_id(&self) -> &T::AccountId { &self.provider_id } - fn get_props<'a>(&'a self) -> NodePropsRef<'a> { - NodePropsRef::StoragePropsRef(&self.props) + fn get_props(&self) -> NodeProps { + NodeProps::StorageProps(self.props.clone()) } fn set_props(&mut self, props: NodeProps) -> Result<(), NodeError> { self.props = match props { @@ -77,30 +106,4 @@ impl NodeTrait for StorageNode { fn get_type(&self) -> NodeType { NodeType::Storage } - fn new( - node_pub_key: NodePubKey, - provider_id: T::AccountId, - node_params: NodeParams, - ) -> Result, NodeError> { - match node_pub_key { - NodePubKey::StoragePubKey(pub_key) => match node_params { - NodeParams::StorageParams(node_params) => Ok(Node::Storage(StorageNode:: { - provider_id, - pub_key, - cluster_id: None, - props: StorageNodeProps { - host: match node_params.host.try_into() { - Ok(vec) => vec, - Err(_) => return Err(NodeError::StorageHostLenExceedsLimit), - }, - http_port: node_params.http_port, - grpc_port: node_params.grpc_port, - p2p_port: node_params.p2p_port, - }, - })), - _ => Err(NodeError::InvalidStorageNodeParams), - }, - _ => Err(NodeError::InvalidStorageNodePubKey), - } - } } diff --git a/pallets/ddc-staking/Cargo.toml b/pallets/ddc-staking/Cargo.toml index 9fbcc154e..0f9c57433 100644 --- a/pallets/ddc-staking/Cargo.toml +++ b/pallets/ddc-staking/Cargo.toml @@ -10,11 +10,9 @@ ddc-traits = { version = "0.1.0", default-features = false, path = "../../traits frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } [dev-dependencies] @@ -35,7 +33,6 @@ std = [ "scale-info/std", "sp-io/std", "sp-runtime/std", - "sp-staking/std", "sp-std/std", ] runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] diff --git a/pallets/ddc-staking/src/benchmarking.rs b/pallets/ddc-staking/src/benchmarking.rs index d682ec9c0..6353e4a5d 100644 --- a/pallets/ddc-staking/src/benchmarking.rs +++ b/pallets/ddc-staking/src/benchmarking.rs @@ -5,7 +5,7 @@ use crate::Pallet as DdcStaking; use ddc_primitives::{CDNNodePubKey, NodeType}; use testing_utils::*; -use frame_support::traits::{Currency, Get}; +use frame_support::traits::Currency; use sp_runtime::traits::StaticLookup; use sp_std::prelude::*; @@ -91,7 +91,7 @@ benchmarks! { assert!(CDNs::::contains_key(&cdn_stash)); frame_system::Pallet::::set_block_number(T::BlockNumber::from(1u32)); DdcStaking::::chill(RawOrigin::Signed(cdn_controller.clone()).into())?; - frame_system::Pallet::::set_block_number(T::BlockNumber::from(1u32) + T::ClusterVisitor::get_chill_delay(&ClusterId::from([1; 20]), NodeType::CDN).unwrap_or(T::BlockNumber::from(10u32))); + frame_system::Pallet::::set_block_number(T::BlockNumber::from(1u32) + T::ClusterVisitor::get_chill_delay(&ClusterId::from([1; 20]), NodeType::CDN).unwrap_or_else(|_| T::BlockNumber::from(10u32))); whitelist_account!(cdn_controller); }: _(RawOrigin::Signed(cdn_controller)) diff --git a/pallets/ddc-staking/src/lib.rs b/pallets/ddc-staking/src/lib.rs index fbc82d69b..9c8469785 100644 --- a/pallets/ddc-staking/src/lib.rs +++ b/pallets/ddc-staking/src/lib.rs @@ -32,6 +32,7 @@ use codec::{Decode, Encode, HasCompact}; pub use ddc_primitives::{ClusterId, NodePubKey, NodeType}; use ddc_traits::{ cluster::{ClusterVisitor, ClusterVisitorError}, + node::NodeVisitor, staking::{StakingVisitor, StakingVisitorError}, }; @@ -157,6 +158,8 @@ pub mod pallet { type WeightInfo: WeightInfo; type ClusterVisitor: ClusterVisitor; + + type NodeVisitor: NodeVisitor; } /// Map from all locked "stash" accounts to the controller account. @@ -187,9 +190,16 @@ pub mod pallet { #[pallet::getter(fn nodes)] pub type Nodes = StorageMap<_, Twox64Concat, NodePubKey, T::AccountId>; + /// Map from operator stash account to DDC node ID. + #[pallet::storage] + #[pallet::getter(fn providers)] + pub type Providers = StorageMap<_, Twox64Concat, T::AccountId, NodePubKey>; + #[pallet::genesis_config] pub struct GenesisConfig { + #[allow(clippy::type_complexity)] pub cdns: Vec<(T::AccountId, T::AccountId, NodePubKey, BalanceOf, ClusterId)>, + #[allow(clippy::type_complexity)] pub storages: Vec<(T::AccountId, T::AccountId, NodePubKey, BalanceOf, ClusterId)>, } @@ -206,7 +216,7 @@ pub mod pallet { // Add initial CDN participants for &(ref stash, ref controller, ref node, balance, cluster) in &self.cdns { assert!( - T::Currency::free_balance(&stash) >= balance, + T::Currency::free_balance(stash) >= balance, "Stash do not have enough balance to participate in CDN." ); assert_ok!(Pallet::::bond( @@ -224,7 +234,7 @@ pub mod pallet { // Add initial storage network participants for &(ref stash, ref controller, ref node, balance, cluster) in &self.storages { assert!( - T::Currency::free_balance(&stash) >= balance, + T::Currency::free_balance(stash) >= balance, "Stash do not have enough balance to participate in storage network." ); assert_ok!(Pallet::::bond( @@ -330,13 +340,14 @@ pub mod pallet { } // Reject a bond with a known DDC node. - if Nodes::::contains_key(&node) { + if Nodes::::contains_key(&node) || Providers::::contains_key(&stash) { Err(Error::::AlreadyPaired)? } frame_system::Pallet::::inc_consumers(&stash).map_err(|_| Error::::BadState)?; Nodes::::insert(&node, &stash); + Providers::::insert(&stash, &node); // You're auto-bonded forever, here. We might improve this by only bonding when // you actually store/serve and remove once you unbond __everything__. @@ -400,12 +411,12 @@ pub mod pallet { let min_active_bond = if let Some(cluster_id) = Self::cdns(&ledger.stash) { let bond_size = T::ClusterVisitor::get_bond_size(&cluster_id, NodeType::CDN) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + .map_err(Into::>::into)?; bond_size.saturated_into::>() } else if let Some(cluster_id) = Self::storages(&ledger.stash) { let bond_size = T::ClusterVisitor::get_bond_size(&cluster_id, NodeType::Storage) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + .map_err(Into::>::into)?; bond_size.saturated_into::>() } else { Zero::zero() @@ -418,12 +429,29 @@ pub mod pallet { let unbonding_delay_in_blocks = if let Some(cluster_id) = Self::cdns(&ledger.stash) { T::ClusterVisitor::get_unbonding_delay(&cluster_id, NodeType::CDN) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))? + .map_err(Into::>::into)? } else if let Some(cluster_id) = Self::storages(&ledger.stash) { T::ClusterVisitor::get_unbonding_delay(&cluster_id, NodeType::Storage) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))? + .map_err(Into::>::into)? } else { - T::BlockNumber::from(100_00u32) + let node_pub_key = + >::get(&ledger.stash).ok_or(Error::::BadState)?; + + if let Ok(Some(cluster_id)) = T::NodeVisitor::get_cluster_id(&node_pub_key) { + match node_pub_key { + NodePubKey::CDNPubKey(_) => + T::ClusterVisitor::get_unbonding_delay(&cluster_id, NodeType::CDN) + .map_err(Into::>::into)?, + NodePubKey::StoragePubKey(_) => T::ClusterVisitor::get_unbonding_delay( + &cluster_id, + NodeType::Storage, + ) + .map_err(Into::>::into)?, + } + } else { + // If node is not a member of any cluster, allow immediate unbonding. + T::BlockNumber::from(0u32) + } }; let block = >::block_number() + unbonding_delay_in_blocks; @@ -500,13 +528,12 @@ pub mod pallet { pub fn serve(origin: OriginFor, cluster_id: ClusterId) -> DispatchResult { let controller = ensure_signed(origin)?; - T::ClusterVisitor::ensure_cluster(&cluster_id) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + T::ClusterVisitor::ensure_cluster(&cluster_id).map_err(Into::>::into)?; let ledger = Self::ledger(&controller).ok_or(Error::::NotController)?; // Retrieve the respective bond size from Cluster Visitor let bond_size = T::ClusterVisitor::get_bond_size(&cluster_id, NodeType::CDN) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + .map_err(Into::>::into)?; ensure!( ledger.active >= bond_size.saturated_into::>(), @@ -515,10 +542,10 @@ pub mod pallet { let stash = &ledger.stash; // Can't participate in CDN if already participating in storage network. - ensure!(!Storages::::contains_key(&stash), Error::::AlreadyInRole); + ensure!(!Storages::::contains_key(stash), Error::::AlreadyInRole); // Is it an attempt to cancel a previous "chill"? - if let Some(current_cluster) = Self::cdns(&stash) { + if let Some(current_cluster) = Self::cdns(stash) { // Switching the cluster is prohibited. The user should chill first. ensure!(current_cluster == cluster_id, Error::::AlreadyInRole); // Cancel previous "chill" attempts @@ -541,13 +568,12 @@ pub mod pallet { pub fn store(origin: OriginFor, cluster_id: ClusterId) -> DispatchResult { let controller = ensure_signed(origin)?; - T::ClusterVisitor::ensure_cluster(&cluster_id) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + T::ClusterVisitor::ensure_cluster(&cluster_id).map_err(Into::>::into)?; let ledger = Self::ledger(&controller).ok_or(Error::::NotController)?; // Retrieve the respective bond size from Cluster Visitor let bond_size = T::ClusterVisitor::get_bond_size(&cluster_id, NodeType::Storage) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + .map_err(Into::>::into)?; ensure!( ledger.active >= bond_size.saturated_into::>(), Error::::InsufficientBond @@ -555,10 +581,10 @@ pub mod pallet { let stash = &ledger.stash; // Can't participate in storage network if already participating in CDN. - ensure!(!CDNs::::contains_key(&stash), Error::::AlreadyInRole); + ensure!(!CDNs::::contains_key(stash), Error::::AlreadyInRole); // Is it an attempt to cancel a previous "chill"? - if let Some(current_cluster) = Self::storages(&stash) { + if let Some(current_cluster) = Self::storages(stash) { // Switching the cluster is prohibited. The user should chill first. ensure!(current_cluster == cluster_id, Error::::AlreadyInRole); // Cancel previous "chill" attempts @@ -596,12 +622,11 @@ pub mod pallet { // Extract delay from the cluster settings. let (cluster, delay) = if let Some(cluster) = Self::cdns(&ledger.stash) { let chill_delay = T::ClusterVisitor::get_chill_delay(&cluster, NodeType::CDN) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + .map_err(Into::>::into)?; (cluster, chill_delay) } else if let Some(cluster) = Self::storages(&ledger.stash) { - let chill_delay = - T::ClusterVisitor::get_chill_delay(&cluster, NodeType::Storage) - .map_err(|e| Into::>::into(ClusterVisitorError::from(e)))?; + let chill_delay = T::ClusterVisitor::get_chill_delay(&cluster, NodeType::Storage) + .map_err(Into::>::into)?; (cluster, chill_delay) } else { return Ok(()) // already chilled @@ -679,7 +704,8 @@ pub mod pallet { ensure!(!>::contains_key(&stash), Error::::AlreadyInRole); ensure!(!>::contains_key(&stash), Error::::AlreadyInRole); - >::insert(new_node, stash); + >::insert(new_node.clone(), stash.clone()); + >::insert(stash, new_node); Ok(()) } @@ -688,15 +714,16 @@ pub mod pallet { /// /// The dispatch origin for this call must be _Signed_ by the controller. #[pallet::weight(10_000)] - pub fn fast_chill(origin: OriginFor, node_pub_key: NodePubKey) -> DispatchResult { + pub fn fast_chill(origin: OriginFor) -> DispatchResult { let controller = ensure_signed(origin)?; let stash = >::get(&controller).ok_or(Error::::NotController)?.stash; + let node_pub_key = >::get(&stash).ok_or(Error::::BadState)?; let node_stash = >::get(&node_pub_key).ok_or(Error::::BadState)?; ensure!(stash == node_stash, Error::::NotNodeController); let cluster_id = >::get(&stash) - .or(>::get(&stash)) + .or_else(|| >::get(&stash)) .ok_or(Error::::NodeHasNoStake)?; let is_cluster_node = T::ClusterVisitor::cluster_has_node(&cluster_id, &node_pub_key); @@ -743,7 +770,7 @@ pub mod pallet { cluster: ClusterId, can_chill_from: T::BlockNumber, ) { - Ledger::::mutate(&controller, |maybe_ledger| { + Ledger::::mutate(controller, |maybe_ledger| { if let Some(ref mut ledger) = maybe_ledger { ledger.chilling = Some(can_chill_from) } @@ -764,9 +791,9 @@ pub mod pallet { >::remove(stash); >::remove(&controller); - if let Some((node, _)) = >::iter().find(|(_, v)| v == stash) { - >::remove(node); - } + if let Some(node_pub_key) = >::take(stash) { + >::remove(node_pub_key); + }; Self::do_remove_storage(stash); Self::do_remove_cdn(stash); @@ -806,7 +833,7 @@ pub mod pallet { /// Reset the chilling block for a controller. pub fn reset_chilling(controller: &T::AccountId) { - Ledger::::mutate(&controller, |maybe_ledger| { + Ledger::::mutate(controller, |maybe_ledger| { if let Some(ref mut ledger) = maybe_ledger { ledger.chilling = None } @@ -820,7 +847,7 @@ pub mod pallet { cluster_id: &ClusterId, ) -> Result { let stash = - >::get(&node_pub_key).ok_or(StakingVisitorError::NodeStakeDoesNotExist)?; + >::get(node_pub_key).ok_or(StakingVisitorError::NodeStakeDoesNotExist)?; let maybe_cdn_in_cluster = CDNs::::get(&stash); let maybe_storage_in_cluster = Storages::::get(&stash); @@ -833,7 +860,7 @@ pub mod pallet { fn node_is_chilling(node_pub_key: &NodePubKey) -> Result { let stash = - >::get(&node_pub_key).ok_or(StakingVisitorError::NodeStakeDoesNotExist)?; + >::get(node_pub_key).ok_or(StakingVisitorError::NodeStakeDoesNotExist)?; let controller = >::get(&stash).ok_or(StakingVisitorError::NodeStakeIsInBadState)?; diff --git a/pallets/ddc-staking/src/mock.rs b/pallets/ddc-staking/src/mock.rs index 041a719a3..549653b92 100644 --- a/pallets/ddc-staking/src/mock.rs +++ b/pallets/ddc-staking/src/mock.rs @@ -4,7 +4,11 @@ use crate::{self as pallet_ddc_staking, *}; use ddc_primitives::{CDNNodePubKey, StorageNodePubKey}; -use ddc_traits::cluster::{ClusterVisitor, ClusterVisitorError}; +use ddc_traits::{ + cluster::{ClusterVisitor, ClusterVisitorError}, + node::{NodeVisitor, NodeVisitorError}, +}; + use frame_support::{ construct_runtime, traits::{ConstU32, ConstU64, Everything, GenesisBuild}, @@ -96,6 +100,7 @@ impl crate::pallet::Config for Test { type RuntimeEvent = RuntimeEvent; type WeightInfo = (); type ClusterVisitor = TestClusterVisitor; + type NodeVisitor = TestNodeVisitor; } pub(crate) type DdcStakingCall = crate::Call; @@ -127,6 +132,14 @@ impl ClusterVisitor for TestClusterVisitor { Ok(T::BlockNumber::from(10u32)) } } + +pub struct TestNodeVisitor; +impl NodeVisitor for TestNodeVisitor { + fn get_cluster_id(_node_pub_key: &NodePubKey) -> Result, NodeVisitorError> { + Ok(None) + } +} + pub struct ExtBuilder { has_cdns: bool, has_storages: bool, @@ -251,7 +264,7 @@ impl ExtBuilder { TestExternalities::new(storage) } - pub fn build_and_execute(self, test: impl FnOnce() -> ()) { + pub fn build_and_execute(self, test: impl FnOnce()) { sp_tracing::try_init_simple(); let mut ext = self.build(); ext.execute_with(test); diff --git a/pallets/ddc-staking/src/testing_utils.rs b/pallets/ddc-staking/src/testing_utils.rs index 05f2a2bda..58e6b656b 100644 --- a/pallets/ddc-staking/src/testing_utils.rs +++ b/pallets/ddc-staking/src/testing_utils.rs @@ -60,7 +60,7 @@ pub fn create_stash_controller_node( node.clone(), amount, )?; - return Ok((stash, controller, node)) + Ok((stash, controller, node)) } /// Create a stash and controller pair with fixed balance. diff --git a/pallets/ddc-staking/src/tests.rs b/pallets/ddc-staking/src/tests.rs index 10f325b46..37d971bca 100644 --- a/pallets/ddc-staking/src/tests.rs +++ b/pallets/ddc-staking/src/tests.rs @@ -1,11 +1,9 @@ //! Tests for the module. use super::{mock::*, *}; -use ddc_primitives::{CDNNodePubKey, NodeType}; -use ddc_traits::cluster::{ClusterVisitor, ClusterVisitorError}; -use frame_support::{ - assert_noop, assert_ok, assert_storage_noop, error::BadOrigin, traits::ReservableCurrency, -}; +use ddc_primitives::CDNNodePubKey; + +use frame_support::{assert_noop, assert_ok, traits::ReservableCurrency}; use pallet_balances::Error as BalancesError; pub const BLOCK_TIME: u64 = 1000; @@ -113,7 +111,7 @@ fn staking_should_work() { assert_ok!(DdcStaking::chill(RuntimeOrigin::signed(4))); // Removal is scheduled, stashed value of 4 is still lock. - let chilling = System::block_number() + BlockNumber::from(10u64); + let chilling = System::block_number() + 10u64; // TestClusterVisitor::get_chill_delay(&ClusterId::from([1; 20]), NodeType::CDN) // .unwrap_or(10_u64); assert_eq!( diff --git a/pallets/ddc-staking/src/weights.rs b/pallets/ddc-staking/src/weights.rs index 969385330..efca88632 100644 --- a/pallets/ddc-staking/src/weights.rs +++ b/pallets/ddc-staking/src/weights.rs @@ -46,9 +46,9 @@ impl WeightInfo for SubstrateWeight { // Storage: DdcStaking Nodes (r:1 w:1) // Storage: Balances Locks (r:1 w:1) fn bond() -> Weight { - Weight::from_ref_time(55_007_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(4 as u64)) + Weight::from_ref_time(55_007_000_u64) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CDNs (r:1 w:0) @@ -57,36 +57,36 @@ impl WeightInfo for SubstrateWeight { // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn unbond() -> Weight { - Weight::from_ref_time(47_727_000 as u64) - .saturating_add(T::DbWeight::get().reads(6 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + Weight::from_ref_time(47_727_000_u64) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CurrentEra (r:1 w:0) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn withdraw_unbonded() -> Weight { - Weight::from_ref_time(69_750_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + Weight::from_ref_time(69_750_000_u64) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } // Storage: DdcStaking Ledger (r:1 w:0) // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking CDNs (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:1) fn store() -> Weight { - Weight::from_ref_time(26_112_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_ref_time(26_112_000_u64) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } // Storage: DdcStaking Ledger (r:1 w:0) // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) // Storage: DdcStaking CDNs (r:1 w:1) fn serve() -> Weight { - Weight::from_ref_time(19_892_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_ref_time(19_892_000_u64) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CurrentEra (r:1 w:0) @@ -94,22 +94,22 @@ impl WeightInfo for SubstrateWeight { // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) fn chill() -> Weight { - Weight::from_ref_time(77_450_000 as u64) - .saturating_add(T::DbWeight::get().reads(5 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + Weight::from_ref_time(77_450_000_u64) + .saturating_add(T::DbWeight::get().reads(5_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } // Storage: DdcStaking Bonded (r:1 w:1) // Storage: DdcStaking Ledger (r:2 w:2) fn set_controller() -> Weight { - Weight::from_ref_time(38_521_000 as u64) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) + Weight::from_ref_time(38_521_000_u64) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) } // Storage: DdcStaking Nodes (r:1 w:1) fn set_node() -> Weight { - Weight::from_ref_time(21_779_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_ref_time(21_779_000_u64) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } @@ -120,9 +120,9 @@ impl WeightInfo for () { // Storage: DdcStaking Nodes (r:1 w:1) // Storage: Balances Locks (r:1 w:1) fn bond() -> Weight { - Weight::from_ref_time(55_007_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(4 as u64)) + Weight::from_ref_time(55_007_000_u64) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CDNs (r:1 w:0) @@ -131,36 +131,36 @@ impl WeightInfo for () { // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn unbond() -> Weight { - Weight::from_ref_time(47_727_000 as u64) - .saturating_add(RocksDbWeight::get().reads(6 as u64)) - .saturating_add(RocksDbWeight::get().writes(3 as u64)) + Weight::from_ref_time(47_727_000_u64) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CurrentEra (r:1 w:0) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn withdraw_unbonded() -> Weight { - Weight::from_ref_time(69_750_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(3 as u64)) + Weight::from_ref_time(69_750_000_u64) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } // Storage: DdcStaking Ledger (r:1 w:0) // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking CDNs (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:1) fn store() -> Weight { - Weight::from_ref_time(26_112_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_ref_time(26_112_000_u64) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } // Storage: DdcStaking Ledger (r:1 w:0) // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) // Storage: DdcStaking CDNs (r:1 w:1) fn serve() -> Weight { - Weight::from_ref_time(19_892_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_ref_time(19_892_000_u64) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CurrentEra (r:1 w:0) @@ -168,21 +168,21 @@ impl WeightInfo for () { // Storage: DdcStaking Settings (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) fn chill() -> Weight { - Weight::from_ref_time(77_450_000 as u64) - .saturating_add(RocksDbWeight::get().reads(5 as u64)) - .saturating_add(RocksDbWeight::get().writes(2 as u64)) + Weight::from_ref_time(77_450_000_u64) + .saturating_add(RocksDbWeight::get().reads(5_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } // Storage: DdcStaking Bonded (r:1 w:1) // Storage: DdcStaking Ledger (r:2 w:2) fn set_controller() -> Weight { - Weight::from_ref_time(38_521_000 as u64) - .saturating_add(RocksDbWeight::get().reads(3 as u64)) - .saturating_add(RocksDbWeight::get().writes(3 as u64)) + Weight::from_ref_time(38_521_000_u64) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } // Storage: DdcStaking Nodes (r:1 w:1) fn set_node() -> Weight { - Weight::from_ref_time(21_779_000 as u64) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_ref_time(21_779_000_u64) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } } diff --git a/pallets/ddc/Cargo.toml b/pallets/ddc/Cargo.toml index 9c89014d1..f25de5056 100644 --- a/pallets/ddc/Cargo.toml +++ b/pallets/ddc/Cargo.toml @@ -1,13 +1,13 @@ [package] +name = 'pallet-cere-ddc' +version = '4.8.1' authors = ['Substrate DevHub '] -description = 'FRAME pallet template for defining custom runtime logic.' edition = '2021' homepage = 'https://www.cere.network/' license = 'Unlicense' -name = 'pallet-cere-ddc' -repository = 'https://github.com/Cerebellum-Network/ddc-pallet' -version = '4.8.1' readme = 'README.md' +repository = 'https://github.com/Cerebellum-Network/ddc-pallet' +description = 'FRAME pallet template for defining custom runtime logic.' [package.metadata.docs.rs] targets = ['x86_64-unknown-linux-gnu'] @@ -16,22 +16,25 @@ targets = ['x86_64-unknown-linux-gnu'] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } [dev-dependencies] -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } serde = { version = "1.0.101" } +sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } [features] default = ['std'] std = [ - 'codec/std', - 'sp-io/std', - 'sp-std/std', - 'sp-runtime/std', - 'frame-support/std', - 'frame-system/std', + 'codec/std', + 'sp-io/std', + 'sp-std/std', + 'sp-runtime/std', + 'frame-support/std', + 'frame-system/std', ] + +[package.metadata.cargo-machete] +ignored = ["scale-info", "codec"] diff --git a/pallets/ddc/src/lib.rs b/pallets/ddc/src/lib.rs index e1d572af6..c7bdc1d73 100644 --- a/pallets/ddc/src/lib.rs +++ b/pallets/ddc/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::all)] #![cfg_attr(not(feature = "std"), no_std)] use frame_support::{ @@ -96,10 +97,10 @@ decl_module! { ensure!(data.len() >= T::MinLength::get(), Error::::TooShort); ensure!(data.len() <= T::MaxLength::get(), Error::::TooLong); - if let Some(_) = >::get(&sender) { - Self::deposit_event(RawEvent::DataStringChanged(sender.clone())); + if >::get(&sender).is_some() { + Self::deposit_event(RawEvent::DataStringChanged(sender)); } else { - Self::deposit_event(RawEvent::DataStringSet(sender.clone())); + Self::deposit_event(RawEvent::DataStringSet(sender)); }; >::insert(send_to, data); diff --git a/pallets/erc20/Cargo.toml b/pallets/erc20/Cargo.toml index 6cce2c8d4..580ba103f 100644 --- a/pallets/erc20/Cargo.toml +++ b/pallets/erc20/Cargo.toml @@ -3,47 +3,44 @@ name = "pallet-erc20" version = "4.8.1" authors = ["Parity Technologies "] edition = "2021" -license = "Unlicense" homepage = "https://substrate.dev" +license = "Unlicense" +readme = "README.md" repository = "https://github.com/paritytech/substrate/" description = "FRAME example pallet" -readme = "README.md" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } -sp-arithmetic = { version = "5.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } pallet-chainbridge = { version = "4.2.0", default-features = false, path = "../chainbridge" } pallet-erc721 = { version = "4.2.0", default-features = false, path = "../erc721" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } - -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } +sp-arithmetic = { version = "5.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } +sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } [features] default = ["std"] std = [ - "serde", - "codec/std", - "sp-runtime/std", - "frame-benchmarking/std", - "frame-support/std", - "frame-system/std", - "pallet-balances/std", - "sp-io/std", - "sp-std/std", - "sp-core/std", - "sp-arithmetic/std", - "pallet-chainbridge/std", - "pallet-erc721/std" + "codec/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", + "pallet-balances/std", + "sp-io/std", + "sp-std/std", + "sp-core/std", + "sp-arithmetic/std", + "pallet-chainbridge/std", + "pallet-erc721/std", ] -runtime-benchmarks = ["frame-benchmarking"] + +[package.metadata.cargo-machete] +ignored = ["scale-info"] diff --git a/pallets/erc20/src/lib.rs b/pallets/erc20/src/lib.rs index a9474ae2f..8e7967ed6 100644 --- a/pallets/erc20/src/lib.rs +++ b/pallets/erc20/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::all)] // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] @@ -81,7 +82,7 @@ decl_module! { let source = ensure_signed(origin)?; ensure!(>::chain_whitelisted(dest_id), Error::::InvalidTransfer); let bridge_id = >::account_id(); - T::Currency::transfer(&source, &bridge_id, amount.into(), AllowDeath)?; + T::Currency::transfer(&source, &bridge_id, amount, AllowDeath)?; let resource_id = T::NativeTokenId::get(); let number_amount: u128 = amount.saturated_into(); @@ -95,7 +96,7 @@ decl_module! { pub fn transfer_erc721(origin, recipient: Vec, token_id: U256, dest_id: bridge::ChainId) -> DispatchResult { let source = ensure_signed(origin)?; ensure!(>::chain_whitelisted(dest_id), Error::::InvalidTransfer); - match >::tokens(&token_id) { + match >::tokens(token_id) { Some(token) => { >::burn_token(source, token_id)?; let resource_id = T::Erc721Id::get(); @@ -115,7 +116,7 @@ decl_module! { #[weight = 195_000_000] pub fn transfer(origin, to: T::AccountId, amount: BalanceOf) -> DispatchResult { let source = T::BridgeOrigin::ensure_origin(origin)?; - ::Currency::transfer(&source, &to, amount.into(), AllowDeath)?; + ::Currency::transfer(&source, &to, amount, AllowDeath)?; Ok(()) } diff --git a/pallets/erc721/Cargo.toml b/pallets/erc721/Cargo.toml index 3f586f103..08e9b531a 100644 --- a/pallets/erc721/Cargo.toml +++ b/pallets/erc721/Cargo.toml @@ -3,43 +3,37 @@ name = "pallet-erc721" version = "4.8.1" authors = ["Parity Technologies "] edition = "2021" -license = "Unlicense" homepage = "https://substrate.dev" +license = "Unlicense" +readme = "README.md" repository = "https://github.com/paritytech/substrate/" description = "FRAME example pallet" -readme = "README.md" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies] -serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false,git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } pallet-chainbridge = { version = "4.2.0", default-features = false, path = "../chainbridge" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } - -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } +sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } [features] default = ["std"] std = [ - "serde", - "codec/std", - "sp-runtime/std", - "frame-benchmarking/std", - "frame-support/std", - "frame-system/std", - "pallet-balances/std", - "sp-io/std", - "sp-std/std", - "sp-core/std", - "pallet-chainbridge/std" + "codec/std", + "sp-runtime/std", + "frame-support/std", + "frame-system/std", + "pallet-balances/std", + "sp-io/std", + "sp-std/std", + "sp-core/std", + "pallet-chainbridge/std", ] -runtime-benchmarks = ["frame-benchmarking"] diff --git a/pallets/erc721/src/lib.rs b/pallets/erc721/src/lib.rs index c5b7244d7..638dc864a 100644 --- a/pallets/erc721/src/lib.rs +++ b/pallets/erc721/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::all)] // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] @@ -113,8 +114,8 @@ impl Module { let new_token = Erc721Token { id, metadata }; - ::insert(&id, new_token); - >::insert(&id, owner.clone()); + ::insert(id, new_token); + >::insert(id, owner.clone()); let new_total = ::get().saturating_add(U256::one()); ::put(new_total); @@ -129,7 +130,7 @@ impl Module { let owner = Self::owner_of(id).ok_or(Error::::TokenIdDoesNotExist)?; ensure!(owner == from, Error::::NotOwner); // Update owner - >::insert(&id, to.clone()); + >::insert(id, to.clone()); Self::deposit_event(RawEvent::Transferred(from, to, id)); @@ -141,8 +142,8 @@ impl Module { let owner = Self::owner_of(id).ok_or(Error::::TokenIdDoesNotExist)?; ensure!(owner == from, Error::::NotOwner); - ::remove(&id); - >::remove(&id); + ::remove(id); + >::remove(id); let new_total = ::get().saturating_sub(U256::one()); ::put(new_total); diff --git a/pallets/erc721/src/tests.rs b/pallets/erc721/src/tests.rs index f273f83a3..9fa6cde1b 100644 --- a/pallets/erc721/src/tests.rs +++ b/pallets/erc721/src/tests.rs @@ -22,7 +22,7 @@ fn mint_burn_tokens() { ); assert_eq!(Erc721::token_count(), 1.into()); assert_noop!( - Erc721::mint(RuntimeOrigin::root(), USER_A, id_a, metadata_a.clone()), + Erc721::mint(RuntimeOrigin::root(), USER_A, id_a, metadata_a), Error::::TokenAlreadyExists ); @@ -33,19 +33,19 @@ fn mint_burn_tokens() { ); assert_eq!(Erc721::token_count(), 2.into()); assert_noop!( - Erc721::mint(RuntimeOrigin::root(), USER_A, id_b, metadata_b.clone()), + Erc721::mint(RuntimeOrigin::root(), USER_A, id_b, metadata_b), Error::::TokenAlreadyExists ); assert_ok!(Erc721::burn(RuntimeOrigin::root(), id_a)); assert_eq!(Erc721::token_count(), 1.into()); - assert!(!::contains_key(&id_a)); - assert!(!>::contains_key(&id_a)); + assert!(!::contains_key(id_a)); + assert!(!>::contains_key(id_a)); assert_ok!(Erc721::burn(RuntimeOrigin::root(), id_b)); assert_eq!(Erc721::token_count(), 0.into()); - assert!(!::contains_key(&id_b)); - assert!(!>::contains_key(&id_b)); + assert!(!::contains_key(id_b)); + assert!(!>::contains_key(id_b)); }) } @@ -57,8 +57,8 @@ fn transfer_tokens() { let metadata_a: Vec = vec![1, 2, 3]; let metadata_b: Vec = vec![4, 5, 6]; - assert_ok!(Erc721::mint(RuntimeOrigin::root(), USER_A, id_a, metadata_a.clone())); - assert_ok!(Erc721::mint(RuntimeOrigin::root(), USER_A, id_b, metadata_b.clone())); + assert_ok!(Erc721::mint(RuntimeOrigin::root(), USER_A, id_a, metadata_a)); + assert_ok!(Erc721::mint(RuntimeOrigin::root(), USER_A, id_b, metadata_b)); assert_ok!(Erc721::transfer(RuntimeOrigin::signed(USER_A), USER_B, id_a)); assert_eq!(Erc721::owner_of(id_a).unwrap(), USER_B); diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 2656e5487..a7b80e589 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -13,10 +13,10 @@ sp-runtime = { version = "6.0.0", default-features = false, git = "https://githu [features] default = ["std"] std = [ - "codec/std", - "scale-info/std", - "serde", - "sp-core/std", - "sp-runtime/std", + "codec/std", + "scale-info/std", + "serde", + "sp-core/std", + "sp-runtime/std", ] runtime-benchmarks = [] diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 0ec6c6924..7ac05a660 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -6,11 +6,11 @@ use scale_info::TypeInfo; use serde::{Deserialize, Serialize}; use sp_core::hash::H160; use sp_runtime::{AccountId32, RuntimeDebug}; - pub type ClusterId = H160; pub type DdcEra = u32; pub type BucketId = u64; - +pub type StorageNodePubKey = AccountId32; +pub type CDNNodePubKey = AccountId32; #[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo, PartialEq)] pub struct ClusterPricingParams { pub unit_per_mb_stored: u128, @@ -25,9 +25,6 @@ pub enum NodePubKey { CDNPubKey(CDNNodePubKey), } -pub type StorageNodePubKey = AccountId32; -pub type CDNNodePubKey = AccountId32; - #[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo, PartialEq)] pub enum NodeType { Storage = 1, diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index e037f35f4..92f3e9a6f 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -5,26 +5,26 @@ edition = "2021" [dependencies] jsonrpsee = { version = "0.15.1", features = ["server"] } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-keystore = { version = "0.12.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-contracts-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-consensus-babe-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-consensus-epochs = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sc-finality-grandpa-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sc-sync-state-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-keystore = { version = "0.12.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } substrate-state-trie-migration-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-contracts-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } diff --git a/runtime/cere-dev/Cargo.toml b/runtime/cere-dev/Cargo.toml index 43ad73ca1..88c42e493 100644 --- a/runtime/cere-dev/Cargo.toml +++ b/runtime/cere-dev/Cargo.toml @@ -2,51 +2,49 @@ name = "cere-dev-runtime" version = "4.8.1" authors = ["Parity Technologies "] -edition = "2021" build = "build.rs" -license = "Apache-2.0" +edition = "2021" homepage = "https://substrate.io" +license = "Apache-2.0" repository = "https://github.com/paritytech/substrate/" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies] - # third-party dependencies -codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = [ - "derive", - "max-encoded-len", -] } -scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -static_assertions = "1.1.0" +codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.3.4", optional = true } log = { version = "0.4.16", default-features = false } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +static_assertions = "1.1.0" # primitives +node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-block-builder = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, version = "4.0.0-dev" } +sp-consensus-babe = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } # frame dependencies -frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +cere-dev-runtime-constants = { path = "./constants", default-features = false } +cere-runtime-common = { path = "../common", default-features = false } frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } +frame-election-provider-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -frame-election-provider-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-try-runtime = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } pallet-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -55,56 +53,53 @@ pallet-babe = { version = "4.0.0-dev", default-features = false, git = "https:// pallet-bags-list = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-cere-ddc = { version = "4.8.1", default-features = false, path = "../../pallets/ddc" } +pallet-chainbridge = { version = "4.8.1", default-features = false, path = "../../pallets/chainbridge" } pallet-child-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-collective = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-contracts-primitives = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-ddc-clusters = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-clusters" } +pallet-ddc-customers = { version = "0.1.0", default-features = false, path = "../../pallets/ddc-customers" } +pallet-ddc-metrics-offchain-worker = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } +pallet-ddc-nodes = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-nodes" } +pallet-ddc-staking = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-staking" } pallet-democracy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-election-provider-multi-phase = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-election-provider-support-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } pallet-elections-phragmen = { version = "5.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-fast-unstake = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +pallet-erc20 = { version = "4.8.1", default-features = false, path = "../../pallets/erc20" } +pallet-erc721 = { version = "4.8.1", default-features = false, path = "../../pallets/erc721" } +pallet-fast-unstake = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } pallet-grandpa = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-identity = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-im-online = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-indices = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-identity = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-membership = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-multisig = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.30" } +pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } +pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.30" } +pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } pallet-offences = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-offences-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, optional = true } pallet-proxy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-recovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-session = { version = "4.0.0-dev", features = [ "historical" ], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } +pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-session = { version = "4.0.0-dev", features = ["historical"], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } pallet-session-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, optional = true } +pallet-society = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-society = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-tips = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-transaction-storage = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-vesting = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -cere-runtime-common = { path = "../common", default-features = false } -cere-dev-runtime-constants = { path = "./constants", default-features = false } -pallet-ddc-staking = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-staking" } -pallet-chainbridge = { version = "4.8.1", default-features = false, path = "../../pallets/chainbridge" } -pallet-cere-ddc = { version = "4.8.1", default-features = false, path = "../../pallets/ddc" } -pallet-ddc-customers = { version = "0.1.0", default-features = false, path = "../../pallets/ddc-customers" } -pallet-erc721 = { version = "4.8.1", default-features = false, path = "../../pallets/erc721" } -pallet-erc20 = { version = "4.8.1", default-features = false, path = "../../pallets/erc20" } -pallet-ddc-metrics-offchain-worker = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } -pallet-ddc-nodes = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-nodes" } -pallet-ddc-clusters = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-clusters" } pallet-ddc-payouts = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-payouts" } [build-dependencies] @@ -191,83 +186,82 @@ std = [ "pallet-ddc-payouts/std", ] runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "pallet-babe/runtime-benchmarks", - "pallet-bags-list/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-bounties/runtime-benchmarks", - "pallet-chainbridge/runtime-benchmarks", - "pallet-child-bounties/runtime-benchmarks", - "pallet-collective/runtime-benchmarks", - "pallet-contracts/runtime-benchmarks", - "pallet-democracy/runtime-benchmarks", - "pallet-election-provider-multi-phase/runtime-benchmarks", - "pallet-election-provider-support-benchmarking/runtime-benchmarks", - "pallet-elections-phragmen/runtime-benchmarks", - "pallet-fast-unstake/runtime-benchmarks", - "pallet-grandpa/runtime-benchmarks", - "pallet-identity/runtime-benchmarks", - "pallet-im-online/runtime-benchmarks", - "pallet-indices/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", - "pallet-nomination-pools/runtime-benchmarks", - "pallet-nomination-pools-benchmarking/runtime-benchmarks", - "pallet-offences-benchmarking/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "pallet-session-benchmarking/runtime-benchmarks", - "pallet-society/runtime-benchmarks", - "pallet-staking/runtime-benchmarks", - "pallet-ddc-staking/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-tips/runtime-benchmarks", - "pallet-treasury/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-vesting/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "hex-literal", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "pallet-babe/runtime-benchmarks", + "pallet-bags-list/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-bounties/runtime-benchmarks", + "pallet-child-bounties/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-contracts/runtime-benchmarks", + "pallet-democracy/runtime-benchmarks", + "pallet-election-provider-multi-phase/runtime-benchmarks", + "pallet-election-provider-support-benchmarking/runtime-benchmarks", + "pallet-elections-phragmen/runtime-benchmarks", + "pallet-fast-unstake/runtime-benchmarks", + "pallet-grandpa/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", + "pallet-im-online/runtime-benchmarks", + "pallet-indices/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-nomination-pools/runtime-benchmarks", + "pallet-nomination-pools-benchmarking/runtime-benchmarks", + "pallet-offences-benchmarking/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-session-benchmarking/runtime-benchmarks", + "pallet-society/runtime-benchmarks", + "pallet-staking/runtime-benchmarks", + "pallet-ddc-staking/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "hex-literal", ] try-runtime = [ - "frame-executive/try-runtime", - "frame-try-runtime", - "frame-system/try-runtime", - "pallet-authority-discovery/try-runtime", - "pallet-authorship/try-runtime", - "pallet-babe/try-runtime", - "pallet-bags-list/try-runtime", - "pallet-balances/try-runtime", - "pallet-bounties/try-runtime", - "pallet-child-bounties/try-runtime", - "pallet-collective/try-runtime", - "pallet-contracts/try-runtime", - "pallet-democracy/try-runtime", - "pallet-election-provider-multi-phase/try-runtime", - "pallet-elections-phragmen/try-runtime", - "pallet-fast-unstake/try-runtime", - "pallet-grandpa/try-runtime", - "pallet-identity/try-runtime", - "pallet-im-online/try-runtime", - "pallet-indices/try-runtime", - "pallet-membership/try-runtime", - "pallet-multisig/try-runtime", - "pallet-nomination-pools/try-runtime", - "pallet-offences/try-runtime", - "pallet-proxy/try-runtime", - "pallet-randomness-collective-flip/try-runtime", - "pallet-recovery/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-session/try-runtime", - "pallet-society/try-runtime", - "pallet-staking/try-runtime", - "pallet-sudo/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-tips/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-treasury/try-runtime", - "pallet-utility/try-runtime", - "pallet-vesting/try-runtime", + "frame-executive/try-runtime", + "frame-try-runtime", + "frame-system/try-runtime", + "pallet-authority-discovery/try-runtime", + "pallet-authorship/try-runtime", + "pallet-babe/try-runtime", + "pallet-bags-list/try-runtime", + "pallet-balances/try-runtime", + "pallet-bounties/try-runtime", + "pallet-child-bounties/try-runtime", + "pallet-collective/try-runtime", + "pallet-contracts/try-runtime", + "pallet-democracy/try-runtime", + "pallet-election-provider-multi-phase/try-runtime", + "pallet-elections-phragmen/try-runtime", + "pallet-fast-unstake/try-runtime", + "pallet-grandpa/try-runtime", + "pallet-identity/try-runtime", + "pallet-im-online/try-runtime", + "pallet-indices/try-runtime", + "pallet-membership/try-runtime", + "pallet-multisig/try-runtime", + "pallet-nomination-pools/try-runtime", + "pallet-offences/try-runtime", + "pallet-proxy/try-runtime", + "pallet-randomness-collective-flip/try-runtime", + "pallet-recovery/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-society/try-runtime", + "pallet-staking/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-tips/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-vesting/try-runtime", ] diff --git a/runtime/cere-dev/constants/Cargo.toml b/runtime/cere-dev/constants/Cargo.toml index 5fdb89737..d42c6c5b2 100644 --- a/runtime/cere-dev/constants/Cargo.toml +++ b/runtime/cere-dev/constants/Cargo.toml @@ -6,10 +6,9 @@ edition = "2021" [dependencies] node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } [features] default = ["std"] std = [ - "sp-runtime/std" + "node-primitives/std", ] diff --git a/runtime/cere-dev/src/impls.rs b/runtime/cere-dev/src/impls.rs index c576e8d31..3e725dca7 100644 --- a/runtime/cere-dev/src/impls.rs +++ b/runtime/cere-dev/src/impls.rs @@ -98,7 +98,7 @@ mod multiplier_tests { fn run_with_system_weight(w: Weight, assertions: F) where - F: Fn() -> (), + F: Fn(), { let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() .build_storage::() @@ -114,12 +114,12 @@ mod multiplier_tests { fn truth_value_update_poc_works() { let fm = Multiplier::saturating_from_rational(1, 2); let test_set = vec![ - (0, fm.clone()), - (100, fm.clone()), - (1000, fm.clone()), - (target().ref_time(), fm.clone()), - (max_normal().ref_time() / 2, fm.clone()), - (max_normal().ref_time(), fm.clone()), + (0, fm), + (100, fm), + (1000, fm), + (target().ref_time(), fm), + (max_normal().ref_time() / 2, fm), + (max_normal().ref_time(), fm), ]; test_set.into_iter().for_each(|(w, fm)| { run_with_system_weight(Weight::from_ref_time(w), || { @@ -325,7 +325,7 @@ mod multiplier_tests { #[test] fn weight_to_fee_should_not_overflow_on_large_weights() { - let kb = 1024 as u64; + let kb = 1024_u64; let mb = kb * kb; let max_fm = Multiplier::saturating_from_integer(i128::MAX); diff --git a/runtime/cere-dev/src/lib.rs b/runtime/cere-dev/src/lib.rs index dcac54c46..b2486b6f6 100644 --- a/runtime/cere-dev/src/lib.rs +++ b/runtime/cere-dev/src/lib.rs @@ -130,7 +130,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 48012, + spec_version: 48013, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 5, @@ -406,7 +406,7 @@ impl pallet_indices::Config for Runtime { } parameter_types! { - pub const ExistentialDeposit: Balance = 1 * DOLLARS; + pub const ExistentialDeposit: Balance = DOLLARS; // For weight estimation, we assume that the most locks on an individual account will be 50. // This number may need to be adjusted in the future if this assumption no longer holds true. pub const MaxLocks: u32 = 50; @@ -566,9 +566,9 @@ parameter_types! { pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; // signed config - pub const SignedRewardBase: Balance = 1 * DOLLARS; - pub const SignedDepositBase: Balance = 1 * DOLLARS; - pub const SignedDepositByte: Balance = 1 * CENTS; + pub const SignedRewardBase: Balance = DOLLARS; + pub const SignedDepositBase: Balance = DOLLARS; + pub const SignedDepositByte: Balance = CENTS; pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(1u32, 10_000); @@ -723,11 +723,11 @@ impl pallet_bags_list::Config for Runtime { } parameter_types! { - pub const LaunchPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; - pub const VotingPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; + pub const LaunchPeriod: BlockNumber = 24 * 60 * MINUTES; + pub const VotingPeriod: BlockNumber = 24 * 60 * MINUTES; pub const FastTrackVotingPeriod: BlockNumber = 3 * 60 * MINUTES; pub const MinimumDeposit: Balance = 50_000 * DOLLARS; - pub const EnactmentPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; + pub const EnactmentPeriod: BlockNumber = 24 * 60 * MINUTES; pub const CooloffPeriod: BlockNumber = 7 * 24 * 60 * MINUTES; pub const MaxProposals: u32 = 100; } @@ -805,7 +805,7 @@ parameter_types! { pub const CandidacyBond: Balance = 5_000_000 * DOLLARS; // 1 storage item created, key size is 32 bytes, value size is 16+16. pub const VotingBondBase: Balance = deposit(1, 64); - pub const VotingBondFactor: Balance = 1 * DOLLARS; + pub const VotingBondFactor: Balance = DOLLARS; pub const TermDuration: BlockNumber = 182 * DAYS; pub const DesiredMembers: u32 = 13; pub const DesiredRunnersUp: u32 = 20; @@ -877,12 +877,12 @@ impl pallet_membership::Config for Runtime { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const ProposalBondMinimum: Balance = 50_000 * DOLLARS; - pub const SpendPeriod: BlockNumber = 1 * DAYS; + pub const SpendPeriod: BlockNumber = DAYS; pub const Burn: Permill = Permill::from_percent(0); - pub const TipCountdown: BlockNumber = 1 * DAYS; + pub const TipCountdown: BlockNumber = DAYS; pub const TipFindersFee: Percent = Percent::from_percent(20); pub const TipReportDepositBase: Balance = 50_000 * DOLLARS; - pub const DataDepositPerByte: Balance = 1 * DOLLARS; + pub const DataDepositPerByte: Balance = DOLLARS; pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); pub const MaximumReasonLength: u32 = 16384; pub const MaxApprovals: u32 = 100; @@ -918,7 +918,7 @@ parameter_types! { pub const BountyValueMinimum: Balance = 10 * DOLLARS; pub const BountyDepositBase: Balance = 50_000 * DOLLARS; pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); - pub const CuratorDepositMin: Balance = 1 * DOLLARS; + pub const CuratorDepositMin: Balance = DOLLARS; pub const CuratorDepositMax: Balance = 100 * DOLLARS; pub const BountyDepositPayoutDelay: BlockNumber = 8 * DAYS; pub const BountyUpdatePeriod: BlockNumber = 90 * DAYS; @@ -940,7 +940,7 @@ impl pallet_bounties::Config for Runtime { } parameter_types! { - pub const ChildBountyValueMinimum: Balance = 1 * DOLLARS; + pub const ChildBountyValueMinimum: Balance = DOLLARS; } impl pallet_child_bounties::Config for Runtime { @@ -1193,7 +1193,7 @@ impl pallet_society::Config for Runtime { } parameter_types! { - pub const MinVestedTransfer: Balance = 1 * DOLLARS; + pub const MinVestedTransfer: Balance = DOLLARS; } impl pallet_vesting::Config for Runtime { @@ -1321,6 +1321,7 @@ impl pallet_ddc_staking::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_ddc_staking::weights::SubstrateWeight; type ClusterVisitor = pallet_ddc_clusters::Pallet; + type NodeVisitor = pallet_ddc_nodes::Pallet; } parameter_types! { @@ -1911,8 +1912,8 @@ mod tests { fn call_size() { let size = core::mem::size_of::(); assert!( - size <= 208, - "size of RuntimeCall {} is more than 208 bytes: some calls have too big arguments, use Box to reduce the + size <= 256, + "size of RuntimeCall {} is more than 256 bytes: some calls have too big arguments, use Box to reduce the size of RuntimeCall. If the limit is too strong, maybe consider increase the limit to 300.", size, diff --git a/runtime/cere/Cargo.toml b/runtime/cere/Cargo.toml index 59a2668cd..95cfa8a4b 100644 --- a/runtime/cere/Cargo.toml +++ b/runtime/cere/Cargo.toml @@ -2,51 +2,49 @@ name = "cere-runtime" version = "4.8.1" authors = ["Parity Technologies "] -edition = "2021" build = "build.rs" -license = "Apache-2.0" +edition = "2021" homepage = "https://substrate.io" +license = "Apache-2.0" repository = "https://github.com/paritytech/substrate/" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies] - # third-party dependencies -codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = [ - "derive", - "max-encoded-len", -] } -scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -static_assertions = "1.1.0" +codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.3.4", optional = true } log = { version = "0.4.16", default-features = false } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +static_assertions = "1.1.0" # primitives +node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-block-builder = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, version = "4.0.0-dev" } +sp-consensus-babe = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } # frame dependencies -frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +cere-runtime-common = { path = "../common", default-features = false } +cere-runtime-constants = { path = "./constants", default-features = false } frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } +frame-election-provider-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -frame-election-provider-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } frame-try-runtime = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } pallet-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -55,52 +53,49 @@ pallet-babe = { version = "4.0.0-dev", default-features = false, git = "https:// pallet-bags-list = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-cere-ddc = { version = "4.8.1", default-features = false, path = "../../pallets/ddc" } +pallet-chainbridge = { version = "4.8.1", default-features = false, path = "../../pallets/chainbridge" } pallet-child-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-collective = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-contracts-primitives = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-ddc-metrics-offchain-worker = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } pallet-democracy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-election-provider-multi-phase = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-election-provider-support-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } pallet-elections-phragmen = { version = "5.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-fast-unstake = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +pallet-erc20 = { version = "4.8.1", default-features = false, path = "../../pallets/erc20" } +pallet-erc721 = { version = "4.8.1", default-features = false, path = "../../pallets/erc721" } +pallet-fast-unstake = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } pallet-grandpa = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-identity = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-im-online = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-indices = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-identity = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-membership = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-multisig = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.30" } +pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } +pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.30" } +pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } pallet-offences = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-offences-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, optional = true } pallet-proxy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-recovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-session = { version = "4.0.0-dev", features = [ "historical" ], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } +pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-session = { version = "4.0.0-dev", features = ["historical"], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } pallet-session-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, optional = true } +pallet-society = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-society = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-tips = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-transaction-storage = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } pallet-vesting = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -cere-runtime-common = { path = "../common", default-features = false } -cere-runtime-constants = { path = "./constants", default-features = false } -pallet-chainbridge = { version = "4.8.1", default-features = false, path = "../../pallets/chainbridge" } -pallet-cere-ddc = { version = "4.8.1", default-features = false, path = "../../pallets/ddc" } -pallet-erc721 = { version = "4.8.1", default-features = false, path = "../../pallets/erc721" } -pallet-erc20 = { version = "4.8.1", default-features = false, path = "../../pallets/erc20" } -pallet-ddc-metrics-offchain-worker = { version = "4.8.1", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } [build-dependencies] substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } @@ -109,154 +104,153 @@ substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/pari default = ["std"] with-tracing = ["frame-executive/with-tracing"] std = [ - "sp-authority-discovery/std", - "pallet-authority-discovery/std", - "pallet-authorship/std", - "sp-consensus-babe/std", - "pallet-babe/std", - "pallet-bags-list/std", - "pallet-balances/std", - "pallet-bounties/std", - "sp-block-builder/std", - "codec/std", - "scale-info/std", - "pallet-collective/std", - "pallet-contracts/std", - "pallet-contracts-primitives/std", - "pallet-contracts-rpc-runtime-api/std", - "pallet-democracy/std", - "pallet-fast-unstake/std", - "pallet-elections-phragmen/std", - "frame-executive/std", - "pallet-cere-ddc/std", - "pallet-chainbridge/std", - "pallet-erc721/std", - "pallet-erc20/std", - "pallet-grandpa/std", - "pallet-im-online/std", - "pallet-indices/std", - "sp-inherents/std", - "pallet-membership/std", - "pallet-multisig/std", - "pallet-nomination-pools/std", - "pallet-nomination-pools-runtime-api/std", - "pallet-identity/std", - "pallet-scheduler/std", - "node-primitives/std", - "sp-offchain/std", - "pallet-offences/std", - "pallet-proxy/std", - "sp-core/std", - "pallet-randomness-collective-flip/std", - "sp-std/std", - "pallet-session/std", - "sp-api/std", - "sp-runtime/std", - "sp-staking/std", - "pallet-staking/std", - "sp-session/std", - "pallet-sudo/std", - "frame-support/std", - "frame-benchmarking/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "pallet-election-provider-multi-phase/std", - "pallet-timestamp/std", - "pallet-tips/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-treasury/std", - "sp-transaction-pool/std", - "pallet-utility/std", - "sp-version/std", - "pallet-society/std", - "pallet-recovery/std", - "pallet-vesting/std", - "log/std", - "frame-try-runtime/std", - "sp-io/std", - "pallet-child-bounties/std", - "pallet-ddc-metrics-offchain-worker/std", - "cere-runtime-common/std", - "cere-runtime-constants/std" + "sp-authority-discovery/std", + "pallet-authority-discovery/std", + "pallet-authorship/std", + "sp-consensus-babe/std", + "pallet-babe/std", + "pallet-bags-list/std", + "pallet-balances/std", + "pallet-bounties/std", + "sp-block-builder/std", + "codec/std", + "scale-info/std", + "pallet-collective/std", + "pallet-contracts/std", + "pallet-contracts-primitives/std", + "pallet-contracts-rpc-runtime-api/std", + "pallet-democracy/std", + "pallet-fast-unstake/std", + "pallet-elections-phragmen/std", + "frame-executive/std", + "pallet-cere-ddc/std", + "pallet-chainbridge/std", + "pallet-erc721/std", + "pallet-erc20/std", + "pallet-grandpa/std", + "pallet-im-online/std", + "pallet-indices/std", + "sp-inherents/std", + "pallet-membership/std", + "pallet-multisig/std", + "pallet-nomination-pools/std", + "pallet-nomination-pools-runtime-api/std", + "pallet-identity/std", + "pallet-scheduler/std", + "node-primitives/std", + "sp-offchain/std", + "pallet-offences/std", + "pallet-proxy/std", + "sp-core/std", + "pallet-randomness-collective-flip/std", + "sp-std/std", + "pallet-session/std", + "sp-api/std", + "sp-runtime/std", + "sp-staking/std", + "pallet-staking/std", + "sp-session/std", + "pallet-sudo/std", + "frame-support/std", + "frame-benchmarking/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "pallet-election-provider-multi-phase/std", + "pallet-timestamp/std", + "pallet-tips/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-treasury/std", + "sp-transaction-pool/std", + "pallet-utility/std", + "sp-version/std", + "pallet-society/std", + "pallet-recovery/std", + "pallet-vesting/std", + "log/std", + "frame-try-runtime/std", + "sp-io/std", + "pallet-child-bounties/std", + "pallet-ddc-metrics-offchain-worker/std", + "cere-runtime-common/std", + "cere-runtime-constants/std", ] runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "pallet-babe/runtime-benchmarks", - "pallet-bags-list/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-bounties/runtime-benchmarks", - "pallet-chainbridge/runtime-benchmarks", - "pallet-child-bounties/runtime-benchmarks", - "pallet-collective/runtime-benchmarks", - "pallet-contracts/runtime-benchmarks", - "pallet-democracy/runtime-benchmarks", - "pallet-election-provider-multi-phase/runtime-benchmarks", - "pallet-election-provider-support-benchmarking/runtime-benchmarks", - "pallet-elections-phragmen/runtime-benchmarks", - "pallet-fast-unstake/runtime-benchmarks", - "pallet-grandpa/runtime-benchmarks", - "pallet-identity/runtime-benchmarks", - "pallet-im-online/runtime-benchmarks", - "pallet-indices/runtime-benchmarks", - "pallet-membership/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", - "pallet-nomination-pools/runtime-benchmarks", - "pallet-nomination-pools-benchmarking/runtime-benchmarks", - "pallet-offences-benchmarking/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "pallet-session-benchmarking/runtime-benchmarks", - "pallet-society/runtime-benchmarks", - "pallet-staking/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-tips/runtime-benchmarks", - "pallet-treasury/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-vesting/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "hex-literal", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "pallet-babe/runtime-benchmarks", + "pallet-bags-list/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-bounties/runtime-benchmarks", + "pallet-child-bounties/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-contracts/runtime-benchmarks", + "pallet-democracy/runtime-benchmarks", + "pallet-election-provider-multi-phase/runtime-benchmarks", + "pallet-election-provider-support-benchmarking/runtime-benchmarks", + "pallet-elections-phragmen/runtime-benchmarks", + "pallet-fast-unstake/runtime-benchmarks", + "pallet-grandpa/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", + "pallet-im-online/runtime-benchmarks", + "pallet-indices/runtime-benchmarks", + "pallet-membership/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-nomination-pools/runtime-benchmarks", + "pallet-nomination-pools-benchmarking/runtime-benchmarks", + "pallet-offences-benchmarking/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-session-benchmarking/runtime-benchmarks", + "pallet-society/runtime-benchmarks", + "pallet-staking/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-tips/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "hex-literal", ] try-runtime = [ - "frame-executive/try-runtime", - "frame-try-runtime", - "frame-system/try-runtime", - "pallet-authority-discovery/try-runtime", - "pallet-authorship/try-runtime", - "pallet-babe/try-runtime", - "pallet-bags-list/try-runtime", - "pallet-balances/try-runtime", - "pallet-bounties/try-runtime", - "pallet-child-bounties/try-runtime", - "pallet-collective/try-runtime", - "pallet-contracts/try-runtime", - "pallet-democracy/try-runtime", - "pallet-election-provider-multi-phase/try-runtime", - "pallet-elections-phragmen/try-runtime", - "pallet-fast-unstake/try-runtime", - "pallet-grandpa/try-runtime", - "pallet-identity/try-runtime", - "pallet-im-online/try-runtime", - "pallet-indices/try-runtime", - "pallet-membership/try-runtime", - "pallet-multisig/try-runtime", - "pallet-nomination-pools/try-runtime", - "pallet-offences/try-runtime", - "pallet-proxy/try-runtime", - "pallet-randomness-collective-flip/try-runtime", - "pallet-recovery/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-session/try-runtime", - "pallet-society/try-runtime", - "pallet-staking/try-runtime", - "pallet-sudo/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-tips/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-treasury/try-runtime", - "pallet-utility/try-runtime", - "pallet-vesting/try-runtime", + "frame-executive/try-runtime", + "frame-try-runtime", + "frame-system/try-runtime", + "pallet-authority-discovery/try-runtime", + "pallet-authorship/try-runtime", + "pallet-babe/try-runtime", + "pallet-bags-list/try-runtime", + "pallet-balances/try-runtime", + "pallet-bounties/try-runtime", + "pallet-child-bounties/try-runtime", + "pallet-collective/try-runtime", + "pallet-contracts/try-runtime", + "pallet-democracy/try-runtime", + "pallet-election-provider-multi-phase/try-runtime", + "pallet-elections-phragmen/try-runtime", + "pallet-fast-unstake/try-runtime", + "pallet-grandpa/try-runtime", + "pallet-identity/try-runtime", + "pallet-im-online/try-runtime", + "pallet-indices/try-runtime", + "pallet-membership/try-runtime", + "pallet-multisig/try-runtime", + "pallet-nomination-pools/try-runtime", + "pallet-offences/try-runtime", + "pallet-proxy/try-runtime", + "pallet-randomness-collective-flip/try-runtime", + "pallet-recovery/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-society/try-runtime", + "pallet-staking/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-tips/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-vesting/try-runtime", ] diff --git a/runtime/cere/constants/Cargo.toml b/runtime/cere/constants/Cargo.toml index 2188486ef..592358dfa 100644 --- a/runtime/cere/constants/Cargo.toml +++ b/runtime/cere/constants/Cargo.toml @@ -6,10 +6,9 @@ edition = "2021" [dependencies] node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } [features] default = ["std"] std = [ - "sp-runtime/std" + "node-primitives/std", ] diff --git a/runtime/cere/src/impls.rs b/runtime/cere/src/impls.rs index 6895f794e..f1763dea1 100644 --- a/runtime/cere/src/impls.rs +++ b/runtime/cere/src/impls.rs @@ -98,7 +98,7 @@ mod multiplier_tests { fn run_with_system_weight(w: Weight, assertions: F) where - F: Fn() -> (), + F: Fn(), { let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() .build_storage::() @@ -114,12 +114,12 @@ mod multiplier_tests { fn truth_value_update_poc_works() { let fm = Multiplier::saturating_from_rational(1, 2); let test_set = vec![ - (0, fm.clone()), - (100, fm.clone()), - (1000, fm.clone()), - (target().ref_time(), fm.clone()), - (max_normal().ref_time() / 2, fm.clone()), - (max_normal().ref_time(), fm.clone()), + (0, fm), + (100, fm), + (1000, fm), + (target().ref_time(), fm), + (max_normal().ref_time() / 2, fm), + (max_normal().ref_time(), fm), ]; test_set.into_iter().for_each(|(w, fm)| { run_with_system_weight(Weight::from_ref_time(w), || { @@ -325,7 +325,7 @@ mod multiplier_tests { #[test] fn weight_to_fee_should_not_overflow_on_large_weights() { - let kb = 1024 as u64; + let kb = 1024_u64; let mb = kb * kb; let max_fm = Multiplier::saturating_from_integer(i128::MAX); diff --git a/runtime/cere/src/lib.rs b/runtime/cere/src/lib.rs index be5ab085d..f7eef4df6 100644 --- a/runtime/cere/src/lib.rs +++ b/runtime/cere/src/lib.rs @@ -401,7 +401,7 @@ impl pallet_indices::Config for Runtime { } parameter_types! { - pub const ExistentialDeposit: Balance = 1 * DOLLARS; + pub const ExistentialDeposit: Balance = DOLLARS; // For weight estimation, we assume that the most locks on an individual account will be 50. // This number may need to be adjusted in the future if this assumption no longer holds true. pub const MaxLocks: u32 = 50; @@ -562,9 +562,9 @@ parameter_types! { pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; // signed config - pub const SignedRewardBase: Balance = 1 * DOLLARS; - pub const SignedDepositBase: Balance = 1 * DOLLARS; - pub const SignedDepositByte: Balance = 1 * CENTS; + pub const SignedRewardBase: Balance = DOLLARS; + pub const SignedDepositBase: Balance = DOLLARS; + pub const SignedDepositByte: Balance = CENTS; pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(1u32, 10_000); @@ -719,11 +719,11 @@ impl pallet_bags_list::Config for Runtime { } parameter_types! { - pub const LaunchPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; - pub const VotingPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; + pub const LaunchPeriod: BlockNumber = 24 * 60 * MINUTES; + pub const VotingPeriod: BlockNumber = 24 * 60 * MINUTES; pub const FastTrackVotingPeriod: BlockNumber = 3 * 60 * MINUTES; pub const MinimumDeposit: Balance = 50_000 * DOLLARS; - pub const EnactmentPeriod: BlockNumber = 1 * 24 * 60 * MINUTES; + pub const EnactmentPeriod: BlockNumber = 24 * 60 * MINUTES; pub const CooloffPeriod: BlockNumber = 7 * 24 * 60 * MINUTES; pub const MaxProposals: u32 = 100; } @@ -801,7 +801,7 @@ parameter_types! { pub const CandidacyBond: Balance = 5_000_000 * DOLLARS; // 1 storage item created, key size is 32 bytes, value size is 16+16. pub const VotingBondBase: Balance = deposit(1, 64); - pub const VotingBondFactor: Balance = 1 * DOLLARS; + pub const VotingBondFactor: Balance = DOLLARS; pub const TermDuration: BlockNumber = 182 * DAYS; pub const DesiredMembers: u32 = 13; pub const DesiredRunnersUp: u32 = 20; @@ -873,12 +873,12 @@ impl pallet_membership::Config for Runtime { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const ProposalBondMinimum: Balance = 50_000 * DOLLARS; - pub const SpendPeriod: BlockNumber = 1 * DAYS; + pub const SpendPeriod: BlockNumber = DAYS; pub const Burn: Permill = Permill::from_percent(0); - pub const TipCountdown: BlockNumber = 1 * DAYS; + pub const TipCountdown: BlockNumber = DAYS; pub const TipFindersFee: Percent = Percent::from_percent(20); pub const TipReportDepositBase: Balance = 50_000 * DOLLARS; - pub const DataDepositPerByte: Balance = 1 * DOLLARS; + pub const DataDepositPerByte: Balance = DOLLARS; pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); pub const MaximumReasonLength: u32 = 16384; pub const MaxApprovals: u32 = 100; @@ -914,7 +914,7 @@ parameter_types! { pub const BountyValueMinimum: Balance = 10 * DOLLARS; pub const BountyDepositBase: Balance = 50_000 * DOLLARS; pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); - pub const CuratorDepositMin: Balance = 1 * DOLLARS; + pub const CuratorDepositMin: Balance = DOLLARS; pub const CuratorDepositMax: Balance = 100 * DOLLARS; pub const BountyDepositPayoutDelay: BlockNumber = 8 * DAYS; pub const BountyUpdatePeriod: BlockNumber = 90 * DAYS; @@ -936,7 +936,7 @@ impl pallet_bounties::Config for Runtime { } parameter_types! { - pub const ChildBountyValueMinimum: Balance = 1 * DOLLARS; + pub const ChildBountyValueMinimum: Balance = DOLLARS; } impl pallet_child_bounties::Config for Runtime { @@ -1189,7 +1189,7 @@ impl pallet_society::Config for Runtime { } parameter_types! { - pub const MinVestedTransfer: Balance = 1 * DOLLARS; + pub const MinVestedTransfer: Balance = DOLLARS; } impl pallet_vesting::Config for Runtime { @@ -1844,8 +1844,8 @@ mod tests { fn call_size() { let size = core::mem::size_of::(); assert!( - size <= 208, - "size of RuntimeCall {} is more than 208 bytes: some calls have too big arguments, use Box to reduce the + size <= 256, + "size of RuntimeCall {} is more than 256 bytes: some calls have too big arguments, use Box to reduce the size of RuntimeCall. If the limit is too strong, maybe consider increase the limit to 300.", size, diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 15c08df07..5aff0c986 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -10,7 +10,7 @@ no_std = [] std = [] [dependencies] -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } frame-support = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.30" } -sp-core = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.30" } node-primitives = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.30" } +sp-core = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.30" } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 9bcb924a2..7e60322a9 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] channel = "nightly-2022-10-09" -components = [ "rustfmt" ] -targets = [ "wasm32-unknown-unknown" ] +components = ["clippy", "rustfmt"] +targets = ["wasm32-unknown-unknown"] diff --git a/rustfmt.toml b/rustfmt.toml index 441913f61..2797c252b 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -21,3 +21,11 @@ match_block_trailing_comma = true trailing_comma = "Vertical" trailing_semicolon = false use_field_init_shorthand = true + +ignore = [ + "pallets/chainbridge", + "pallets/ddc-metrics-offchain-worker", + "pallets/ddc", + "pallets/erc20", + "pallets/erc721", +] diff --git a/scripts/init.sh b/scripts/init.sh index beca622b2..1472424dc 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -9,3 +9,4 @@ rustup install nightly-2022-10-09 rustup target add wasm32-unknown-unknown --toolchain nightly-2022-10-09 ln -sf $PWD/scripts/pre-commit.sh $PWD/.git/hooks/pre-commit || true +ln -sf $PWD/scripts/pre-push.sh $PWD/.git/hooks/pre-push || true diff --git a/scripts/pre-push.sh b/scripts/pre-push.sh new file mode 100755 index 000000000..9c6679c02 --- /dev/null +++ b/scripts/pre-push.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# Check code with clippy before publishing +cargo clippy --all --all-targets -- -D warnings +if [ $? -ne 0 ]; then + echo "Run \`cargo clippy --fix --all --allow-staged --allow-dirty\` to apply clippy's suggestions." + exit 1 +fi diff --git a/traits/Cargo.toml b/traits/Cargo.toml index cf6f08ee7..aa4110332 100644 --- a/traits/Cargo.toml +++ b/traits/Cargo.toml @@ -4,10 +4,6 @@ version = "0.1.0" edition = "2021" [dependencies] -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } ddc-primitives = { version = "0.1.0", default-features = false, path = "../primitives" } sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } diff --git a/traits/src/lib.rs b/traits/src/lib.rs index b3b4f9787..dc252fc3b 100644 --- a/traits/src/lib.rs +++ b/traits/src/lib.rs @@ -1,5 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] - pub mod cluster; pub mod customer; +pub mod node; pub mod staking; diff --git a/traits/src/node.rs b/traits/src/node.rs new file mode 100644 index 000000000..af22b5a8b --- /dev/null +++ b/traits/src/node.rs @@ -0,0 +1,10 @@ +use ddc_primitives::{ClusterId, NodePubKey}; +use frame_system::Config; + +pub trait NodeVisitor { + fn get_cluster_id(node_pub_key: &NodePubKey) -> Result, NodeVisitorError>; +} + +pub enum NodeVisitorError { + NodeDoesNotExist, +} diff --git a/zombienet/0000-block-building/block-building.toml b/zombienet/0000-block-building/block-building.toml index b9d662117..10b9955de 100644 --- a/zombienet/0000-block-building/block-building.toml +++ b/zombienet/0000-block-building/block-building.toml @@ -2,8 +2,8 @@ default_command = "./target/release/cere" chain = "local" - [[relaychain.nodes]] - name = "alice" +[[relaychain.nodes]] +name = "alice" - [[relaychain.nodes]] - name = "bob" +[[relaychain.nodes]] +name = "bob" diff --git a/zombienet/0001-ddc-validation/ddc-validation.toml b/zombienet/0001-ddc-validation/ddc-validation.toml index 64b4111ed..e5d7ae40a 100644 --- a/zombienet/0001-ddc-validation/ddc-validation.toml +++ b/zombienet/0001-ddc-validation/ddc-validation.toml @@ -3,21 +3,21 @@ default_command = "./target/release/cere" default_args = ["--enable-ddc-validation --dac-url {{DAC_URL}}"] chain = "local" - [[relaychain.nodes]] - name = "alice" +[[relaychain.nodes]] +name = "alice" - [[relaychain.nodes]] - name = "bob" +[[relaychain.nodes]] +name = "bob" - [[relaychain.nodes]] - name = "charlie" +[[relaychain.nodes]] +name = "charlie" - [[relaychain.nodes]] - name = "dave" +[[relaychain.nodes]] +name = "dave" - [[relaychain.nodes]] - name = "eve" +[[relaychain.nodes]] +name = "eve" - [[relaychain.nodes]] - name = "ferdie" - validator = false +[[relaychain.nodes]] +name = "ferdie" +validator = false