From 66719626bbde1609515337b3151dcc2ffe486419 Mon Sep 17 00:00:00 2001 From: Uncle Stretch Date: Thu, 3 Oct 2024 15:38:52 +0300 Subject: [PATCH] inital commit, which is clearly not initial Signed-off-by: Uncle Stretch --- .gitignore | 11 + Cargo.lock | 14095 ++++++++++++++++ Cargo.toml | 379 + LICENSE.md | 1 + README.md | 1 + cli/Cargo.toml | 81 + cli/build.rs | 7 + cli/src/cli.rs | 112 + cli/src/command.rs | 369 + cli/src/error.rs | 46 + cli/src/lib.rs | 19 + client/cli/Cargo.toml | 29 + client/cli/src/commands/generate.rs | 74 + client/cli/src/commands/inspect_key.rs | 253 + client/cli/src/commands/key.rs | 40 + client/cli/src/commands/mod.rs | 11 + client/cli/src/commands/utils.rs | 220 + client/cli/src/commands/vanity.rs | 214 + client/cli/src/lib.rs | 5 + client/cli/src/params/mod.rs | 70 + core-primitives/Cargo.toml | 21 + core-primitives/src/lib.rs | 58 + file_header.txt | 14 + metrics/Cargo.toml | 40 + metrics/src/lib.rs | 47 + metrics/src/metronome.rs | 51 + metrics/src/runtime/mod.rs | 189 + metrics/src/tests.rs | 66 + pallets/claims/Cargo.toml | 74 + pallets/claims/src/benchmarking.rs | 56 + pallets/claims/src/lib.rs | 313 + pallets/claims/src/mock.rs | 221 + pallets/claims/src/secp_utils.rs | 37 + pallets/claims/src/tests.rs | 274 + pallets/claims/src/weights.rs | 9 + pallets/networks/Cargo.toml | 49 + pallets/networks/src/benchmarking.rs | 222 + pallets/networks/src/lib.rs | 538 + pallets/networks/src/mock.rs | 104 + pallets/networks/src/tests.rs | 637 + pallets/networks/src/weights.rs | 325 + pallets/slow-clap/Cargo.toml | 71 + pallets/slow-clap/src/benchmarking.rs | 205 + pallets/slow-clap/src/lib.rs | 1334 ++ pallets/slow-clap/src/mock.rs | 253 + pallets/slow-clap/src/tests.rs | 696 + pallets/slow-clap/src/weights.rs | 18 + pallets/traits/Cargo.toml | 19 + pallets/traits/src/lib.rs | 3 + pallets/traits/src/networks.rs | 29 + primitives/machine/Cargo.toml | 14 + .../machine/src/ghost_node_hardware.json | 22 + primitives/machine/src/lib.rs | 6 + rpc/Cargo.toml | 36 + rpc/src/lib.rs | 145 + runtime/casper/Cargo.toml | 301 + runtime/casper/build.rs | 7 + runtime/casper/constants/Cargo.toml | 30 + runtime/casper/constants/src/lib.rs | 110 + .../constants/src/weights/block_weights.rs | 79 + .../src/weights/extrinsic_weights.rs | 79 + runtime/casper/constants/src/weights/mod.rs | 9 + .../constants/src/weights/paritydb_weights.rs | 83 + .../constants/src/weights/rocksdb_weights.rs | 82 + runtime/casper/src/bag_thresholds.rs | 222 + runtime/casper/src/cult/mod.rs | 164 + runtime/casper/src/cult/origins.rs | 168 + runtime/casper/src/cult/tracks.rs | 377 + runtime/casper/src/genesis_config_presets.rs | 237 + runtime/casper/src/impls.rs | 93 + runtime/casper/src/lib.rs | 1915 +++ .../weights/frame_benchmarking_baseline.rs | 104 + .../frame_election_provider_support.rs | 79 + runtime/casper/src/weights/frame_system.rs | 170 + runtime/casper/src/weights/ghost_claims.rs | 71 + runtime/casper/src/weights/ghost_networks.rs | 191 + runtime/casper/src/weights/ghost_slow_clap.rs | 125 + runtime/casper/src/weights/mod.rs | 28 + runtime/casper/src/weights/pallet_alliance.rs | 483 + runtime/casper/src/weights/pallet_babe.rs | 60 + .../casper/src/weights/pallet_bags_list.rs | 105 + runtime/casper/src/weights/pallet_balances.rs | 173 + runtime/casper/src/weights/pallet_bounties.rs | 63 + .../casper/src/weights/pallet_collective.rs | 297 + .../src/weights/pallet_core_fellowship.rs | 226 + .../pallet_election_provider_multi_phase.rs | 268 + .../casper/src/weights/pallet_fast_unstake.rs | 207 + runtime/casper/src/weights/pallet_grandpa.rs | 71 + runtime/casper/src/weights/pallet_identity.rs | 434 + runtime/casper/src/weights/pallet_indices.rs | 113 + runtime/casper/src/weights/pallet_multisig.rs | 161 + .../src/weights/pallet_nomination_pools.rs | 671 + runtime/casper/src/weights/pallet_preimage.rs | 264 + runtime/casper/src/weights/pallet_proxy.rs | 222 + .../src/weights/pallet_ranked_collective.rs | 198 + .../casper/src/weights/pallet_referenda.rs | 537 + runtime/casper/src/weights/pallet_salary.rs | 153 + .../casper/src/weights/pallet_scheduler.rs | 286 + runtime/casper/src/weights/pallet_session.rs | 81 + runtime/casper/src/weights/pallet_staking.rs | 847 + .../casper/src/weights/pallet_timestamp.rs | 71 + runtime/casper/src/weights/pallet_treasury.rs | 61 + runtime/casper/src/weights/pallet_utility.rs | 98 + runtime/casper/src/weights/pallet_vesting.rs | 261 + .../casper/src/weights/pallet_whitelist.rs | 122 + runtime/common/Cargo.toml | 73 + runtime/common/src/benchmarking.rs | 26 + runtime/common/src/elections.rs | 42 + runtime/common/src/impls.rs | 253 + runtime/common/src/lib.rs | 186 + runtime/common/src/try_runtime.rs | 96 + runtime/common/src/weights/block_weights.rs | 27 + runtime/common/src/weights/extrinsic.rs | 27 + runtime/common/src/weights/mod.rs | 5 + scripts/bags-generator.sh | 42 + scripts/build-only-wasm.sh | 29 + scripts/common.sh | 18 + scripts/header-prefixer.sh | 16 + scripts/prepare-test-net.sh | 48 + scripts/release.sh | 29 + scripts/run-all-benches.sh | 169 + scripts/run-local-network.sh | 16 + scripts/two-node-local-net.sh | 122 + service/Cargo.toml | 134 + service/chain-specs/casper.json | 0 service/src/benchmarking.rs | 204 + service/src/chain_spec.rs | 513 + service/src/lib.rs | 760 + src/main.rs | 17 + tests/benchmark_block.rs | 84 + tests/benchmark_extrinsic.rs | 47 + tests/benchmark_overhead.rs | 50 + tests/benchmark_storage_works.rs | 32 + tests/common.rs | 87 + tests/invalid_order_arguments.rs | 18 + tests/purge_chain_works.rs | 58 + tests/running_the_node_and_interrupt.rs | 52 + utils/bags-list/Cargo.toml | 22 + utils/bags-list/src/main.rs | 84 + utils/chain-spec-builder/Cargo.toml | 21 + utils/chain-spec-builder/bin/main.rs | 103 + utils/chain-spec-builder/build.rs | 7 + utils/chain-spec-builder/src/lib.rs | 196 + utils/generate-bags/Cargo.toml | 16 + utils/generate-bags/src/main.rs | 55 + utils/ghostkey/Cargo.toml | 21 + utils/ghostkey/src/lib.rs | 35 + utils/ghostkey/src/main.rs | 5 + utils/staking-miner/Cargo.toml | 44 + utils/staking-miner/playground/Cargo.toml | 11 + .../staking-miner/playground/node/Cargo.toml | 61 + utils/staking-miner/playground/node/build.rs | 6 + .../playground/node/src/chain_spec.rs | 187 + .../staking-miner/playground/node/src/cli.rs | 42 + .../playground/node/src/command.rs | 108 + .../playground/node/src/command_helper.rs | 111 + .../staking-miner/playground/node/src/lib.rs | 3 + .../staking-miner/playground/node/src/main.rs | 12 + .../staking-miner/playground/node/src/rpc.rs | 49 + .../playground/node/src/service.rs | 350 + .../playground/runtime/Cargo.toml | 90 + .../staking-miner/playground/runtime/build.rs | 7 + .../playground/runtime/src/lib.rs | 794 + .../playground/runtime/src/voter_bags.rs | 441 + utils/staking-miner/src/client.rs | 51 + utils/staking-miner/src/epm.rs | 530 + utils/staking-miner/src/error.rs | 41 + utils/staking-miner/src/helpers.rs | 128 + utils/staking-miner/src/lib.rs | 12 + utils/staking-miner/src/main.rs | 342 + utils/staking-miner/src/opt.rs | 114 + utils/staking-miner/src/prelude.rs | 45 + utils/staking-miner/src/prometheus.rs | 210 + utils/staking-miner/src/signer.rs | 52 + utils/staking-miner/src/static_types.rs | 180 + utils/staking-miner/tests/cli.rs | 36 + utils/staking-miner/tests/common.rs | 215 + utils/staking-miner/tests/monitor.rs | 102 + 178 files changed, 41709 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100755 LICENSE.md create mode 100755 README.md create mode 100755 cli/Cargo.toml create mode 100755 cli/build.rs create mode 100755 cli/src/cli.rs create mode 100755 cli/src/command.rs create mode 100755 cli/src/error.rs create mode 100755 cli/src/lib.rs create mode 100644 client/cli/Cargo.toml create mode 100755 client/cli/src/commands/generate.rs create mode 100755 client/cli/src/commands/inspect_key.rs create mode 100755 client/cli/src/commands/key.rs create mode 100755 client/cli/src/commands/mod.rs create mode 100755 client/cli/src/commands/utils.rs create mode 100755 client/cli/src/commands/vanity.rs create mode 100644 client/cli/src/lib.rs create mode 100644 client/cli/src/params/mod.rs create mode 100755 core-primitives/Cargo.toml create mode 100755 core-primitives/src/lib.rs create mode 100755 file_header.txt create mode 100644 metrics/Cargo.toml create mode 100644 metrics/src/lib.rs create mode 100644 metrics/src/metronome.rs create mode 100644 metrics/src/runtime/mod.rs create mode 100644 metrics/src/tests.rs create mode 100644 pallets/claims/Cargo.toml create mode 100644 pallets/claims/src/benchmarking.rs create mode 100644 pallets/claims/src/lib.rs create mode 100644 pallets/claims/src/mock.rs create mode 100644 pallets/claims/src/secp_utils.rs create mode 100644 pallets/claims/src/tests.rs create mode 100644 pallets/claims/src/weights.rs create mode 100755 pallets/networks/Cargo.toml create mode 100755 pallets/networks/src/benchmarking.rs create mode 100755 pallets/networks/src/lib.rs create mode 100755 pallets/networks/src/mock.rs create mode 100755 pallets/networks/src/tests.rs create mode 100755 pallets/networks/src/weights.rs create mode 100755 pallets/slow-clap/Cargo.toml create mode 100644 pallets/slow-clap/src/benchmarking.rs create mode 100755 pallets/slow-clap/src/lib.rs create mode 100644 pallets/slow-clap/src/mock.rs create mode 100644 pallets/slow-clap/src/tests.rs create mode 100644 pallets/slow-clap/src/weights.rs create mode 100755 pallets/traits/Cargo.toml create mode 100755 pallets/traits/src/lib.rs create mode 100755 pallets/traits/src/networks.rs create mode 100644 primitives/machine/Cargo.toml create mode 100644 primitives/machine/src/ghost_node_hardware.json create mode 100644 primitives/machine/src/lib.rs create mode 100755 rpc/Cargo.toml create mode 100755 rpc/src/lib.rs create mode 100755 runtime/casper/Cargo.toml create mode 100755 runtime/casper/build.rs create mode 100755 runtime/casper/constants/Cargo.toml create mode 100755 runtime/casper/constants/src/lib.rs create mode 100644 runtime/casper/constants/src/weights/block_weights.rs create mode 100644 runtime/casper/constants/src/weights/extrinsic_weights.rs create mode 100644 runtime/casper/constants/src/weights/mod.rs create mode 100644 runtime/casper/constants/src/weights/paritydb_weights.rs create mode 100644 runtime/casper/constants/src/weights/rocksdb_weights.rs create mode 100644 runtime/casper/src/bag_thresholds.rs create mode 100755 runtime/casper/src/cult/mod.rs create mode 100755 runtime/casper/src/cult/origins.rs create mode 100755 runtime/casper/src/cult/tracks.rs create mode 100644 runtime/casper/src/genesis_config_presets.rs create mode 100644 runtime/casper/src/impls.rs create mode 100755 runtime/casper/src/lib.rs create mode 100644 runtime/casper/src/weights/frame_benchmarking_baseline.rs create mode 100644 runtime/casper/src/weights/frame_election_provider_support.rs create mode 100644 runtime/casper/src/weights/frame_system.rs create mode 100644 runtime/casper/src/weights/ghost_claims.rs create mode 100644 runtime/casper/src/weights/ghost_networks.rs create mode 100644 runtime/casper/src/weights/ghost_slow_clap.rs create mode 100644 runtime/casper/src/weights/mod.rs create mode 100644 runtime/casper/src/weights/pallet_alliance.rs create mode 100644 runtime/casper/src/weights/pallet_babe.rs create mode 100644 runtime/casper/src/weights/pallet_bags_list.rs create mode 100644 runtime/casper/src/weights/pallet_balances.rs create mode 100644 runtime/casper/src/weights/pallet_bounties.rs create mode 100644 runtime/casper/src/weights/pallet_collective.rs create mode 100644 runtime/casper/src/weights/pallet_core_fellowship.rs create mode 100644 runtime/casper/src/weights/pallet_election_provider_multi_phase.rs create mode 100644 runtime/casper/src/weights/pallet_fast_unstake.rs create mode 100644 runtime/casper/src/weights/pallet_grandpa.rs create mode 100644 runtime/casper/src/weights/pallet_identity.rs create mode 100644 runtime/casper/src/weights/pallet_indices.rs create mode 100644 runtime/casper/src/weights/pallet_multisig.rs create mode 100644 runtime/casper/src/weights/pallet_nomination_pools.rs create mode 100644 runtime/casper/src/weights/pallet_preimage.rs create mode 100644 runtime/casper/src/weights/pallet_proxy.rs create mode 100644 runtime/casper/src/weights/pallet_ranked_collective.rs create mode 100644 runtime/casper/src/weights/pallet_referenda.rs create mode 100644 runtime/casper/src/weights/pallet_salary.rs create mode 100644 runtime/casper/src/weights/pallet_scheduler.rs create mode 100644 runtime/casper/src/weights/pallet_session.rs create mode 100644 runtime/casper/src/weights/pallet_staking.rs create mode 100644 runtime/casper/src/weights/pallet_timestamp.rs create mode 100644 runtime/casper/src/weights/pallet_treasury.rs create mode 100644 runtime/casper/src/weights/pallet_utility.rs create mode 100644 runtime/casper/src/weights/pallet_vesting.rs create mode 100644 runtime/casper/src/weights/pallet_whitelist.rs create mode 100755 runtime/common/Cargo.toml create mode 100644 runtime/common/src/benchmarking.rs create mode 100644 runtime/common/src/elections.rs create mode 100755 runtime/common/src/impls.rs create mode 100755 runtime/common/src/lib.rs create mode 100644 runtime/common/src/try_runtime.rs create mode 100755 runtime/common/src/weights/block_weights.rs create mode 100755 runtime/common/src/weights/extrinsic.rs create mode 100755 runtime/common/src/weights/mod.rs create mode 100755 scripts/bags-generator.sh create mode 100755 scripts/build-only-wasm.sh create mode 100755 scripts/common.sh create mode 100755 scripts/header-prefixer.sh create mode 100755 scripts/prepare-test-net.sh create mode 100755 scripts/release.sh create mode 100755 scripts/run-all-benches.sh create mode 100755 scripts/run-local-network.sh create mode 100755 scripts/two-node-local-net.sh create mode 100755 service/Cargo.toml create mode 100644 service/chain-specs/casper.json create mode 100644 service/src/benchmarking.rs create mode 100755 service/src/chain_spec.rs create mode 100755 service/src/lib.rs create mode 100755 src/main.rs create mode 100755 tests/benchmark_block.rs create mode 100755 tests/benchmark_extrinsic.rs create mode 100755 tests/benchmark_overhead.rs create mode 100755 tests/benchmark_storage_works.rs create mode 100755 tests/common.rs create mode 100755 tests/invalid_order_arguments.rs create mode 100755 tests/purge_chain_works.rs create mode 100755 tests/running_the_node_and_interrupt.rs create mode 100644 utils/bags-list/Cargo.toml create mode 100644 utils/bags-list/src/main.rs create mode 100644 utils/chain-spec-builder/Cargo.toml create mode 100644 utils/chain-spec-builder/bin/main.rs create mode 100644 utils/chain-spec-builder/build.rs create mode 100644 utils/chain-spec-builder/src/lib.rs create mode 100755 utils/generate-bags/Cargo.toml create mode 100755 utils/generate-bags/src/main.rs create mode 100755 utils/ghostkey/Cargo.toml create mode 100755 utils/ghostkey/src/lib.rs create mode 100755 utils/ghostkey/src/main.rs create mode 100755 utils/staking-miner/Cargo.toml create mode 100644 utils/staking-miner/playground/Cargo.toml create mode 100644 utils/staking-miner/playground/node/Cargo.toml create mode 100644 utils/staking-miner/playground/node/build.rs create mode 100644 utils/staking-miner/playground/node/src/chain_spec.rs create mode 100644 utils/staking-miner/playground/node/src/cli.rs create mode 100644 utils/staking-miner/playground/node/src/command.rs create mode 100644 utils/staking-miner/playground/node/src/command_helper.rs create mode 100644 utils/staking-miner/playground/node/src/lib.rs create mode 100644 utils/staking-miner/playground/node/src/main.rs create mode 100644 utils/staking-miner/playground/node/src/rpc.rs create mode 100644 utils/staking-miner/playground/node/src/service.rs create mode 100644 utils/staking-miner/playground/runtime/Cargo.toml create mode 100644 utils/staking-miner/playground/runtime/build.rs create mode 100644 utils/staking-miner/playground/runtime/src/lib.rs create mode 100755 utils/staking-miner/playground/runtime/src/voter_bags.rs create mode 100644 utils/staking-miner/src/client.rs create mode 100644 utils/staking-miner/src/epm.rs create mode 100644 utils/staking-miner/src/error.rs create mode 100644 utils/staking-miner/src/helpers.rs create mode 100644 utils/staking-miner/src/lib.rs create mode 100755 utils/staking-miner/src/main.rs create mode 100644 utils/staking-miner/src/opt.rs create mode 100644 utils/staking-miner/src/prelude.rs create mode 100644 utils/staking-miner/src/prometheus.rs create mode 100644 utils/staking-miner/src/signer.rs create mode 100644 utils/staking-miner/src/static_types.rs create mode 100755 utils/staking-miner/tests/cli.rs create mode 100644 utils/staking-miner/tests/common.rs create mode 100644 utils/staking-miner/tests/monitor.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ebd90bd --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +debug/ +target/ + +.env* +.idea +.local + + +**/*rs.bk + +*.pdb diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..37a09f1 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,14095 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli 0.27.3", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli 0.28.1", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "adler32" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array 0.14.7", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher 0.4.4", + "cpufeatures", +] + +[[package]] +name = "aes-gcm" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" +dependencies = [ + "aead", + "aes", + "cipher 0.4.4", + "ctr", + "ghash", + "subtle 2.5.0", +] + +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom 0.2.15", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "getrandom 0.2.15", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anstream" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "aquamarine" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21cc1548309245035eb18aa7f0967da6bc65587005170c56e6ef2788a4cf3f4e" +dependencies = [ + "include_dir", + "itertools 0.10.5", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "ark-bls12-377" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb00293ba84f51ce3bd026bd0de55899c4e68f0a39a5728cebae3a73ffdc0a4f" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-bls12-377-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20c7021f180a0cbea0380eba97c2af3c57074cdaffe0eef7e840e1c9f2841e55" +dependencies = [ + "ark-bls12-377", + "ark-ec", + "ark-models-ext", + "ark-std", +] + +[[package]] +name = "ark-bls12-381" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-bls12-381-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1dc4b3d08f19e8ec06e949712f95b8361e43f1391d94f65e4234df03480631c" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-models-ext", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-bw6-761" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e0605daf0cc5aa2034b78d008aaf159f56901d92a52ee4f6ecdfdac4f426700" +dependencies = [ + "ark-bls12-377", + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-bw6-761-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccee5fba47266f460067588ee1bf070a9c760bf2050c1c509982c5719aadb4f2" +dependencies = [ + "ark-bw6-761", + "ark-ec", + "ark-ff", + "ark-models-ext", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "rayon", + "zeroize", +] + +[[package]] +name = "ark-ed-on-bls12-377" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b10d901b9ac4b38f9c32beacedfadcdd64e46f8d7f8e88c1ae1060022cf6f6c6" +dependencies = [ + "ark-bls12-377", + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-ed-on-bls12-377-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524a4fb7540df2e1a8c2e67a83ba1d1e6c3947f4f9342cc2359fc2e789ad731d" +dependencies = [ + "ark-ec", + "ark-ed-on-bls12-377", + "ark-ff", + "ark-models-ext", + "ark-std", +] + +[[package]] +name = "ark-ed-on-bls12-381-bandersnatch" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9cde0f2aa063a2a5c28d39b47761aa102bda7c13c84fc118a61b87c7b2f785c" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-ed-on-bls12-381-bandersnatch-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d15185f1acb49a07ff8cbe5f11a1adc5a93b19e211e325d826ae98e98e124346" +dependencies = [ + "ark-ec", + "ark-ed-on-bls12-381-bandersnatch", + "ark-ff", + "ark-models-ext", + "ark-std", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-models-ext" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e9eab5d4b5ff2f228b763d38442adc9b084b0a465409b059fac5c2308835ec2" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-scale" +version = "0.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f69c00b3b529be29528a6f2fd5fa7b1790f8bed81b9cdca17e326538545a179" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "ark-secret-scalar" +version = "0.0.2" +source = "git+https://github.com/w3f/ring-vrf?rev=e9782f9#e9782f938629c90f3adb3fff2358bc8d1386af3e" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", + "ark-transcript", + "digest 0.10.7", + "getrandom_or_panic", + "zeroize", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand 0.8.5", + "rayon", +] + +[[package]] +name = "ark-transcript" +version = "0.0.2" +source = "git+https://github.com/w3f/ring-vrf?rev=e9782f9#e9782f938629c90f3adb3fff2358bc8d1386af3e" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "digest 0.10.7", + "rand_core 0.6.4", + "sha3", +] + +[[package]] +name = "array-bytes" +version = "6.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5dde061bd34119e902bbb2d9b90c5692635cf59fb91d582c2b68043f1b8293" + +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + +[[package]] +name = "arrayvec" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +dependencies = [ + "nodrop", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "asn1-rs" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure 0.12.6", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "assert_cmd" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed72493ac66d5804837f480ab3766c72bdfab91a65e565fc54fa9e42db0073a8" +dependencies = [ + "anstyle", + "bstr", + "doc-comment", + "predicates 3.1.0", + "predicates-core", + "predicates-tree", + "wait-timeout", +] + +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener 2.5.3", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite 0.2.14", +] + +[[package]] +name = "async-executor" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8828ec6e544c02b0d6691d21ed9f9218d0384a82542855073c2a3f58304aaf0" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "slab", +] + +[[package]] +name = "async-fs" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a" +dependencies = [ + "async-lock", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-io" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6baa8f0178795da0e71bc42c9e5d13261aac7ee549853162e66a241ba17964" +dependencies = [ + "async-lock", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix 0.38.34", + "slab", + "tracing", + "windows-sys 0.52.0", +] + +[[package]] +name = "async-lock" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" +dependencies = [ + "event-listener 5.3.1", + "event-listener-strategy", + "pin-project-lite 0.2.14", +] + +[[package]] +name = "async-net" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7" +dependencies = [ + "async-io", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-process" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7eda79bbd84e29c2b308d1dc099d7de8dcc7035e48f4bf5dc4a531a44ff5e2a" +dependencies = [ + "async-channel 2.3.1", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener 5.3.1", + "futures-lite", + "rustix 0.38.34", + "tracing", + "windows-sys 0.52.0", +] + +[[package]] +name = "async-signal" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "794f185324c2f00e771cd9f1ae8b5ac68be2ca7abb129a87afd6e86d228bc54d" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 0.38.34", + "signal-hook-registry", + "slab", + "windows-sys 0.52.0", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "asynchronous-codec" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4057f2c32adbb2fc158e22fb38433c8e9bbf76b75a4732c7c0cbaf695fb65568" +dependencies = [ + "bytes", + "futures-sink", + "futures-util", + "memchr", + "pin-project-lite 0.2.14", +] + +[[package]] +name = "atomic-take" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8ab6b55fe97976e46f91ddbed8d147d966475dc29b2032757ba47e02376fbc3" + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "backtrace" +version = "0.3.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +dependencies = [ + "addr2line 0.21.0", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object 0.32.2", + "rustc-demangle", +] + +[[package]] +name = "bandersnatch_vrfs" +version = "0.0.4" +source = "git+https://github.com/w3f/ring-vrf?rev=e9782f9#e9782f938629c90f3adb3fff2358bc8d1386af3e" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ed-on-bls12-381-bandersnatch", + "ark-ff", + "ark-serialize", + "ark-std", + "dleq_vrf", + "fflonk", + "merlin", + "rand_chacha 0.3.1", + "rand_core 0.6.4", + "ring 0.1.0", + "sha2 0.10.8", + "sp-ark-bls12-381", + "sp-ark-ed-on-bls12-381-bandersnatch", + "zeroize", +] + +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base58" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "beef" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" +dependencies = [ + "serde", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bindgen" +version = "0.65.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" +dependencies = [ + "bitflags 1.3.2", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "prettyplease 0.2.20", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.66", +] + +[[package]] +name = "bip39" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" +dependencies = [ + "bitcoin_hashes 0.11.0", +] + +[[package]] +name = "bitcoin-internals" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" + +[[package]] +name = "bitcoin_hashes" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" + +[[package]] +name = "bitcoin_hashes" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +dependencies = [ + "bitcoin-internals", + "hex-conservative", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake2" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330" +dependencies = [ + "byte-tools", + "crypto-mac 0.7.0", + "digest 0.8.1", + "opaque-debug 0.2.3", +] + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "blake2-rfc" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +dependencies = [ + "arrayvec 0.4.12", + "constant_time_eq 0.1.5", +] + +[[package]] +name = "blake2b_simd" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" +dependencies = [ + "arrayref", + "arrayvec 0.7.4", + "constant_time_eq 0.3.0", +] + +[[package]] +name = "blake2s_simd" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94230421e395b9920d23df13ea5d77a20e1725331f90fbbf6df6040b33f756ae" +dependencies = [ + "arrayref", + "arrayvec 0.7.4", + "constant_time_eq 0.3.0", +] + +[[package]] +name = "blake3" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" +dependencies = [ + "arrayref", + "arrayvec 0.7.4", + "cc", + "cfg-if", + "constant_time_eq 0.3.0", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "blocking" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" +dependencies = [ + "async-channel 2.3.1", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "bounded-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32385ecb91a31bddaf908e8dcf4a15aef1bcd3913cc03ebfad02ff6d568abc1" +dependencies = [ + "log", + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bstr" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" +dependencies = [ + "memchr", + "regex-automata 0.4.6", + "serde", +] + +[[package]] +name = "build-helper" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdce191bf3fa4995ce948c8c83b4640a1745457a149e73c6db75b4ffe36aad5f" +dependencies = [ + "semver 0.6.0", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + +[[package]] +name = "bytemuck" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "c2-chacha" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d27dae93fe7b1e0424dc57179ac396908c26b035a87234809f5c4dfd1b47dc80" +dependencies = [ + "cipher 0.2.5", + "ppv-lite86", +] + +[[package]] +name = "camino" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.23", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "casper-runtime" +version = "3.5.17" +dependencies = [ + "casper-runtime-constants", + "frame-benchmarking", + "frame-election-provider-support", + "frame-executive", + "frame-remote-externalities", + "frame-support", + "frame-system", + "frame-system-benchmarking", + "frame-system-rpc-runtime-api", + "frame-try-runtime", + "ghost-claims", + "ghost-core-primitives", + "ghost-networks", + "ghost-runtime-common", + "ghost-slow-clap", + "log", + "pallet-alliance", + "pallet-authority-discovery", + "pallet-authorship", + "pallet-babe", + "pallet-bags-list", + "pallet-balances", + "pallet-bounties", + "pallet-child-bounties", + "pallet-collective", + "pallet-core-fellowship", + "pallet-election-provider-multi-phase", + "pallet-election-provider-support-benchmarking", + "pallet-fast-unstake", + "pallet-grandpa", + "pallet-identity", + "pallet-indices", + "pallet-multisig", + "pallet-nomination-pools", + "pallet-nomination-pools-benchmarking", + "pallet-nomination-pools-runtime-api", + "pallet-offences", + "pallet-offences-benchmarking", + "pallet-preimage", + "pallet-proxy", + "pallet-ranked-collective", + "pallet-referenda", + "pallet-salary", + "pallet-scheduler", + "pallet-session", + "pallet-session-benchmarking", + "pallet-staking", + "pallet-staking-reward-curve", + "pallet-staking-reward-fn", + "pallet-staking-runtime-api", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-treasury", + "pallet-utility", + "pallet-vesting", + "pallet-whitelist", + "parity-scale-codec", + "scale-info", + "separator", + "serde_json", + "sp-api", + "sp-application-crypto 30.0.0", + "sp-arithmetic 23.0.0", + "sp-authority-discovery", + "sp-block-builder", + "sp-consensus-babe", + "sp-consensus-grandpa", + "sp-core 28.0.0", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-genesis-builder", + "sp-inherents", + "sp-io 30.0.0", + "sp-keyring", + "sp-npos-elections", + "sp-offchain", + "sp-runtime 31.0.1", + "sp-session", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-transaction-pool", + "sp-trie 29.0.0", + "sp-version", + "substrate-wasm-builder", + "tokio", +] + +[[package]] +name = "casper-runtime-constants" +version = "0.3.25" +dependencies = [ + "frame-support", + "ghost-core-primitives", + "ghost-runtime-common", + "smallvec", + "sp-core 28.0.0", + "sp-runtime 31.0.1", + "sp-weights 27.0.0", +] + +[[package]] +name = "cc" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" +dependencies = [ + "jobserver", + "libc", + "once_cell", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-expr" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +dependencies = [ + "smallvec", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddf3c081b5fba1e5615640aae998e0fbd10c24cbd897ee39ed754a77601a4862" +dependencies = [ + "byteorder", + "keystream", +] + +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher 0.4.4", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher 0.4.4", + "poly1305", + "zeroize", +] + +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-targets 0.52.5", +] + +[[package]] +name = "cid" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9b68e3193982cd54187d71afdb2a271ad4cf8af157858e9cb911b91321de143" +dependencies = [ + "core2", + "multibase", + "multihash 0.17.0", + "serde", + "unsigned-varint", +] + +[[package]] +name = "cid" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd94671561e36e4e7de75f753f577edafb0e7c05d6e4547229fdf7938fbcd2c3" +dependencies = [ + "core2", + "multibase", + "multihash 0.18.1", + "serde", + "unsigned-varint", +] + +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clap" +version = "3.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +dependencies = [ + "atty", + "bitflags 1.3.2", + "clap_derive 3.2.25", + "clap_lex 0.2.4", + "indexmap 1.9.3", + "once_cell", + "strsim 0.10.0", + "termcolor", + "textwrap", +] + +[[package]] +name = "clap" +version = "4.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +dependencies = [ + "clap_builder", + "clap_derive 4.5.4", +] + +[[package]] +name = "clap_builder" +version = "4.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +dependencies = [ + "anstream", + "anstyle", + "clap_lex 0.7.0", + "strsim 0.11.1", + "terminal_size", +] + +[[package]] +name = "clap_derive" +version = "3.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" +dependencies = [ + "heck 0.4.1", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "clap_derive" +version = "4.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "clap_lex" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" + +[[package]] +name = "coarsetime" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13b3839cf01bb7960114be3ccf2340f541b6d0c81f8690b007b2b39f750f7e5d" +dependencies = [ + "libc", + "wasix", + "wasm-bindgen", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "color-eyre" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55146f5e46f237f7423d74111267d4597b59b0dad0ffaf7303bce9945d843ad5" +dependencies = [ + "backtrace", + "color-spantrace", + "eyre", + "indenter", + "once_cell", + "owo-colors", + "tracing-error", +] + +[[package]] +name = "color-spantrace" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd6be1b2a7e382e2b98b43b2adcca6bb0e465af0bdd38123873ae61eb17a72c2" +dependencies = [ + "once_cell", + "owo-colors", + "tracing-core", + "tracing-error", +] + +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "comfy-table" +version = "7.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b34115915337defe99b2aff5c2ce6771e5fbc4079f4b506301f5cf394c8452f7" +dependencies = [ + "strum 0.26.2", + "strum_macros 0.26.3", + "unicode-width", +] + +[[package]] +name = "common" +version = "0.1.0" +source = "git+https://github.com/w3f/ring-proof#b273d33f9981e2bb3375ab45faeb537f7ee35224" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "fflonk", + "getrandom_or_panic", + "merlin", + "rand_chacha 0.3.1", +] + +[[package]] +name = "common-path" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101" + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "console" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.52.0", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "const-random" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" +dependencies = [ + "const-random-macro", +] + +[[package]] +name = "const-random-macro" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" +dependencies = [ + "getrandom 0.2.15", + "once_cell", + "tiny-keccak", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + +[[package]] +name = "constcat" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd7e35aee659887cbfb97aaf227ac12cad1a9d7c71e55ff3376839ed4e282d08" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "core2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] + +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpp_demangle" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8227005286ec39567949b33df9896bcadfa6051bccca2488129f108ca23119" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-bforest" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1277fbfa94bc82c8ec4af2ded3e639d49ca5f7f3c7eeab2c66accd135ece4e70" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6e8c31ad3b2270e9aeec38723888fe1b0ace3bea2b06b3f749ccf46661d3220" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-entity", + "cranelift-isle", + "gimli 0.27.3", + "hashbrown 0.13.2", + "log", + "regalloc2 0.6.1", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ac5ac30d62b2d66f12651f6b606dbdfd9c2cfd0908de6b387560a277c5c9da" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd82b8b376247834b59ed9bdc0ddeb50f517452827d4a11bccf5937b213748b8" + +[[package]] +name = "cranelift-entity" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40099d38061b37e505e63f89bab52199037a72b931ad4868d9089ff7268660b0" +dependencies = [ + "serde", +] + +[[package]] +name = "cranelift-frontend" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a25d9d0a0ae3079c463c34115ec59507b4707175454f0eee0891e83e30e82d" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80de6a7d0486e4acbd5f9f87ec49912bf4c8fb6aea00087b989685460d4469ba" + +[[package]] +name = "cranelift-native" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb6b03e0e03801c4b3fd8ce0758a94750c07a44e7944cc0ffbf0d3f2e7c79b00" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.95.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff3220489a3d928ad91e59dd7aeaa8b3de18afb554a6211213673a71c90737ac" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools 0.10.5", + "log", + "smallvec", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", + "subtle 2.5.0", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array 0.14.7", + "rand_core 0.6.4", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +dependencies = [ + "generic-array 0.12.4", + "subtle 1.0.0", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array 0.14.7", + "subtle 2.5.0", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher 0.4.4", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle 2.5.0", + "zeroize", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "platforms", + "rustc_version", + "subtle 2.5.0", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "cxx" +version = "1.0.124" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "273dcfd3acd4e1e276af13ed2a43eea7001318823e7a726a6b3ed39b4acc0b82" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.124" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b2766fbd92be34e9ed143898fce6c572dc009de39506ed6903e5a05b68914e" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn 2.0.66", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.124" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "839fcd5e43464614ffaa989eaf1c139ef1f0c51672a1ed08023307fa1b909ccd" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.124" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2c1c1776b986979be68bb2285da855f8d8a35851a769fca8740df7c3d07877" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core 0.14.4", + "darling_macro 0.14.4", +] + +[[package]] +name = "darling" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" +dependencies = [ + "darling_core 0.20.9", + "darling_macro 0.20.9", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 1.0.109", +] + +[[package]] +name = "darling_core" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.11.1", + "syn 2.0.66", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core 0.14.4", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" +dependencies = [ + "darling_core 0.20.9", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core 0.9.10", +] + +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + +[[package]] +name = "data-encoding-macro" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1559b6cba622276d6d63706db152618eeb15b89b3e4041446b05876e352e639" +dependencies = [ + "data-encoding", + "data-encoding-macro-internal", +] + +[[package]] +name = "data-encoding-macro-internal" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332d754c0af53bc87c108fed664d121ecf59207ec4196041f04d6ab9002ad33f" +dependencies = [ + "data-encoding", + "syn 1.0.109", +] + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "der-parser" +version = "8.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive-syn-parse" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive-syn-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "derive-where" +version = "1.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62d671cc41a825ebabc75757b62d3d168c577f9149b2d49ece1dad1f72119d25" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 1.0.109", +] + +[[package]] +name = "difflib" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "const-oid", + "crypto-common", + "subtle 2.5.0", +] + +[[package]] +name = "directories" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "dleq_vrf" +version = "0.0.2" +source = "git+https://github.com/w3f/ring-vrf?rev=e9782f9#e9782f938629c90f3adb3fff2358bc8d1386af3e" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-scale", + "ark-secret-scalar", + "ark-serialize", + "ark-std", + "ark-transcript", + "arrayvec 0.7.4", + "zeroize", +] + +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + +[[package]] +name = "docify" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a2f138ad521dc4a2ced1a4576148a6a610b4c5923933b062a263130a6802ce" +dependencies = [ + "docify_macros", +] + +[[package]] +name = "docify_macros" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a081e51fb188742f5a7a1164ad752121abcb22874b21e2c3b0dd040c515fdad" +dependencies = [ + "common-path", + "derive-syn-parse 0.2.0", + "once_cell", + "proc-macro2", + "quote", + "regex", + "syn 2.0.66", + "termcolor", + "toml 0.8.14", + "walkdir", +] + +[[package]] +name = "downcast" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dtoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" + +[[package]] +name = "dyn-clonable" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" +dependencies = [ + "dyn-clonable-impl", + "dyn-clone", +] + +[[package]] +name = "dyn-clonable-impl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "dyn-clone" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "serdect", + "signature 2.2.0", + "spki", +] + +[[package]] +name = "ed25519" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +dependencies = [ + "signature 1.6.4", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature 2.2.0", +] + +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek 3.2.0", + "ed25519 1.5.3", + "rand 0.7.3", + "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +dependencies = [ + "curve25519-dalek 4.1.2", + "ed25519 2.2.3", + "rand_core 0.6.4", + "serde", + "sha2 0.10.8", + "subtle 2.5.0", + "zeroize", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "ed25519-zebra" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d9ce6874da5d4415896cd45ffbc4d1cfc0c4f9c079427bd870742c30f2f65a9" +dependencies = [ + "curve25519-dalek 4.1.2", + "ed25519 2.2.3", + "hashbrown 0.14.5", + "hex", + "rand_core 0.6.4", + "sha2 0.10.8", + "zeroize", +] + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array 0.14.7", + "group", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "serdect", + "subtle 2.5.0", + "zeroize", +] + +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enum-as-inner" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "enum-as-inner" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "enumflags2" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d232db7f5956f3f14313dc2f87985c58bd2c695ce124c8cdd984e08e15ac133d" +dependencies = [ + "enumflags2_derive", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "env_filter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "env_logger" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", +] + +[[package]] +name = "environmental" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "event-listener" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" +dependencies = [ + "concurrent-queue", + "pin-project-lite 0.2.14", +] + +[[package]] +name = "event-listener" +version = "5.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite 0.2.14", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +dependencies = [ + "event-listener 5.3.1", + "pin-project-lite 0.2.14", +] + +[[package]] +name = "exit-future" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" +dependencies = [ + "futures", +] + +[[package]] +name = "expander" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00e83c02035136f1592a47964ea60c05a50e4ed8b5892cfac197063850898d4d" +dependencies = [ + "blake2 0.10.6", + "fs-err", + "prettier-please", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "eyre" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" +dependencies = [ + "indenter", + "once_cell", +] + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fastrand" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" + +[[package]] +name = "fdlimit" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e182f7dbc2ef73d9ef67351c5fbbea084729c48362d3ce9dd44c28e32e277fe5" +dependencies = [ + "libc", + "thiserror", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core 0.6.4", + "subtle 2.5.0", +] + +[[package]] +name = "fflonk" +version = "0.1.0" +source = "git+https://github.com/w3f/fflonk#1e854f35e9a65d08b11a86291405cdc95baa0a35" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "merlin", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "file-per-thread-logger" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84f2e425d9790201ba4af4630191feac6dcc98765b118d4d18e91d23c2353866" +dependencies = [ + "env_logger 0.10.2", + "log", +] + +[[package]] +name = "filetime" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.4.1", + "windows-sys 0.52.0", +] + +[[package]] +name = "finality-grandpa" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36530797b9bf31cd4ff126dcfee8170f86b00cfdcea3269d73133cc0415945c3" +dependencies = [ + "either", + "futures", + "futures-timer", + "log", + "num-traits", + "parity-scale-codec", + "parking_lot 0.12.3", + "scale-info", +] + +[[package]] +name = "findshlibs" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40b9e59cd0f7e0806cca4be089683ecb6434e602038df21fe6bf6711b2f07f64" +dependencies = [ + "cc", + "lazy_static", + "libc", + "winapi", +] + +[[package]] +name = "finito" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2384245d85162258a14b43567a9ee3598f5ae746a1581fb5d3d2cb780f0dbf95" +dependencies = [ + "futures-timer", + "pin-project", +] + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "flate2" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +dependencies = [ + "crc32fast", + "libz-sys", + "miniz_oxide", +] + +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" +dependencies = [ + "num-traits", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "fork-tree" +version = "12.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "forwarded-header-value" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835f84f38484cc86f110a805655697908257fb9a7af005234060891557198e9" +dependencies = [ + "nonempty", + "thiserror", +] + +[[package]] +name = "fragile" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" + +[[package]] +name = "frame-benchmarking" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-support", + "frame-support-procedural", + "frame-system", + "linregress", + "log", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto 30.0.0", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "static_assertions", +] + +[[package]] +name = "frame-benchmarking-cli" +version = "32.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "Inflector", + "array-bytes", + "chrono", + "clap 4.5.4", + "comfy-table", + "frame-benchmarking", + "frame-support", + "frame-system", + "gethostname", + "handlebars", + "itertools 0.11.0", + "lazy_static", + "linked-hash-map", + "log", + "parity-scale-codec", + "rand 0.8.5", + "rand_pcg", + "sc-block-builder", + "sc-chain-spec", + "sc-cli", + "sc-client-api", + "sc-client-db", + "sc-executor", + "sc-service", + "sc-sysinfo", + "serde", + "serde_json", + "sp-api", + "sp-blockchain", + "sp-core 28.0.0", + "sp-database", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-genesis-builder", + "sp-inherents", + "sp-io 30.0.0", + "sp-keystore 0.34.0", + "sp-runtime 31.0.1", + "sp-state-machine 0.35.0", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-trie 29.0.0", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "thiserror", + "thousands", +] + +[[package]] +name = "frame-election-provider-solution-type" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "frame-election-provider-support" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-election-provider-solution-type", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-arithmetic 23.0.0", + "sp-core 28.0.0", + "sp-npos-elections", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "frame-executive" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "aquamarine", + "frame-support", + "frame-system", + "frame-try-runtime", + "log", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "frame-metadata" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "878babb0b136e731cc77ec2fd883ff02745ff21e6fb662729953d44923df009c" +dependencies = [ + "cfg-if", + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "frame-metadata" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cf1549fba25a6fcac22785b61698317d958e96cac72a59102ea45b9ae64692" +dependencies = [ + "cfg-if", + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "frame-remote-externalities" +version = "0.35.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "futures", + "indicatif", + "jsonrpsee", + "log", + "parity-scale-codec", + "serde", + "sp-core 28.0.0", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-state-machine 0.35.0", + "spinners", + "substrate-rpc-client", + "tokio", + "tokio-retry", +] + +[[package]] +name = "frame-support" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "aquamarine", + "array-bytes", + "bitflags 1.3.2", + "docify", + "environmental", + "frame-metadata 16.0.0", + "frame-support-procedural", + "impl-trait-for-tuples", + "k256", + "log", + "macro_magic", + "parity-scale-codec", + "paste", + "scale-info", + "serde", + "serde_json", + "smallvec", + "sp-api", + "sp-arithmetic 23.0.0", + "sp-core 28.0.0", + "sp-crypto-hashing-proc-macro", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-genesis-builder", + "sp-inherents", + "sp-io 30.0.0", + "sp-metadata-ir", + "sp-runtime 31.0.1", + "sp-staking", + "sp-state-machine 0.35.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-weights 27.0.0", + "static_assertions", + "tt-call", +] + +[[package]] +name = "frame-support-procedural" +version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "Inflector", + "cfg-expr", + "derive-syn-parse 0.2.0", + "expander", + "frame-support-procedural-tools", + "itertools 0.11.0", + "macro_magic", + "proc-macro-warning", + "proc-macro2", + "quote", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "syn 2.0.66", +] + +[[package]] +name = "frame-support-procedural-tools" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-support-procedural-tools-derive", + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "frame-support-procedural-tools-derive" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "frame-system" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "cfg-if", + "docify", + "frame-support", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-version", + "sp-weights 27.0.0", +] + +[[package]] +name = "frame-system-benchmarking" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "frame-system-rpc-runtime-api" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "sp-api", +] + +[[package]] +name = "frame-try-runtime" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-support", + "parity-scale-codec", + "sp-api", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "fs-err" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a41f105fe1d5b6b34b2055e3dc59bb79b46b48b2040b9e6c7b4b5de097aa41" +dependencies = [ + "autocfg", +] + +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "fs4" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29f9df8a11882c4e3335eb2d18a0137c505d9ca927470b0cac9c6f0ae07d28f7" +dependencies = [ + "rustix 0.38.34", + "windows-sys 0.48.0", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", + "num_cpus", +] + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-lite" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite 0.2.14", +] + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "futures-rustls" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" +dependencies = [ + "futures-io", + "rustls 0.20.9", + "webpki", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite 0.2.14", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generate-bags" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "chrono", + "frame-election-provider-support", + "frame-support", + "frame-system", + "num-format", + "pallet-staking", + "sp-staking", +] + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "gethostname" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom_or_panic" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea1015b5a70616b688dc230cfe50c8af89d972cb132d5a622814d29773b10b9" +dependencies = [ + "rand 0.8.5", + "rand_core 0.6.4", +] + +[[package]] +name = "ghash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" +dependencies = [ + "opaque-debug 0.3.1", + "polyval", +] + +[[package]] +name = "ghost-claims" +version = "0.2.2" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "hex-literal", + "libsecp256k1", + "pallet-balances", + "pallet-ranked-collective", + "pallet-vesting", + "parity-scale-codec", + "rustc-hex", + "scale-info", + "serde", + "serde_derive", + "serde_json", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "ghost-cli" +version = "0.7.178" +dependencies = [ + "cfg-if", + "clap 4.5.4", + "frame-benchmarking-cli", + "futures", + "ghost-client-cli", + "ghost-core-primitives", + "ghost-machine-primitives", + "ghost-metrics", + "ghost-service", + "log", + "pyroscope", + "pyroscope_pprofrs", + "sc-cli", + "sc-executor", + "sc-service", + "sc-storage-monitor", + "sc-sysinfo", + "sc-tracing", + "serde_json", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-keyring", + "sp-maybe-compressed-blob", + "sp-runtime 31.0.1", + "substrate-build-script-utils", + "thiserror", +] + +[[package]] +name = "ghost-client-cli" +version = "0.1.3" +dependencies = [ + "array-bytes", + "clap 4.5.4", + "itertools 0.11.0", + "parity-bip39", + "rand 0.8.5", + "sc-cli", + "serde_json", + "sp-core 28.0.0", + "sp-runtime 31.0.1", +] + +[[package]] +name = "ghost-core-primitives" +version = "0.5.19" +dependencies = [ + "sp-core 28.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "ghost-machine-primitives" +version = "0.7.178" +dependencies = [ + "lazy_static", + "sc-sysinfo", + "serde_json", +] + +[[package]] +name = "ghost-metrics" +version = "0.7.178" +dependencies = [ + "assert_cmd", + "bs58 0.5.1", + "futures", + "futures-timer", + "ghost-core-primitives", + "hyper", + "log", + "parity-scale-codec", + "prioritized-metered-channel", + "prometheus-parse", + "sc-cli", + "sc-service", + "sc-tracing", + "sp-keyring", + "substrate-prometheus-endpoint", + "tempfile", + "tokio", +] + +[[package]] +name = "ghost-miner" +version = "1.5.0" +dependencies = [ + "anyhow", + "assert_cmd", + "clap 4.5.4", + "frame-election-provider-support", + "frame-support", + "futures", + "hyper", + "jsonrpsee", + "log", + "once_cell", + "pallet-election-provider-multi-phase", + "parity-scale-codec", + "pin-project-lite 0.2.14", + "prometheus", + "regex", + "scale-info", + "scale-value", + "serde", + "serde_json", + "sp-npos-elections", + "sp-runtime 31.0.1", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "subxt", + "thiserror", + "tokio", + "tracing-subscriber 0.3.18", +] + +[[package]] +name = "ghost-networks" +version = "0.7.178" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "ghost-core-primitives", + "ghost-traits", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "ghost-node" +version = "0.7.178" +dependencies = [ + "assert_cmd", + "color-eyre", + "ghost-cli", + "ghost-core-primitives", + "nix 0.28.0", + "substrate-build-script-utils", + "substrate-rpc-client", + "tempfile", + "tikv-jemallocator", + "tokio", +] + +[[package]] +name = "ghost-remote-ext-tests-bags-list" +version = "1.0.0" +dependencies = [ + "casper-runtime", + "casper-runtime-constants", + "clap 4.5.4", + "frame-system", + "log", + "pallet-bags-list-remote-tests", + "sp-core 28.0.0", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "tokio", +] + +[[package]] +name = "ghost-rpc" +version = "0.7.178" +dependencies = [ + "ghost-core-primitives", + "jsonrpsee", + "pallet-transaction-payment-rpc", + "sc-chain-spec", + "sc-client-api", + "sc-consensus-babe", + "sc-consensus-babe-rpc", + "sc-consensus-epochs", + "sc-consensus-grandpa", + "sc-consensus-grandpa-rpc", + "sc-rpc", + "sc-rpc-spec-v2", + "sc-sync-state-rpc", + "sc-transaction-pool-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-keystore 0.34.0", + "sp-runtime 31.0.1", + "substrate-frame-rpc-system", + "substrate-state-trie-migration-rpc", +] + +[[package]] +name = "ghost-runtime-common" +version = "0.4.2" +dependencies = [ + "frame-support", + "frame-system", + "ghost-core-primitives", + "pallet-authorship", + "pallet-balances", + "pallet-election-provider-multi-phase", + "pallet-staking", + "pallet-staking-reward-fn", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-treasury", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "static_assertions", +] + +[[package]] +name = "ghost-service" +version = "0.7.178" +dependencies = [ + "assert_matches", + "async-trait", + "bitvec", + "casper-runtime", + "casper-runtime-constants", + "env_logger 0.11.3", + "frame-benchmarking", + "frame-benchmarking-cli", + "frame-support", + "frame-system", + "frame-system-rpc-runtime-api", + "futures", + "ghost-core-primitives", + "ghost-machine-primitives", + "ghost-networks", + "ghost-rpc", + "ghost-slow-clap", + "hex-literal", + "is_executable", + "kvdb", + "kvdb-rocksdb", + "log", + "pallet-babe", + "pallet-staking", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "parity-db", + "parity-scale-codec", + "parking_lot 0.12.3", + "sc-authority-discovery", + "sc-basic-authorship", + "sc-block-builder", + "sc-chain-spec", + "sc-client-api", + "sc-client-db", + "sc-consensus", + "sc-consensus-babe", + "sc-consensus-grandpa", + "sc-consensus-slots", + "sc-executor", + "sc-keystore", + "sc-network", + "sc-network-common", + "sc-network-sync", + "sc-offchain", + "sc-service", + "sc-sync-state-rpc", + "sc-sysinfo", + "sc-telemetry", + "sc-transaction-pool", + "sc-transaction-pool-api", + "schnellru", + "serde", + "serde_json", + "serial_test", + "sp-api", + "sp-authority-discovery", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-consensus-grandpa", + "sp-core 28.0.0", + "sp-inherents", + "sp-io 30.0.0", + "sp-keyring", + "sp-keystore 0.34.0", + "sp-offchain", + "sp-runtime 31.0.1", + "sp-session", + "sp-state-machine 0.35.0", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-timestamp", + "sp-version", + "sp-weights 27.0.0", + "substrate-prometheus-endpoint", + "tempfile", + "thiserror", +] + +[[package]] +name = "ghost-slow-clap" +version = "0.3.14" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "ghost-networks", + "log", + "pallet-balances", + "pallet-session", + "parity-scale-codec", + "scale-info", + "serde", + "serde_json", + "sp-application-crypto 30.0.0", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "ghost-staging-chain-spec-builder" +version = "1.6.1" +dependencies = [ + "clap 4.5.4", + "log", + "sc-chain-spec", + "serde_json", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "ghost-traits" +version = "0.3.19" +dependencies = [ + "frame-support", + "sp-runtime 31.0.1", +] + +[[package]] +name = "ghost-voter-bags" +version = "0.3.6" +dependencies = [ + "casper-runtime", + "clap 4.5.4", + "generate-bags", + "sp-io 30.0.0", +] + +[[package]] +name = "ghostkey" +version = "0.3.15" +dependencies = [ + "clap 4.5.4", + "ghost-client-cli", + "sc-cli", +] + +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +dependencies = [ + "fallible-iterator 0.2.0", + "indexmap 1.9.3", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +dependencies = [ + "fallible-iterator 0.3.0", + "stable_deref_trait", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "governor" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a7f542ee6b35af73b06abc0dad1c1bae89964e4e253bc4b587b91c9637867b" +dependencies = [ + "cfg-if", + "dashmap", + "futures", + "futures-timer", + "no-std-compat", + "nonzero_ext", + "parking_lot 0.12.3", + "portable-atomic", + "quanta", + "rand 0.8.5", + "smallvec", + "spinning_top", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle 2.5.0", +] + +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "handlebars" +version = "5.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d08485b96a0e6393e9e4d1b8d48cf74ad6c063cd905eb33f42c1ce3f0377539b" +dependencies = [ + "log", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "hash-db" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e7d7786361d7425ae2fe4f9e407eb0efaa0840f5212d109cc018c40c35c6ab4" + +[[package]] +name = "hash256-std-hasher" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" +dependencies = [ + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.8", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.11", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash 0.8.11", + "allocator-api2", + "serde", +] + +[[package]] +name = "hashlink" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +dependencies = [ + "hashbrown 0.14.5", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-conservative" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac 0.12.1", +] + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac 0.8.0", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array 0.14.7", + "hmac 0.8.1", +] + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http", + "pin-project-lite 0.2.14", +] + +[[package]] +name = "http-range-header" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "hyper" +version = "0.14.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite 0.2.14", + "socket2 0.5.7", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +dependencies = [ + "futures-util", + "http", + "hyper", + "log", + "rustls 0.21.12", + "rustls-native-certs 0.6.3", + "tokio", + "tokio-rustls 0.24.1", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core 0.52.0", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "if-addrs" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cabb0019d51a643781ff15c9c8a3e5dedc365c47211270f4e8f82812fedd8f0a" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "if-watch" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6b0422c86d7ce0e97169cc42e04ae643caf278874a7a3c87b8150a220dc7e1e" +dependencies = [ + "async-io", + "core-foundation", + "fnv", + "futures", + "if-addrs", + "ipnet", + "log", + "rtnetlink", + "system-configuration", + "tokio", + "windows", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "include_dir" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" +dependencies = [ + "include_dir_macros", +] + +[[package]] +name = "include_dir_macros" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", +] + +[[package]] +name = "indexmap-nostd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" + +[[package]] +name = "indicatif" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" +dependencies = [ + "console", + "instant", + "number_prefix", + "portable-atomic", + "unicode-width", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "integer-sqrt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" +dependencies = [ + "num-traits", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "ip_network" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" + +[[package]] +name = "ipconfig" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" +dependencies = [ + "socket2 0.5.7", + "widestring", + "windows-sys 0.48.0", + "winreg", +] + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "is-terminal" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "is_executable" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa9acdc6d67b75e626ad644734e8bc6df893d9cd2a834129065d3dd6158ea9c8" +dependencies = [ + "winapi", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "jobserver" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "json" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" + +[[package]] +name = "jsonrpsee" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfdb12a2381ea5b2e68c3469ec604a007b367778cdb14d09612c8069ebd616ad" +dependencies = [ + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-http-client", + "jsonrpsee-proc-macros", + "jsonrpsee-server", + "jsonrpsee-types", + "jsonrpsee-ws-client", + "tokio", + "tracing", +] + +[[package]] +name = "jsonrpsee-client-transport" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4978087a58c3ab02efc5b07c5e5e2803024536106fd5506f558db172c889b3aa" +dependencies = [ + "futures-util", + "http", + "jsonrpsee-core", + "pin-project", + "rustls-native-certs 0.7.0", + "rustls-pki-types", + "soketto", + "thiserror", + "tokio", + "tokio-rustls 0.25.0", + "tokio-util", + "tracing", + "url", +] + +[[package]] +name = "jsonrpsee-core" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4b257e1ec385e07b0255dde0b933f948b5c8b8c28d42afda9587c3a967b896d" +dependencies = [ + "anyhow", + "async-trait", + "beef", + "futures-timer", + "futures-util", + "hyper", + "jsonrpsee-types", + "parking_lot 0.12.3", + "pin-project", + "rand 0.8.5", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-stream", + "tracing", +] + +[[package]] +name = "jsonrpsee-http-client" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ccf93fc4a0bfe05d851d37d7c32b7f370fe94336b52a2f0efc5f1981895c2e5" +dependencies = [ + "async-trait", + "hyper", + "hyper-rustls", + "jsonrpsee-core", + "jsonrpsee-types", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower", + "tracing", + "url", +] + +[[package]] +name = "jsonrpsee-proc-macros" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d0bb047e79a143b32ea03974a6bf59b62c2a4c5f5d42a381c907a8bbb3f75c0" +dependencies = [ + "heck 0.4.1", + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "jsonrpsee-server" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12d8b6a9674422a8572e0b0abb12feeb3f2aeda86528c80d0350c2bd0923ab41" +dependencies = [ + "futures-util", + "http", + "hyper", + "jsonrpsee-core", + "jsonrpsee-types", + "pin-project", + "route-recognizer", + "serde", + "serde_json", + "soketto", + "thiserror", + "tokio", + "tokio-stream", + "tokio-util", + "tower", + "tracing", +] + +[[package]] +name = "jsonrpsee-types" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "150d6168405890a7a3231a3c74843f58b8959471f6df76078db2619ddee1d07d" +dependencies = [ + "anyhow", + "beef", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "jsonrpsee-ws-client" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58b9db2dfd5bb1194b0ce921504df9ceae210a345bc2f6c5a61432089bbab070" +dependencies = [ + "http", + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-types", + "url", +] + +[[package]] +name = "k256" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "serdect", + "sha2 0.10.8", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "keystream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c33070833c9ee02266356de0c43f723152bd38bd96ddf52c82b3af10c9138b28" + +[[package]] +name = "kvdb" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7d770dcb02bf6835887c3a979b5107a04ff4bbde97a5f0928d27404a155add9" +dependencies = [ + "smallvec", +] + +[[package]] +name = "kvdb-memorydb" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7a85fe66f9ff9cd74e169fdd2c94c6e1e74c412c99a73b4df3200b5d3760b2" +dependencies = [ + "kvdb", + "parking_lot 0.12.3", +] + +[[package]] +name = "kvdb-rocksdb" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b644c70b92285f66bfc2032922a79000ea30af7bc2ab31902992a5dcb9b434f6" +dependencies = [ + "kvdb", + "num_cpus", + "parking_lot 0.12.3", + "regex", + "rocksdb", + "smallvec", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libflate" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ff4ae71b685bbad2f2f391fe74f6b7659a34871c08b210fdc039e43bee07d18" +dependencies = [ + "adler32", + "crc32fast", + "libflate_lz77", +] + +[[package]] +name = "libflate_lz77" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a52d3a8bfc85f250440e4424db7d857e241a3aebbbe301f3eb606ab15c39acbf" +dependencies = [ + "rle-decode-fast", +] + +[[package]] +name = "libloading" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" +dependencies = [ + "cfg-if", + "windows-targets 0.52.5", +] + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libp2p" +version = "0.51.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f35eae38201a993ece6bdc823292d6abd1bffed1c4d0f4a3517d2bd8e1d917fe" +dependencies = [ + "bytes", + "futures", + "futures-timer", + "getrandom 0.2.15", + "instant", + "libp2p-allow-block-list", + "libp2p-connection-limits", + "libp2p-core", + "libp2p-dns", + "libp2p-identify", + "libp2p-identity", + "libp2p-kad", + "libp2p-mdns", + "libp2p-metrics", + "libp2p-noise", + "libp2p-ping", + "libp2p-quic", + "libp2p-request-response", + "libp2p-swarm", + "libp2p-tcp", + "libp2p-wasm-ext", + "libp2p-websocket", + "libp2p-yamux", + "multiaddr", + "pin-project", +] + +[[package]] +name = "libp2p-allow-block-list" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "510daa05efbc25184458db837f6f9a5143888f1caa742426d92e1833ddd38a50" +dependencies = [ + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "void", +] + +[[package]] +name = "libp2p-connection-limits" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4caa33f1d26ed664c4fe2cca81a08c8e07d4c1c04f2f4ac7655c2dd85467fda0" +dependencies = [ + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "void", +] + +[[package]] +name = "libp2p-core" +version = "0.39.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c1df63c0b582aa434fb09b2d86897fa2b419ffeccf934b36f87fcedc8e835c2" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "libp2p-identity", + "log", + "multiaddr", + "multihash 0.17.0", + "multistream-select", + "once_cell", + "parking_lot 0.12.3", + "pin-project", + "quick-protobuf", + "rand 0.8.5", + "rw-stream-sink", + "smallvec", + "thiserror", + "unsigned-varint", + "void", +] + +[[package]] +name = "libp2p-dns" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146ff7034daae62077c415c2376b8057368042df6ab95f5432ad5e88568b1554" +dependencies = [ + "futures", + "libp2p-core", + "log", + "parking_lot 0.12.3", + "smallvec", + "trust-dns-resolver 0.22.0", +] + +[[package]] +name = "libp2p-identify" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5455f472243e63b9c497ff320ded0314254a9eb751799a39c283c6f20b793f3c" +dependencies = [ + "asynchronous-codec", + "either", + "futures", + "futures-timer", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "log", + "lru 0.10.1", + "quick-protobuf", + "quick-protobuf-codec", + "smallvec", + "thiserror", + "void", +] + +[[package]] +name = "libp2p-identity" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276bb57e7af15d8f100d3c11cbdd32c6752b7eef4ba7a18ecf464972c07abcce" +dependencies = [ + "bs58 0.4.0", + "ed25519-dalek 2.1.1", + "log", + "multiaddr", + "multihash 0.17.0", + "quick-protobuf", + "rand 0.8.5", + "sha2 0.10.8", + "thiserror", + "zeroize", +] + +[[package]] +name = "libp2p-kad" +version = "0.43.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39d5ef876a2b2323d63c258e63c2f8e36f205fe5a11f0b3095d59635650790ff" +dependencies = [ + "arrayvec 0.7.4", + "asynchronous-codec", + "bytes", + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "log", + "quick-protobuf", + "rand 0.8.5", + "sha2 0.10.8", + "smallvec", + "thiserror", + "uint", + "unsigned-varint", + "void", +] + +[[package]] +name = "libp2p-mdns" +version = "0.43.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19983e1f949f979a928f2c603de1cf180cc0dc23e4ac93a62651ccb18341460b" +dependencies = [ + "data-encoding", + "futures", + "if-watch", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "log", + "rand 0.8.5", + "smallvec", + "socket2 0.4.10", + "tokio", + "trust-dns-proto 0.22.0", + "void", +] + +[[package]] +name = "libp2p-metrics" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a42ec91e227d7d0dafa4ce88b333cdf5f277253873ab087555c92798db2ddd46" +dependencies = [ + "libp2p-core", + "libp2p-identify", + "libp2p-kad", + "libp2p-ping", + "libp2p-swarm", + "prometheus-client", +] + +[[package]] +name = "libp2p-noise" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3673da89d29936bc6435bafc638e2f184180d554ce844db65915113f86ec5e" +dependencies = [ + "bytes", + "curve25519-dalek 3.2.0", + "futures", + "libp2p-core", + "libp2p-identity", + "log", + "once_cell", + "quick-protobuf", + "rand 0.8.5", + "sha2 0.10.8", + "snow", + "static_assertions", + "thiserror", + "x25519-dalek 1.1.1", + "zeroize", +] + +[[package]] +name = "libp2p-ping" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e57759c19c28a73ef1eb3585ca410cefb72c1a709fcf6de1612a378e4219202" +dependencies = [ + "either", + "futures", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-swarm", + "log", + "rand 0.8.5", + "void", +] + +[[package]] +name = "libp2p-quic" +version = "0.7.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6b26abd81cd2398382a1edfe739b539775be8a90fa6914f39b2ab49571ec735" +dependencies = [ + "bytes", + "futures", + "futures-timer", + "if-watch", + "libp2p-core", + "libp2p-identity", + "libp2p-tls", + "log", + "parking_lot 0.12.3", + "quinn-proto", + "rand 0.8.5", + "rustls 0.20.9", + "thiserror", + "tokio", +] + +[[package]] +name = "libp2p-request-response" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffdb374267d42dc5ed5bc53f6e601d4a64ac5964779c6e40bb9e4f14c1e30d5" +dependencies = [ + "async-trait", + "futures", + "instant", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "rand 0.8.5", + "smallvec", +] + +[[package]] +name = "libp2p-swarm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b3d592d7694e56204d211f29d31bc004be99386644ba8731fc3e3ef27b296" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm-derive", + "log", + "rand 0.8.5", + "smallvec", + "tokio", + "void", +] + +[[package]] +name = "libp2p-swarm-derive" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fba456131824ab6acd4c7bf61e9c0f0a3014b5fc9868ccb8e10d344594cdc4f" +dependencies = [ + "heck 0.4.1", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "libp2p-tcp" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33d33698596d7722d85d3ab0c86c2c322254fce1241e91208e3679b4eb3026cf" +dependencies = [ + "futures", + "futures-timer", + "if-watch", + "libc", + "libp2p-core", + "log", + "socket2 0.4.10", + "tokio", +] + +[[package]] +name = "libp2p-tls" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff08d13d0dc66e5e9ba6279c1de417b84fa0d0adc3b03e5732928c180ec02781" +dependencies = [ + "futures", + "futures-rustls", + "libp2p-core", + "libp2p-identity", + "rcgen", + "ring 0.16.20", + "rustls 0.20.9", + "thiserror", + "webpki", + "x509-parser 0.14.0", + "yasna", +] + +[[package]] +name = "libp2p-wasm-ext" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77dff9d32353a5887adb86c8afc1de1a94d9e8c3bc6df8b2201d7cdf5c848f43" +dependencies = [ + "futures", + "js-sys", + "libp2p-core", + "parity-send-wrapper", + "wasm-bindgen", + "wasm-bindgen-futures", +] + +[[package]] +name = "libp2p-websocket" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111273f7b3d3510524c752e8b7a5314b7f7a1fee7e68161c01a7d72cbb06db9f" +dependencies = [ + "either", + "futures", + "futures-rustls", + "libp2p-core", + "log", + "parking_lot 0.12.3", + "quicksink", + "rw-stream-sink", + "soketto", + "url", + "webpki-roots 0.22.6", +] + +[[package]] +name = "libp2p-yamux" +version = "0.43.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd21d950662700a385d4c6d68e2f5f54d778e97068cdd718522222ef513bda" +dependencies = [ + "futures", + "libp2p-core", + "log", + "thiserror", + "yamux", +] + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.5.0", + "libc", +] + +[[package]] +name = "librocksdb-sys" +version = "0.11.0+8.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" +dependencies = [ + "bindgen", + "bzip2-sys", + "cc", + "glob", + "libc", + "libz-sys", + "tikv-jemalloc-sys", +] + +[[package]] +name = "libsecp256k1" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +dependencies = [ + "arrayref", + "base64 0.13.1", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand 0.8.5", + "serde", + "sha2 0.9.9", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle 2.5.0", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libz-sys" +version = "1.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c15da26e5af7e25c90b37a2d75cdbf940cf4a55316de9d84c679c9b8bfabf82e" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "link-cplusplus" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d240c6f7e1ba3a28b0249f774e6a9dd0175054b52dfbb61b16eb8505c3785c9" +dependencies = [ + "cc", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linked_hash_set" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47186c6da4d81ca383c7c47c1bfc80f4b95f4720514d860a5407aaf4233f9588" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "linregress" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4de04dcecc58d366391f9920245b85ffa684558a5ef6e7736e754347c3aea9c2" +dependencies = [ + "nalgebra", +] + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "lioness" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae926706ba42c425c9457121178330d75e273df2e82e28b758faf3de3a9acb9" +dependencies = [ + "arrayref", + "blake2 0.8.1", + "chacha", + "keystream", +] + +[[package]] +name = "litep2p" +version = "0.3.0" +source = "git+https://github.com/paritytech/litep2p?rev=e03a6023882db111beeb24d8c0ceaac0721d3f0f#e03a6023882db111beeb24d8c0ceaac0721d3f0f" +dependencies = [ + "async-trait", + "bs58 0.4.0", + "bytes", + "cid 0.10.1", + "ed25519-dalek 1.0.1", + "futures", + "futures-timer", + "hex-literal", + "indexmap 2.2.6", + "libc", + "mockall", + "multiaddr", + "multihash 0.17.0", + "network-interface", + "nohash-hasher", + "parking_lot 0.12.3", + "pin-project", + "prost 0.11.9", + "prost-build 0.11.9", + "quinn", + "rand 0.8.5", + "rcgen", + "ring 0.16.20", + "rustls 0.20.9", + "serde", + "sha2 0.10.8", + "simple-dns", + "smallvec", + "snow", + "socket2 0.5.7", + "static_assertions", + "str0m", + "thiserror", + "tokio", + "tokio-stream", + "tokio-tungstenite", + "tokio-util", + "tracing", + "trust-dns-resolver 0.23.2", + "uint", + "unsigned-varint", + "url", + "webpki", + "x25519-dalek 2.0.1", + "x509-parser 0.15.1", + "yasna", + "zeroize", +] + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "lru" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670" +dependencies = [ + "hashbrown 0.13.2", +] + +[[package]] +name = "lru" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +dependencies = [ + "hashbrown 0.14.5", +] + +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "lz4" +version = "1.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e9e2dd86df36ce760a60f6ff6ad526f7ba1f14ba0356f8254fb6905e6494df1" +dependencies = [ + "libc", + "lz4-sys", +] + +[[package]] +name = "lz4-sys" +version = "1.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + +[[package]] +name = "macro_magic" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e03844fc635e92f3a0067e25fa4bf3e3dbf3f2927bf3aa01bb7bc8f1c428949d" +dependencies = [ + "macro_magic_core", + "macro_magic_macros", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "macro_magic_core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "468155613a44cfd825f1fb0ffa532b018253920d404e6fca1e8d43155198a46d" +dependencies = [ + "const-random", + "derive-syn-parse 0.1.5", + "macro_magic_core_macros", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "macro_magic_core_macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea73aa640dc01d62a590d48c0c3521ed739d53b27f919b25c3551e233481654" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "macro_magic_macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef9d79ae96aaba821963320eb2b6e34d17df1e5a83d8a1985c29cc5be59577b3" +dependencies = [ + "macro_magic_core", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" + +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + +[[package]] +name = "matchers" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "matches" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" + +[[package]] +name = "matrixmultiply" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2" +dependencies = [ + "autocfg", + "rawpointer", +] + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix 0.38.34", +] + +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + +[[package]] +name = "memmap2" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memory-db" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808b50db46293432a45e63bc15ea51e0ab4c0a1647b8eb114e31a3e698dd6fbe" +dependencies = [ + "hash-db", +] + +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.6.4", + "zeroize", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.48.0", +] + +[[package]] +name = "mixnet" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daa3eb39495d8e2e2947a1d862852c90cc6a4a8845f8b41c8829cb9fcc047f4a" +dependencies = [ + "arrayref", + "arrayvec 0.7.4", + "bitflags 1.3.2", + "blake2 0.10.6", + "c2-chacha", + "curve25519-dalek 4.1.2", + "either", + "hashlink", + "lioness", + "log", + "parking_lot 0.12.3", + "rand 0.8.5", + "rand_chacha 0.3.1", + "rand_distr", + "subtle 2.5.0", + "thiserror", + "zeroize", +] + +[[package]] +name = "mockall" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c84490118f2ee2d74570d114f3d0493cbf02790df303d2707606c3e14e07c96" +dependencies = [ + "cfg-if", + "downcast", + "fragile", + "lazy_static", + "mockall_derive", + "predicates 2.1.5", + "predicates-tree", +] + +[[package]] +name = "mockall_derive" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ce75669015c4f47b289fd4d4f56e894e4c96003ffdf3ac51313126f94c6cbb" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "multiaddr" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b36f567c7099511fa8612bbbb52dda2419ce0bdbacf31714e3a5ffdb766d3bd" +dependencies = [ + "arrayref", + "byteorder", + "data-encoding", + "log", + "multibase", + "multihash 0.17.0", + "percent-encoding", + "serde", + "static_assertions", + "unsigned-varint", + "url", +] + +[[package]] +name = "multibase" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b3539ec3c1f04ac9748a260728e855f261b4977f5c3406612c884564f329404" +dependencies = [ + "base-x", + "data-encoding", + "data-encoding-macro", +] + +[[package]] +name = "multihash" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40" +dependencies = [ + "blake2b_simd", + "blake2s_simd", + "blake3", + "core2", + "digest 0.10.7", + "multihash-derive 0.8.1", + "sha2 0.10.8", + "sha3", + "unsigned-varint", +] + +[[package]] +name = "multihash" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfd8a792c1694c6da4f68db0a9d707c72bd260994da179e6030a5dcee00bb815" +dependencies = [ + "blake2b_simd", + "blake2s_simd", + "blake3", + "core2", + "digest 0.10.7", + "multihash-derive 0.8.1", + "sha2 0.10.8", + "sha3", + "unsigned-varint", +] + +[[package]] +name = "multihash" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "076d548d76a0e2a0d4ab471d0b1c36c577786dfc4471242035d97a12a735c492" +dependencies = [ + "core2", + "unsigned-varint", +] + +[[package]] +name = "multihash-codetable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6d815ecb3c8238d00647f8630ede7060a642c9f704761cd6082cb4028af6935" +dependencies = [ + "blake2b_simd", + "blake2s_simd", + "blake3", + "core2", + "digest 0.10.7", + "multihash-derive 0.9.0", + "ripemd", + "serde", + "sha1", + "sha2 0.10.8", + "sha3", + "strobe-rs", +] + +[[package]] +name = "multihash-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6d4752e6230d8ef7adf7bd5d8c4b1f6561c1014c5ba9a37445ccefe18aa1db" +dependencies = [ + "proc-macro-crate 1.1.3", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure 0.12.6", +] + +[[package]] +name = "multihash-derive" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "890e72cb7396cb99ed98c1246a97b243cc16394470d94e0bc8b0c2c11d84290e" +dependencies = [ + "core2", + "multihash 0.19.1", + "multihash-derive-impl", +] + +[[package]] +name = "multihash-derive-impl" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3958713ce794e12f7c6326fac9aa274c68d74c4881dd37b3e2662b8a2046bb19" +dependencies = [ + "proc-macro-crate 2.0.0", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.66", + "synstructure 0.13.1", +] + +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + +[[package]] +name = "multimap" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" + +[[package]] +name = "multistream-select" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8552ab875c1313b97b8d20cb857b9fd63e2d1d6a0a1b53ce9821e575405f27a" +dependencies = [ + "bytes", + "futures", + "log", + "pin-project", + "smallvec", + "unsigned-varint", +] + +[[package]] +name = "nalgebra" +version = "0.32.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ea4908d4f23254adda3daa60ffef0f1ac7b8c3e9a864cf3cc154b251908a2ef" +dependencies = [ + "approx", + "matrixmultiply", + "nalgebra-macros", + "num-complex", + "num-rational", + "num-traits", + "simba", + "typenum", +] + +[[package]] +name = "nalgebra-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91761aed67d03ad966ef783ae962ef9bbaca728d2dd7ceb7939ec110fffad998" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "names" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bddcd3bf5144b6392de80e04c347cd7fab2508f6df16a85fc496ecd5cec39bc" +dependencies = [ + "clap 3.2.25", + "rand 0.8.5", +] + +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" + +[[package]] +name = "netlink-packet-core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "345b8ab5bd4e71a2986663e88c56856699d060e78e152e6e9d7966fcd5491297" +dependencies = [ + "anyhow", + "byteorder", + "libc", + "netlink-packet-utils", +] + +[[package]] +name = "netlink-packet-route" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" +dependencies = [ + "anyhow", + "bitflags 1.3.2", + "byteorder", + "libc", + "netlink-packet-core", + "netlink-packet-utils", +] + +[[package]] +name = "netlink-packet-utils" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ede8a08c71ad5a95cdd0e4e52facd37190977039a4704eb82a283f713747d34" +dependencies = [ + "anyhow", + "byteorder", + "paste", + "thiserror", +] + +[[package]] +name = "netlink-proto" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65b4b14489ab424703c092062176d52ba55485a89c076b4f9db05092b7223aa6" +dependencies = [ + "bytes", + "futures", + "log", + "netlink-packet-core", + "netlink-sys", + "thiserror", + "tokio", +] + +[[package]] +name = "netlink-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "416060d346fbaf1f23f9512963e3e878f1a78e707cb699ba9215761754244307" +dependencies = [ + "bytes", + "futures", + "libc", + "log", + "tokio", +] + +[[package]] +name = "network-interface" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a43439bf756eed340bdf8feba761e2d50c7d47175d87545cd5cbe4a137c4d1" +dependencies = [ + "cc", + "libc", + "thiserror", + "winapi", +] + +[[package]] +name = "nix" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", +] + +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", +] + +[[package]] +name = "nix" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" +dependencies = [ + "bitflags 2.5.0", + "cfg-if", + "cfg_aliases 0.1.1", + "libc", +] + +[[package]] +name = "no-std-compat" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" + +[[package]] +name = "no-std-net" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43794a0ace135be66a25d3ae77d41b91615fb68ae937f904090203e81f755b65" + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nonempty" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9e591e719385e6ebaeb5ce5d3887f7d5676fceca6411d1925ccc95745f3d6f7" + +[[package]] +name = "nonzero_ext" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" + +[[package]] +name = "normalize-line-endings" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-bigint" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-format" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" +dependencies = [ + "arrayvec 0.7.4", + "itoa", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.9", + "libc", +] + +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + +[[package]] +name = "object" +version = "0.30.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" +dependencies = [ + "crc32fast", + "hashbrown 0.13.2", + "indexmap 1.9.3", + "memchr", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + +[[package]] +name = "oid-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" +dependencies = [ + "asn1-rs", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "openssl" +version = "0.10.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +dependencies = [ + "bitflags 2.5.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-src" +version = "300.3.1+3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7259953d42a81bf137fbbd73bd30a8e1914d6dce43c2b90ed575783a22608b91" +dependencies = [ + "cc", +] + +[[package]] +name = "openssl-sys" +version = "0.9.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +dependencies = [ + "cc", + "libc", + "openssl-src", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "os_str_bytes" +version = "6.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "owo-colors" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" + +[[package]] +name = "pallet-alliance" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "array-bytes", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-collective", + "pallet-identity", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-authority-discovery" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-support", + "frame-system", + "pallet-session", + "parity-scale-codec", + "scale-info", + "sp-application-crypto 30.0.0", + "sp-authority-discovery", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-authorship" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-babe" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-session", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-application-crypto 30.0.0", + "sp-consensus-babe", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-session", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-bags-list" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "aquamarine", + "docify", + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-bags-list-remote-tests" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-election-provider-support", + "frame-remote-externalities", + "frame-support", + "frame-system", + "log", + "pallet-bags-list", + "pallet-staking", + "sp-core 28.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-balances" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-bounties" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-child-bounties" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-bounties", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-collective" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-core-fellowship" +version = "12.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-ranked-collective", + "parity-scale-codec", + "scale-info", + "sp-arithmetic 23.0.0", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-election-provider-multi-phase" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-election-provider-support-benchmarking", + "parity-scale-codec", + "rand 0.8.5", + "scale-info", + "sp-arithmetic 23.0.0", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-npos-elections", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "strum 0.26.2", +] + +[[package]] +name = "pallet-election-provider-support-benchmarking" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-system", + "parity-scale-codec", + "sp-npos-elections", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-fast-unstake" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-grandpa" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-session", + "parity-scale-codec", + "scale-info", + "sp-application-crypto 30.0.0", + "sp-consensus-grandpa", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-session", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-identity" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "enumflags2", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-im-online" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "parity-scale-codec", + "scale-info", + "sp-application-crypto 30.0.0", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-indices" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-keyring", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-multisig" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-nomination-pools" +version = "25.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-nomination-pools-benchmarking" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "pallet-bags-list", + "pallet-nomination-pools", + "pallet-staking", + "parity-scale-codec", + "scale-info", + "sp-runtime 31.0.1", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-nomination-pools-runtime-api" +version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "pallet-nomination-pools", + "parity-scale-codec", + "sp-api", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-offences" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "serde", + "sp-runtime 31.0.1", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-offences-benchmarking" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-babe", + "pallet-balances", + "pallet-grandpa", + "pallet-im-online", + "pallet-offences", + "pallet-session", + "pallet-staking", + "parity-scale-codec", + "scale-info", + "sp-runtime 31.0.1", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-preimage" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-proxy" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-ranked-collective" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "scale-info", + "sp-arithmetic 23.0.0", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-referenda" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "assert_matches", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-arithmetic 23.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-salary" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-ranked-collective", + "parity-scale-codec", + "scale-info", + "sp-arithmetic 23.0.0", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-scheduler" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-weights 27.0.0", +] + +[[package]] +name = "pallet-session" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "log", + "pallet-timestamp", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-session", + "sp-staking", + "sp-state-machine 0.35.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-trie 29.0.0", +] + +[[package]] +name = "pallet-session-benchmarking" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-session", + "pallet-staking", + "parity-scale-codec", + "rand 0.8.5", + "sp-runtime 31.0.1", + "sp-session", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-staking" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-election-provider-support", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "pallet-session", + "parity-scale-codec", + "rand_chacha 0.3.1", + "scale-info", + "serde", + "sp-application-crypto 30.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-staking", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-staking-reward-curve" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "pallet-staking-reward-fn" +version = "19.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "log", + "sp-arithmetic 23.0.0", +] + +[[package]] +name = "pallet-staking-runtime-api" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "sp-api", + "sp-staking", +] + +[[package]] +name = "pallet-timestamp" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-inherents", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-timestamp", +] + +[[package]] +name = "pallet-transaction-payment" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-transaction-payment-rpc" +version = "30.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "jsonrpsee", + "pallet-transaction-payment-rpc-runtime-api", + "parity-scale-codec", + "sp-api", + "sp-blockchain", + "sp-core 28.0.0", + "sp-rpc", + "sp-runtime 31.0.1", + "sp-weights 27.0.0", +] + +[[package]] +name = "pallet-transaction-payment-rpc-runtime-api" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "pallet-transaction-payment", + "parity-scale-codec", + "sp-api", + "sp-runtime 31.0.1", + "sp-weights 27.0.0", +] + +[[package]] +name = "pallet-treasury" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "docify", + "frame-benchmarking", + "frame-support", + "frame-system", + "impl-trait-for-tuples", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 28.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-utility" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-vesting" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "pallet-whitelist" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "parity-bip39" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e69bf016dc406eff7d53a7d3f7cf1c2e72c82b9088aac1118591e36dd2cd3e9" +dependencies = [ + "bitcoin_hashes 0.13.0", + "rand 0.8.5", + "rand_core 0.6.4", + "serde", + "unicode-normalization", +] + +[[package]] +name = "parity-db" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "592a28a24b09c9dc20ac8afaa6839abc417c720afe42c12e1e4a9d6aa2508d2e" +dependencies = [ + "blake2 0.10.6", + "crc32fast", + "fs2", + "hex", + "libc", + "log", + "lz4", + "memmap2 0.5.10", + "parking_lot 0.12.3", + "rand 0.8.5", + "siphasher 0.3.11", + "snap", + "winapi", +] + +[[package]] +name = "parity-scale-codec" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" +dependencies = [ + "arrayvec 0.7.4", + "bitvec", + "byte-slice-cast", + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "parity-send-wrapper" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" + +[[package]] +name = "parity-wasm" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" + +[[package]] +name = "parking" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.10", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.1", + "smallvec", + "windows-targets 0.52.5", +] + +[[package]] +name = "partial_sort" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7924d1d0ad836f665c9065e26d016c673ece3993f30d340068b16f282afc1156" + +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core 0.6.4", + "subtle 2.5.0", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest 0.10.7", + "password-hash", +] + +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + +[[package]] +name = "pem" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pest" +version = "2.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "pest_meta" +version = "2.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd" +dependencies = [ + "once_cell", + "pest", + "sha2 0.10.8", +] + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap 2.2.6", +] + +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "piper" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1d5c74c9876f070d3e8fd503d748c7d974c3e48da8f41350fa5222ef9b4391" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "platforms" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" + +[[package]] +name = "polkavm" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a3693e5efdb2bf74e449cd25fd777a28bd7ed87e41f5d5da75eb31b4de48b94" +dependencies = [ + "libc", + "log", + "polkavm-assembler", + "polkavm-common 0.9.0", + "polkavm-linux-raw", +] + +[[package]] +name = "polkavm-assembler" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa96d6d868243acc12de813dd48e756cbadcc8e13964c70d272753266deadc1" +dependencies = [ + "log", +] + +[[package]] +name = "polkavm-common" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92c99f7eee94e7be43ba37eef65ad0ee8cbaf89b7c00001c3f6d2be985cb1817" + +[[package]] +name = "polkavm-common" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d9428a5cfcc85c5d7b9fc4b6a18c4b802d0173d768182a51cc7751640f08b92" +dependencies = [ + "log", +] + +[[package]] +name = "polkavm-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79fa916f7962348bd1bb1a65a83401675e6fc86c51a0fdbcf92a3108e58e6125" +dependencies = [ + "polkavm-derive-impl-macro 0.8.0", +] + +[[package]] +name = "polkavm-derive" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae8c4bea6f3e11cd89bb18bcdddac10bd9a24015399bd1c485ad68a985a19606" +dependencies = [ + "polkavm-derive-impl-macro 0.9.0", +] + +[[package]] +name = "polkavm-derive-impl" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c10b2654a8a10a83c260bfb93e97b262cf0017494ab94a65d389e0eda6de6c9c" +dependencies = [ + "polkavm-common 0.8.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "polkavm-derive-impl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c4fdfc49717fb9a196e74a5d28e0bc764eb394a2c803eb11133a31ac996c60c" +dependencies = [ + "polkavm-common 0.9.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "polkavm-derive-impl-macro" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e85319a0d5129dc9f021c62607e0804f5fb777a05cdda44d750ac0732def66" +dependencies = [ + "polkavm-derive-impl 0.8.0", + "syn 2.0.66", +] + +[[package]] +name = "polkavm-derive-impl-macro" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ba81f7b5faac81e528eb6158a6f3c9e0bb1008e0ffa19653bc8dea925ecb429" +dependencies = [ + "polkavm-derive-impl 0.9.0", + "syn 2.0.66", +] + +[[package]] +name = "polkavm-linker" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c7be503e60cf56c0eb785f90aaba4b583b36bff00e93997d93fef97f9553c39" +dependencies = [ + "gimli 0.28.1", + "hashbrown 0.14.5", + "log", + "object 0.32.2", + "polkavm-common 0.9.0", + "regalloc2 0.9.3", + "rustc-demangle", +] + +[[package]] +name = "polkavm-linux-raw" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26e85d3456948e650dff0cfc85603915847faf893ed1e66b020bb82ef4557120" + +[[package]] +name = "polling" +version = "3.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6a007746f34ed64099e88783b0ae369eaa3da6392868ba262e2af9b8fbaea1" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi 0.3.9", + "pin-project-lite 0.2.14", + "rustix 0.38.34", + "tracing", + "windows-sys 0.52.0", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug 0.3.1", + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug 0.3.1", + "universal-hash", +] + +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "pprof" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978385d59daf9269189d052ca8a84c1acfd0715c0599a5d5188d4acc078ca46a" +dependencies = [ + "backtrace", + "cfg-if", + "findshlibs", + "libc", + "log", + "nix 0.26.4", + "once_cell", + "parking_lot 0.12.3", + "smallvec", + "symbolic-demangle", + "tempfile", + "thiserror", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "predicates" +version = "2.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" +dependencies = [ + "difflib", + "float-cmp", + "itertools 0.10.5", + "normalize-line-endings", + "predicates-core", + "regex", +] + +[[package]] +name = "predicates" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" +dependencies = [ + "anstyle", + "difflib", + "predicates-core", +] + +[[package]] +name = "predicates-core" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" + +[[package]] +name = "predicates-tree" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" +dependencies = [ + "predicates-core", + "termtree", +] + +[[package]] +name = "prettier-please" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22020dfcf177fcc7bf5deaf7440af371400c67c0de14c399938d8ed4fb4645d3" +dependencies = [ + "proc-macro2", + "syn 2.0.66", +] + +[[package]] +name = "prettyplease" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28f53e8b192565862cf99343194579a022eb9c7dd3a8d03134734803c7b3125" +dependencies = [ + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "prettyplease" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +dependencies = [ + "proc-macro2", + "syn 2.0.66", +] + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-serde", + "scale-info", + "uint", +] + +[[package]] +name = "prioritized-metered-channel" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a172e6cc603231f2cf004232eabcecccc0da53ba576ab286ef7baa0cfc7927ad" +dependencies = [ + "coarsetime", + "crossbeam-queue", + "derive_more", + "futures", + "futures-timer", + "nanorand", + "thiserror", + "tracing", +] + +[[package]] +name = "proc-macro-crate" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" +dependencies = [ + "thiserror", + "toml 0.5.11", +] + +[[package]] +name = "proc-macro-crate" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +dependencies = [ + "toml_edit 0.20.7", +] + +[[package]] +name = "proc-macro-crate" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +dependencies = [ + "toml_edit 0.21.1", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-warning" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "834da187cfe638ae8abb0203f0b33e5ccdb02a28e7199f2f47b3e2754f50edca" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "proc-macro2" +version = "1.0.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prometheus" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d33c28a30771f7f96db69893f78b857f7450d7e0237e9c8fc6427a81bae7ed1" +dependencies = [ + "cfg-if", + "fnv", + "lazy_static", + "memchr", + "parking_lot 0.12.3", + "protobuf", + "thiserror", +] + +[[package]] +name = "prometheus-client" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6fa99d535dd930d1249e6c79cb3c2915f9172a540fe2b02a4c8f9ca954721e" +dependencies = [ + "dtoa", + "itoa", + "parking_lot 0.12.3", + "prometheus-client-derive-encode", +] + +[[package]] +name = "prometheus-client-derive-encode" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "prometheus-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "811031bea65e5a401fb2e1f37d802cca6601e204ac463809a3189352d13b78a5" +dependencies = [ + "chrono", + "itertools 0.12.1", + "once_cell", + "regex", +] + +[[package]] +name = "prost" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +dependencies = [ + "bytes", + "prost-derive 0.11.9", +] + +[[package]] +name = "prost" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +dependencies = [ + "bytes", + "prost-derive 0.12.6", +] + +[[package]] +name = "prost-build" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" +dependencies = [ + "bytes", + "heck 0.4.1", + "itertools 0.10.5", + "lazy_static", + "log", + "multimap 0.8.3", + "petgraph", + "prettyplease 0.1.11", + "prost 0.11.9", + "prost-types 0.11.9", + "regex", + "syn 1.0.109", + "tempfile", + "which", +] + +[[package]] +name = "prost-build" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" +dependencies = [ + "bytes", + "heck 0.5.0", + "itertools 0.12.1", + "log", + "multimap 0.10.0", + "once_cell", + "petgraph", + "prettyplease 0.2.20", + "prost 0.12.6", + "prost-types 0.12.6", + "regex", + "syn 2.0.66", + "tempfile", +] + +[[package]] +name = "prost-derive" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +dependencies = [ + "anyhow", + "itertools 0.10.5", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "prost-derive" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +dependencies = [ + "anyhow", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "prost-types" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +dependencies = [ + "prost 0.11.9", +] + +[[package]] +name = "prost-types" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" +dependencies = [ + "prost 0.12.6", +] + +[[package]] +name = "protobuf" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "pyroscope" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac8a53ce01af1087eaeee6ce7c4fbf50ea4040ab1825c0115c4bafa039644ba9" +dependencies = [ + "json", + "libc", + "libflate", + "log", + "names", + "prost 0.11.9", + "reqwest", + "thiserror", + "url", + "winapi", +] + +[[package]] +name = "pyroscope_pprofrs" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f010b2a981a7f8449a650f25f309e520b5206ea2d89512dcb146aaa5518ff4" +dependencies = [ + "log", + "pprof", + "pyroscope", + "thiserror", +] + +[[package]] +name = "quanta" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" +dependencies = [ + "crossbeam-utils", + "libc", + "once_cell", + "raw-cpuid", + "wasi 0.11.0+wasi-snapshot-preview1", + "web-sys", + "winapi", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quick-protobuf" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d6da84cc204722a989e01ba2f6e1e276e190f22263d0cb6ce8526fcdb0d2e1f" +dependencies = [ + "byteorder", +] + +[[package]] +name = "quick-protobuf-codec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1693116345026436eb2f10b677806169c1a1260c1c60eaaffe3fb5a29ae23d8b" +dependencies = [ + "asynchronous-codec", + "bytes", + "quick-protobuf", + "thiserror", + "unsigned-varint", +] + +[[package]] +name = "quicksink" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77de3c815e5a160b1539c6592796801df2043ae35e123b46d73380cfa57af858" +dependencies = [ + "futures-core", + "futures-sink", + "pin-project-lite 0.1.12", +] + +[[package]] +name = "quinn" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e8b432585672228923edbbf64b8b12c14e1112f62e88737655b4a083dbcd78e" +dependencies = [ + "bytes", + "pin-project-lite 0.2.14", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls 0.20.9", + "thiserror", + "tokio", + "tracing", + "webpki", +] + +[[package]] +name = "quinn-proto" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94b0b33c13a79f669c85defaf4c275dc86a0c0372807d0ca3d78e0bb87274863" +dependencies = [ + "bytes", + "rand 0.8.5", + "ring 0.16.20", + "rustc-hash", + "rustls 0.20.9", + "slab", + "thiserror", + "tinyvec", + "tracing", + "webpki", +] + +[[package]] +name = "quinn-udp" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "641538578b21f5e5c8ea733b736895576d0fe329bb883b937db6f4d163dbaaf4" +dependencies = [ + "libc", + "quinn-proto", + "socket2 0.4.10", + "tracing", + "windows-sys 0.42.0", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.15", +] + +[[package]] +name = "rand_distr" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_pcg" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59cad018caf63deb318e5a4586d99a24424a364f40f1e5778c29aca23f4fc73e" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "raw-cpuid" +version = "11.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e29830cbb1290e404f24c73af91c5d8d631ce7e128691e9477556b540cd01ecd" +dependencies = [ + "bitflags 2.5.0", +] + +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "rcgen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" +dependencies = [ + "pem", + "ring 0.16.20", + "time", + "yasna", +] + +[[package]] +name = "reconnecting-jsonrpsee-ws-client" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89cc4a6f1e641017e300c050f0c4c46a198627fb39ec03e7a028d20256b5e54" +dependencies = [ + "cfg_aliases 0.2.1", + "finito", + "futures", + "jsonrpsee", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +dependencies = [ + "bitflags 2.5.0", +] + +[[package]] +name = "redox_users" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +dependencies = [ + "getrandom 0.2.15", + "libredox", + "thiserror", +] + +[[package]] +name = "ref-cast" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf0a6f84d5f1d581da8b41b47ec8600871962f2a528115b542b362d4b744931" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "regalloc2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80535183cae11b149d618fbd3c37e38d7cda589d82d7769e196ca9a9042d7621" +dependencies = [ + "fxhash", + "log", + "slice-group-by", + "smallvec", +] + +[[package]] +name = "regalloc2" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" +dependencies = [ + "hashbrown 0.13.2", + "log", + "rustc-hash", + "slice-group-by", + "smallvec", +] + +[[package]] +name = "regex" +version = "1.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.6", + "regex-syntax 0.8.3", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.3", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" + +[[package]] +name = "reqwest" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite 0.2.14", + "rustls 0.21.12", + "rustls-pemfile 1.0.4", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-rustls 0.24.1", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.25.4", + "winreg", +] + +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac 0.12.1", + "subtle 2.5.0", +] + +[[package]] +name = "ring" +version = "0.1.0" +source = "git+https://github.com/w3f/ring-proof#b273d33f9981e2bb3375ab45faeb537f7ee35224" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "blake2 0.10.6", + "common", + "fflonk", + "merlin", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted 0.7.1", + "web-sys", + "winapi", +] + +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.15", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "rle-decode-fast" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422" + +[[package]] +name = "rocksdb" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" +dependencies = [ + "libc", + "librocksdb-sys", +] + +[[package]] +name = "route-recognizer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" + +[[package]] +name = "rpassword" +version = "7.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80472be3c897911d0137b2d2b9055faf6eeac5b14e324073d83bc17b191d7e3f" +dependencies = [ + "libc", + "rtoolbox", + "windows-sys 0.48.0", +] + +[[package]] +name = "rtnetlink" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322c53fd76a18698f1c27381d58091de3a043d356aa5bd0d510608b565f469a0" +dependencies = [ + "futures", + "log", + "netlink-packet-route", + "netlink-proto", + "nix 0.24.3", + "thiserror", + "tokio", +] + +[[package]] +name = "rtoolbox" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c247d24e63230cdb56463ae328478bd5eac8b8faa8c69461a77e8e323afac90e" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.23", +] + +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + +[[package]] +name = "rustix" +version = "0.36.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "305efbd14fde4139eb501df5f136994bb520b033fa9fbdce287507dc23b8c7ed" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.1.4", + "windows-sys 0.45.0", +] + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.5.0", + "errno", + "libc", + "linux-raw-sys 0.4.14", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" +dependencies = [ + "log", + "ring 0.16.20", + "sct", + "webpki", +] + +[[package]] +name = "rustls" +version = "0.21.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +dependencies = [ + "log", + "ring 0.17.8", + "rustls-webpki 0.101.7", + "sct", +] + +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring 0.17.8", + "rustls-pki-types", + "rustls-webpki 0.102.4", + "subtle 2.5.0", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" +dependencies = [ + "openssl-probe", + "rustls-pemfile 1.0.4", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-native-certs" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" +dependencies = [ + "openssl-probe", + "rustls-pemfile 2.1.2", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + +[[package]] +name = "rustls-pemfile" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +dependencies = [ + "base64 0.22.1", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring 0.17.8", + "untrusted 0.9.0", +] + +[[package]] +name = "rustls-webpki" +version = "0.102.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +dependencies = [ + "ring 0.17.8", + "rustls-pki-types", + "untrusted 0.9.0", +] + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "ruzstd" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c4eb8a81997cf040a091d1f7e1938aeab6749d3a0dfa73af43cdc32393483d" +dependencies = [ + "byteorder", + "derive_more", + "twox-hash", +] + +[[package]] +name = "rw-stream-sink" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" +dependencies = [ + "futures", + "pin-project", + "static_assertions", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "safe_arch" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "sc-allocator" +version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "log", + "sp-core 28.0.0", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "thiserror", +] + +[[package]] +name = "sc-authority-discovery" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "ip_network", + "libp2p", + "linked_hash_set", + "log", + "multihash 0.17.0", + "multihash-codetable", + "parity-scale-codec", + "prost 0.12.6", + "prost-build 0.12.6", + "rand 0.8.5", + "sc-client-api", + "sc-network", + "sc-network-types", + "sp-api", + "sp-authority-discovery", + "sp-blockchain", + "sp-core 28.0.0", + "sp-keystore 0.34.0", + "sp-runtime 31.0.1", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "sc-basic-authorship" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "futures", + "futures-timer", + "log", + "parity-scale-codec", + "sc-block-builder", + "sc-proposer-metrics", + "sc-telemetry", + "sc-transaction-pool-api", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core 28.0.0", + "sp-inherents", + "sp-runtime 31.0.1", + "substrate-prometheus-endpoint", +] + +[[package]] +name = "sc-block-builder" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-core 28.0.0", + "sp-inherents", + "sp-runtime 31.0.1", + "sp-trie 29.0.0", +] + +[[package]] +name = "sc-chain-spec" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "array-bytes", + "docify", + "log", + "memmap2 0.9.4", + "parity-scale-codec", + "sc-chain-spec-derive", + "sc-client-api", + "sc-executor", + "sc-network", + "sc-telemetry", + "serde", + "serde_json", + "sp-blockchain", + "sp-core 28.0.0", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-genesis-builder", + "sp-io 30.0.0", + "sp-runtime 31.0.1", + "sp-state-machine 0.35.0", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "sc-chain-spec-derive" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "sc-cli" +version = "0.36.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "array-bytes", + "chrono", + "clap 4.5.4", + "fdlimit", + "futures", + "itertools 0.11.0", + "libp2p-identity", + "log", + "names", + "parity-bip39", + "parity-scale-codec", + "rand 0.8.5", + "regex", + "rpassword", + "sc-client-api", + "sc-client-db", + "sc-keystore", + "sc-mixnet", + "sc-network", + "sc-service", + "sc-telemetry", + "sc-tracing", + "sc-utils", + "serde", + "serde_json", + "sp-blockchain", + "sp-core 28.0.0", + "sp-keyring", + "sp-keystore 0.34.0", + "sp-panic-handler 13.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-runtime 31.0.1", + "sp-version", + "thiserror", + "tokio", +] + +[[package]] +name = "sc-client-api" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "fnv", + "futures", + "log", + "parity-scale-codec", + "parking_lot 0.12.3", + "sc-executor", + "sc-transaction-pool-api", + "sc-utils", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core 28.0.0", + "sp-database", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-runtime 31.0.1", + "sp-state-machine 0.35.0", + "sp-statement-store", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-trie 29.0.0", + "substrate-prometheus-endpoint", +] + +[[package]] +name = "sc-client-db" +version = "0.35.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "hash-db", + "kvdb", + "kvdb-memorydb", + "kvdb-rocksdb", + "linked-hash-map", + "log", + "parity-db", + "parity-scale-codec", + "parking_lot 0.12.3", + "sc-client-api", + "sc-state-db", + "schnellru", + "sp-arithmetic 23.0.0", + "sp-blockchain", + "sp-core 28.0.0", + "sp-database", + "sp-runtime 31.0.1", + "sp-state-machine 0.35.0", + "sp-trie 29.0.0", +] + +[[package]] +name = "sc-consensus" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "log", + "mockall", + "parking_lot 0.12.3", + "sc-client-api", + "sc-network-types", + "sc-utils", + "serde", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core 28.0.0", + "sp-runtime 31.0.1", + "sp-state-machine 0.35.0", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "sc-consensus-babe" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "fork-tree", + "futures", + "log", + "num-bigint", + "num-rational", + "num-traits", + "parity-scale-codec", + "parking_lot 0.12.3", + "sc-client-api", + "sc-consensus", + "sc-consensus-epochs", + "sc-consensus-slots", + "sc-telemetry", + "sc-transaction-pool-api", + "sp-api", + "sp-application-crypto 30.0.0", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-consensus-slots", + "sp-core 28.0.0", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-inherents", + "sp-keystore 0.34.0", + "sp-runtime 31.0.1", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "sc-consensus-babe-rpc" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "futures", + "jsonrpsee", + "sc-consensus-babe", + "sc-consensus-epochs", + "sc-rpc-api", + "serde", + "sp-api", + "sp-application-crypto 30.0.0", + "sp-blockchain", + "sp-consensus", + "sp-consensus-babe", + "sp-core 28.0.0", + "sp-keystore 0.34.0", + "sp-runtime 31.0.1", + "thiserror", +] + +[[package]] +name = "sc-consensus-epochs" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "fork-tree", + "parity-scale-codec", + "sc-client-api", + "sc-consensus", + "sp-blockchain", + "sp-runtime 31.0.1", +] + +[[package]] +name = "sc-consensus-grandpa" +version = "0.19.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "ahash 0.8.11", + "array-bytes", + "async-trait", + "dyn-clone", + "finality-grandpa", + "fork-tree", + "futures", + "futures-timer", + "log", + "parity-scale-codec", + "parking_lot 0.12.3", + "rand 0.8.5", + "sc-block-builder", + "sc-chain-spec", + "sc-client-api", + "sc-consensus", + "sc-network", + "sc-network-common", + "sc-network-gossip", + "sc-network-sync", + "sc-network-types", + "sc-telemetry", + "sc-transaction-pool-api", + "sc-utils", + "serde_json", + "sp-api", + "sp-application-crypto 30.0.0", + "sp-arithmetic 23.0.0", + "sp-blockchain", + "sp-consensus", + "sp-consensus-grandpa", + "sp-core 28.0.0", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-keystore 0.34.0", + "sp-runtime 31.0.1", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "sc-consensus-grandpa-rpc" +version = "0.19.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "finality-grandpa", + "futures", + "jsonrpsee", + "log", + "parity-scale-codec", + "sc-client-api", + "sc-consensus-grandpa", + "sc-rpc", + "serde", + "sp-blockchain", + "sp-core 28.0.0", + "sp-runtime 31.0.1", + "thiserror", +] + +[[package]] +name = "sc-consensus-slots" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "log", + "parity-scale-codec", + "sc-client-api", + "sc-consensus", + "sc-telemetry", + "sp-arithmetic 23.0.0", + "sp-blockchain", + "sp-consensus", + "sp-consensus-slots", + "sp-core 28.0.0", + "sp-inherents", + "sp-runtime 31.0.1", + "sp-state-machine 0.35.0", +] + +[[package]] +name = "sc-executor" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "parking_lot 0.12.3", + "sc-executor-common", + "sc-executor-polkavm", + "sc-executor-wasmtime", + "schnellru", + "sp-api", + "sp-core 28.0.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-io 30.0.0", + "sp-panic-handler 13.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-trie 29.0.0", + "sp-version", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "tracing", +] + +[[package]] +name = "sc-executor-common" +version = "0.29.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "polkavm", + "sc-allocator", + "sp-maybe-compressed-blob", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "thiserror", + "wasm-instrument", +] + +[[package]] +name = "sc-executor-polkavm" +version = "0.29.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "log", + "polkavm", + "sc-executor-common", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "sc-executor-wasmtime" +version = "0.29.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "anyhow", + "cfg-if", + "libc", + "log", + "parking_lot 0.12.3", + "rustix 0.36.17", + "sc-allocator", + "sc-executor-common", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "wasmtime", +] + +[[package]] +name = "sc-informant" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "ansi_term", + "futures", + "futures-timer", + "log", + "sc-client-api", + "sc-network", + "sc-network-common", + "sc-network-sync", + "sp-blockchain", + "sp-runtime 31.0.1", +] + +[[package]] +name = "sc-keystore" +version = "25.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "array-bytes", + "parking_lot 0.12.3", + "serde_json", + "sp-application-crypto 30.0.0", + "sp-core 28.0.0", + "sp-keystore 0.34.0", + "thiserror", +] + +[[package]] +name = "sc-mixnet" +version = "0.4.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "array-bytes", + "arrayvec 0.7.4", + "blake2 0.10.6", + "bytes", + "futures", + "futures-timer", + "log", + "mixnet", + "multiaddr", + "parity-scale-codec", + "parking_lot 0.12.3", + "sc-client-api", + "sc-network", + "sc-network-types", + "sc-transaction-pool-api", + "sp-api", + "sp-consensus", + "sp-core 28.0.0", + "sp-keystore 0.34.0", + "sp-mixnet", + "sp-runtime 31.0.1", + "thiserror", +] + +[[package]] +name = "sc-network" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "array-bytes", + "async-channel 1.9.0", + "async-trait", + "asynchronous-codec", + "bytes", + "cid 0.9.0", + "either", + "fnv", + "futures", + "futures-timer", + "ip_network", + "libp2p", + "linked_hash_set", + "litep2p", + "log", + "mockall", + "once_cell", + "parity-scale-codec", + "parking_lot 0.12.3", + "partial_sort", + "pin-project", + "prost 0.12.6", + "prost-build 0.12.6", + "rand 0.8.5", + "sc-client-api", + "sc-network-common", + "sc-network-types", + "sc-utils", + "schnellru", + "serde", + "serde_json", + "smallvec", + "sp-arithmetic 23.0.0", + "sp-blockchain", + "sp-core 28.0.0", + "sp-runtime 31.0.1", + "substrate-prometheus-endpoint", + "thiserror", + "tokio", + "tokio-stream", + "unsigned-varint", + "void", + "wasm-timer", + "zeroize", +] + +[[package]] +name = "sc-network-common" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "bitflags 1.3.2", + "futures", + "libp2p-identity", + "parity-scale-codec", + "prost-build 0.12.6", + "sc-consensus", + "sc-network-types", + "sp-consensus", + "sp-consensus-grandpa", + "sp-runtime 31.0.1", +] + +[[package]] +name = "sc-network-gossip" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "ahash 0.8.11", + "futures", + "futures-timer", + "libp2p", + "log", + "sc-network", + "sc-network-common", + "sc-network-sync", + "sc-network-types", + "schnellru", + "sp-runtime 31.0.1", + "substrate-prometheus-endpoint", + "tracing", +] + +[[package]] +name = "sc-network-light" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "array-bytes", + "async-channel 1.9.0", + "futures", + "log", + "parity-scale-codec", + "prost 0.12.6", + "prost-build 0.12.6", + "sc-client-api", + "sc-network", + "sc-network-types", + "sp-blockchain", + "sp-core 28.0.0", + "sp-runtime 31.0.1", + "thiserror", +] + +[[package]] +name = "sc-network-sync" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "array-bytes", + "async-channel 1.9.0", + "async-trait", + "fork-tree", + "futures", + "futures-timer", + "libp2p", + "log", + "mockall", + "parity-scale-codec", + "prost 0.12.6", + "prost-build 0.12.6", + "sc-client-api", + "sc-consensus", + "sc-network", + "sc-network-common", + "sc-network-types", + "sc-utils", + "schnellru", + "smallvec", + "sp-arithmetic 23.0.0", + "sp-blockchain", + "sp-consensus", + "sp-consensus-grandpa", + "sp-core 28.0.0", + "sp-runtime 31.0.1", + "substrate-prometheus-endpoint", + "thiserror", + "tokio", + "tokio-stream", +] + +[[package]] +name = "sc-network-transactions" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "array-bytes", + "futures", + "libp2p", + "log", + "parity-scale-codec", + "sc-network", + "sc-network-common", + "sc-network-sync", + "sc-network-types", + "sc-utils", + "sp-consensus", + "sp-runtime 31.0.1", + "substrate-prometheus-endpoint", +] + +[[package]] +name = "sc-network-types" +version = "0.10.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "bs58 0.5.1", + "libp2p-identity", + "litep2p", + "multiaddr", + "multihash 0.17.0", + "rand 0.8.5", + "thiserror", +] + +[[package]] +name = "sc-offchain" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "array-bytes", + "bytes", + "fnv", + "futures", + "futures-timer", + "hyper", + "hyper-rustls", + "libp2p", + "log", + "num_cpus", + "once_cell", + "parity-scale-codec", + "parking_lot 0.12.3", + "rand 0.8.5", + "sc-client-api", + "sc-network", + "sc-network-common", + "sc-network-types", + "sc-transaction-pool-api", + "sc-utils", + "sp-api", + "sp-core 28.0.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-keystore 0.34.0", + "sp-offchain", + "sp-runtime 31.0.1", + "threadpool", + "tracing", +] + +[[package]] +name = "sc-proposer-metrics" +version = "0.17.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "log", + "substrate-prometheus-endpoint", +] + +[[package]] +name = "sc-rpc" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "futures", + "jsonrpsee", + "log", + "parity-scale-codec", + "parking_lot 0.12.3", + "sc-block-builder", + "sc-chain-spec", + "sc-client-api", + "sc-mixnet", + "sc-rpc-api", + "sc-tracing", + "sc-transaction-pool-api", + "sc-utils", + "serde_json", + "sp-api", + "sp-blockchain", + "sp-core 28.0.0", + "sp-keystore 0.34.0", + "sp-offchain", + "sp-rpc", + "sp-runtime 31.0.1", + "sp-session", + "sp-statement-store", + "sp-version", + "tokio", +] + +[[package]] +name = "sc-rpc-api" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "jsonrpsee", + "parity-scale-codec", + "sc-chain-spec", + "sc-mixnet", + "sc-transaction-pool-api", + "scale-info", + "serde", + "serde_json", + "sp-core 28.0.0", + "sp-rpc", + "sp-runtime 31.0.1", + "sp-version", + "thiserror", +] + +[[package]] +name = "sc-rpc-server" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "forwarded-header-value", + "futures", + "governor", + "http", + "hyper", + "ip_network", + "jsonrpsee", + "log", + "serde_json", + "substrate-prometheus-endpoint", + "tokio", + "tower", + "tower-http", +] + +[[package]] +name = "sc-rpc-spec-v2" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "array-bytes", + "futures", + "futures-util", + "hex", + "jsonrpsee", + "log", + "parity-scale-codec", + "parking_lot 0.12.3", + "rand 0.8.5", + "sc-chain-spec", + "sc-client-api", + "sc-rpc", + "sc-transaction-pool-api", + "sc-utils", + "schnellru", + "serde", + "sp-api", + "sp-blockchain", + "sp-core 28.0.0", + "sp-rpc", + "sp-runtime 31.0.1", + "sp-version", + "thiserror", + "tokio", + "tokio-stream", +] + +[[package]] +name = "sc-service" +version = "0.35.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "directories", + "exit-future", + "futures", + "futures-timer", + "jsonrpsee", + "log", + "parity-scale-codec", + "parking_lot 0.12.3", + "pin-project", + "rand 0.8.5", + "sc-chain-spec", + "sc-client-api", + "sc-client-db", + "sc-consensus", + "sc-executor", + "sc-informant", + "sc-keystore", + "sc-network", + "sc-network-common", + "sc-network-light", + "sc-network-sync", + "sc-network-transactions", + "sc-network-types", + "sc-rpc", + "sc-rpc-server", + "sc-rpc-spec-v2", + "sc-sysinfo", + "sc-telemetry", + "sc-tracing", + "sc-transaction-pool", + "sc-transaction-pool-api", + "sc-utils", + "schnellru", + "serde", + "serde_json", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-core 28.0.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-keystore 0.34.0", + "sp-runtime 31.0.1", + "sp-session", + "sp-state-machine 0.35.0", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-transaction-pool", + "sp-transaction-storage-proof", + "sp-trie 29.0.0", + "sp-version", + "static_init", + "substrate-prometheus-endpoint", + "tempfile", + "thiserror", + "tokio", + "tracing", + "tracing-futures", +] + +[[package]] +name = "sc-state-db" +version = "0.30.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "log", + "parity-scale-codec", + "parking_lot 0.12.3", + "sp-core 28.0.0", +] + +[[package]] +name = "sc-storage-monitor" +version = "0.16.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "clap 4.5.4", + "fs4", + "log", + "sp-core 28.0.0", + "thiserror", + "tokio", +] + +[[package]] +name = "sc-sync-state-rpc" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "jsonrpsee", + "parity-scale-codec", + "sc-chain-spec", + "sc-client-api", + "sc-consensus-babe", + "sc-consensus-epochs", + "sc-consensus-grandpa", + "serde", + "serde_json", + "sp-blockchain", + "sp-runtime 31.0.1", + "thiserror", +] + +[[package]] +name = "sc-sysinfo" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "derive_more", + "futures", + "libc", + "log", + "rand 0.8.5", + "rand_pcg", + "regex", + "sc-telemetry", + "serde", + "serde_json", + "sp-core 28.0.0", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-io 30.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "sc-telemetry" +version = "15.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "chrono", + "futures", + "libp2p", + "log", + "parking_lot 0.12.3", + "pin-project", + "rand 0.8.5", + "sc-network", + "sc-utils", + "serde", + "serde_json", + "thiserror", + "wasm-timer", +] + +[[package]] +name = "sc-tracing" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "ansi_term", + "chrono", + "is-terminal", + "lazy_static", + "libc", + "log", + "parity-scale-codec", + "parking_lot 0.12.3", + "regex", + "rustc-hash", + "sc-client-api", + "sc-tracing-proc-macro", + "serde", + "sp-api", + "sp-blockchain", + "sp-core 28.0.0", + "sp-rpc", + "sp-runtime 31.0.1", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "thiserror", + "tracing", + "tracing-log 0.2.0", + "tracing-subscriber 0.3.18", +] + +[[package]] +name = "sc-tracing-proc-macro" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "sc-transaction-pool" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "linked-hash-map", + "log", + "parity-scale-codec", + "parking_lot 0.12.3", + "sc-client-api", + "sc-transaction-pool-api", + "sc-utils", + "serde", + "sp-api", + "sp-blockchain", + "sp-core 28.0.0", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-runtime 31.0.1", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-transaction-pool", + "substrate-prometheus-endpoint", + "thiserror", +] + +[[package]] +name = "sc-transaction-pool-api" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "futures", + "log", + "parity-scale-codec", + "serde", + "sp-blockchain", + "sp-core 28.0.0", + "sp-runtime 31.0.1", + "thiserror", +] + +[[package]] +name = "sc-utils" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-channel 1.9.0", + "futures", + "futures-timer", + "lazy_static", + "log", + "parking_lot 0.12.3", + "prometheus", + "sp-arithmetic 23.0.0", +] + +[[package]] +name = "scale-bits" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57b1e7f6b65ed1f04e79a85a57d755ad56d76fdf1e9bddcc9ae14f71fcdcf54" +dependencies = [ + "parity-scale-codec", + "scale-info", + "scale-type-resolver", + "serde", +] + +[[package]] +name = "scale-decode" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e98f3262c250d90e700bb802eb704e1f841e03331c2eb815e46516c4edbf5b27" +dependencies = [ + "derive_more", + "parity-scale-codec", + "primitive-types", + "scale-bits", + "scale-decode-derive", + "scale-type-resolver", + "smallvec", +] + +[[package]] +name = "scale-decode-derive" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb22f574168103cdd3133b19281639ca65ad985e24612728f727339dcaf4021" +dependencies = [ + "darling 0.14.4", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "scale-encode" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ba0b9c48dc0eb20c60b083c29447c0c4617cb7c4a4c9fef72aa5c5bc539e15e" +dependencies = [ + "derive_more", + "parity-scale-codec", + "primitive-types", + "scale-bits", + "scale-encode-derive", + "scale-type-resolver", + "smallvec", +] + +[[package]] +name = "scale-encode-derive" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82ab7e60e2d9c8d47105f44527b26f04418e5e624ffc034f6b4a86c0ba19c5bf" +dependencies = [ + "darling 0.14.4", + "proc-macro-crate 1.1.3", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "scale-info" +version = "2.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" +dependencies = [ + "bitvec", + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", + "serde", +] + +[[package]] +name = "scale-info-derive" +version = "2.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "scale-type-resolver" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0cded6518aa0bd6c1be2b88ac81bf7044992f0f154bfbabd5ad34f43512abcb" +dependencies = [ + "scale-info", + "smallvec", +] + +[[package]] +name = "scale-typegen" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "498d1aecf2ea61325d4511787c115791639c0fd21ef4f8e11e49dd09eff2bbac" +dependencies = [ + "proc-macro2", + "quote", + "scale-info", + "syn 2.0.66", + "thiserror", +] + +[[package]] +name = "scale-value" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2cf9738c263c665144177201126bdad39d3d62512152f178f35002228026976" +dependencies = [ + "base58", + "blake2 0.10.6", + "derive_more", + "either", + "frame-metadata 15.1.0", + "parity-scale-codec", + "scale-bits", + "scale-decode", + "scale-encode", + "scale-info", + "scale-type-resolver", + "serde", + "yap", +] + +[[package]] +name = "schannel" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "schnellru" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9a8ef13a93c54d20580de1e5c413e624e53121d42fc7e2c11d10ef7f8b02367" +dependencies = [ + "ahash 0.8.11", + "cfg-if", + "hashbrown 0.13.2", +] + +[[package]] +name = "schnorrkel" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de18f6d8ba0aad7045f5feae07ec29899c1112584a38509a84ad7b04451eaa0" +dependencies = [ + "aead", + "arrayref", + "arrayvec 0.7.4", + "curve25519-dalek 4.1.2", + "getrandom_or_panic", + "merlin", + "rand_core 0.6.4", + "serde_bytes", + "sha2 0.10.8", + "subtle 2.5.0", + "zeroize", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scratch" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152" + +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring 0.17.8", + "untrusted 0.9.0", +] + +[[package]] +name = "sctp-proto" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f64cef148d3295c730c3cb340b0b252a4d570b1c7d4bf0808f88540b0a888bc" +dependencies = [ + "bytes", + "crc", + "fxhash", + "log", + "rand 0.8.5", + "slab", + "thiserror", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array 0.14.7", + "pkcs8", + "serdect", + "subtle 2.5.0", + "zeroize", +] + +[[package]] +name = "secp256k1" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +dependencies = [ + "cc", +] + +[[package]] +name = "secrecy" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +dependencies = [ + "zeroize", +] + +[[package]] +name = "security-framework" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +dependencies = [ + "bitflags 2.5.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +dependencies = [ + "serde", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "separator" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f97841a747eef040fcd2e7b3b9a220a7205926e60488e673d9e4926d27772ce5" + +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "serde_json" +version = "1.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serdect" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" +dependencies = [ + "base16ct", + "serde", +] + +[[package]] +name = "serial_test" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e56dd856803e253c8f298af3f4d7eb0ae5e23a737252cd90bb4f3b435033b2d" +dependencies = [ + "dashmap", + "futures", + "lazy_static", + "log", + "parking_lot 0.12.3", + "serial_test_derive", +] + +[[package]] +name = "serial_test_derive" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "sha-1" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.1", +] + +[[package]] +name = "sha-1" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", + "sha1-asm", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha1-asm" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "286acebaf8b67c1130aedffad26f594eff0c1292389158135327d2e23aed582b" +dependencies = [ + "cc", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.1", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "simba" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" +dependencies = [ + "approx", + "num-complex", + "num-traits", + "paste", + "wide", +] + +[[package]] +name = "simple-dns" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cae9a3fcdadafb6d97f4c0e007e4247b114ee0f119f650c3cbf3a8b3a1479694" +dependencies = [ + "bitflags 2.5.0", +] + +[[package]] +name = "simple-mermaid" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "620a1d43d70e142b1d46a929af51d44f383db9c7a2ec122de2cd992ccfcf3c18" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "smol" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e635339259e51ef85ac7aa29a1cd991b957047507288697a690e80ab97d07cad" +dependencies = [ + "async-channel 2.3.1", + "async-executor", + "async-fs", + "async-io", + "async-lock", + "async-net", + "async-process", + "blocking", + "futures-lite", +] + +[[package]] +name = "smoldot" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d1eaa97d77be4d026a1e7ffad1bb3b78448763b357ea6f8188d3e6f736a9b9" +dependencies = [ + "arrayvec 0.7.4", + "async-lock", + "atomic-take", + "base64 0.21.7", + "bip39", + "blake2-rfc", + "bs58 0.5.1", + "chacha20", + "crossbeam-queue", + "derive_more", + "ed25519-zebra 4.0.3", + "either", + "event-listener 4.0.3", + "fnv", + "futures-lite", + "futures-util", + "hashbrown 0.14.5", + "hex", + "hmac 0.12.1", + "itertools 0.12.1", + "libm", + "libsecp256k1", + "merlin", + "no-std-net", + "nom", + "num-bigint", + "num-rational", + "num-traits", + "pbkdf2", + "pin-project", + "poly1305", + "rand 0.8.5", + "rand_chacha 0.3.1", + "ruzstd", + "schnorrkel", + "serde", + "serde_json", + "sha2 0.10.8", + "sha3", + "siphasher 1.0.1", + "slab", + "smallvec", + "soketto", + "twox-hash", + "wasmi", + "x25519-dalek 2.0.1", + "zeroize", +] + +[[package]] +name = "smoldot-light" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5496f2d116b7019a526b1039ec2247dd172b8670633b1a64a614c9ea12c9d8c7" +dependencies = [ + "async-channel 2.3.1", + "async-lock", + "base64 0.21.7", + "blake2-rfc", + "derive_more", + "either", + "event-listener 4.0.3", + "fnv", + "futures-channel", + "futures-lite", + "futures-util", + "hashbrown 0.14.5", + "hex", + "itertools 0.12.1", + "log", + "lru 0.12.3", + "no-std-net", + "parking_lot 0.12.3", + "pin-project", + "rand 0.8.5", + "rand_chacha 0.3.1", + "serde", + "serde_json", + "siphasher 1.0.1", + "slab", + "smol", + "smoldot", + "zeroize", +] + +[[package]] +name = "snap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" + +[[package]] +name = "snow" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "850948bee068e713b8ab860fe1adc4d109676ab4c3b621fd8147f06b261f2f85" +dependencies = [ + "aes-gcm", + "blake2 0.10.6", + "chacha20poly1305", + "curve25519-dalek 4.1.2", + "rand_core 0.6.4", + "ring 0.17.8", + "rustc_version", + "sha2 0.10.8", + "subtle 2.5.0", +] + +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "soketto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" +dependencies = [ + "base64 0.13.1", + "bytes", + "flate2", + "futures", + "http", + "httparse", + "log", + "rand 0.8.5", + "sha-1 0.9.8", +] + +[[package]] +name = "sp-api" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "scale-info", + "sp-api-proc-macro", + "sp-core 28.0.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-metadata-ir", + "sp-runtime 31.0.1", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-state-machine 0.35.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-trie 29.0.0", + "sp-version", + "thiserror", +] + +[[package]] +name = "sp-api-proc-macro" +version = "15.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "Inflector", + "blake2 0.10.6", + "expander", + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "sp-application-crypto" +version = "30.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "sp-application-crypto" +version = "33.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13ca6121c22c8bd3d1dce1f05c479101fd0d7b159bef2a3e8c834138d839c75c" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 31.0.0", + "sp-io 33.0.0", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sp-arithmetic" +version = "23.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "docify", + "integer-sqrt", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "static_assertions", +] + +[[package]] +name = "sp-arithmetic" +version = "25.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "910c07fa263b20bf7271fdd4adcb5d3217dfdac14270592e0780223542e7e114" +dependencies = [ + "integer-sqrt", + "num-traits", + "parity-scale-codec", + "scale-info", + "serde", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions", +] + +[[package]] +name = "sp-ark-bls12-381" +version = "0.4.2" +source = "git+https://github.com/paritytech/arkworks-substrate#caa2eed74beb885dd07c7db5f916f2281dad818f" +dependencies = [ + "ark-bls12-381-ext", + "sp-crypto-ec-utils", +] + +[[package]] +name = "sp-ark-ed-on-bls12-381-bandersnatch" +version = "0.4.2" +source = "git+https://github.com/paritytech/arkworks-substrate#caa2eed74beb885dd07c7db5f916f2281dad818f" +dependencies = [ + "ark-ed-on-bls12-381-bandersnatch-ext", + "sp-crypto-ec-utils", +] + +[[package]] +name = "sp-authority-discovery" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-application-crypto 30.0.0", + "sp-runtime 31.0.1", +] + +[[package]] +name = "sp-block-builder" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "sp-api", + "sp-inherents", + "sp-runtime 31.0.1", +] + +[[package]] +name = "sp-blockchain" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "futures", + "log", + "parity-scale-codec", + "parking_lot 0.12.3", + "schnellru", + "sp-api", + "sp-consensus", + "sp-database", + "sp-runtime 31.0.1", + "sp-state-machine 0.35.0", + "thiserror", +] + +[[package]] +name = "sp-consensus" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "futures", + "log", + "sp-core 28.0.0", + "sp-inherents", + "sp-runtime 31.0.1", + "sp-state-machine 0.35.0", + "thiserror", +] + +[[package]] +name = "sp-consensus-babe" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto 30.0.0", + "sp-consensus-slots", + "sp-core 28.0.0", + "sp-inherents", + "sp-runtime 31.0.1", + "sp-timestamp", +] + +[[package]] +name = "sp-consensus-grandpa" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "finality-grandpa", + "log", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-application-crypto 30.0.0", + "sp-core 28.0.0", + "sp-keystore 0.34.0", + "sp-runtime 31.0.1", +] + +[[package]] +name = "sp-consensus-slots" +version = "0.32.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-timestamp", +] + +[[package]] +name = "sp-core" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "array-bytes", + "bandersnatch_vrfs", + "bitflags 1.3.2", + "blake2 0.10.6", + "bounded-collections", + "bs58 0.5.1", + "dyn-clonable", + "ed25519-zebra 4.0.3", + "futures", + "hash-db", + "hash256-std-hasher", + "impl-serde", + "itertools 0.11.0", + "k256", + "libsecp256k1", + "log", + "merlin", + "parity-bip39", + "parity-scale-codec", + "parking_lot 0.12.3", + "paste", + "primitive-types", + "rand 0.8.5", + "scale-info", + "schnorrkel", + "secp256k1", + "secrecy", + "serde", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "ss58-registry", + "substrate-bip39 0.4.7", + "thiserror", + "tracing", + "w3f-bls", + "zeroize", +] + +[[package]] +name = "sp-core" +version = "31.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d7a0fd8f16dcc3761198fc83be12872f823b37b749bc72a3a6a1f702509366" +dependencies = [ + "array-bytes", + "bitflags 1.3.2", + "blake2 0.10.6", + "bounded-collections", + "bs58 0.5.1", + "dyn-clonable", + "ed25519-zebra 3.1.0", + "futures", + "hash-db", + "hash256-std-hasher", + "impl-serde", + "itertools 0.10.5", + "k256", + "libsecp256k1", + "log", + "merlin", + "parity-bip39", + "parity-scale-codec", + "parking_lot 0.12.3", + "paste", + "primitive-types", + "rand 0.8.5", + "scale-info", + "schnorrkel", + "secp256k1", + "secrecy", + "serde", + "sp-crypto-hashing 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-debug-derive 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.27.0", + "sp-runtime-interface 26.0.0", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 20.0.0", + "ss58-registry", + "substrate-bip39 0.5.0", + "thiserror", + "tracing", + "w3f-bls", + "zeroize", +] + +[[package]] +name = "sp-crypto-ec-utils" +version = "0.10.0" +source = "git+https://github.com/paritytech/polkadot-sdk#7084463a49f2359dc2f378f5834c7252af02ed4d" +dependencies = [ + "ark-bls12-377", + "ark-bls12-377-ext", + "ark-bls12-381", + "ark-bls12-381-ext", + "ark-bw6-761", + "ark-bw6-761-ext", + "ark-ec", + "ark-ed-on-bls12-377", + "ark-ed-on-bls12-377-ext", + "ark-ed-on-bls12-381-bandersnatch", + "ark-ed-on-bls12-381-bandersnatch-ext", + "ark-scale", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk)", +] + +[[package]] +name = "sp-crypto-hashing" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc9927a7f81334ed5b8a98a4a978c81324d12bd9713ec76b5c68fd410174c5eb" +dependencies = [ + "blake2b_simd", + "byteorder", + "digest 0.10.7", + "sha2 0.10.8", + "sha3", + "twox-hash", +] + +[[package]] +name = "sp-crypto-hashing" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "blake2b_simd", + "byteorder", + "digest 0.10.7", + "sha2 0.10.8", + "sha3", + "twox-hash", +] + +[[package]] +name = "sp-crypto-hashing-proc-macro" +version = "0.1.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "quote", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "syn 2.0.66", +] + +[[package]] +name = "sp-database" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "kvdb", + "parking_lot 0.12.3", +] + +[[package]] +name = "sp-debug-derive" +version = "14.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d09fa0a5f7299fb81ee25ae3853d26200f7a348148aed6de76be905c007dbe" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "sp-debug-derive" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "sp-debug-derive" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#7084463a49f2359dc2f378f5834c7252af02ed4d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "sp-externalities" +version = "0.25.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "sp-externalities" +version = "0.25.0" +source = "git+https://github.com/paritytech/polkadot-sdk#7084463a49f2359dc2f378f5834c7252af02ed4d" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk)", +] + +[[package]] +name = "sp-externalities" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d6a4572eadd4a63cff92509a210bf425501a0c5e76574b30a366ac77653787" +dependencies = [ + "environmental", + "parity-scale-codec", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 20.0.0", +] + +[[package]] +name = "sp-genesis-builder" +version = "0.8.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde_json", + "sp-api", + "sp-runtime 31.0.1", +] + +[[package]] +name = "sp-inherents" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "sp-runtime 31.0.1", + "thiserror", +] + +[[package]] +name = "sp-io" +version = "30.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "bytes", + "ed25519-dalek 2.1.1", + "libsecp256k1", + "log", + "parity-scale-codec", + "polkavm-derive 0.9.1", + "rustversion", + "secp256k1", + "sp-core 28.0.0", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-keystore 0.34.0", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-state-machine 0.35.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-trie 29.0.0", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-io" +version = "33.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e09bba780b55bd9e67979cd8f654a31e4a6cf45426ff371394a65953d2177f2" +dependencies = [ + "bytes", + "ed25519-dalek 2.1.1", + "libsecp256k1", + "log", + "parity-scale-codec", + "polkavm-derive 0.9.1", + "rustversion", + "secp256k1", + "sp-core 31.0.0", + "sp-crypto-hashing 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-externalities 0.27.0", + "sp-keystore 0.37.0", + "sp-runtime-interface 26.0.0", + "sp-state-machine 0.38.0", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-tracing 16.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-trie 32.0.0", + "tracing", + "tracing-core", +] + +[[package]] +name = "sp-keyring" +version = "31.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "sp-core 28.0.0", + "sp-runtime 31.0.1", + "strum 0.26.2", +] + +[[package]] +name = "sp-keystore" +version = "0.34.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "parking_lot 0.12.3", + "sp-core 28.0.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "sp-keystore" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdbab8b61bd61d5f8625a0c75753b5d5a23be55d3445419acd42caf59cf6236b" +dependencies = [ + "parity-scale-codec", + "parking_lot 0.12.3", + "sp-core 31.0.0", + "sp-externalities 0.27.0", +] + +[[package]] +name = "sp-maybe-compressed-blob" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "thiserror", + "zstd 0.12.4", +] + +[[package]] +name = "sp-metadata-ir" +version = "0.6.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-metadata 16.0.0", + "parity-scale-codec", + "scale-info", +] + +[[package]] +name = "sp-mixnet" +version = "0.4.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-application-crypto 30.0.0", +] + +[[package]] +name = "sp-npos-elections" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "scale-info", + "serde", + "sp-arithmetic 23.0.0", + "sp-core 28.0.0", + "sp-runtime 31.0.1", +] + +[[package]] +name = "sp-offchain" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "sp-api", + "sp-core 28.0.0", + "sp-runtime 31.0.1", +] + +[[package]] +name = "sp-panic-handler" +version = "13.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8f5a17a0a11de029a8b811cb6e8b32ce7e02183cc04a3e965c383246798c416" +dependencies = [ + "backtrace", + "lazy_static", + "regex", +] + +[[package]] +name = "sp-panic-handler" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "backtrace", + "lazy_static", + "regex", +] + +[[package]] +name = "sp-rpc" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "rustc-hash", + "serde", + "sp-core 28.0.0", +] + +[[package]] +name = "sp-runtime" +version = "31.0.1" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "docify", + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "num-traits", + "parity-scale-codec", + "paste", + "rand 0.8.5", + "scale-info", + "serde", + "simple-mermaid", + "sp-application-crypto 30.0.0", + "sp-arithmetic 23.0.0", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-weights 27.0.0", +] + +[[package]] +name = "sp-runtime" +version = "34.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3cb126971e7db2f0fcf8053dce740684c438c7180cfca1959598230f342c58" +dependencies = [ + "docify", + "either", + "hash256-std-hasher", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "paste", + "rand 0.8.5", + "scale-info", + "serde", + "simple-mermaid", + "sp-application-crypto 33.0.0", + "sp-arithmetic 25.0.0", + "sp-core 31.0.0", + "sp-io 33.0.0", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-weights 30.0.0", +] + +[[package]] +name = "sp-runtime-interface" +version = "24.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "polkavm-derive 0.9.1", + "primitive-types", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface" +version = "24.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#7084463a49f2359dc2f378f5834c7252af02ed4d" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "polkavm-derive 0.9.1", + "primitive-types", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-runtime-interface-proc-macro 17.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-storage 19.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "sp-wasm-interface 20.0.0 (git+https://github.com/paritytech/polkadot-sdk)", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface" +version = "26.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a675ea4858333d4d755899ed5ed780174aa34fec15953428d516af5452295" +dependencies = [ + "bytes", + "impl-trait-for-tuples", + "parity-scale-codec", + "polkavm-derive 0.8.0", + "primitive-types", + "sp-externalities 0.27.0", + "sp-runtime-interface-proc-macro 18.0.0", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-storage 20.0.0", + "sp-tracing 16.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-wasm-interface 20.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "17.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "Inflector", + "expander", + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "17.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#7084463a49f2359dc2f378f5834c7252af02ed4d" +dependencies = [ + "Inflector", + "expander", + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "sp-runtime-interface-proc-macro" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0195f32c628fee3ce1dfbbf2e7e52a30ea85f3589da9fe62a8b816d70fc06294" +dependencies = [ + "Inflector", + "expander", + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "sp-session" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "scale-info", + "sp-api", + "sp-core 28.0.0", + "sp-keystore 0.34.0", + "sp-runtime 31.0.1", + "sp-staking", +] + +[[package]] +name = "sp-staking" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 28.0.0", + "sp-runtime 31.0.1", +] + +[[package]] +name = "sp-state-machine" +version = "0.35.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "parking_lot 0.12.3", + "rand 0.8.5", + "smallvec", + "sp-core 28.0.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-panic-handler 13.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-trie 29.0.0", + "thiserror", + "tracing", + "trie-db 0.29.1", +] + +[[package]] +name = "sp-state-machine" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1eae0eac8034ba14437e772366336f579398a46d101de13dbb781ab1e35e67c5" +dependencies = [ + "hash-db", + "log", + "parity-scale-codec", + "parking_lot 0.12.3", + "rand 0.8.5", + "smallvec", + "sp-core 31.0.0", + "sp-externalities 0.27.0", + "sp-panic-handler 13.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-trie 32.0.0", + "thiserror", + "tracing", + "trie-db 0.28.0", +] + +[[package]] +name = "sp-statement-store" +version = "10.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "aes-gcm", + "curve25519-dalek 4.1.2", + "ed25519-dalek 2.1.1", + "hkdf", + "parity-scale-codec", + "rand 0.8.5", + "scale-info", + "sha2 0.10.8", + "sp-api", + "sp-application-crypto 30.0.0", + "sp-core 28.0.0", + "sp-crypto-hashing 0.1.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-runtime 31.0.1", + "sp-runtime-interface 24.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "thiserror", + "x25519-dalek 2.0.1", +] + +[[package]] +name = "sp-std" +version = "14.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8ee986414b0a9ad741776762f4083cd3a5128449b982a3919c4df36874834" + +[[package]] +name = "sp-std" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" + +[[package]] +name = "sp-std" +version = "14.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#7084463a49f2359dc2f378f5834c7252af02ed4d" + +[[package]] +name = "sp-storage" +version = "19.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "sp-storage" +version = "19.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#7084463a49f2359dc2f378f5834c7252af02ed4d" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk)", +] + +[[package]] +name = "sp-storage" +version = "20.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dba5791cb3978e95daf99dad919ecb3ec35565604e88cd38d805d9d4981e8bd" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "ref-cast", + "serde", + "sp-debug-derive 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sp-timestamp" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "parity-scale-codec", + "sp-inherents", + "sp-runtime 31.0.1", + "thiserror", +] + +[[package]] +name = "sp-tracing" +version = "16.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0351810b9d074df71c4514c5228ed05c250607cba131c1c9d1526760ab69c05c" +dependencies = [ + "parity-scale-codec", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing", + "tracing-core", + "tracing-subscriber 0.2.25", +] + +[[package]] +name = "sp-tracing" +version = "16.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "tracing", + "tracing-core", + "tracing-subscriber 0.3.18", +] + +[[package]] +name = "sp-tracing" +version = "16.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#7084463a49f2359dc2f378f5834c7252af02ed4d" +dependencies = [ + "parity-scale-codec", + "tracing", + "tracing-core", + "tracing-subscriber 0.3.18", +] + +[[package]] +name = "sp-transaction-pool" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "sp-api", + "sp-runtime 31.0.1", +] + +[[package]] +name = "sp-transaction-storage-proof" +version = "26.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "parity-scale-codec", + "scale-info", + "sp-core 28.0.0", + "sp-inherents", + "sp-runtime 31.0.1", + "sp-trie 29.0.0", +] + +[[package]] +name = "sp-trie" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "ahash 0.8.11", + "hash-db", + "lazy_static", + "memory-db", + "nohash-hasher", + "parity-scale-codec", + "parking_lot 0.12.3", + "rand 0.8.5", + "scale-info", + "schnellru", + "sp-core 28.0.0", + "sp-externalities 0.25.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "thiserror", + "tracing", + "trie-db 0.29.1", + "trie-root", +] + +[[package]] +name = "sp-trie" +version = "32.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1aa91ad26c62b93d73e65f9ce7ebd04459c4bad086599348846a81988d6faa4" +dependencies = [ + "ahash 0.8.11", + "hash-db", + "lazy_static", + "memory-db", + "nohash-hasher", + "parity-scale-codec", + "parking_lot 0.12.3", + "rand 0.8.5", + "scale-info", + "schnellru", + "sp-core 31.0.0", + "sp-externalities 0.27.0", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror", + "tracing", + "trie-db 0.28.0", + "trie-root", +] + +[[package]] +name = "sp-version" +version = "29.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "impl-serde", + "parity-scale-codec", + "parity-wasm", + "scale-info", + "serde", + "sp-crypto-hashing-proc-macro", + "sp-runtime 31.0.1", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", + "sp-version-proc-macro", + "thiserror", +] + +[[package]] +name = "sp-version-proc-macro" +version = "13.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "parity-scale-codec", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "sp-wasm-interface" +version = "20.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ef97172c42eb4c6c26506f325f48463e9bc29b2034a587f1b9e48c751229bee" +dependencies = [ + "anyhow", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmtime", +] + +[[package]] +name = "sp-wasm-interface" +version = "20.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "anyhow", + "impl-trait-for-tuples", + "log", + "parity-scale-codec", + "wasmtime", +] + +[[package]] +name = "sp-wasm-interface" +version = "20.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk#7084463a49f2359dc2f378f5834c7252af02ed4d" +dependencies = [ + "impl-trait-for-tuples", + "log", + "parity-scale-codec", +] + +[[package]] +name = "sp-weights" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "bounded-collections", + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 23.0.0", + "sp-debug-derive 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)", +] + +[[package]] +name = "sp-weights" +version = "30.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9af6c661fe3066b29f9e1d258000f402ff5cc2529a9191972d214e5871d0ba87" +dependencies = [ + "bounded-collections", + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic 25.0.0", + "sp-debug-derive 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-std 14.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spinners" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0ef947f358b9c238923f764c72a4a9d42f2d637c46e059dbd319d6e7cfb4f82" +dependencies = [ + "lazy_static", + "maplit", + "strum 0.24.1", +] + +[[package]] +name = "spinning_top" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "ss58-registry" +version = "1.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4743ce898933fbff7bbf414f497c459a782d496269644b3d650a398ae6a487ba" +dependencies = [ + "Inflector", + "num-format", + "proc-macro2", + "quote", + "serde", + "serde_json", + "unicode-xid", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "static_init" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a2a1c578e98c1c16fc3b8ec1328f7659a500737d7a0c6d625e73e830ff9c1f6" +dependencies = [ + "bitflags 1.3.2", + "cfg_aliases 0.1.1", + "libc", + "parking_lot 0.11.2", + "parking_lot_core 0.8.6", + "static_init_macro", + "winapi", +] + +[[package]] +name = "static_init_macro" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a2595fc3aa78f2d0e45dd425b22282dd863273761cc77780914b2cf3003acf" +dependencies = [ + "cfg_aliases 0.1.1", + "memchr", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "str0m" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3f10d3f68e60168d81110410428a435dbde28cc5525f5f7c6fdec92dbdc2800" +dependencies = [ + "combine", + "crc", + "hmac 0.12.1", + "once_cell", + "openssl", + "openssl-sys", + "rand 0.8.5", + "sctp-proto", + "serde", + "sha-1 0.10.1", + "thiserror", + "tracing", +] + +[[package]] +name = "strobe-rs" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabb238a1cccccfa4c4fb703670c0d157e1256c1ba695abf1b93bd2bb14bab2d" +dependencies = [ + "bitflags 1.3.2", + "byteorder", + "keccak", + "subtle 2.5.0", + "zeroize", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +dependencies = [ + "strum_macros 0.24.3", +] + +[[package]] +name = "strum" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +dependencies = [ + "strum_macros 0.26.3", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", +] + +[[package]] +name = "strum_macros" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7993a8e3a9e88a00351486baae9522c91b123a088f76469e5bd5cc17198ea87" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.66", +] + +[[package]] +name = "substrate-bip39" +version = "0.4.7" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "hmac 0.12.1", + "pbkdf2", + "schnorrkel", + "sha2 0.10.8", + "zeroize", +] + +[[package]] +name = "substrate-bip39" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2b564c293e6194e8b222e52436bcb99f60de72043c7f845cf6c4406db4df121" +dependencies = [ + "hmac 0.12.1", + "pbkdf2", + "schnorrkel", + "sha2 0.10.8", + "zeroize", +] + +[[package]] +name = "substrate-build-script-utils" +version = "11.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" + +[[package]] +name = "substrate-frame-rpc-system" +version = "28.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "frame-system-rpc-runtime-api", + "futures", + "jsonrpsee", + "log", + "parity-scale-codec", + "sc-rpc-api", + "sc-transaction-pool-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-core 28.0.0", + "sp-runtime 31.0.1", +] + +[[package]] +name = "substrate-prometheus-endpoint" +version = "0.17.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "hyper", + "log", + "prometheus", + "thiserror", + "tokio", +] + +[[package]] +name = "substrate-rpc-client" +version = "0.33.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "async-trait", + "jsonrpsee", + "log", + "sc-rpc-api", + "serde", + "sp-runtime 31.0.1", +] + +[[package]] +name = "substrate-state-trie-migration-rpc" +version = "27.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "jsonrpsee", + "parity-scale-codec", + "sc-client-api", + "sc-rpc-api", + "serde", + "sp-core 28.0.0", + "sp-runtime 31.0.1", + "sp-state-machine 0.35.0", + "sp-trie 29.0.0", + "trie-db 0.29.1", +] + +[[package]] +name = "substrate-wasm-builder" +version = "17.0.0" +source = "git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0#b4016902ac7fc1d885eae236a2f71ddc58abc2f9" +dependencies = [ + "build-helper", + "cargo_metadata", + "console", + "filetime", + "parity-wasm", + "polkavm-linker", + "sp-maybe-compressed-blob", + "strum 0.26.2", + "tempfile", + "toml 0.8.14", + "walkdir", + "wasm-opt", +] + +[[package]] +name = "subtle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "subxt" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a160cba1edbf3ec4fbbeaea3f1a185f70448116a6bccc8276bb39adb3b3053bd" +dependencies = [ + "async-trait", + "derive-where", + "either", + "frame-metadata 16.0.0", + "futures", + "hex", + "impl-serde", + "instant", + "jsonrpsee", + "parity-scale-codec", + "primitive-types", + "reconnecting-jsonrpsee-ws-client", + "scale-bits", + "scale-decode", + "scale-encode", + "scale-info", + "scale-value", + "serde", + "serde_json", + "sp-crypto-hashing 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "subxt-core", + "subxt-lightclient", + "subxt-macro", + "subxt-metadata", + "thiserror", + "tokio-util", + "tracing", + "url", +] + +[[package]] +name = "subxt-codegen" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d703dca0905cc5272d7cc27a4ac5f37dcaae7671acc7fef0200057cc8c317786" +dependencies = [ + "frame-metadata 16.0.0", + "heck 0.5.0", + "hex", + "jsonrpsee", + "parity-scale-codec", + "proc-macro2", + "quote", + "scale-info", + "scale-typegen", + "subxt-metadata", + "syn 2.0.66", + "thiserror", + "tokio", +] + +[[package]] +name = "subxt-core" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59f41eb2e2eea6ed45649508cc735f92c27f1fcfb15229e75f8270ea73177345" +dependencies = [ + "base58", + "blake2 0.10.6", + "derive-where", + "frame-metadata 16.0.0", + "hashbrown 0.14.5", + "hex", + "impl-serde", + "parity-scale-codec", + "primitive-types", + "scale-bits", + "scale-decode", + "scale-encode", + "scale-info", + "scale-value", + "serde", + "serde_json", + "sp-core 31.0.0", + "sp-crypto-hashing 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sp-runtime 34.0.0", + "subxt-metadata", + "tracing", +] + +[[package]] +name = "subxt-lightclient" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d9406fbdb9548c110803cb8afa750f8b911d51eefdf95474b11319591d225d9" +dependencies = [ + "futures", + "futures-util", + "serde", + "serde_json", + "smoldot-light", + "thiserror", + "tokio", + "tokio-stream", + "tracing", +] + +[[package]] +name = "subxt-macro" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c195f803d70687e409aba9be6c87115b5da8952cd83c4d13f2e043239818fcd" +dependencies = [ + "darling 0.20.9", + "parity-scale-codec", + "proc-macro-error", + "quote", + "scale-typegen", + "subxt-codegen", + "syn 2.0.66", +] + +[[package]] +name = "subxt-metadata" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "738be5890fdeff899bbffff4d9c0f244fe2a952fb861301b937e3aa40ebb55da" +dependencies = [ + "frame-metadata 16.0.0", + "hashbrown 0.14.5", + "parity-scale-codec", + "scale-info", + "sp-crypto-hashing 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "symbolic-common" +version = "12.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71297dc3e250f7dbdf8adb99e235da783d690f5819fdeb4cce39d9cfb0aca9f1" +dependencies = [ + "debugid", + "memmap2 0.9.4", + "stable_deref_trait", + "uuid", +] + +[[package]] +name = "symbolic-demangle" +version = "12.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "424fa2c9bf2c862891b9cfd354a752751a6730fd838a4691e7f6c2c7957b9daf" +dependencies = [ + "cpp_demangle 0.4.3", + "rustc-demangle", + "symbolic-common", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "unicode-xid", +] + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "target-lexicon" +version = "0.12.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" + +[[package]] +name = "tempfile" +version = "3.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +dependencies = [ + "cfg-if", + "fastrand", + "rustix 0.38.34", + "windows-sys 0.52.0", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix 0.38.34", + "windows-sys 0.48.0", +] + +[[package]] +name = "termtree" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" + +[[package]] +name = "textwrap" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "thousands" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "tikv-jemalloc-sys" +version = "0.5.4+5.3.0-patched" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9402443cb8fd499b6f327e40565234ff34dbda27460c5b47db0db77443dd85d1" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "tikv-jemallocator" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965fe0c26be5c56c94e38ba547249074803efd52adfb66de62107d95aab3eaca" +dependencies = [ + "libc", + "tikv-jemalloc-sys", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot 0.12.3", + "pin-project-lite 0.2.14", + "signal-hook-registry", + "socket2 0.5.7", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "tokio-retry" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" +dependencies = [ + "pin-project", + "rand 0.8.5", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls 0.21.12", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.4", + "rustls-pki-types", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +dependencies = [ + "futures-core", + "pin-project-lite 0.2.14", + "tokio", + "tokio-util", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" +dependencies = [ + "futures-util", + "log", + "rustls 0.21.12", + "rustls-native-certs 0.6.3", + "tokio", + "tokio-rustls 0.24.1", + "tungstenite", +] + +[[package]] +name = "tokio-util" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +dependencies = [ + "bytes", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite 0.2.14", + "tokio", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.14", +] + +[[package]] +name = "toml_datetime" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +dependencies = [ + "indexmap 2.2.6", + "toml_datetime", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +dependencies = [ + "indexmap 2.2.6", + "toml_datetime", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" +dependencies = [ + "indexmap 2.2.6", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.11", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite 0.2.14", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" +dependencies = [ + "bitflags 2.5.0", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-range-header", + "pin-project-lite 0.2.14", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite 0.2.14", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-error" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" +dependencies = [ + "tracing", + "tracing-subscriber 0.3.18", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-log" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "ansi_term", + "chrono", + "lazy_static", + "matchers 0.0.1", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log 0.1.4", + "tracing-serde", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers 0.1.0", + "nu-ansi-term", + "once_cell", + "parking_lot 0.12.3", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log 0.2.0", +] + +[[package]] +name = "trie-db" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff28e0f815c2fea41ebddf148e008b077d2faddb026c9555b29696114d602642" +dependencies = [ + "hash-db", + "hashbrown 0.13.2", + "log", + "rustc-hex", + "smallvec", +] + +[[package]] +name = "trie-db" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c992b4f40c234a074d48a757efeabb1a6be88af84c0c23f7ca158950cb0ae7f" +dependencies = [ + "hash-db", + "log", + "rustc-hex", + "smallvec", +] + +[[package]] +name = "trie-root" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4ed310ef5ab98f5fa467900ed906cb9232dd5376597e00fd4cba2a449d06c0b" +dependencies = [ + "hash-db", +] + +[[package]] +name = "trust-dns-proto" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f7f83d1e4a0e4358ac54c5c3681e5d7da5efc5a7a632c90bb6d6669ddd9bc26" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner 0.5.1", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.2.3", + "ipnet", + "lazy_static", + "rand 0.8.5", + "smallvec", + "socket2 0.4.10", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "trust-dns-proto" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner 0.6.0", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand 0.8.5", + "smallvec", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe" +dependencies = [ + "cfg-if", + "futures-util", + "ipconfig", + "lazy_static", + "lru-cache", + "parking_lot 0.12.3", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "tracing", + "trust-dns-proto 0.22.0", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6" +dependencies = [ + "cfg-if", + "futures-util", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot 0.12.3", + "rand 0.8.5", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "tracing", + "trust-dns-proto 0.23.2", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "tt-call" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" + +[[package]] +name = "tungstenite" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.8.5", + "rustls 0.21.12", + "sha1", + "thiserror", + "url", + "utf-8", +] + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "digest 0.10.7", + "rand 0.8.5", + "static_assertions", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle 2.5.0", +] + +[[package]] +name = "unsigned-varint" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" +dependencies = [ + "asynchronous-codec", + "bytes", + "futures-io", + "futures-util", + "tokio-util", +] + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna 0.5.0", + "percent-encoding", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "uuid" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "w3f-bls" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c5da5fa2c6afa2c9158eaa7cd9aee249765eb32b5fb0c63ad8b9e79336a47ec" +dependencies = [ + "ark-bls12-377", + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-serialize-derive", + "arrayref", + "constcat", + "digest 0.10.7", + "rand 0.8.5", + "rand_chacha 0.3.1", + "rand_core 0.6.4", + "sha2 0.10.8", + "sha3", + "thiserror", + "zeroize", +] + +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasix" +version = "0.12.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1fbb4ef9bbca0c1170e0b00dd28abc9e3b68669821600cad1caaed606583c6d" +dependencies = [ + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.66", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" + +[[package]] +name = "wasm-instrument" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a47ecb37b9734d1085eaa5ae1a81e60801fd8c28d4cabdd8aedb982021918bc" +dependencies = [ + "parity-wasm", +] + +[[package]] +name = "wasm-opt" +version = "0.116.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd87a4c135535ffed86123b6fb0f0a5a0bc89e50416c942c5f0662c645f679c" +dependencies = [ + "anyhow", + "libc", + "strum 0.24.1", + "strum_macros 0.24.3", + "tempfile", + "thiserror", + "wasm-opt-cxx-sys", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-cxx-sys" +version = "0.116.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c57b28207aa724318fcec6575fe74803c23f6f266fce10cbc9f3f116762f12e" +dependencies = [ + "anyhow", + "cxx", + "cxx-build", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-sys" +version = "0.116.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a1cce564dc768dacbdb718fc29df2dba80bd21cb47d8f77ae7e3d95ceb98cbe" +dependencies = [ + "anyhow", + "cc", + "cxx", + "cxx-build", +] + +[[package]] +name = "wasm-timer" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" +dependencies = [ + "futures", + "js-sys", + "parking_lot 0.11.2", + "pin-utils", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wasmi" +version = "0.31.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8281d1d660cdf54c76a3efa9ddd0c270cada1383a995db3ccb43d166456c7" +dependencies = [ + "smallvec", + "spin 0.9.8", + "wasmi_arena", + "wasmi_core", + "wasmparser-nostd", +] + +[[package]] +name = "wasmi_arena" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" + +[[package]] +name = "wasmi_core" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" +dependencies = [ + "downcast-rs", + "libm", + "num-traits", + "paste", +] + +[[package]] +name = "wasmparser" +version = "0.102.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" +dependencies = [ + "indexmap 1.9.3", + "url", +] + +[[package]] +name = "wasmparser-nostd" +version = "0.100.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" +dependencies = [ + "indexmap-nostd", +] + +[[package]] +name = "wasmtime" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f907fdead3153cb9bfb7a93bbd5b62629472dc06dee83605358c64c52ed3dda9" +dependencies = [ + "anyhow", + "bincode", + "cfg-if", + "indexmap 1.9.3", + "libc", + "log", + "object 0.30.4", + "once_cell", + "paste", + "psm", + "rayon", + "serde", + "target-lexicon", + "wasmparser", + "wasmtime-cache", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-jit", + "wasmtime-runtime", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3b9daa7c14cd4fa3edbf69de994408d5f4b7b0959ac13fa69d465f6597f810d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c86437fa68626fe896e5afc69234bb2b5894949083586535f200385adfd71213" +dependencies = [ + "anyhow", + "base64 0.21.7", + "bincode", + "directories-next", + "file-per-thread-logger", + "log", + "rustix 0.36.17", + "serde", + "sha2 0.10.8", + "toml 0.5.11", + "windows-sys 0.45.0", + "zstd 0.11.2+zstd.1.5.2", +] + +[[package]] +name = "wasmtime-cranelift" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1cefde0cce8cb700b1b21b6298a3837dba46521affd7b8c38a9ee2c869eee04" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli 0.27.3", + "log", + "object 0.30.4", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-cranelift-shared", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-cranelift-shared" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd041e382ef5aea1b9fc78442394f1a4f6d676ce457e7076ca4cb3f397882f8b" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-native", + "gimli 0.27.3", + "object 0.30.4", + "target-lexicon", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-environ" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a990198cee4197423045235bf89d3359e69bd2ea031005f4c2d901125955c949" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.27.3", + "indexmap 1.9.3", + "log", + "object 0.30.4", + "serde", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de48df552cfca1c9b750002d3e07b45772dd033b0b206d5c0968496abf31244" +dependencies = [ + "addr2line 0.19.0", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle 0.3.5", + "gimli 0.27.3", + "log", + "object 0.30.4", + "rustc-demangle", + "serde", + "target-lexicon", + "wasmtime-environ", + "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", + "wasmtime-runtime", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e0554b84c15a27d76281d06838aed94e13a77d7bf604bbbaf548aa20eb93846" +dependencies = [ + "object 0.30.4", + "once_cell", + "rustix 0.36.17", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aecae978b13f7f67efb23bd827373ace4578f2137ec110bbf6a4a7cde4121bbd" +dependencies = [ + "cfg-if", + "libc", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-runtime" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "658cf6f325232b6760e202e5255d823da5e348fdea827eff0a2a22319000b441" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "indexmap 1.9.3", + "libc", + "log", + "mach", + "memfd", + "memoffset", + "paste", + "rand 0.8.5", + "rustix 0.36.17", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-jit-debug", + "windows-sys 0.45.0", +] + +[[package]] +name = "wasmtime-types" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4f6fffd2a1011887d57f07654dd112791e872e3ff4a2e626aee8059ee17f06f" +dependencies = [ + "cranelift-entity", + "serde", + "thiserror", + "wasmparser", +] + +[[package]] +name = "web-sys" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" +dependencies = [ + "ring 0.17.8", + "untrusted 0.9.0", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] + +[[package]] +name = "webpki-roots" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.34", +] + +[[package]] +name = "wide" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a040b111774ab63a19ef46bbc149398ab372b4ccdcfd719e9814dbd7dfd76c8" +dependencies = [ + "bytemuck", + "safe_arch", +] + +[[package]] +name = "widestring" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" +dependencies = [ + "windows-core 0.51.1", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.5", +] + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.5", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c52728401e1dc672a56e81e593e912aa54c78f40246869f78359a2bf24d29d" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "x25519-dalek" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" +dependencies = [ + "curve25519-dalek 3.2.0", + "rand_core 0.5.1", + "zeroize", +] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek 4.1.2", + "rand_core 0.6.4", + "serde", + "zeroize", +] + +[[package]] +name = "x509-parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" +dependencies = [ + "asn1-rs", + "base64 0.13.1", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "x509-parser" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7069fba5b66b9193bd2c5d3d4ff12b839118f6bcbef5328efafafb5395cf63da" +dependencies = [ + "asn1-rs", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "yamux" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d9ba232399af1783a58d8eb26f6b5006fbefe2dc9ef36bd283324792d03ea5" +dependencies = [ + "futures", + "log", + "nohash-hasher", + "parking_lot 0.12.3", + "rand 0.8.5", + "static_assertions", +] + +[[package]] +name = "yap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff4524214bc4629eba08d78ceb1d6507070cc0bcbbed23af74e19e6e924a24cf" + +[[package]] +name = "yasna" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" +dependencies = [ + "time", +] + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe 5.0.2+zstd.1.5.2", +] + +[[package]] +name = "zstd" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +dependencies = [ + "zstd-safe 6.0.6", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-safe" +version = "6.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.10+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..c0f31d5 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,379 @@ +[[bin]] +name = "ghost" +path = "src/main.rs" + +[package] +name = "ghost-node" +description = "Implementation of a Ghost Node in Rust based on the Substrate Network" +readme = "README.md" +default-run = "ghost" +license.workspace = true +authors.workspace = true +version.workspace = true +edition.workspace = true +repository.workspace = true +homepage.workspace = true + +[workspace.package] +license = "GPL-3.0-only" +authors = ["571nky", "57r37ch", "f4750"] +version = "0.7.178" +edition = "2021" +homepage = "https://ghostchain.io" +repository = "https://github.com/realGhostChain/ghost-node" + +[workspace.dependencies] +# External dependencies +rand = { version = "0.8.5" } +lazy_static = { version = "1.4.0" } +hex-literal = { version = "0.4.1" } +is_executable = { version = "1.0.1" } +primitive-types = { version = "0.12.0" } +array-bytes = { version = "6.2.2" } +itertools = { version = "0.11" } +static_assertions = { version = "1.1.0" } +clap = { version = "4.5.3" } +separator = { version = "0.4.1" } +tokio = { version = "1.36.0" } +smallvec = { version = "1.13.1" } +futures = { version = "0.3" } +futures-timer = { version = "3.0.2" } +thiserror = { version = "1.0" } +jsonrpsee = { version = "0.22.3" } +pin-project-lite = { version = "0.2" } +tracing-subscriber = { version = "0.3.18" } +hyper = { version = "0.14.29" } +once_cell = { version = "1.19" } +prometheus = { version = "0.13" } +anyhow = { version = "1" } +assert_cmd = { version = "2.0" } +regex = { version = "1" } +nix = { version = "0.28.0" } +tempfile = { version = "3.2.0" } +cfg-if = { version = "1.0" } +kvdb = { version = "0.13.0" } +kvdb-rocksdb = { version = "0.19.0" } +parity-db = { version = "0.4.12" } +parking_lot = { version = "0.12.1" } +pyro = { package = "pyroscope", version = "0.5.3" } +pyroscope_pprofrs = { version = "0.2" } +tikv-jemallocator = { version = "0.5.0" } +async-trait = { version = "0.1.79" } +bitvec = { version = "1.0.1" } +schnellru = { version = "0.2.1" } +assert_matches = { version = "1.5.0" } +env_logger = { version = "0.11" } +serial_test = { version = "2.0.0" } +color-eyre = { version = "0.6.1" } +bs58 = { version = "0.5.0" } +prometheus-parse = { version = "0.2.2" } +rustc-hex = { version = "2.1.0", default-features = false } +log = { version = "0.4", default-features = false } +libsecp256k1 = { version = "0.7", default-features = false } +bip39 = { package = "parity-bip39", version = "2.0.1" } +sha3 = { version = "0.10", default-features = false } +serde = { version = "1.0.197", default-features = false } +serde_derive = { version = "1.0.117", default-features = false } +serde_json = { version = "1.0.114", default-features = false } +blake2-rfc = { version = "0.2.18", default-features = false } +impl-serde = { version = "0.4.0", default-features = false } +hex = { version = "0.4.3", default-features = false } +metered = { package = "prioritized-metered-channel", version = "0.6.1", default-features = false } + +scale-value = { version = "0.16.0" } +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false } +scale-info = { version = "2.5.0", default-features = false } +subxt = { version = "0.37.0", default-features = false } + +# Frames +frame-support = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +frame-system = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +frame-executive = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +frame-election-provider-support = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } + +remote-externalities = { package = "frame-remote-externalities", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +substrate-rpc-client = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +substrate-state-trie-migration-rpc = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } + +# Substrate Primitives dependencies +keyring = { package = "sp-keyring", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-trie = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-io = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-api = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-runtime-interface = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-std = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-tracing = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-debug-derive = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-arithmetic = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-genesis-builder = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-application-crypto = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-staking = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-session = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-storage = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-version = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-weights = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-npos-elections = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-maybe-compressed-blob = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +authority-discovery-primitives = { package = "sp-authority-discovery", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +babe-primitives = { package = "sp-consensus-babe", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +grandpa-primitives = { package = "sp-consensus-grandpa", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +block-builder-api = { package = "sp-block-builder", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +inherents = { package = "sp-inherents", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +offchain-primitives = { package = "sp-offchain", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +consensus-common = { package = "sp-consensus", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } + +# Pallets +pallet-alliance = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-authority-discovery = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-authorship = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-babe = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-bags-list = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-bounties = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-child-bounties = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-collective = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-core-fellowship = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-fast-unstake = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-grandpa = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-identity = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-indices = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-multisig = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-nomination-pools = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-offences = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-preimage = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-proxy = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-ranked-collective = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-referenda = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-salary = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-scheduler = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-session = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-staking = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-staking-reward-fn = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-staking-reward-curve = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } # TODO +pallet-staking-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-treasury = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-whitelist = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-vesting = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } + +# Benchmarking +frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +frame-try-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +generate-bags = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-election-provider-support-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-offences-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-session-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } +pallet-bags-list-remote-tests = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0", default-features = false } + +# Substrate Client dependencies +sc-cli = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-chain-spec = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-executor = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-service = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-storage-monitor = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-tracing = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-keystore = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-authority-discovery = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-block-builder = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-client-db = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-network = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-network-common = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-offchain = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-sync-state-rpc = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-consensus-slots = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-consensus-epochs = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +sc-rpc-spec-v2 = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +babe = { package = "sc-consensus-babe", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +babe-rpc = { package = "sc-consensus-babe-rpc", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +grandpa = { package = "sc-consensus-grandpa", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +grandpa-rpc = { package = "sc-consensus-grandpa-rpc", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +telemetry = { package = "sc-telemetry", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } +tx-pool-api = { package = "sc-transaction-pool-api", git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.12.0" } + +# Local dependencies +ghost-cli = { path = "cli", default-features = false } +ghost-client-cli = { path = "client/cli", default-features = false } +ghost-machine-primitives = { path = "primitives/machine", default-features = false } +ghost-metrics = { path = "metrics", default-features = false } +ghost-rpc = { path = "rpc", default-features = false } +service = { package = "ghost-service", path = "service", default-features = false } +ghost-traits = { path = "pallets/traits", default-features = false } +ghost-networks = { path = "pallets/networks", default-features = false } +ghost-claims = { path = "pallets/claims", default-features = false } +ghost-slow-clap = { path = "pallets/slow-clap", default-features = false } +ghost-runtime-constants = { package = "ghost-runtime-constants", path = "runtime/ghost/constants", default-features = false } +casper-runtime = { path = "runtime/casper", default-features = false } +casper-runtime-constants = { package = "casper-runtime-constants", path = "runtime/casper/constants", default-features = false } +primitives = { package = "ghost-core-primitives", path = "core-primitives", default-features = false } +runtime-common = { package = "ghost-runtime-common", path = "runtime/common", default-features = false } + +[dependencies] +color-eyre = { workspace = true } +tikv-jemallocator = { workspace = true, optional = true, features = ["unprefixed_malloc_on_supported_platforms"] } +ghost-cli = { workspace = true, optional = true } + +[target.'cfg(target_os = "linux")'.dependencies] +tikv-jemallocator = { workspace = true, features = ["unprefixed_malloc_on_supported_platforms"] } + +[dev-dependencies] +assert_cmd = { workspace = true } +nix = { workspace = true, features = ["signal"] } +tempfile = { workspace = true } +tokio = { workspace = true } +substrate-rpc-client = { workspace = true } +primitives = { workspace = true } + +[build-dependencies] +substrate-build-script-utils = { workspace = true } + +[workspace] +resolver = "2" + +members = [ + "core-primitives", + "cli", + "rpc", + "service", + "metrics", + "client/cli", + "primitives/machine", + "runtime/common", + "runtime/casper", + "runtime/casper/constants", + "pallets/networks", + "pallets/claims", + "pallets/slow-clap", + "utils/bags-list", + "utils/chain-spec-builder", + "utils/generate-bags", + "utils/ghostkey", + "utils/staking-miner", +] + +[badges] +maintenance = { status = "actively-developed" } + +[profile.release] +panic = "unwind" +opt-level = 3 + +[profile.dev.package.backtrace] +inherits = "release" + +[profile.production] +inherits = "release" +lto = true +codegen-units = 1 + +[profile.testnet] +inherits = "release" +debug = 1 # debug symbols are useful for profilers +debug-assertions = true +overflow-checks = true + +# The list if dependencies below (which can be both direct and indirect +# dependencies) are crates that are suspected to be CPU-intensive, and that +# are unlikely to require debugging (as some of their debug info might be +# missing) or to require to be frequently recompiled. We compile these +# dependencies with `opt-level=3` even in "dev" mode in order to make "dev" +# mode more usable. +# The majority of these crates are cryptographic libraries. +# +# If you see an error mentioning "profile package spec ... did not match any +# packages", it probably concerns this list. +# +# This list ordered alphabetically. +[profile.dev.package] +blake2 = { opt-level = 3 } +blake2b_simd = { opt-level = 3 } +chacha20poly1305 = { opt-level = 3 } +cranelift-codegen = { opt-level = 3 } +cranelift-wasm = { opt-level = 3 } +crc32fast = { opt-level = 3 } +crossbeam-deque = { opt-level = 3 } +crypto-mac = { opt-level = 3 } +curve25519-dalek = { opt-level = 3 } +ed25519-dalek = { opt-level = 3 } +flate2 = { opt-level = 3 } +futures-channel = { opt-level = 3 } +hash-db = { opt-level = 3 } +hashbrown = { opt-level = 3 } +hmac = { opt-level = 3 } +httparse = { opt-level = 3 } +integer-sqrt = { opt-level = 3 } +keccak = { opt-level = 3 } +libm = { opt-level = 3 } +librocksdb-sys = { opt-level = 3 } +libsecp256k1 = { opt-level = 3 } +libz-sys = { opt-level = 3 } +mio = { opt-level = 3 } +nalgebra = { opt-level = 3 } +num-bigint = { opt-level = 3 } +parking_lot = { opt-level = 3 } +parking_lot_core = { opt-level = 3 } +percent-encoding = { opt-level = 3 } +primitive-types = { opt-level = 3 } +ring = { opt-level = 3 } +rustls = { opt-level = 3 } +sha2 = { opt-level = 3 } +sha3 = { opt-level = 3 } +smallvec = { opt-level = 3 } +snow = { opt-level = 3 } +substrate-bip39 = { opt-level = 3 } +twox-hash = { opt-level = 3 } +uint = { opt-level = 3 } +wasmi = { opt-level = 3 } +x25519-dalek = { opt-level = 3 } +yamux = { opt-level = 3 } +zeroize = { opt-level = 3 } + +[features] +default = ["cli", "casper-native"] +cli = [ + "ghost-cli", + "ghost-cli/cli", + "ghost-cli/db", + "ghost-cli/full-node", +] +runtime-benchmarks = ["ghost-cli/runtime-benchmarks"] +try-runtime = ["ghost-cli/try-runtime"] +fast-runtime = ["ghost-cli/fast-runtime"] +pyroscope = ["ghost-cli/pyroscope"] +jemalloc-allocator = [ + "dep:tikv-jemallocator", +] + +# Configure runtimes. +ghost-native = [] +casper-native = ["ghost-cli?/casper-native"] + +[package.metadata.deb] +[package.metadata.spellcheck] diff --git a/LICENSE.md b/LICENSE.md new file mode 100755 index 0000000..1333ed7 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1 @@ +TODO diff --git a/README.md b/README.md new file mode 100755 index 0000000..1333ed7 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +TODO diff --git a/cli/Cargo.toml b/cli/Cargo.toml new file mode 100755 index 0000000..a267ed4 --- /dev/null +++ b/cli/Cargo.toml @@ -0,0 +1,81 @@ +[package] +name = "ghost-cli" +description = "Ghost Client Node" +version.workspace = true +edition.workspace = true +authors.workspace = true +license.workspace = true +repository.workspace = true +homepage.workspace = true + +[package.metadata.wasm-pack.profile.release] +# `wasm-opt` has some problems on Linux, see +# https://github.com/rustwasm/wasm-pack/issues/781 etc. +wasm-opt = false + +[lib] +crate-type = ["cdylib", "rlib"] + +[dependencies] +cfg-if = { workspace = true } +clap = { workspace = true, features = ["derive"], optional = true } +log = { workspace = true, default-features = false } +serde_json = { workspace = true, default-features = false } +thiserror = { workspace = true } +futures = { workspace = true } +pyro = { workspace = true, optional = true } +pyroscope_pprofrs = { workspace = true, optional = true } + +service = { workspace = true, optional = true } +ghost-client-cli = { workspace = true, optional = true } +ghost-machine-primitives = { workspace = true, optional = true } + +sp-core = { workspace = true, default-features = true } +sp-io = { workspace = true, default-features = true } +sp-runtime = { workspace = true, default-features = true } +sp-maybe-compressed-blob = { workspace = true, default-features = true } +keyring = { workspace = true, default-features = true } +frame-benchmarking-cli = { workspace = true, default-features = true, optional = true } +sc-cli = { workspace = true, default-features = true, optional = true } +sc-service = { workspace = true, default-features = true, optional = true } +ghost-metrics = { workspace = true, default-features = true } +primitives = { workspace = true, default-features = true } +sc-tracing = { workspace = true, default-features = true, optional = true } +sc-sysinfo = { workspace = true, default-features = true } +sc-executor = { workspace = true, default-features = true } +sc-storage-monitor = { workspace = true, default-features = true } + +[build-dependencies] +substrate-build-script-utils = { workspace = true } + +[features] +default = ["cli", "db", "full-node"] +db = ["service/db"] +cli = [ + "clap", + "frame-benchmarking-cli", + "sc-cli", + "sc-service", + "sc-tracing", + "service", + "ghost-client-cli", + "ghost-machine-primitives", +] +runtime-benchmarks = [ + "frame-benchmarking-cli?/runtime-benchmarks", + "ghost-metrics/runtime-benchmarks", + "sc-service?/runtime-benchmarks", + "service/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] +full-node = ["service/full-node"] +try-runtime = [ + "service/try-runtime", + "sp-runtime/try-runtime", +] +fast-runtime = ["service/fast-runtime"] +pyroscope = ["pyro", "pyroscope_pprofrs"] + +# Configure the native runtimes to use +ghost-native = [] +casper-native = ["service/casper-native"] diff --git a/cli/build.rs b/cli/build.rs new file mode 100755 index 0000000..205c792 --- /dev/null +++ b/cli/build.rs @@ -0,0 +1,7 @@ +fn main () { + if let Ok(profile) = std::env::var("PROFILE") { + println!("cargo:rustc-cfg=build_type=\"{}\"", profile); + } + substrate_build_script_utils::generate_cargo_keys(); + substrate_build_script_utils::rerun_if_git_head_changed(); +} diff --git a/cli/src/cli.rs b/cli/src/cli.rs new file mode 100755 index 0000000..f1a28b3 --- /dev/null +++ b/cli/src/cli.rs @@ -0,0 +1,112 @@ +//! Ghost CLI library. + +use clap::Parser; +use ghost_client_cli::commands::{KeySubcommand, VanityCmd}; + +#[derive(Debug, clap::Subcommand)] +pub enum KeyCmd { + /// Key utility for the CLI + #[clap(flatten)] + KeyCli(KeySubcommand), + + /// Sign a message, with a given (secret) key. + Sign(sc_cli::SignCmd), + + /// Generate a seed that provides a vanity address/ + Vanity(VanityCmd), + + /// Verify a signature for a mesage, provided on STDIN, with a given + /// (public or secret) key. + Verify(sc_cli::VerifyCmd), +} + +impl KeyCmd { + pub fn run(&self, cli: &C) -> Result<(), sc_cli::Error> { + match self { + KeyCmd::KeyCli(cmd) => cmd.run(cli), + KeyCmd::Sign(cmd) => cmd.run(), + KeyCmd::Vanity(cmd) => cmd.run(), + KeyCmd::Verify(cmd) => cmd.run(), + } + } +} + +/// Possible subcommands of the main binary. +#[derive(Debug, clap::Subcommand)] +pub enum Subcommand { + /// Build a chain specification. + BuildSpec(sc_cli::BuildSpecCmd), + + /// Validate blocks. + CheckBlock(sc_cli::CheckBlockCmd), + + /// Export blocks. + ExportBlocks(sc_cli::ExportBlocksCmd), + + /// Export the state of a given block into a chain spec. + ExportState(sc_cli::ExportStateCmd), + + /// Import blocks. + ImportBlocks(sc_cli::ImportBlocksCmd), + + /// Remove the whole chain. + PurgeChain(sc_cli::PurgeChainCmd), + + /// Revert the chain to a previous state. + Revert(sc_cli::RevertCmd), + + /// The custom benchmark subcommmand benchmarking runtime pallets. + #[clap(subcommand)] + Benchmark(frame_benchmarking_cli::BenchmarkCmd), + + /// Key managment cli utilities. + #[clap(subcommand)] + Key(KeyCmd), + + /// Db meta columns information + ChainInfo(sc_cli::ChainInfoCmd), +} + +#[allow(missing_docs)] +#[derive(Debug, Parser)] +#[group(skip)] +pub struct RunCmd { + #[clap(flatten)] + pub base: sc_cli::RunCmd, + + /// Disable autimatic hardware benchmarks. + /// + /// By default these benchamrks are automatically ran at startup and + /// measure the CPU speed, the memory bandwidth and the disk speed. + /// + /// The results, are then printed out in the logs, and also send as part + /// of telemetry, if telemetry is enabled. + #[arg(long)] + pub no_hardware_benchmarks: bool, + + /// Enable the block authoring backoff that is triggered when finality is + /// lagging. + #[arg(long)] + pub force_authoring_backoff: bool, + + /// Add the destination address to the `pyroscope` agent. + /// Must be valid socket address, of format `IP:PORT` (commonly `127.0.0.1:4040`). + #[arg(long)] + pub pyroscope_server: Option, +} + +/// An overarching CLI command definition +#[derive(Debug, clap::Parser)] +pub struct Cli { + /// Possible subcommands with parameters. + #[clap(subcommand)] + pub subcommand: Option, + + /// Base command line. + #[clap(flatten)] + pub run: RunCmd, + + /// Parameters used to create the storage monitor. + #[clap(flatten)] + pub storage_monitor: sc_storage_monitor::StorageMonitorParams, +} diff --git a/cli/src/command.rs b/cli/src/command.rs new file mode 100755 index 0000000..3acc5bf --- /dev/null +++ b/cli/src/command.rs @@ -0,0 +1,369 @@ +use crate::cli::{Cli, Subcommand}; +use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory}; +use futures::future::TryFutureExt; +use sc_cli::SubstrateCli; +use service::{ + self, IdentifyVariant, + benchmarking::{ + benchmark_inherent_data, RemarkBuilder, TransferKeepAliveBuilder + }, +}; +use keyring::Sr25519Keyring; + +pub use crate::{error::Error, service::BlockId}; +#[cfg(feature = "pyroscope")] +use pyroscope_pprofrs::{pprof_backend, PprofConfig}; + +type Result = std::result::Result; + +fn get_exec_name() -> Option { + std::env::current_exe() + .ok() + .and_then(|pb| pb.file_name().map(|s| s.to_os_string())) + .and_then(|s| s.into_string().ok()) +} + +impl SubstrateCli for Cli { + fn impl_name() -> String { + "Ghost Node".into() + } + + fn impl_version() -> String { + env!("CARGO_PKG_DESCRIPTION").into() + } + + fn description() -> String { + env!("CARGO_PKG_DESCRIPTION").into() + } + + fn author() -> String { + env!("CARGO_PKG_AUTHORS").into() + } + + fn support_url() -> String { + format!("{}/issues/new", env!("CARGO_PKG_REPOSITORY")).into() + } + + fn copyright_start_year() -> i32 { + 2024 + } + + fn executable_name() -> String { + get_exec_name().unwrap_or("ghost".into()) + } + + fn load_spec(&self, id: &str) -> std::result::Result, String> { + let id = if id == "" { + let n = get_exec_name().unwrap_or_default(); + ["casper"] + .iter() + .cloned() + .find(|&chain| n.starts_with(chain)) + .unwrap_or("casper") + } else { + id + }; + + Ok(match id { + #[cfg(feature = "casper-native")] + "casper" => Box::new(service::chain_spec::casper_config()?), + #[cfg(feature = "casper-native")] + "casper-dev" | "dev" | "development" => Box::new(service::chain_spec::casper_development_config()?), + #[cfg(feature = "casper-native")] + "casper-local" | "local" => Box::new(service::chain_spec::casper_local_testnet_config()?), + #[cfg(feature = "casper-native")] + "casper-staging" | "staging" => Box::new(service::chain_spec::casper_staging_testnet_config()?), + #[cfg(not(feature = "casper-native"))] + name if name.starts_with("casper-") && !name.ends_with(".json") => + Err(format!("`{}` only supported with `casper-native` feature enabled.", name))?, + #[cfg(feature = "casper-native")] + path => { + let path = std::path::PathBuf::from(path); + + let chain_spec = Box::new( + service::GenericChainSpec::from_json_file(path.clone())? + ) as Box; + + if chain_spec.is_casper() { + Box::new(service::CasperChainSpec::from_json_file(path)?) + } else { + chain_spec + } + }, + }) + } +} + +fn set_ss58_version(spec: &Box) { + use sp_core::crypto::Ss58AddressFormat; + + let ss58_version = if spec.is_ghost() { + Ss58AddressFormat::custom(1995) + } else if spec.is_casper() { + Ss58AddressFormat::custom(1996) + } else { + panic!("Invalid network") + } + .into(); + + sp_core::crypto::set_default_ss58_version(ss58_version); +} + +fn run_node_inner( + cli: Cli, + logger_hook: F, +) -> Result<()> +where + F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration), +{ + let runner = cli + .create_runner_with_logger_hook::(&cli.run.base, logger_hook) + .map_err(Error::from)?; + let chain_spec = &runner.config().chain_spec; + + set_ss58_version(chain_spec); + + runner.run_node_until_exit(move |config| async move { + let hwbench = (!cli.run.no_hardware_benchmarks) + .then_some(config.database.path().map(|database_path| { + let _ = std::fs::create_dir_all(&database_path); + sc_sysinfo::gather_hwbench(Some(database_path)) + })).flatten(); + + let database_source = config.database.clone(); + let task_manager = service::build_full( + config, + service::NewFullParams { + force_authoring_backoff: cli.run.force_authoring_backoff, + telemetry_worker_handle: None, + hwbench, + }, + ).map(|full| full.task_manager)?; + + if let Some(path) = database_source.path() { + sc_storage_monitor::StorageMonitorService::try_spawn( + cli.storage_monitor, + path.to_path_buf(), + &task_manager.spawn_essential_handle(), + )?; + } + + Ok(task_manager) + }) +} + +/// Parses ghost specific CLI arguments and run the service. +pub fn run() -> Result<()> { + let cli: Cli = Cli::from_args(); + + #[cfg(feature = "pyroscope")] + let mut pyroscope_agent_maybe = if let Some(ref agent_addr) = cli.run.pyroscope_server { + let address = agent_addr + .to_socket_addrs() + .map_err(Error::AddressResolutionFailure)? + .next() + .ok_or_else(|| Error::AddressResolutionMissing)?; + + let agent = pyro::Pyroscope::builder( + "http://".to_owned() + address.to_string().as_str(), + "ghost".to_owned(), + ).backend(pprof_backend(PprofConfig::new().sample_rate(113))).build()?; + + Some(agent.start()?) + } else { + None + }; + + #[cfg(not(feature = "pyroscope"))] + if cli.run.pyroscope_server.is_some() { + return Err(Error::PyroscopeNotCompiledIn) + } + + match &cli.subcommand { + None => run_node_inner(cli, ghost_metrics::logger_hook()), + Some(Subcommand::BuildSpec(cmd)) => { + let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?; + Ok(runner.sync_run(|config| cmd.run(config.chain_spec, config.network))?) + }, + Some(Subcommand::CheckBlock(cmd)) => { + let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?; + let chain_spec = &runner.config().chain_spec; + + set_ss58_version(chain_spec); + + runner.async_run(|mut config| { + let (client, _, import_queue, task_manager) = + service::new_chain_ops(&mut config)?; + Ok((cmd.run(client, import_queue).map_err(Error::SubstrateCli), task_manager)) + }) + }, + Some(Subcommand::ExportBlocks(cmd)) => { + let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?; + let chain_spec = &runner.config().chain_spec; + + set_ss58_version(chain_spec); + + Ok(runner.async_run(|mut config| { + let ( client, _, _, task_manager ) = + service::new_chain_ops(&mut config)?; + Ok((cmd.run(client, config.database).map_err(Error::SubstrateCli), task_manager)) + })?) + }, + Some(Subcommand::ExportState(cmd)) => { + let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?; + let chain_spec = &runner.config().chain_spec; + + set_ss58_version(chain_spec); + + Ok(runner.async_run(|mut config| { + let ( client, _, _, task_manager ) = + service::new_chain_ops(&mut config)?; + Ok((cmd.run(client, config.chain_spec).map_err(Error::SubstrateCli), task_manager)) + })?) + }, + Some(Subcommand::ImportBlocks(cmd)) => { + let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?; + let chain_spec = &runner.config().chain_spec; + + set_ss58_version(chain_spec); + + Ok(runner.async_run(|mut config| { + let ( client, _, import_queue, task_manager ) = + service::new_chain_ops(&mut config)?; + Ok((cmd.run(client, import_queue).map_err(Error::SubstrateCli), task_manager)) + })?) + }, + Some(Subcommand::PurgeChain(cmd)) => { + let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?; + Ok(runner.sync_run(|config| cmd.run(config.database))?) + }, + Some(Subcommand::Revert(cmd)) => { + let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?; + let chain_spec = &runner.config().chain_spec; + + set_ss58_version(chain_spec); + + Ok(runner.async_run(|mut config| { + let (client, backend, _, task_manager) = + service::new_chain_ops(&mut config)?; + + let aux_revert = Box::new(|client, backend, blocks| { + service::revert_backend(client, backend, blocks).map_err(|err| { + match err { + service::Error::Blockchain(err) => err.into(), + err => sc_cli::Error::Application(err.into()), + } + }) + }); + + Ok(( + cmd.run(client, backend, Some(aux_revert)).map_err(Error::SubstrateCli), + task_manager + )) + })?) + }, + Some(Subcommand::Benchmark(cmd)) => { + let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?; + let chain_spec = &runner.config().chain_spec; + + match cmd { + #[cfg(not(feature = "runtime-benchmarks"))] + BenchmarkCmd::Storage(_) => + return Err(sc_cli::Error::Input( + "Compile with `--feature=runtime-benchmarks \ + to enable storage benchmarks.".into() + ).into()), + #[cfg(feature = "runtime-benchmarks")] + BenchmarkCmd::Storage(cmd) => runner.sync_run(|mut config| { + let (client, backend, _, _,) = + service::new_chain_ops(&mut config)?; + let db = backend.expose_db(); + let storage = backend.expose_storage(); + + cmd.run(config, client.clone(), db, storage).map_err(Error::SubstrateCli) + }), + BenchmarkCmd::Block(cmd) => runner.sync_run(|mut config| { + let (client, _, _, _,) = + service::new_chain_ops(&mut config)?; + cmd.run(client.clone()).map_err(Error::SubstrateCli) + }), + // These commands are very similar and can be handled in nearly the same way + BenchmarkCmd::Extrinsic(_) | BenchmarkCmd::Overhead(_) => + runner.sync_run(|mut config| { + let (client, _, _, _) = + service::new_chain_ops(&mut config)?; + + let inherent_data = benchmark_inherent_data() + .map_err(|e| format!("generating inherent data: {:?}", e))?; + + let remark_builder = RemarkBuilder::new( + client.clone(), + config.chain_spec.identify_chain(), + ); + + match cmd { + BenchmarkCmd::Extrinsic(cmd) => { + let tka_builder = TransferKeepAliveBuilder::new( + client.clone(), + Sr25519Keyring::Alice.to_account_id(), + config.chain_spec.identify_chain(), + ); + + let ext_factory = ExtrinsicFactory(vec![ + Box::new(remark_builder), + Box::new(tka_builder), + ]); + + cmd.run(client.clone(), inherent_data, Vec::new(), &ext_factory) + .map_err(Error::SubstrateCli) + }, + BenchmarkCmd::Overhead(cmd) => cmd.run( + config, + client.clone(), + inherent_data, + Vec::new(), + &remark_builder, + ).map_err(Error::SubstrateCli), + _ => unreachable!("Ensured by the outside match; qed"), + } + }), + BenchmarkCmd::Pallet(cmd) => { + set_ss58_version(chain_spec); + + if cfg!(feature = "runtime-benchmarks") { + runner.sync_run(|config| { + cmd.run_with_spec::, ()>( + Some(config.chain_spec), + ).map_err(|e| Error::SubstrateCli(e)) + }) + } else { + Err(sc_cli::Error::Input( + "Benchmarking wasn't enabled when building the node. \ + You can enable it with `--features=runtime-benchmarks`.".into() + ).into()) + } + }, + BenchmarkCmd::Machine(cmd) => runner.sync_run(|config| { + cmd.run(&config, ghost_machine_primitives::GHOST_NODE_REFERENCE_HARDWARE.clone()) + .map_err(Error::SubstrateCli) + }), + // Note: this allows to implement additional new benchmark + // commands. + #[allow(unreachable_patterns)] + _ => Err(Error::CommandNotImplemented), + } + }, + Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?), + Some(Subcommand::ChainInfo(cmd)) => { + let runner = cli.create_runner(cmd)?; + Ok(runner.sync_run(|config| cmd.run::(&config))?) + }, + }?; + + #[cfg(feature = "pyroscope")] + if let Some(pyroscope_agent) = pyroscope_agent_maybe.take() { + let agent = pyroscope_agent.stop()?; + agent.shutdown(); + } + Ok(()) +} diff --git a/cli/src/error.rs b/cli/src/error.rs new file mode 100755 index 0000000..4b4fc8d --- /dev/null +++ b/cli/src/error.rs @@ -0,0 +1,46 @@ +#[derive(thiserror::Error, Debug)] +pub enum Error { + #[error(transparent)] + GhostService(#[from] service::Error), + + #[error(transparent)] + SubstrateCli(#[from] sc_cli::Error), + + #[error(transparent)] + SubstrateService(#[from] sc_service::Error), + + #[error(transparent)] + SubstrateTracing(#[from] sc_tracing::logging::Error), + + #[cfg(not(feature = "pyroscope"))] + #[error("Binary was not compiled with `--feature=pyroscope")] + PyroscopeNotCompiledIn, + + #[cfg(feature = "pyroscope")] + #[error("Failed to connect to pyroscope agent")] + PyroscopeError(#[from] pyro::error::PyroscopeError), + + #[error("Failed to resolve provided URL")] + AddressResolutionFailure(#[from] std::io::Error), + + #[error("URL did not resolve to anthing")] + AddressResolutionMissing, + + #[error("Command not implemented")] + CommandNotImplemented, + + #[error(transparent)] + Storage(#[from] sc_storage_monitor::Error), + + #[error("Other: {0}")] + Other(String), + + #[error("This subcommand is only available when compiled with `{feature}`")] + FeatureNotEnabled { feature: &'static str }, +} + +impl From for Error { + fn from(s: String) -> Self { + Self::Other(s) + } +} diff --git a/cli/src/lib.rs b/cli/src/lib.rs new file mode 100755 index 0000000..5163726 --- /dev/null +++ b/cli/src/lib.rs @@ -0,0 +1,19 @@ +#[cfg(feature = "cli")] +mod cli; +#[cfg(feature = "cli")] +mod command; +#[cfg(feature = "cli")] +mod error; + +#[cfg(feature = "service")] +pub use service::{ + self, Block, CoreApi, IdentifyVariant, ProvideRuntimeApi, TFullClient, +}; + +#[cfg(feature = "cli")] +pub use cli::*; +#[cfg(feature = "cli")] +pub use command::*; + +#[cfg(feature = "cli")] +pub use sc_cli::{Error, Result}; diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml new file mode 100644 index 0000000..7227a04 --- /dev/null +++ b/client/cli/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "ghost-client-cli" +version = "0.1.3" +description = "Ghost CLI interface" +license.workspace = true +authors.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true + +[dependencies] +clap = { workspace = true } +itertools = { workspace = true } +bip39 = { workspace = true } +rand = { workspace = true } +array-bytes = { workspace = true } +serde_json = { workspace = true } + +sc-cli = { workspace = true } +sp-runtime = { workspace = true } +sp-core = { workspace = true } + +[features] +default = ["std"] +std = [ + "serde_json/std", + "sp-runtime/std", + "sp-core/std", +] diff --git a/client/cli/src/commands/generate.rs b/client/cli/src/commands/generate.rs new file mode 100755 index 0000000..1f89119 --- /dev/null +++ b/client/cli/src/commands/generate.rs @@ -0,0 +1,74 @@ +//! Implementation of the `generate` subcommand + +use bip39::Mnemonic; +use clap::Parser; +use itertools::Itertools; +use sc_cli::{ + with_crypto_scheme, KeystoreParams, OutputTypeFlag, + CryptoSchemeFlag, Error, +}; + +use crate::params::NetworkSchemeFlag; +use crate::commands::utils::print_from_uri; + +/// The `generate` command +#[derive(Debug, Clone, Parser)] +#[command(name = "generate", about = "Generate a random account")] +pub struct GenerateCmd { + /// The number of words in the phrase to generate. One of 12 (default), + /// 15, 18, 21 and 24. + #[arg(short = 'w', long, value_name = "WORDS")] + words: Option, + + #[allow(missing_docs)] + #[clap(flatten)] + pub keystore_params: KeystoreParams, + + #[allow(missing_docs)] + #[clap(flatten)] + pub network_scheme: NetworkSchemeFlag, + + #[allow(missing_docs)] + #[clap(flatten)] + pub output_scheme: OutputTypeFlag, + + #[allow(missing_docs)] + #[clap(flatten)] + pub crypto_scheme: CryptoSchemeFlag, +} + +impl GenerateCmd { + /// Run the command + pub fn run(&self) -> Result<(), Error> { + let words = match self.words { + Some(words_count) if [12, 15, 18, 21, 24].contains(&words_count) => Ok(words_count), + Some(_) => Err(Error::Input( + "Invalid number of words given for phrase: must be 12/15/18/21/24".into(), + )), + None => Ok(12), + }?; + let mnemonic = Mnemonic::generate(words) + .map_err(|e| Error::Input(format!("Mnemonic generation failed: {e}").into()))?; + let password = self.keystore_params.read_password()?; + let output = self.output_scheme.output_type; + + let phrase = mnemonic.words().join(" "); + + with_crypto_scheme!( + self.crypto_scheme.scheme, + print_from_uri(&phrase, password, self.network_scheme.network, output) + ); + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn generate() { + let generate = GenerateCmd::parse_from(&["generate", "--password", "12345"]); + assert!(generate.run().is_ok()) + } +} diff --git a/client/cli/src/commands/inspect_key.rs b/client/cli/src/commands/inspect_key.rs new file mode 100755 index 0000000..bcb94f0 --- /dev/null +++ b/client/cli/src/commands/inspect_key.rs @@ -0,0 +1,253 @@ +//! Implementation of the `inspect` subcommand + +use clap::Parser; +use sp_core::crypto::{ExposeSecret, SecretString, SecretUri, Ss58Codec}; +use std::str::FromStr; +use sc_cli::{ + with_crypto_scheme, KeystoreParams, OutputTypeFlag, CryptoSchemeFlag, Error, + utils::read_uri, +}; +use crate::params::NetworkSchemeFlag; +use crate::commands::utils::{print_from_public, print_from_uri}; + +/// The `inspect` command +#[derive(Debug, Parser)] +#[command( + name = "inspect", + about = "Gets a public key and a SS58 address from the provided Secret URI" +)] +pub struct InspectKeyCmd { + /// A Key URI to be inspected. May be a secret seed, secret URI + /// (with derivation paths and password), SS58, public URI or a hex encoded public key. + /// + /// If it is a hex encoded public key, `--public` needs to be given as argument. + /// + /// If the given value is a file, the file content will be used + /// as URI. + /// + /// If omitted, you will be prompted for the URI. + uri: Option, + + /// Is the given `uri` a hex encoded public key? + #[arg(long)] + public: bool, + + #[allow(missing_docs)] + #[clap(flatten)] + pub keystore_params: KeystoreParams, + + #[allow(missing_docs)] + #[clap(flatten)] + pub network_scheme: NetworkSchemeFlag, + + #[allow(missing_docs)] + #[clap(flatten)] + pub output_scheme: OutputTypeFlag, + + #[allow(missing_docs)] + #[clap(flatten)] + pub crypto_scheme: CryptoSchemeFlag, + + /// Expect that `--uri` has the given public key/account-id. + /// + /// If `--uri` has any derivations, the public key is checked against the base `uri`, i.e. the + /// `uri` without any derivation applied. However, if `uri` has a password or there is one + /// given by `--password`, it will be used to decrypt `uri` before comparing the public + /// key/account-id. + /// + /// If there is no derivation in `--uri`, the public key will be checked against the public key + /// of `--uri` directly. + #[arg(long, conflicts_with = "public")] + pub expect_public: Option, +} + +impl InspectKeyCmd { + /// Run the command + pub fn run(&self) -> Result<(), Error> { + let uri = read_uri(self.uri.as_ref())?; + let password = self.keystore_params.read_password()?; + + if self.public { + with_crypto_scheme!( + self.crypto_scheme.scheme, + print_from_public( + &uri, + self.network_scheme.network, + self.output_scheme.output_type, + ) + )?; + } else { + if let Some(ref expect_public) = self.expect_public { + with_crypto_scheme!( + self.crypto_scheme.scheme, + expect_public_from_phrase(expect_public, &uri, password.as_ref()) + )?; + } + + with_crypto_scheme!( + self.crypto_scheme.scheme, + print_from_uri( + &uri, + password, + self.network_scheme.network, + self.output_scheme.output_type, + ) + ); + } + + Ok(()) + } +} + +/// Checks that `expect_public` is the public key of `suri`. +/// +/// If `suri` has any derivations, `expect_public` is checked against the public key of the "bare" +/// `suri`, i.e. without any derivations. +/// +/// Returns an error if the public key does not match. +fn expect_public_from_phrase( + expect_public: &str, + suri: &str, + password: Option<&SecretString>, +) -> Result<(), Error> { + let secret_uri = SecretUri::from_str(suri).map_err(|e| format!("{:?}", e))?; + let expected_public = if let Some(public) = expect_public.strip_prefix("0x") { + let hex_public = array_bytes::hex2bytes(public) + .map_err(|_| format!("Invalid expected public key hex: `{}`", expect_public))?; + Pair::Public::try_from(&hex_public) + .map_err(|_| format!("Invalid expected public key: `{}`", expect_public))? + } else { + Pair::Public::from_string_with_version(expect_public) + .map_err(|_| format!("Invalid expected account id: `{}`", expect_public))? + .0 + }; + + let pair = Pair::from_string_with_seed( + secret_uri.phrase.expose_secret().as_str(), + password + .or_else(|| secret_uri.password.as_ref()) + .map(|p| p.expose_secret().as_str()), + ) + .map_err(|_| format!("Invalid secret uri: {}", suri))? + .0; + + if pair.public() == expected_public { + Ok(()) + } else { + Err(format!("Expected public ({}) key does not match.", expect_public).into()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use sp_core::crypto::{ByteArray, Pair}; + use sp_runtime::traits::IdentifyAccount; + + #[test] + fn inspect() { + let words = + "remember fiber forum demise paper uniform squirrel feel access exclude casual effort"; + let seed = "0xad1fb77243b536b90cfe5f0d351ab1b1ac40e3890b41dc64f766ee56340cfca5"; + + let inspect = InspectKeyCmd::parse_from(&["inspect-key", words, "--password", "12345"]); + assert!(inspect.run().is_ok()); + + let inspect = InspectKeyCmd::parse_from(&["inspect-key", seed]); + assert!(inspect.run().is_ok()); + } + + #[test] + fn inspect_public_key() { + let public = "0x12e76e0ae8ce41b6516cce52b3f23a08dcb4cfeed53c6ee8f5eb9f7367341069"; + + let inspect = InspectKeyCmd::parse_from(&["inspect-key", "--public", public]); + assert!(inspect.run().is_ok()); + } + + #[test] + fn inspect_with_expected_public_key() { + let check_cmd = |seed, expected_public, success| { + let inspect = InspectKeyCmd::parse_from(&[ + "inspect-key", + "--expect-public", + expected_public, + seed, + ]); + let res = inspect.run(); + + if success { + assert!(res.is_ok()); + } else { + assert!(res.unwrap_err().to_string().contains(&format!( + "Expected public ({}) key does not match.", + expected_public + ))); + } + }; + + let seed = + "remember fiber forum demise paper uniform squirrel feel access exclude casual effort"; + let invalid_public = "0x12e76e0ae8ce41b6516cce52b3f23a08dcb4cfeed53c6ee8f5eb9f7367341069"; + let valid_public = sp_core::sr25519::Pair::from_string_with_seed(seed, None) + .expect("Valid") + .0 + .public(); + let valid_public_hex = array_bytes::bytes2hex("0x", valid_public.as_slice()); + let valid_accountid = format!("{}", valid_public.into_account()); + + // It should fail with the invalid public key + check_cmd(seed, invalid_public, false); + + // It should work with the valid public key & account id + check_cmd(seed, &valid_public_hex, true); + check_cmd(seed, &valid_accountid, true); + + let password = "test12245"; + let seed_with_password = format!("{}///{}", seed, password); + let valid_public_with_password = + sp_core::sr25519::Pair::from_string_with_seed(&seed_with_password, Some(password)) + .expect("Valid") + .0 + .public(); + let valid_public_hex_with_password = + array_bytes::bytes2hex("0x", valid_public_with_password.as_slice()); + let valid_accountid_with_password = + format!("{}", &valid_public_with_password.into_account()); + + // Only the public key that corresponds to the seed with password should be accepted. + check_cmd(&seed_with_password, &valid_public_hex, false); + check_cmd(&seed_with_password, &valid_accountid, false); + + check_cmd(&seed_with_password, &valid_public_hex_with_password, true); + check_cmd(&seed_with_password, &valid_accountid_with_password, true); + + let seed_with_password_and_derivation = format!("{}//test//account///{}", seed, password); + + let valid_public_with_password_and_derivation = + sp_core::sr25519::Pair::from_string_with_seed( + &seed_with_password_and_derivation, + Some(password), + ) + .expect("Valid") + .0 + .public(); + let valid_public_hex_with_password_and_derivation = + array_bytes::bytes2hex("0x", valid_public_with_password_and_derivation.as_slice()); + + // They should still be valid, because we check the base secret key. + check_cmd(&seed_with_password_and_derivation, &valid_public_hex_with_password, true); + check_cmd(&seed_with_password_and_derivation, &valid_accountid_with_password, true); + + // And these should be invalid. + check_cmd(&seed_with_password_and_derivation, &valid_public_hex, false); + check_cmd(&seed_with_password_and_derivation, &valid_accountid, false); + + // The public of the derived account should fail. + check_cmd( + &seed_with_password_and_derivation, + &valid_public_hex_with_password_and_derivation, + false, + ); + } +} diff --git a/client/cli/src/commands/key.rs b/client/cli/src/commands/key.rs new file mode 100755 index 0000000..0b1181d --- /dev/null +++ b/client/cli/src/commands/key.rs @@ -0,0 +1,40 @@ +//! Key related CLI utilities + +use super::{generate::GenerateCmd, inspect_key::InspectKeyCmd}; +use sc_cli::{ + GenerateKeyCmdCommon, InsertKeyCmd, InspectNodeKeyCmd, Error, + SubstrateCli, +}; + +/// Key utilities for the cli. +#[derive(Debug, clap::Subcommand)] +pub enum KeySubcommand { + /// Generate a random node key, write it to a file or stdout and write the + /// corresponding peer-id to stderr + GenerateNodeKey(GenerateKeyCmdCommon), + + /// Generate a Substrate-based random account + Generate(GenerateCmd), + + /// Gets a public key and a SS58 address from the provided Secret URI + Inspect(InspectKeyCmd), + + /// Load a node key from a file or stdin and print the corresponding peer-id + InspectNodeKey(InspectNodeKeyCmd), + + /// Insert a key to the keystore of a node. + Insert(InsertKeyCmd), +} + +impl KeySubcommand { + /// run the key subcommands + pub fn run(&self, cli: &C) -> Result<(), Error> { + match self { + KeySubcommand::GenerateNodeKey(cmd) => cmd.run(), + KeySubcommand::Generate(cmd) => cmd.run(), + KeySubcommand::Inspect(cmd) => cmd.run(), + KeySubcommand::Insert(cmd) => cmd.run(cli), + KeySubcommand::InspectNodeKey(cmd) => cmd.run(), + } + } +} diff --git a/client/cli/src/commands/mod.rs b/client/cli/src/commands/mod.rs new file mode 100755 index 0000000..a916150 --- /dev/null +++ b/client/cli/src/commands/mod.rs @@ -0,0 +1,11 @@ +mod key; +mod generate; +mod vanity; +mod inspect_key; +mod utils; + +pub use self::{ + key::KeySubcommand, vanity::VanityCmd, inspect_key::InspectKeyCmd, + generate::GenerateCmd, + utils::{unwrap_or_default_ss58_name, print_from_uri, print_from_public}, +}; diff --git a/client/cli/src/commands/utils.rs b/client/cli/src/commands/utils.rs new file mode 100755 index 0000000..73eec92 --- /dev/null +++ b/client/cli/src/commands/utils.rs @@ -0,0 +1,220 @@ +use serde_json::json; +use sc_cli::{ + OutputType, + utils::{PublicFor, SeedFor}, +}; +use sp_runtime::{traits::IdentifyAccount, MultiSigner}; +use sp_core::{ + crypto::{ + unwrap_or_default_ss58_version, + Ss58Codec, ExposeSecret, Ss58AddressFormat, SecretString, + }, + hexdisplay::HexDisplay, +}; + +pub fn print_from_uri( + uri: &str, + password: Option, + network_override: Option, + output: OutputType, +) where + Pair: sp_core::Pair, + Pair::Public: Into, +{ + let password = password.as_ref().map(|s| s.expose_secret().as_str()); + let network_id = unwrap_or_default_ss58_name(network_override); + + if let Ok((pair, seed)) = Pair::from_phrase(uri, password) { + let public_key = pair.public(); + let network_override = unwrap_or_default_ss58_version(network_override); + + match output { + OutputType::Json => { + let json = json!({ + "secretPhrase": uri, + "networkId": network_id, + "secretSeed": format_seed::(seed), + "publicKey": format_public_key::(public_key.clone()), + "ss58PublicKey": public_key.to_ss58check_with_version(network_override), + "accountId": format_account_id::(public_key), + "ss58Address": pair.public().into().into_account().to_ss58check_with_version(network_override), + }); + println!( + "{}", + serde_json::to_string_pretty(&json).expect("Json pretty print failed") + ); + }, + OutputType::Text => { + println!( + "Secret phrase: {}\n \ + Network ID: {}\n \ + Secret seed: {}\n \ + Public key (hex): {}\n \ + Account ID: {}\n \ + Public key (SS58): {}\n \ + SS58 Address: {}", + uri, + network_id, + format_seed::(seed), + format_public_key::(public_key.clone()), + format_account_id::(public_key.clone()), + public_key.to_ss58check_with_version(network_override), + pair.public().into().into_account().to_ss58check_with_version(network_override), + ); + }, + } + } else if let Ok((pair, seed)) = Pair::from_string_with_seed(uri, password) { + let public_key = pair.public(); + let network_override = unwrap_or_default_ss58_version(network_override); + + match output { + OutputType::Json => { + let json = json!({ + "secretKeyUri": uri, + "networkId": network_id, + "secretSeed": if let Some(seed) = seed { format_seed::(seed) } else { "n/a".into() }, + "publicKey": format_public_key::(public_key.clone()), + "ss58PublicKey": public_key.to_ss58check_with_version(network_override), + "accountId": format_account_id::(public_key), + "ss58Address": pair.public().into().into_account().to_ss58check_with_version(network_override), + }); + println!( + "{}", + serde_json::to_string_pretty(&json).expect("Json pretty print failed") + ); + }, + OutputType::Text => { + println!( + "Secret Key URI `{}` is account:\n \ + Network ID: {}\n \ + Secret seed: {}\n \ + Public key (hex): {}\n \ + Account ID: {}\n \ + Public key (SS58): {}\n \ + SS58 Address: {}", + uri, + network_id, + if let Some(seed) = seed { format_seed::(seed) } else { "n/a".into() }, + format_public_key::(public_key.clone()), + format_account_id::(public_key.clone()), + public_key.to_ss58check_with_version(network_override), + pair.public().into().into_account().to_ss58check_with_version(network_override), + ); + }, + } + } else if let Ok((public_key, network)) = Pair::Public::from_string_with_version(uri) { + let network_override = network_override.unwrap_or(network); + + match output { + OutputType::Json => { + let json = json!({ + "publicKeyUri": uri, + "networkId": String::from(network_override), + "publicKey": format_public_key::(public_key.clone()), + "accountId": format_account_id::(public_key.clone()), + "ss58PublicKey": public_key.to_ss58check_with_version(network_override), + "ss58Address": public_key.to_ss58check_with_version(network_override), + }); + + println!( + "{}", + serde_json::to_string_pretty(&json).expect("Json pretty print failed") + ); + }, + OutputType::Text => { + println!( + "Public Key URI `{}` is account:\n \ + Network ID/Version: {}\n \ + Public key (hex): {}\n \ + Account ID: {}\n \ + Public key (SS58): {}\n \ + SS58 Address: {}", + uri, + String::from(network_override), + format_public_key::(public_key.clone()), + format_account_id::(public_key.clone()), + public_key.to_ss58check_with_version(network_override), + public_key.to_ss58check_with_version(network_override), + ); + }, + } + } else { + println!("Invalid phrase/URI given"); + } +} + +/// Try to parse given `public` as hex encoded public key and print relevant information. +pub fn print_from_public( + public_str: &str, + network_override: Option, + output: OutputType, +) -> Result<(), sc_cli::Error> +where + Pair: sp_core::Pair, + Pair::Public: Into, +{ + let public = array_bytes::hex2bytes(public_str)?; + + let public_key = Pair::Public::try_from(&public) + .map_err(|_| "Failed to construct public key from given hex")?; + + let network_override = unwrap_or_default_ss58_version(network_override); + + match output { + OutputType::Json => { + let json = json!({ + "networkId": String::from(network_override), + "publicKey": format_public_key::(public_key.clone()), + "accountId": format_account_id::(public_key.clone()), + "ss58PublicKey": public_key.to_ss58check_with_version(network_override), + "ss58Address": public_key.to_ss58check_with_version(network_override), + }); + + println!("{}", serde_json::to_string_pretty(&json).expect("Json pretty print failed")); + }, + OutputType::Text => { + println!( + "Network ID/Version: {}\n \ + Public key (hex): {}\n \ + Account ID: {}\n \ + Public key (SS58): {}\n \ + SS58 Address: {}", + String::from(network_override), + format_public_key::(public_key.clone()), + format_account_id::(public_key.clone()), + public_key.to_ss58check_with_version(network_override), + public_key.to_ss58check_with_version(network_override), + ); + }, + } + + Ok(()) +} + +pub fn unwrap_or_default_ss58_name(x: Option) -> String { + if let Some(x) = x { + let name = match x.prefix() { + 1995 => String::from("Ghost"), + 1996 => String::from("Casper"), + _ => String::from("Unwknown"), + }; + format!("{} ({})", name, x.prefix()) + } else { + String::from("Unknown (unknown)") + } +} + +pub fn format_seed(seed: SeedFor

) -> String { + format!("0x{}", HexDisplay::from(&seed.as_ref())) +} + +fn format_public_key(public_key: PublicFor

) -> String { + format!("0x{}", HexDisplay::from(&public_key.as_ref())) +} + +fn format_account_id(public_key: PublicFor

) -> String +where + PublicFor

: Into, +{ + format!("0x{}", HexDisplay::from(&public_key.into().into_account().as_ref())) +} diff --git a/client/cli/src/commands/vanity.rs b/client/cli/src/commands/vanity.rs new file mode 100755 index 0000000..2204336 --- /dev/null +++ b/client/cli/src/commands/vanity.rs @@ -0,0 +1,214 @@ +//! implementation of the `vanity` subcommand + +use clap::Parser; +use rand::{rngs::OsRng, RngCore}; +use sp_core::crypto::{ + unwrap_or_default_ss58_version, Ss58AddressFormat, Ss58Codec, +}; +use sp_runtime::traits::IdentifyAccount; +use sc_cli::{ + with_crypto_scheme, Error, OutputTypeFlag, CryptoSchemeFlag, + utils::format_seed, +}; + +use crate::commands::utils::print_from_uri; +use crate::params::NetworkSchemeFlag; + +/// The `vanity` command +#[derive(Debug, Clone, Parser)] +#[command(name = "vanity", about = "Generate a seed that provides a vanity address")] +pub struct VanityCmd { + /// Desired pattern + #[arg(long, value_parser = assert_non_empty_string)] + pattern: String, + + #[allow(missing_docs)] + #[clap(flatten)] + network_scheme: NetworkSchemeFlag, + + #[allow(missing_docs)] + #[clap(flatten)] + output_scheme: OutputTypeFlag, + + #[allow(missing_docs)] + #[clap(flatten)] + crypto_scheme: CryptoSchemeFlag, +} + +impl VanityCmd { + /// Run the command + pub fn run(&self) -> Result<(), Error> { + let formated_seed = with_crypto_scheme!( + self.crypto_scheme.scheme, + generate_key( + &self.pattern, + unwrap_or_default_ss58_version(self.network_scheme.network) + ), + )?; + + with_crypto_scheme!( + self.crypto_scheme.scheme, + print_from_uri( + &formated_seed, + None, + self.network_scheme.network, + self.output_scheme.output_type, + ), + ); + Ok(()) + } +} + +/// genertae a key based on given pattern +fn generate_key( + desired: &str, + network_override: Ss58AddressFormat, +) -> Result +where + Pair: sp_core::Pair, + Pair::Public: IdentifyAccount, + ::AccountId: Ss58Codec, +{ + println!("Generating key containing pattern '{}'", desired); + + let top = 45 + (desired.len() * 48); + let mut best = 0; + let mut seed = Pair::Seed::default(); + let mut done = 0; + + loop { + if done % 100000 == 0 { + OsRng.fill_bytes(seed.as_mut()); + } else { + next_seed(seed.as_mut()); + } + + let p = Pair::from_seed(&seed); + let ss58 = p.public().into_account().to_ss58check_with_version(network_override); + println!("{:?}", ss58); + let score = calculate_score(desired, &ss58); + if score > best || desired.len() < 2 { + best = score; + if best >= top { + println!("best: {} == top: {}", best, top); + return Ok(format_seed::(seed.clone())) + } + } + done += 1; + + if done % good_waypoint(done) == 0 { + println!("{} keys searched; best is {}/{} complete", done, best, top); + } + } +} + +fn good_waypoint(done: u64) -> u64 { + match done { + 0..=1_000_000 => 100_000, + 1_000_001..=10_000_000 => 1_000_000, + 10_000_001..=100_000_000 => 10_000_000, + 100_000_001.. => 100_000_000, + } +} + +fn next_seed(seed: &mut [u8]) { + for s in seed { + match s { + 255 => { + *s = 0; + }, + _ => { + *s += 1; + break + }, + } + } +} + +/// Calculate the score of a key based on the desired +/// input. +fn calculate_score(_desired: &str, key: &str) -> usize { + for truncate in 0.._desired.len() { + let snip_size = _desired.len() - truncate; + let truncated = &_desired[0..snip_size]; + if let Some(pos) = key.find(truncated) { + return (47 - pos) + (snip_size * 48) + } + } + 0 +} + +/// checks that `pattern` is non-empty +fn assert_non_empty_string(pattern: &str) -> Result { + if pattern.is_empty() { + Err("Pattern must not be empty") + } else { + Ok(pattern.to_string()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use sp_core::{ + crypto::{default_ss58_version, Ss58AddressFormatRegistry, Ss58Codec}, + sr25519, Pair, + }; + + #[test] + fn vanity() { + let vanity = VanityCmd::parse_from(&["vanity", "--pattern", "j"]); + assert!(vanity.run().is_ok()); + } + + #[test] + fn test_generation_with_single_char() { + let seed = generate_key::("ab", default_ss58_version()).unwrap(); + assert!(sr25519::Pair::from_seed_slice(&array_bytes::hex2bytes_unchecked(&seed)) + .unwrap() + .public() + .to_ss58check() + .contains("ab")); + } + + #[test] + fn generate_key_respects_network_override() { + let seed = + generate_key::("ab", Ss58AddressFormatRegistry::PolkadotAccount.into()) + .unwrap(); + assert!(sr25519::Pair::from_seed_slice(&array_bytes::hex2bytes_unchecked(&seed)) + .unwrap() + .public() + .to_ss58check_with_version(Ss58AddressFormatRegistry::PolkadotAccount.into()) + .contains("ab")); + } + + #[test] + fn test_score_1_char_100() { + let score = calculate_score("j", "sYrjWiZkEP1PQe2kKEZiC1Bi9L8yFSsB5RPEkzEPd5NThsB5H"); + assert_eq!(score, 96); + } + + #[test] + fn test_score_100() { + let score = calculate_score("ghst", "sYsghstuhYd9p6unUC3kPxjD2gv2zRCztYQaEDCMJpYrPTqTG"); + assert_eq!(score, 246); + } + + #[test] + fn test_score_50_2() { + // 50% for the position + 50% for the size + assert_eq!( + calculate_score("ghst", "sYsghXXuhYd9p6unUC3kPxjD2gv2zRCztYQaEDCMJpYrPTqTG"), + 146 + ); + } + + #[test] + fn test_score_0() { + assert_eq!( + calculate_score("ghst", "sYrjWiZkEP1PQe2kKEZiC1Bi9L8yFSsB5RPEkzEPd5NThsB5H"), + 0 + ); + } +} diff --git a/client/cli/src/lib.rs b/client/cli/src/lib.rs new file mode 100644 index 0000000..02258a0 --- /dev/null +++ b/client/cli/src/lib.rs @@ -0,0 +1,5 @@ +pub mod params; +pub mod commands; + +pub use commands::KeySubcommand; +pub use commands::VanityCmd; diff --git a/client/cli/src/params/mod.rs b/client/cli/src/params/mod.rs new file mode 100644 index 0000000..86e2e27 --- /dev/null +++ b/client/cli/src/params/mod.rs @@ -0,0 +1,70 @@ +use clap::Args; +use sp_core::crypto::Ss58AddressFormat; + +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +pub struct ParseError; + +impl std::fmt::Display for ParseError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "failed to parse network value as u16") + } +} + +impl std::error::Error for ParseError {} + +static ALL_POSSIBLE_NAMES: [&str; 2] = ["ghost", "casper"]; +static ALL_POSSIBLE_IDS: [u16; 2] = [1995, 1996]; + +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub struct InnerSs58AddressFormat(Ss58AddressFormat); + +impl InnerSs58AddressFormat { + #[inline] + pub fn custom(prefix: u16) -> Self { + Self { 0: Ss58AddressFormat::custom(prefix) } + } +} + +impl std::fmt::Display for InnerSs58AddressFormat { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "{} network", ALL_POSSIBLE_IDS + .binary_search(&u16::from(self.0)) + .expect("always be found")) + } +} + +impl<'a>TryFrom<&'a str> for InnerSs58AddressFormat { + type Error = ParseError; + + fn try_from(x: &'a str) -> Result { + match ALL_POSSIBLE_NAMES.iter().position(|&n| n == x) { + Some(id) => Ok(InnerSs58AddressFormat::custom(ALL_POSSIBLE_IDS[id])), + _ => Err(ParseError), + } + } +} + +pub fn parse_s58_prefix_address_format(x: &str,) -> Result { + match InnerSs58AddressFormat::try_from(x) { + Ok(format_registry) => Ok(format_registry.0.into()), + Err(_) => Err(format!( + "Unable to parse variant. Known variants: {:?}", + &ALL_POSSIBLE_NAMES + )) + } +} + +/// Optional flag for specifying network scheme +#[derive(Debug, Clone, Args)] +pub struct NetworkSchemeFlag { + /// Network address format + #[arg( + short = 'n', + long, + ignore_case = true, + value_parser = parse_s58_prefix_address_format, + value_name = "NETWORK", + default_value = "casper", + )] + pub network: Option, +} diff --git a/core-primitives/Cargo.toml b/core-primitives/Cargo.toml new file mode 100755 index 0000000..071dcc1 --- /dev/null +++ b/core-primitives/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "ghost-core-primitives" +version = "0.5.19" +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true + +[dependencies] +sp-core = { workspace = true } +sp-std = { workspace = true } +sp-runtime = { workspace = true } + +[features] +default = ["std"] +std = [ + "sp-core/std", + "sp-runtime/std", + "sp-std/std", +] diff --git a/core-primitives/src/lib.rs b/core-primitives/src/lib.rs new file mode 100755 index 0000000..7bba022 --- /dev/null +++ b/core-primitives/src/lib.rs @@ -0,0 +1,58 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use sp_runtime::{ + generic, + traits::{BlakeTwo256, IdentifyAccount, Verify}, + MultiSignature, OpaqueExtrinsic as UncheckedExtrinsic, +}; + +/// The block number type used by GHOST/ +/// 32-bits will allow for 136 years of blocks assuming 1 block per second. +pub type BlockNumber = u32; + +/// An instant or duration time. +pub type Moment = u64; + +/// Alias to 512-bit hash when used in the context of a transaction signature +/// on the chain. +pub type Signature = MultiSignature; + +/// Alias to public key used for GHOST chain, actually a 'MultiSigner'. Like +/// the signature, this also isn't a fixed size when encoded, as different +/// cryptos have different size public key. +pub type AccountPublic = ::Signer; + +/// Alias to public key used for this chain, actually a `AccountId32`. This is +/// always 32 bytes. +pub type AccountId = ::AccountId; + +/// The type for looking up accounts. We don't expect more than 4 billion of them. +pub type AccountIndex = u32; + +/// Identifier for a chain. 32-bit should be plenty. +pub type ChainId = u32; + +/// A hash of some data used by the relay chain. +pub type Hash = sp_core::H256; + +/// Index of transaction in the chain. +pub type Nonce = u32; + +/// The balance of an account. +pub type Balance = u128; + +/// Amount type. +pub type Amount = i128; + +/// Header type. +pub type Header = generic::Header; + +/// Block type. +pub type Block = generic::Block; + +/// Block ID. +pub type BlockId = generic::BlockId; + +/// Type for identifier for the named reserve. +pub type ReserveIdentifier = [u8; 8]; +pub type FreezeIdentifier = [u8; 8]; diff --git a/file_header.txt b/file_header.txt new file mode 100755 index 0000000..c110eec --- /dev/null +++ b/file_header.txt @@ -0,0 +1,14 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . diff --git a/metrics/Cargo.toml b/metrics/Cargo.toml new file mode 100644 index 0000000..d5eca04 --- /dev/null +++ b/metrics/Cargo.toml @@ -0,0 +1,40 @@ +[package] +name = "ghost-metrics" +description = "Substrate metric helper" +version.workspace = true +edition.workspace = true +authors.workspace = true +license.workspace = true +repository.workspace = true +homepage.workspace = true + +[dependencies] +futures = { workspace = true } +futures-timer = { workspace = true } +metered = { workspace = true, features = ["futures_channel"] } +codec = { workspace = true, default-features = true } +log = { workspace = true, default-features = true } +bs58 = { workspace = true, features = ["alloc"] } + +sc-service = { workspace = true, default-features = true } +sc-cli = { workspace = true, default-features = true } +sc-tracing = { workspace = true, default-features = true } + +prometheus-endpoint = { workspace = true, default-features = true } +primitives = { workspace = true, default-features = true } + +[dev-dependencies] +assert_cmd = { workspace = true } +tempfile = { workspace = true } +hyper = { workspace = true, features = ["http1", "tcp"] } +tokio = { workspace = true } +sc-service = { workspace = true, default-features = true } +keyring = { workspace = true, default-features = true } +prometheus-parse = { workspace = true } + +[features] +default = [] +runtime-metrics = [] +runtime-benchmarks = [ + "sc-service/runtime-benchmarks", +] diff --git a/metrics/src/lib.rs b/metrics/src/lib.rs new file mode 100644 index 0000000..dd6219c --- /dev/null +++ b/metrics/src/lib.rs @@ -0,0 +1,47 @@ +pub use metered; + +pub mod metronome; +pub use self::metronome::Metronome; + +#[cfg(feature = "runtime-metrics")] +pub mod runtime; +#[cfg(feature = "runtime-metrics")] +pub use self::runtime::logger_hook; + +/// Export a dummy logger hook when the `runtime-metrics` feature is not enbaled. +#[cfg(not(feature = "runtime-metrics"))] +pub fn logger_hook() -> impl FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration) { + |_logger_builder, _config| {} +} + +/// This module exports Prometheus types an:d defines +/// the [`Metrics`](metrics::Metrics) trait. +pub mod metrics { + pub use prometheus_endpoint as prometheus; + + pub trait Metrics: Default + Clone { + fn try_register( + registry: &prometheus::Registry, + ) -> Result; + + fn register( + registry: Option<&prometheus::Registry>, + ) -> Result { + match registry { + None => Ok(Self::default()), + Some(registry) => Self::try_register(registry), + } + } + } + + impl Metrics for () { + fn try_register( + _registry: &prometheus::Registry, + ) -> Result<(), prometheus::PrometheusError> { + Ok(()) + } + } +} + +#[cfg(all(feature = "runtime-metrics", not(feature = "runtime-benchmarks"), test))] +mod tests; diff --git a/metrics/src/metronome.rs b/metrics/src/metronome.rs new file mode 100644 index 0000000..dbe5e17 --- /dev/null +++ b/metrics/src/metronome.rs @@ -0,0 +1,51 @@ +use futures::prelude::*; +use futures_timer::Delay; +use std::{ + pin::Pin, + task::{Context, Poll}, + time::Duration, +}; + +#[derive(Copy, Clone)] +enum MetronomeState { + Snooze, + SetAlarm, +} + +pub struct Metronome { + delay: Delay, + period: Duration, + state: MetronomeState, +} + +impl Metronome { + /// Create a new metronome source with a defined cycle duration. + pub fn new(cycle: Duration) -> Self { + let period = cycle.into(); + Self { period, delay: Delay::new(period), state: MetronomeState::Snooze } + } +} + +impl futures::Stream for Metronome { + type Item = (); + + fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + loop { + match self.state { + MetronomeState::SetAlarm => { + let val = self.period; + self.delay.reset(val); + self.state = MetronomeState::Snooze; + }, + MetronomeState::Snooze => { + if !Pin::new(&mut self.delay).poll(cx).is_ready() { + break + } + self.state = MetronomeState::SetAlarm; + return Poll::Ready(Some(())) + }, + } + } + Poll::Pending + } +} diff --git a/metrics/src/runtime/mod.rs b/metrics/src/runtime/mod.rs new file mode 100644 index 0000000..0a7ac19 --- /dev/null +++ b/metrics/src/runtime/mod.rs @@ -0,0 +1,189 @@ +#![cfg(feature = "runtime-metrics")] + +use codec::Decode; +use core_primitives::{ + metrics_definitions::{ + CounterDefinition, CounterVecDefinition, HistogramDefinition, + }, + RuntimeMetricLabelValues, RuntimeMetricOp, RuntimeMetricUpdate, +}; +use prometheus_endpoint::{ + register, Counter, CounterVec, Histogram, HistogramOpts, Opts, Registry, + PrometheusError, U64, +}; +use std::{ + collections::hash_map::HashMap, + sync::{Arc, Mutex, MutexGuard}, +} + +#[derive(Clone, Debug)] +pub struct Metrics { + counter_vecs: Arc>>>, + counters: Arc>>>, + histograms: Arc>>, +} + +#[derive(Clone)] +pub struct RuntimeMetricsProvider(Registry, Metrics); +impl RuntimeMetricsProvider { + pub fn new(metrics_registry: Registry) -> Self { + Self(metrics_registry, Metrics::default()) + } + + pub fn register_countervec(&self, countervec: CounterVecDefinition) { + self.with_counter_vecs_lock_held(|mut hashmap| { + hashmap.entry(countervec.name.to_owned()).or_insert(register( + CounterVec::new( + Opts::new(countervec.name, countervec.description), + countervec.labels, + )?, + &self.0, + )?); + Ok(()) + }) + } + + pub fn register_counter(&self, counter: CounterDefinition) { + self.with_counters_lock_held(|mut hashmap| { + hashmap.entry(counter.name.to_owned()).or_insert(register( + Counter::new( + counter.name, + counter.description, + )?, + &self.0, + )?); + Ok(()) + }) + } + + pub fn register_histogram(&self, hist: HistogramDefinition) { + self.with_histograms_lock_held(|mut hashmap| { + hashmap.entry(hist.name.to_owned()).or_insert(register( + Histogram::with_opts( + HistogramOpts::new(hist.name, hist.description) + .buckets(hist.buckets.to_vec()), + )?, + &self.0, + )?); + Ok(()) + }) + } + + pub fn inc_counter_vec_by( + &self, + name: &str, + value: u64, + labels: &RuntimeMetricsProvider, + ) { + self.with_counter_vecs_lock_held(|mut hashmap| { + hashmap.entry(name.to_owned()).and_modify(|counter_vec| { + counter_vec.with_label_values(&labels.as_str_vec()).inc_by(value) + }); + Ok(()) + }) + } + + pub fn inc_counter_by(&self, name: &str, value: u64) { + self.with_counters_lock_held(|mut hashmap| { + hashmap.entry(name.to_owned()) + .and_modify(|counter_vec| counter_vec.inc_by(value)); + Ok(()) + }) + } + + pub fn observe_histogram(&self, name: &str, value: u128) { + self.with_histograms_lock_held(|mut hashmap| { + hashmap.entry(name.to_owned()) + and_modify(|histogram| histogram.observe(value as f64 / 1_000_000_000.0)); + Ok(()) + }) + } + + fn with_counters_lock_held(&self, do_something: F) + where + F: FnOnce(MutexGuard<'_, HashMap>>) -> Result<(), PrometheusError>, + { + let _ = self.1.counters.lock().map(do_something).or_else(|error| Err(error)); + } + + fn with_counter_vecs_lock_held(&self, do_something: F) + where + F: FnOnce(MutexGuard<'_, HashMap>>) -> Result<(), PrometheusError>, + { + let _ = self.1.counter_vecs.lock().map(do_something).or_else(|error| Err(error)); + } + + fn with_histograms_lock_held(&self, do_something: F) + where + F: FnOnce(MutexGuard<'_, HashMap>) -> Result<(), PrometheusError>, + { + let _ = self.1.histograms.lock().map(do_something).or_else(|error| Err(error)); + } +} + +impl sc_tracing::TraceHandler for RuntimeMetricsProvider { + fn handle_span(&self, _span: &sc_tracing::SpanDatum) {} + fn handle_span(&self, _span: &sc_tracing::TraceEvent) { + if event + .values + .string_values + .get("target") + .unwrap_or(&String::default()) + .ne("metrics") + { + return + } + + if let Some(update_op_bs58) = event.values.string_values.get("params") { + match RuntimeMetricUpdate::decode( + &mut RuntimeMetricsProvider::parse_event_params(&update_op_bs58) + .unwrap_or_default() + .as_slice(), + ) { + Ok(update_op) => self.parse_metric_update(update_op), + Err(_) => {}, + } + } + } +} + +impl RuntimeMetricsProvider { + fn parse_metric_update(&self, update: RuntimeMetricUpdate) { + match update.op { + RuntimeMetricOp::IncrementCounterVec(value, ref labels) => + self.inc_counter_vec_by(update.metric_name(), value, labels), + RuntimeMetricOp::IncrementCounter(value) => + self.inc_counter_by(update.metric_name(), value), + RuntimeMetricOp::ObserveHistogram(value) => + self.observe_histogram(update.metric_name(), value), + } + } + + fn parse_event_params(event_params: &str) -> Option> { + let new_len = event_params.len().saturating_sub(2); + let event_params = &event_params[..new_len]; + + const SKIP_CHARS: &'static str = " { update_op: "; + if SKIP_CHARS.len() < event_params.len() { + if SKIP_CHARS.eq_ignore_ascii_case(&event_params[..SKIP_CHARS.len()]) { + bs58::decode(&event_params[SKIP_CHARS.len()..].as_bytes()) + .into_vec() + .ok() + } + } + None + } +} + +pub fn logger_hook() -> impl FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration) -> () { + |logger_builder, config| { + if config.prometheus_registry().is_none() { + return + } + + let registry = config.prometheus_registry().cloned().unwrap(); + let metrics_provider = RuntimeMetricsProvider::new(registry); + // TODO: register some extra metrics + logger_builder.with_custom_profiling(Box::new(metrics_provider)); + } +} diff --git a/metrics/src/tests.rs b/metrics/src/tests.rs new file mode 100644 index 0000000..8c6e78e --- /dev/null +++ b/metrics/src/tests.rs @@ -0,0 +1,66 @@ +use hyper::{Client, Uri}; +use ghost_test_service::{node_config, run_validator_node, test_prometheus_config}; +use keyring::AccountKeyring::*; +use std::collections::HashMap; + +const DEFAULT_PROMETHEUS_PORT: u16 = 9616; + +#[tokio::test(flavor = "multi_thread")] +async fn runtime_can_publish_metrics() { + let mut alice_config = + node_config(|| {}, tokio::runtime::Handle::current(), Alice, Vec::new(), true); + + // Enable prometheus metrics for Alice. + alice_config.prometheus_config = Some(test_prometheus_config(DEFAULT_PROMETHEUS_PORT)); + + let mut builder = sc_cli::LoggerBuilder::new(""); + + // Enable profiling with `wasm_tracing` target. + builder.with_profiling(Default::default(), String::from("wasm_tracing=trace")); + + // Setup the runtime metrics provider. + crate::logger_hook()(&mut builder, &alice_config); + + builder.init().expect("Failed to set up logger"); + + // Start validator Alice + let alice = run_validator_node(alice_config, None); + + let bob_config = + node_config(|| {}, tokio::runtime::Handle::current(), Bob, vec![alice.addr.clone()], true); + + // Start validator Bob + let _bob = run_validator_node(bob_config, None); + + // Wait for Alice to see finalized blocks. + alice.wait_for_finalized_blocks(2).await; + + let metrics_uri = format!("http://localhost:{}/metrics", DEFAULT_PROMETHEUS_PORT); + let metrics = scrape_prometheus_metrics(&metrics_uri).await; + + // TODO: which assert +} + +async fn scrape_prometheus_metrics(metrics_uri: &str) -> HashMap { + let res = Client::new() + .get(Uri::try_from(metrics_uri).expect("bad URI")) + .await + .expect("GET request failed"); + + let body = String::from_utf8( + hyper::body::to_bytes(res).await.expect("can't get body as bytes").to_vec(), + ).expect("body is not an UTF8 string"); + + let lines: Vec<_> = body.lines().map(|s| Ok(s.to_owned())).collect(); + prometheus_parse::Scrape::parse(lines.into_iter()) + .expect("Scraper failed to parse Prometheus metrics") + .samples + .into_iter() + .filter_map(|prometheus_parse::Sample { metric, value, .. }| match value { + prometheus_parse::Value::Counter(value) => Some((metric, value as u64)), + prometheus_parse::Value::Gauge(value) => Some((metric, value as u64)), + prometheus_parse::Value::Untyped(value) => Some((metric, value as u64)), + _ => None, + }) + .collect() +} diff --git a/pallets/claims/Cargo.toml b/pallets/claims/Cargo.toml new file mode 100644 index 0000000..2fcd180 --- /dev/null +++ b/pallets/claims/Cargo.toml @@ -0,0 +1,74 @@ +[package] +name = "ghost-claims" +version = "0.2.2" +description = "Ghost balance and rank claims based on EVM actions" +license.workspace = true +authors.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true + +[dependencies] +codec = { workspace = true, features = ["derive"] } +scale-info = { workspace = true, features = ["derive"] } +serde = { workspace = true } +serde_derive = { workspace = true } +rustc-hex = { workspace = true } +libsecp256k1 = { workspace = true, default-features = false } + +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } + +pallet-ranked-collective = { workspace = true } +pallet-vesting = { workspace = true } +pallet-balances = { workspace = true } + +sp-core = { features = ["serde"], workspace = true } +sp-runtime = { features = ["serde"], workspace = true } +sp-io = { workspace = true } +sp-std = { workspace = true } + +[dev-dependencies] +hex-literal = { workspace = true, default-features = true } +libsecp256k1 = { workspace = true, default-features = true } +serde_json = { workspace = true, default-features = true } + +[features] +default = ["std"] +std = [ + "frame-benchmarking?/std", + "serde/std", + "codec/std", + "scale-info/std", + "libsecp256k1/std", + "frame-support/std", + "frame-system/std", + "sp-core/std", + "sp-runtime/std", + "sp-io/std", + "sp-std/std", + "pallet-ranked-collective/std", + "pallet-vesting/std", + "pallet-balances/std", + "rustc-hex/std", +] +runtime-benchmarks = [ + "libsecp256k1/hmac", + "libsecp256k1/static-context", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-ranked-collective/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-ranked-collective/try-runtime", + "pallet-vesting/try-runtime", + "pallet-balances/try-runtime", + "sp-runtime/try-runtime", +] diff --git a/pallets/claims/src/benchmarking.rs b/pallets/claims/src/benchmarking.rs new file mode 100644 index 0000000..0ee7bb1 --- /dev/null +++ b/pallets/claims/src/benchmarking.rs @@ -0,0 +1,56 @@ +#![cfg(feature = "runtime-benchmarks")] + +use super::*; +use frame_benchmarking::v2::*; + +#[instance_benchmarks] +mod benchmarks { + use super::*; + use pallet_ranked_collective::Pallet as Club; + use frame_support::dispatch::RawOrigin; + + #[benchmark] + fn claim() { + let i = 1337u32; + let ethereum_secret_key = libsecp256k1::SecretKey::parse( + &keccak_256(&i.to_le_bytes())).unwrap(); + let eth_address = crate::secp_utils::eth(ðereum_secret_key); + + let balance = CurrencyOf::::minimum_balance(); + let pseudo_account: T::AccountId = Pallet::::into_account_id(eth_address).unwrap(); + let _ = CurrencyOf::::deposit_creating(&pseudo_account, balance); + Total::::put(balance); + + let pseudo_rank = 5u16; + let _ = Club::::do_add_member_to_rank( + pseudo_account.clone(), + pseudo_rank, + false, + ); + + let user_account: T::AccountId = account("user", i, 0); + let signature = crate::secp_utils::sig::(ðereum_secret_key, &user_account.encode()); + + let prev_balance = CurrencyOf::::free_balance(&user_account); + let prev_rank = Club::::rank_of(&user_account); + + #[extrinsic_call] + claim(RawOrigin::Signed(user_account.clone()), eth_address, signature); + + assert_eq!(CurrencyOf::::free_balance(&user_account), prev_balance + balance); + assert_eq!(CurrencyOf::::free_balance(&pseudo_account), balance - balance); + + let rank = match prev_rank { + Some(current_rank) if pseudo_rank <= current_rank => Some(current_rank), + _ => Some(pseudo_rank), + }; + assert_eq!(Club::::rank_of(&user_account), rank); + assert_eq!(Club::::rank_of(&pseudo_account), None); + } + + impl_benchmark_test_suite!( + Pallet, + crate::mock::new_test_ext(), + crate::mock::Test, + ); +} diff --git a/pallets/claims/src/lib.rs b/pallets/claims/src/lib.rs new file mode 100644 index 0000000..4fcd4e3 --- /dev/null +++ b/pallets/claims/src/lib.rs @@ -0,0 +1,313 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +use frame_support::{ + ensure, pallet_prelude::*, + traits::{ + Currency, ExistenceRequirement, Get, RankedMembers, + RankedMembersSwapHandler, VestingSchedule, + }, + DefaultNoBound, +}; +use frame_system::pallet_prelude::*; +use serde::{self, Deserialize, Deserializer, Serialize, Serializer}; +pub use pallet::*; + +use sp_io::{crypto::secp256k1_ecdsa_recover, hashing::keccak_256}; +use sp_runtime::traits::{CheckedSub, CheckedDiv, BlockNumberProvider}; +use sp_std::prelude::*; + +extern crate alloc; +#[cfg(not(feature = "std"))] +use alloc::{format, string::String}; + +pub mod weights; +pub use crate::weights::WeightInfo; +mod tests; +mod mock; +mod benchmarking; +mod secp_utils; + +/// An ethereum address (i.e. 20 bytes, used to represent an Ethereum account). +/// +/// This gets serialized to the 0x-prefixed hex representation. +#[derive(Clone, Copy, PartialEq, Eq, Encode, Decode, Default, RuntimeDebug, TypeInfo)] +pub struct EthereumAddress(pub [u8; 20]); + +impl Serialize for EthereumAddress { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + let hex: String = rustc_hex::ToHex::to_hex(&self.0[..]); + serializer.serialize_str(&format!("0x{}", hex)) + } +} + +impl<'de> Deserialize<'de> for EthereumAddress { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let base_string = String::deserialize(deserializer)?; + let offset = if base_string.starts_with("0x") { 2 } else { 0 }; + let s = &base_string[offset..]; + if s.len() != 40 { + Err(serde::de::Error::custom( + "Bad length of Ethereum address (should be 42 including `0x`)", + ))?; + } + let raw: Vec = rustc_hex::FromHex::from_hex(s) + .map_err(|e| serde::de::Error::custom(format!("{:?}", e)))?; + let mut r = Self::default(); + r.0.copy_from_slice(&raw); + Ok(r) + } +} + +#[derive(Encode, Decode, Clone, TypeInfo)] +pub struct EcdsaSignature(pub [u8; 65]); + +impl PartialEq for EcdsaSignature { + fn eq(&self, other: &Self) -> bool { + &self.0[..] == &other.0[..] + } +} + +impl sp_std::fmt::Debug for EcdsaSignature { + fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result { + write!(f, "EcdsaSignature({:?})", &self.0[..]) + } +} + +type CurrencyOf = <>::VestingSchedule as VestingSchedule< + ::AccountId +>>::Currency; + +type BalanceOf = as Currency< + ::AccountId> +>::Balance; + +type RankOf = as RankedMembers>::Rank; +type AccountIdOf = as RankedMembers>::AccountId; + +#[frame_support::pallet] +pub mod pallet { + use super::*; + + #[pallet::pallet] + #[pallet::without_storage_info] + pub struct Pallet(_); + + #[pallet::config] + pub trait Config: frame_system::Config + pallet_ranked_collective::Config { + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + + type VestingSchedule: VestingSchedule>; + type BlockNumberProvider: BlockNumberProvider>; + type MemberSwappedHandler: RankedMembersSwapHandler, RankOf>; + + #[pallet::constant] + type Prefix: Get<&'static [u8]>; + + #[pallet::constant] + type MaximumWithdrawAmount: Get>; + + #[pallet::constant] + type VestingBlocks: Get; + + type WeightInfo: WeightInfo; + } + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event, I: 'static = ()> { + Claimed { + receiver: T::AccountId, + donor: T::AccountId, + amount: BalanceOf, + rank: Option>, + }, + } + + #[pallet::error] + pub enum Error { + InvalidEthereumSignature, + InvalidEthereumAddress, + NoBalanceToClaim, + AddressDecodingFailed, + ArithmeticError, + PotUnderflow, + } + + #[pallet::storage] + pub type Total, I: 'static = ()> = StorageValue<_, BalanceOf, ValueQuery>; + + #[pallet::genesis_config] + #[derive(DefaultNoBound)] + pub struct GenesisConfig, I: 'static = ()> { + pub total: BalanceOf, + pub members_and_ranks: Vec<(T::AccountId, u16)>, + } + + #[pallet::genesis_build] + impl, I: 'static> BuildGenesisConfig for GenesisConfig { + fn build(&self) { + let cult_accounts: Vec<_> = self + .members_and_ranks + .iter() + .map(|(account_id, rank)| { + assert!( + pallet_ranked_collective::Pallet::::do_add_member_to_rank( + account_id.clone(), *rank, false).is_ok(), + "error during adding and promotion" + ); + account_id + }) + .collect(); + + assert!( + self.members_and_ranks.len() == cult_accounts.len(), + "duplicates in `members_and_ranks`" + ); + + Total::::put(self.total); + } + } + + #[pallet::call] + impl, I: 'static> Pallet { + #[pallet::call_index(0)] + #[pallet::weight(>::WeightInfo::claim())] + pub fn claim( + origin: OriginFor, + ethereum_address: EthereumAddress, + ethereum_signature: EcdsaSignature, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + let data = who.using_encoded(to_ascii_hex); + let recovered_address = Self::recover_ethereum_address( + ðereum_signature, + &data, + ).ok_or(Error::::InvalidEthereumSignature)?; + + ensure!(recovered_address == ethereum_address, + Error::::InvalidEthereumAddress); + + Self::do_claim(who, ethereum_address) + } + } +} + +fn to_ascii_hex(data: &[u8]) -> Vec { + let mut r = Vec::with_capacity(data.len() * 2); + let mut push_nibble = |n| r.push(if n < 10 { b'0' + n } else { b'a' - 10 + n }); + for &b in data.iter() { + push_nibble(b / 16); + push_nibble(b % 16); + } + r +} + +impl, I: 'static> Pallet { + fn ethereum_signable_message(what: &[u8]) -> Vec { + let prefix = T::Prefix::get(); + let mut l = prefix.len() + what.len(); + let mut rev = Vec::new(); + while l > 0 { + rev.push(b'0' + (l % 10) as u8); + l /= 10; + } + let mut v = b"\x19Ethereum Signed Message:\n".to_vec(); + v.extend(rev.into_iter().rev()); + v.extend_from_slice(prefix); + v.extend_from_slice(what); + v + } + + fn recover_ethereum_address(s: &EcdsaSignature, what: &[u8]) -> Option { + let msg = keccak_256(&Self::ethereum_signable_message(what)); + let mut res = EthereumAddress::default(); + res.0 + .copy_from_slice(&keccak_256(&secp256k1_ecdsa_recover(&s.0, &msg).ok()?[..])[12..]); + Some(res) + } + + fn into_account_id(address: EthereumAddress) -> Result { + let mut data = [0u8; 32]; + data[0..4].copy_from_slice(b"evm:"); + data[4..24].copy_from_slice(&address.0[..]); + + let hash = sp_core::keccak_256(&data); + T::AccountId::decode(&mut &hash[..]) + } + + fn do_claim(receiver: T::AccountId, ethereum_address: EthereumAddress) -> DispatchResult { + let donor = Self::into_account_id(ethereum_address).ok() + .ok_or(Error::::AddressDecodingFailed)?; + + let balance_due = CurrencyOf::::free_balance(&donor); + ensure!(balance_due >= CurrencyOf::::minimum_balance(), + Error::::NoBalanceToClaim); + + let new_total = Total::::get() + .checked_sub(&balance_due) + .ok_or(Error::::PotUnderflow)?; + + CurrencyOf::::transfer( + &donor, + &receiver, + balance_due, + ExistenceRequirement::AllowDeath, + )?; + + let max_amount = T::MaximumWithdrawAmount::get(); + if balance_due > max_amount { + let vesting_balance = balance_due + .checked_sub(&max_amount) + .ok_or(Error::::ArithmeticError)?; + + let vesting_blocks = T::VestingBlocks::get(); + let per_block_balance = vesting_balance + .checked_div(&vesting_blocks.into()) + .ok_or(Error::::ArithmeticError)?; + + T::VestingSchedule::add_vesting_schedule( + &receiver, + vesting_balance, + per_block_balance, + T::BlockNumberProvider::current_block_number(), + )?; + } + + let rank = if let Some(rank) = as RankedMembers>::rank_of(&donor) { + pallet_ranked_collective::Pallet::::do_remove_member_from_rank(&donor, rank)?; + let new_rank = match as RankedMembers>::rank_of(&receiver) { + Some(current_rank) if current_rank >= rank => current_rank, + Some(current_rank) if current_rank < rank => { + for _ in 0..rank - current_rank { + pallet_ranked_collective::Pallet::::do_promote_member(receiver.clone(), None, false)?; + } + rank + }, + _ => { + pallet_ranked_collective::Pallet::::do_add_member_to_rank(receiver.clone(), rank, false)?; + rank + }, + }; + >::MemberSwappedHandler::swapped(&donor, &receiver, new_rank); + Some(new_rank) + } else { + None + }; + + Total::::put(new_total); + Self::deposit_event(Event::::Claimed { + receiver, + donor, + amount: balance_due, + rank, + }); + + Ok(()) + } +} diff --git a/pallets/claims/src/mock.rs b/pallets/claims/src/mock.rs new file mode 100644 index 0000000..c61fe56 --- /dev/null +++ b/pallets/claims/src/mock.rs @@ -0,0 +1,221 @@ +#![cfg(test)] + +use super::*; + +pub use crate as ghost_claims; +use frame_support::{ + parameter_types, derive_impl, + traits::{PollStatus, Polling, WithdrawReasons, ConstU16, ConstU64}, +}; +use frame_system::EnsureRootWithSuccess; +use sp_runtime::{BuildStorage, traits::Convert}; +pub use pallet_ranked_collective::{TallyOf, Rank}; + +pub mod eth_keys { + use crate::{ + mock::Test, + EcdsaSignature, EthereumAddress, + }; + use hex_literal::hex; + use codec::Encode; + + pub fn total_claims() -> u64 { 10 + 100 + 1000 } + pub fn alice_account_id() -> ::AccountId { 69 } + pub fn bob_account_id() -> ::AccountId { 1337 } + + pub fn first_eth_public_known() -> EthereumAddress { EthereumAddress(hex!("1A69d2D5568D1878023EeB121a73d33B9116A760")) } + pub fn second_eth_public_known() -> EthereumAddress { EthereumAddress(hex!("2f86cfBED3fbc1eCf2989B9aE5fc019a837A9C12")) } + pub fn third_eth_public_known() -> EthereumAddress { EthereumAddress(hex!("e83f67361Ac74D42A48E2DAfb6706eb047D8218D")) } + pub fn fourth_eth_public_known() -> EthereumAddress { EthereumAddress(hex!("827ee4ad9b259b6fa1390ed60921508c78befd63")) } + + fn first_eth_private_key() -> libsecp256k1::SecretKey { libsecp256k1::SecretKey::parse(&hex!("01c928771aea942a1e7ac06adf2b73dfbc9a25d9eaa516e3673116af7f345198")).unwrap() } + fn second_eth_private_key() -> libsecp256k1::SecretKey { libsecp256k1::SecretKey::parse(&hex!("b19a435901872f817185f7234a1484eae837613f9d10cf21927a23c2d8cb9139")).unwrap() } + fn third_eth_private_key() -> libsecp256k1::SecretKey { libsecp256k1::SecretKey::parse(&hex!("d3baf57b74d65719b2dc33f5a464176022d0cc5edbca002234229f3e733875fc")).unwrap() } + fn fourth_eth_private_key() -> libsecp256k1::SecretKey { libsecp256k1::SecretKey::parse(&hex!("c4683d566436af6b58b4a59c8f501319226e85b21869bf93d5eeb4596d4791d4")).unwrap() } + fn wrong_eth_private_key() -> libsecp256k1::SecretKey { libsecp256k1::SecretKey::parse(&hex!("deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef")).unwrap() } + + pub fn first_eth_public_key() -> EthereumAddress { crate::secp_utils::eth(&first_eth_private_key()) } + pub fn second_eth_public_key() -> EthereumAddress { crate::secp_utils::eth(&second_eth_private_key()) } + pub fn third_eth_public_key() -> EthereumAddress { crate::secp_utils::eth(&third_eth_private_key()) } + pub fn fourth_eth_public_key() -> EthereumAddress { crate::secp_utils::eth(&fourth_eth_private_key()) } + + pub fn first_account_id() -> ::AccountId { crate::secp_utils::into_account_id::(first_eth_public_key()) } + pub fn second_account_id() -> ::AccountId { crate::secp_utils::into_account_id::(second_eth_public_key()) } + pub fn third_account_id() -> ::AccountId { crate::secp_utils::into_account_id::(third_eth_public_key()) } + pub fn fourth_account_id() -> ::AccountId { crate::secp_utils::into_account_id::(fourth_eth_public_key()) } + + pub fn first_signature() -> EcdsaSignature { crate::secp_utils::sig::(&first_eth_private_key(), &alice_account_id().encode()) } + pub fn second_signature() -> EcdsaSignature { crate::secp_utils::sig::(&second_eth_private_key(), &alice_account_id().encode()) } + pub fn third_signature() -> EcdsaSignature { crate::secp_utils::sig::(&third_eth_private_key(), &alice_account_id().encode()) } + pub fn fourth_signature() -> EcdsaSignature { crate::secp_utils::sig::(&fourth_eth_private_key(), &bob_account_id().encode()) } + pub fn wrong_signature() -> EcdsaSignature { crate::secp_utils::sig::(&wrong_eth_private_key(), &alice_account_id().encode()) } +} + +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] +impl frame_system::Config for Test { + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type Block = Block; + type RuntimeEvent = RuntimeEvent; + type AccountData = pallet_balances::AccountData; + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)] +impl pallet_balances::Config for Test { + type AccountStore = System; +} + + +parameter_types! { + pub const MinVestedTransfer: u64 = 1; + pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = + WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); +} + +impl pallet_vesting::Config for Test { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type BlockNumberToBalance = sp_runtime::traits::ConvertInto; + type MinVestedTransfer = MinVestedTransfer; + type WeightInfo = (); + type UnvestedFundsAllowedWithdrawReasons = + UnvestedFundsAllowedWithdrawReasons; + + type BlockNumberProvider = System; + const MAX_VESTING_SCHEDULES: u32 = 28; +} + +parameter_types! { + pub MinRankOfClassDelta: Rank = 1; +} + +pub struct MinRankOfClass(sp_std::marker::PhantomData); +impl> Convert for MinRankOfClass { + fn convert(a: Class) -> Rank { + a.saturating_sub(Delta::get()) + } +} + +pub struct TestPolls; +impl Polling> for TestPolls { + type Index = u8; + type Votes = u32; + type Moment = u64; + type Class = Class; + + fn classes() -> Vec { + unimplemented!() + } + + fn as_ongoing(_index: u8) -> Option<(TallyOf, Self::Class)> { + unimplemented!() + } + + fn access_poll( + _index: Self::Index, + _f: impl FnOnce(PollStatus<&mut TallyOf, Self::Moment, Self::Class>) -> R, + ) -> R { + unimplemented!() + } + + fn try_access_poll( + _index: Self::Index, + _f: impl FnOnce( + PollStatus<&mut TallyOf, Self::Moment, Self::Class>, + ) -> Result, + ) -> Result { + unimplemented!() + } + + #[cfg(feature = "runtime-benchmarks")] + fn create_ongoing(_class: Self::Class) -> Result { + unimplemented!() + } + + #[cfg(feature = "runtime-benchmarks")] + fn end_ongoing(_index: Self::Index, _approved: bool) -> Result<(), ()> { + unimplemented!() + } +} + +impl pallet_ranked_collective::Config for Test { + type WeightInfo = (); + type RuntimeEvent = RuntimeEvent; + + type AddOrigin = EnsureRootWithSuccess>; + type RemoveOrigin = EnsureRootWithSuccess>; + type PromoteOrigin = EnsureRootWithSuccess>; + type DemoteOrigin = EnsureRootWithSuccess>; + type ExchangeOrigin = EnsureRootWithSuccess>; + + type Polls = TestPolls; + type MemberSwappedHandler = (); + type MinRankOfClass = MinRankOfClass; + type VoteWeight = pallet_ranked_collective::Geometric; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkSetup = (); +} + +parameter_types! { + pub Prefix: &'static [u8] = b"AccountId:"; +} + +impl Config for Test { + type RuntimeEvent = RuntimeEvent; + type VestingSchedule = Vesting; + type BlockNumberProvider = System; + type MemberSwappedHandler = (); + + type Prefix = Prefix; + type MaximumWithdrawAmount = ConstU64<200>; + type VestingBlocks = ConstU32<80>; + + type WeightInfo = (); +} + +type Block = frame_system::mocking::MockBlock; +type Class = Rank; + +frame_support::construct_runtime!( + pub enum Test + { + System: frame_system, + Balances: pallet_balances, + Vesting: pallet_vesting, + Club: pallet_ranked_collective, + Claims: ghost_claims, + } +); + +pub fn new_test_ext() -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::::default() + .build_storage() + .unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![ + (crate::mock::eth_keys::first_account_id(), 10), + (crate::mock::eth_keys::second_account_id(), 100), + (crate::mock::eth_keys::third_account_id(), 1000), + ], + } + .assimilate_storage(&mut t) + .unwrap(); + + ghost_claims::GenesisConfig:: { + total: crate::mock::eth_keys::total_claims(), + members_and_ranks: vec![ + (crate::mock::eth_keys::second_account_id(), 1), + (crate::mock::eth_keys::third_account_id(), 3), + ], + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| { + System::set_block_number(1); + }); + ext +} diff --git a/pallets/claims/src/secp_utils.rs b/pallets/claims/src/secp_utils.rs new file mode 100644 index 0000000..0449f1e --- /dev/null +++ b/pallets/claims/src/secp_utils.rs @@ -0,0 +1,37 @@ +#![cfg(any(test, feature = "runtime-benchmarks"))] + +use crate::{keccak_256, Config, EcdsaSignature, EthereumAddress}; + +pub fn public(secret: &libsecp256k1::SecretKey) -> libsecp256k1::PublicKey { + libsecp256k1::PublicKey::from_secret_key(secret) +} + +pub fn eth(secret: &libsecp256k1::SecretKey) -> EthereumAddress { + let mut res = EthereumAddress::default(); + res.0.copy_from_slice(&keccak_256(&public(secret).serialize()[1..65])[12..]); + res +} + +#[cfg(test)] +pub fn into_account_id, I: 'static>(address: EthereumAddress) -> T::AccountId { + super::Pallet::::into_account_id(address).unwrap() +} + +pub fn sig, I: 'static>( + secret: &libsecp256k1::SecretKey, + what: &[u8], +) -> EcdsaSignature { + let msg = keccak_256(&super::Pallet::::ethereum_signable_message( + &crate::to_ascii_hex(what)[..], + )); + + let (sig, recovery_id) = libsecp256k1::sign( + &libsecp256k1::Message::parse(&msg), + secret, + ); + + let mut r = [0u8; 65]; + r[0..64].copy_from_slice(&sig.serialize()[..]); + r[64] = recovery_id.serialize(); + EcdsaSignature(r) +} diff --git a/pallets/claims/src/tests.rs b/pallets/claims/src/tests.rs new file mode 100644 index 0000000..d71e98a --- /dev/null +++ b/pallets/claims/src/tests.rs @@ -0,0 +1,274 @@ +#![cfg(test)] + +use mock::{ + new_test_ext, ghost_claims, + Test, System, Balances, Club, Vesting, Claims, RuntimeOrigin, RuntimeEvent, + eth_keys::{ + alice_account_id, total_claims, first_eth_public_known, + first_eth_public_key, first_account_id, first_signature, + second_eth_public_known, second_eth_public_key, second_account_id, + second_signature, third_eth_public_known, third_eth_public_key, + third_account_id, third_signature, fourth_eth_public_known, + fourth_eth_public_key, fourth_account_id, fourth_signature, + wrong_signature, bob_account_id, + } +}; +use hex_literal::hex; +use frame_support::{assert_err, assert_ok}; +use super::*; + +#[test] +fn serde_works() { + let x = EthereumAddress(hex!["0123456789abcdef0123456789abcdef01234567"]); + let y = serde_json::to_string(&x).unwrap(); + assert_eq!(y, "\"0x0123456789abcdef0123456789abcdef01234567\""); + let z: EthereumAddress = serde_json::from_str(&y).unwrap(); + assert_eq!(x, z); +} + +#[test] +fn known_eth_public_accounts_are_correct() { + assert_eq!(first_eth_public_key(), first_eth_public_known()); + assert_eq!(second_eth_public_key(), second_eth_public_known()); + assert_eq!(third_eth_public_key(), third_eth_public_known()); + assert_eq!(fourth_eth_public_key(), fourth_eth_public_known()); +} + +#[test] +fn basic_setup_works() { + new_test_ext().execute_with(|| { + assert_eq!(Balances::usable_balance(&alice_account_id()), 0); + assert_eq!(Balances::usable_balance(&first_account_id()), 10); + assert_eq!(Balances::usable_balance(&second_account_id()), 100); + assert_eq!(Balances::usable_balance(&third_account_id()), 1000); + + assert_eq!(Club::rank_of(&alice_account_id()), None); + assert_eq!(Club::rank_of(&first_account_id()), None); + assert_eq!(Club::rank_of(&second_account_id()), Some(1)); + assert_eq!(Club::rank_of(&third_account_id()), Some(3)); + + assert_eq!(Vesting::vesting_balance(&alice_account_id()), None); + assert_eq!(ghost_claims::Total::::get(), total_claims()); + }); +} + +#[test] +fn small_claiming_works() { + new_test_ext().execute_with(|| { + assert_ok!(Claims::claim( + RuntimeOrigin::signed(alice_account_id()), + first_eth_public_key(), + first_signature())); + + assert_eq!(Balances::usable_balance(&alice_account_id()), 10); + assert_eq!(Balances::usable_balance(&first_account_id()), 0); + assert_eq!(Balances::usable_balance(&second_account_id()), 100); + assert_eq!(Balances::usable_balance(&third_account_id()), 1000); + + assert_eq!(Club::rank_of(&alice_account_id()), None); + assert_eq!(Club::rank_of(&first_account_id()), None); + + assert_eq!(Vesting::vesting_balance(&alice_account_id()), None); + assert_eq!(ghost_claims::Total::::get(), total_claims() - 10); + }) +} + +#[test] +fn medium_claiming_works() { + new_test_ext().execute_with(|| { + assert_ok!(Claims::claim( + RuntimeOrigin::signed(alice_account_id()), + second_eth_public_key(), + second_signature(), + )); + + assert_eq!(Balances::usable_balance(&alice_account_id()), 100); + assert_eq!(Balances::usable_balance(&first_account_id()), 10); + assert_eq!(Balances::usable_balance(&second_account_id()), 0); + assert_eq!(Balances::usable_balance(&third_account_id()), 1000); + + assert_eq!(Club::rank_of(&alice_account_id()), Some(1)); + assert_eq!(Club::rank_of(&second_account_id()), None); + + assert_eq!(Vesting::vesting_balance(&alice_account_id()), None); + assert_eq!(ghost_claims::Total::::get(), total_claims() - 100); + }) +} + +#[test] +fn big_claiming_works() { + new_test_ext().execute_with(|| { + assert_ok!(Claims::claim( + RuntimeOrigin::signed(alice_account_id()), + third_eth_public_key(), + third_signature(), + )); + + assert_eq!(Balances::usable_balance(&alice_account_id()), 200); + assert_eq!(Balances::usable_balance(&first_account_id()), 10); + assert_eq!(Balances::usable_balance(&second_account_id()), 100); + assert_eq!(Balances::usable_balance(&third_account_id()), 0); + + assert_eq!(Club::rank_of(&alice_account_id()), Some(3)); + assert_eq!(Club::rank_of(&third_account_id()), None); + + assert_eq!(Vesting::vesting_balance(&alice_account_id()), Some(800)); + assert_eq!(ghost_claims::Total::::get(), total_claims() - 1000); + assert_ok!(Balances::transfer_allow_death( + RuntimeOrigin::signed(alice_account_id()), + bob_account_id(), + 200)); + }) +} + +#[test] +fn multiple_accounts_claiming_works() { + new_test_ext().execute_with(|| { + assert_ok!(Claims::claim( + RuntimeOrigin::signed(alice_account_id()), + first_eth_public_key(), + first_signature(), + )); + assert_ok!(Claims::claim( + RuntimeOrigin::signed(alice_account_id()), + second_eth_public_key(), + second_signature(), + )); + assert_ok!(Claims::claim( + RuntimeOrigin::signed(alice_account_id()), + third_eth_public_key(), + third_signature(), + )); + + assert_eq!(Balances::usable_balance(&alice_account_id()), 310); + assert_eq!(Balances::usable_balance(&first_account_id()), 0); + assert_eq!(Balances::usable_balance(&second_account_id()), 0); + assert_eq!(Balances::usable_balance(&third_account_id()), 0); + + assert_eq!(Club::rank_of(&alice_account_id()), Some(3)); + assert_eq!(Club::rank_of(&third_account_id()), None); + + assert_eq!(Vesting::vesting_balance(&alice_account_id()), Some(800)); + assert_eq!(ghost_claims::Total::::get(), 0); + }) +} + +#[test] +fn multiple_accounts_reverese_claiming_works() { + new_test_ext().execute_with(|| { + assert_ok!(Claims::claim( + RuntimeOrigin::signed(alice_account_id()), + third_eth_public_key(), + third_signature(), + )); + assert_ok!(Claims::claim( + RuntimeOrigin::signed(alice_account_id()), + second_eth_public_key(), + second_signature(), + )); + assert_ok!(Claims::claim( + RuntimeOrigin::signed(alice_account_id()), + first_eth_public_key(), + first_signature(), + )); + + assert_eq!(Balances::usable_balance(&alice_account_id()), 310); + assert_eq!(Balances::usable_balance(&first_account_id()), 0); + assert_eq!(Balances::usable_balance(&second_account_id()), 0); + assert_eq!(Balances::usable_balance(&third_account_id()), 0); + + assert_eq!(Club::rank_of(&alice_account_id()), Some(3)); + assert_eq!(Club::rank_of(&third_account_id()), None); + + assert_eq!(Vesting::vesting_balance(&alice_account_id()), Some(800)); + assert_eq!(ghost_claims::Total::::get(), 0); + }) +} + +#[test] +fn cannot_claim_with_bad_signature() { + new_test_ext().execute_with(|| { + assert_err!(Claims::claim( + RuntimeOrigin::signed(alice_account_id()), + first_eth_public_key(), + wrong_signature()), + crate::Error::::InvalidEthereumAddress); + + assert_eq!(Balances::usable_balance(&alice_account_id()), 0); + assert_eq!(Balances::usable_balance(&first_account_id()), 10); + assert_eq!(Balances::usable_balance(&second_account_id()), 100); + assert_eq!(Balances::usable_balance(&third_account_id()), 1000); + + assert_eq!(Club::rank_of(&alice_account_id()), None); + assert_eq!(Club::rank_of(&first_account_id()), None); + assert_eq!(Club::rank_of(&second_account_id()), Some(1)); + assert_eq!(Club::rank_of(&third_account_id()), Some(3)); + + assert_eq!(Vesting::vesting_balance(&alice_account_id()), None); + assert_eq!(ghost_claims::Total::::get(), total_claims()); + }) +} + +#[test] +fn cannot_claim_with_wrong_address() { + new_test_ext().execute_with(|| { + assert_err!(Claims::claim( + RuntimeOrigin::signed(bob_account_id()), + first_eth_public_key(), + first_signature()), + crate::Error::::InvalidEthereumAddress); + + assert_eq!(Balances::usable_balance(&bob_account_id()), 0); + assert_eq!(Balances::usable_balance(&alice_account_id()), 0); + assert_eq!(Balances::usable_balance(&first_account_id()), 10); + assert_eq!(Balances::usable_balance(&second_account_id()), 100); + assert_eq!(Balances::usable_balance(&third_account_id()), 1000); + + assert_eq!(Club::rank_of(&alice_account_id()), None); + assert_eq!(Club::rank_of(&first_account_id()), None); + assert_eq!(Club::rank_of(&second_account_id()), Some(1)); + assert_eq!(Club::rank_of(&third_account_id()), Some(3)); + + assert_eq!(Vesting::vesting_balance(&alice_account_id()), None); + assert_eq!(ghost_claims::Total::::get(), total_claims()); + }) +} + +#[test] +fn cannot_claim_nothing() { + new_test_ext().execute_with(|| { + assert_err!(Claims::claim( + RuntimeOrigin::signed(bob_account_id()), + fourth_eth_public_key(), + fourth_signature()), + crate::Error::::NoBalanceToClaim); + assert_eq!(Balances::usable_balance(&bob_account_id()), 0); + assert_eq!(Balances::usable_balance(&fourth_account_id()), 0); + assert_eq!(Vesting::vesting_balance(&bob_account_id()), None); + assert_eq!(ghost_claims::Total::::get(), total_claims()); + }) +} + +#[test] +fn event_emitted_during_claim() { + new_test_ext().execute_with(|| { + let account = third_account_id(); + let amount = Balances::usable_balance(&account); + let rank = Club::rank_of(&account); + + System::reset_events(); + assert_eq!(System::event_count(), 0); + assert_ok!(Claims::claim( + RuntimeOrigin::signed(alice_account_id()), + third_eth_public_key(), + third_signature(), + )); + System::assert_has_event(RuntimeEvent::Claims( + crate::Event::Claimed { + receiver: alice_account_id(), + donor: account, + amount, + rank, + })); + }) +} diff --git a/pallets/claims/src/weights.rs b/pallets/claims/src/weights.rs new file mode 100644 index 0000000..c4746d2 --- /dev/null +++ b/pallets/claims/src/weights.rs @@ -0,0 +1,9 @@ +use frame_support::weights::Weight; + +pub trait WeightInfo { + fn claim() -> Weight; +} + +impl WeightInfo for () { + fn claim() -> Weight { Weight::zero() } +} diff --git a/pallets/networks/Cargo.toml b/pallets/networks/Cargo.toml new file mode 100755 index 0000000..3f97642 --- /dev/null +++ b/pallets/networks/Cargo.toml @@ -0,0 +1,49 @@ +[package] +name = "ghost-networks" +license.workspace = true +authors.workspace = true +version.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true + +[dependencies] +scale-info = { workspace = true, features = ["derive"] } +codec = { workspace = true, features = ["max-encoded-len"] } + +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } +ghost-traits = { workspace = true } + +[dev-dependencies] +primitives = { workspace = true } +pallet-balances = { workspace = true } +sp-io = { workspace = true } + +[features] +default = ["std"] +std = [ + "scale-info/std", + "codec/std", + "frame-support/std", + "frame-system/std", + "frame-benchmarking?/std", + "sp-runtime/std", + "sp-std/std", + "sp-io/std", + "ghost-traits/std", + "pallet-balances/std", +] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", +] diff --git a/pallets/networks/src/benchmarking.rs b/pallets/networks/src/benchmarking.rs new file mode 100755 index 0000000..1906826 --- /dev/null +++ b/pallets/networks/src/benchmarking.rs @@ -0,0 +1,222 @@ +#![cfg(feature = "runtime-benchmarks")] + +use super::*; + +use crate::Pallet as GhostNetworks; +use frame_benchmarking::v1::{benchmarks, BenchmarkError}; +use sp_runtime::Saturating; + +const MAX_NAME_LEN: u32 = 20; +const MAX_ENDPOINT_LEN: u32 = 150; + +fn assert_last_event(generic_event: ::RuntimeEvent) { + frame_system::Pallet::::assert_last_event(generic_event.into()); +} + +fn prepare_network( + n: u32, m: u32, +) -> (::NetworkId, NetworkData) { + let chain_id: ::NetworkId = Default::default(); + let chain_id = chain_id.saturating_add((n + m).into()); + + let mut gatekeeper = b"0x".to_vec(); + for i in 0..40 { gatekeeper.push(i); } + + let mut topic_name = b"0x".to_vec(); + for i in 0..64 { topic_name.push(i); } + + let network = NetworkData { + chain_name: sp_std::vec![0x69; n as usize], + default_endpoint: sp_std::vec![0x69; m as usize], + gatekeeper, + topic_name, + finality_delay: Some(69), + release_delay: Some(69), + network_type: NetworkType::Evm, + incoming_fee: 0, + outgoing_fee: 0, + }; + + (chain_id, network) +} + +fn create_network( + chain_id: ::NetworkId, + network: NetworkData, +) -> Result, BenchmarkError> { + let prev_network = match GhostNetworks::::get(&chain_id) { + Some(net) => net, + None => { + let authority = T::RegisterOrigin::try_successful_origin() + .map_err(|_| BenchmarkError::Weightless)?; + GhostNetworks::::register_network( + authority.clone(), chain_id.clone(), network.clone() + ).map_err(|_| BenchmarkError::Weightless)?; + network + } + }; + + Ok(Some(prev_network)) +} + +benchmarks! { + register_network { + let i in 1 .. MAX_NAME_LEN; + let j in 1 .. MAX_ENDPOINT_LEN; + + let (chain_id, network) = prepare_network::(i, j); + let authority = T::RegisterOrigin::try_successful_origin() + .map_err(|_| BenchmarkError::Weightless)?; + let prev_network = GhostNetworks::::networks(chain_id.clone()); + }: _(authority, chain_id.clone(), network.clone()) + verify { + assert_last_event::(Event::NetworkRegistered { + chain_id: chain_id.clone(), network, + }.into()); + assert_ne!(GhostNetworks::::networks(chain_id.clone()), prev_network); + } + + update_network_name { + let n in 1 .. MAX_NAME_LEN; + let name = sp_std::vec![0x42; n as usize]; + let (chain_id, network) = prepare_network::(1, 1); + let authority = T::UpdateOrigin::try_successful_origin() + .map_err(|_| BenchmarkError::Weightless)?; + let prev_network = create_network::(chain_id.clone(), network.clone())?; + }: _(authority, chain_id.clone(), name.clone()) + verify { + assert_last_event::(Event::NetworkNameUpdated { + chain_id: chain_id.clone(), chain_name: name, + }.into()); + assert_ne!(GhostNetworks::::networks(chain_id.clone()), prev_network); + } + + update_network_endpoint { + let n in 1 .. MAX_ENDPOINT_LEN; + let endpoint = sp_std::vec![0x42; n as usize]; + let (chain_id, network) = prepare_network::(1, 1); + let authority = T::UpdateOrigin::try_successful_origin() + .map_err(|_| BenchmarkError::Weightless)?; + let prev_network = create_network::(chain_id.clone(), network.clone())?; + }: _(authority, chain_id.clone(), endpoint.clone()) + verify { + assert_last_event::(Event::NetworkEndpointUpdated { + chain_id: chain_id.clone(), default_endpoint: endpoint, + }.into()); + assert_ne!(GhostNetworks::::networks(chain_id.clone()), prev_network); + } + + update_network_finality_delay { + let delay = Some(1337); + let (chain_id, network) = prepare_network::(1, 1); + let authority = T::UpdateOrigin::try_successful_origin() + .map_err(|_| BenchmarkError::Weightless)?; + let prev_network = create_network::(chain_id.clone(), network.clone())?; + }: _(authority, chain_id.clone(), delay) + verify { + assert_last_event::(Event::NetworkFinalityDelayUpdated { + chain_id: chain_id.clone(), finality_delay: delay, + }.into()); + assert_ne!(GhostNetworks::::networks(chain_id.clone()), prev_network); + } + + update_network_release_delay { + let delay = Some(1337); + let (chain_id, network) = prepare_network::(1, 1); + let authority = T::UpdateOrigin::try_successful_origin() + .map_err(|_| BenchmarkError::Weightless)?; + let prev_network = create_network::(chain_id.clone(), network.clone())?; + }: _(authority, chain_id.clone(), delay) + verify { + assert_last_event::(Event::NetworkReleaseDelayUpdated { + chain_id: chain_id.clone(), release_delay: delay, + }.into()); + assert_ne!(GhostNetworks::::networks(chain_id.clone()), prev_network); + } + + update_network_type { + let network_type = NetworkType::Utxo; + let (chain_id, network) = prepare_network::(1, 1); + let authority = T::UpdateOrigin::try_successful_origin() + .map_err(|_| BenchmarkError::Weightless)?; + let prev_network = create_network::(chain_id.clone(), network.clone())?; + }: _(authority, chain_id.clone(), network_type.clone()) + verify { + assert_last_event::(Event::NetworkTypeUpdated { + chain_id: chain_id.clone(), network_type: network_type.clone(), + }.into()); + assert_ne!(GhostNetworks::::networks(chain_id.clone()), prev_network); + } + + update_network_gatekeeper { + let mut gatekeeper = b"0x".to_vec(); + for i in 0..40 { gatekeeper.push(i + 1); } + let (chain_id, network) = prepare_network::(1, 1); + let authority = T::UpdateOrigin::try_successful_origin() + .map_err(|_| BenchmarkError::Weightless)?; + let prev_network = create_network::(chain_id.clone(), network.clone())?; + }: _(authority, chain_id.clone(), gatekeeper.clone()) + verify { + assert_last_event::(Event::NetworkGatekeeperUpdated { + chain_id: chain_id.clone(), gatekeeper, + }.into()); + assert_ne!(GhostNetworks::::networks(chain_id.clone()), prev_network); + } + + update_network_topic_name { + let topic_name = b"0x9876543219876543219876543219876543219876543219876543219876543219".to_vec(); + let (chain_id, network) = prepare_network::(1, 1); + let authority = T::UpdateOrigin::try_successful_origin() + .map_err(|_| BenchmarkError::Weightless)?; + let prev_network = create_network::(chain_id.clone(), network.clone())?; + }: _(authority, chain_id.clone(), topic_name.clone()) + verify { + assert_last_event::(Event::NetworkTopicNameUpdated { + chain_id: chain_id.clone(), topic_name, + }.into()); + assert_ne!(GhostNetworks::::networks(chain_id.clone()), prev_network); + } + + update_incoming_network_fee { + let incoming_fee = 1337; + let (chain_id, network) = prepare_network::(1, 1); + let authority = T::UpdateOrigin::try_successful_origin() + .map_err(|_| BenchmarkError::Weightless)?; + let prev_network = create_network::(chain_id.clone(), network.clone())?; + }: _(authority, chain_id.clone(), incoming_fee) + verify { + assert_last_event::(Event::NetworkIncomingFeeUpdated { + chain_id: chain_id.clone(), incoming_fee, + }.into()); + assert_ne!(GhostNetworks::::networks(chain_id.clone()), prev_network); + } + + update_outgoing_network_fee { + let outgoing_fee = 1337; + let (chain_id, network) = prepare_network::(1, 1); + let authority = T::UpdateOrigin::try_successful_origin() + .map_err(|_| BenchmarkError::Weightless)?; + let prev_network = create_network::(chain_id.clone(), network.clone())?; + }: _(authority, chain_id.clone(), outgoing_fee) + verify { + assert_last_event::(Event::NetworkOutgoingFeeUpdated { + chain_id: chain_id.clone(), outgoing_fee, + }.into()); + assert_ne!(GhostNetworks::::networks(chain_id.clone()), prev_network); + } + + remove_network { + let (chain_id, network) = prepare_network::(1, 1); + let authority = T::RemoveOrigin::try_successful_origin() + .map_err(|_| BenchmarkError::Weightless)?; + let prev_network = create_network::(chain_id.clone(), network.clone())?; + }: _(authority, chain_id.clone()) + verify { + assert_last_event::(Event::NetworkRemoved { + chain_id: chain_id.clone(), + }.into()); + assert_ne!(GhostNetworks::::networks(chain_id.clone()), prev_network); + } + + impl_benchmark_test_suite!(GhostNetworks, crate::mock::ExtBuilder::build(), crate::mock::Test); +} diff --git a/pallets/networks/src/lib.rs b/pallets/networks/src/lib.rs new file mode 100755 index 0000000..b347044 --- /dev/null +++ b/pallets/networks/src/lib.rs @@ -0,0 +1,538 @@ +#![cfg_attr(not(feature = "std"), no_std)] +#![allow(clippy::large_enum_variant)] +#![allow(clippy::too_many_arguments)] + +use frame_support::{ + pallet_prelude::*, + storage::PrefixIterator, traits::EnsureOrigin, +}; +use frame_system::pallet_prelude::*; +use scale_info::TypeInfo; +use sp_runtime::{ + traits::{AtLeast32BitUnsigned, Member}, + DispatchResult, +}; +use sp_std::prelude::*; + +pub use ghost_traits::networks::{ + NetworkDataBasicHandler, NetworkDataInspectHandler, + NetworkDataMutateHandler, +}; + +mod weights; + +pub use module::*; +pub use crate::weights::WeightInfo; + +#[cfg(any(feature = "runtime-benchmarks", test))] +mod benchmarking; +#[cfg(all(feature = "std", test))] +mod mock; +#[cfg(all(feature = "std", test))] +mod tests; + +#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] +pub enum NetworkType { + Evm = 0, + Utxo = 1, + Undefined = 2, +} + +impl Default for NetworkType { + fn default() -> Self { NetworkType::Evm } +} + +#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)] +pub struct NetworkData { + pub chain_name: Vec, + pub default_endpoint: Vec, + pub gatekeeper: Vec, + pub topic_name: Vec, + pub finality_delay: Option, + pub release_delay: Option, + pub network_type: NetworkType, + pub incoming_fee: u32, + pub outgoing_fee: u32, +} + +#[frame_support::pallet] +pub mod module { + use super::*; + + #[pallet::config] + pub trait Config: frame_system::Config { + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + + /// The type used as a unique network id. + type NetworkId: Parameter + + Member + + Parameter + + AtLeast32BitUnsigned + + Default + + Copy + + Ord + + TypeInfo + + MaybeSerializeDeserialize + + MaxEncodedLen; + + /// The origin required to register new network. + type RegisterOrigin: EnsureOrigin; + /// The origin required to update network information. + type UpdateOrigin: EnsureOrigin; + /// The origin required to remove network. + type RemoveOrigin: EnsureOrigin; + + /// Weight information for extrinsics in this module. + type WeightInfo: WeightInfo; + } + + #[pallet::error] + pub enum Error { + /// Network already registered. + NetworkAlreadyRegistered, + /// Network does not exist. + NetworkDoesNotExist, + /// Gatekeeper address length not 42 or prefix `0x` missed. + WrongGatekeeperAddress, + /// Topic name length not 66 or prefix `0x` missed. + WrongTopicName, + } + + #[pallet::event] + #[pallet::generate_deposit(pub(crate) fn deposit_event)] + pub enum Event { + NetworkRegistered { chain_id: T::NetworkId, network: NetworkData }, + NetworkNameUpdated { chain_id: T::NetworkId, chain_name: Vec }, + NetworkEndpointUpdated { chain_id: T::NetworkId, default_endpoint: Vec }, + NetworkFinalityDelayUpdated { chain_id: T::NetworkId, finality_delay: Option }, + NetworkReleaseDelayUpdated { chain_id: T::NetworkId, release_delay: Option }, + NetworkTypeUpdated { chain_id: T::NetworkId, network_type: NetworkType }, + NetworkGatekeeperUpdated { chain_id: T::NetworkId, gatekeeper: Vec }, + NetworkTopicNameUpdated { chain_id: T::NetworkId, topic_name: Vec }, + NetworkIncomingFeeUpdated { chain_id: T::NetworkId, incoming_fee: u32 }, + NetworkOutgoingFeeUpdated { chain_id: T::NetworkId, outgoing_fee: u32 }, + NetworkRemoved { chain_id: T::NetworkId }, + } + + #[pallet::storage] + #[pallet::getter(fn networks)] + pub type Networks = + StorageMap<_, Twox64Concat, T::NetworkId, NetworkData, OptionQuery>; + + #[pallet::genesis_config] + pub struct GenesisConfig { + pub networks: Vec<(T::NetworkId, Vec)>, + } + + impl Default for GenesisConfig { + fn default() -> Self { + Self { networks: vec![] } + } + } + + #[pallet::genesis_build] + impl BuildGenesisConfig for GenesisConfig { + fn build(&self) { + if !self.networks.is_empty() { + self.networks.iter().for_each(|(chain_id, network_metadata)| { + let network = + NetworkData::decode(&mut &network_metadata[..]) + .expect("Error decoding NetworkData"); + Pallet::::do_register_network(chain_id.clone(), network) + .expect("Error registering network"); + }); + } + } + } + + #[pallet::pallet] + #[pallet::without_storage_info] + pub struct Pallet(PhantomData); + + #[pallet::hooks] + impl Hooks> for Pallet {} + + #[pallet::call] + impl Pallet { + #[pallet::call_index(0)] + #[pallet::weight(T::WeightInfo::register_network( + network.chain_name.len() as u32, + network.default_endpoint.len() as u32, + ))] + pub fn register_network( + origin: OriginFor, + chain_id: T::NetworkId, + network: NetworkData, + ) -> DispatchResult { + T::RegisterOrigin::ensure_origin_or_root(origin)?; + Self::do_register_network(chain_id, network) + } + + #[pallet::call_index(1)] + #[pallet::weight(T::WeightInfo::update_network_name( + chain_name.len() as u32, + ))] + pub fn update_network_name( + origin: OriginFor, + chain_id: T::NetworkId, + chain_name: Vec, + ) -> DispatchResult { + T::UpdateOrigin::ensure_origin_or_root(origin)?; + Self::do_update_network_name( + chain_id, + chain_name, + ) + } + + #[pallet::call_index(2)] + #[pallet::weight(T::WeightInfo::update_network_endpoint( + default_endpoint.len() as u32 + ))] + pub fn update_network_endpoint( + origin: OriginFor, + chain_id: T::NetworkId, + default_endpoint: Vec, + ) -> DispatchResult { + T::UpdateOrigin::ensure_origin_or_root(origin)?; + Self::do_update_network_endpoint( + chain_id, + default_endpoint, + ) + } + + #[pallet::call_index(3)] + #[pallet::weight(T::WeightInfo::update_network_finality_delay())] + pub fn update_network_finality_delay( + origin: OriginFor, + chain_id: T::NetworkId, + finality_delay: Option, + ) -> DispatchResult { + T::UpdateOrigin::ensure_origin_or_root(origin)?; + Self::do_update_network_finality_delay( + chain_id, + finality_delay, + ) + } + + #[pallet::call_index(4)] + #[pallet::weight(T::WeightInfo::update_network_release_delay())] + pub fn update_network_release_delay( + origin: OriginFor, + chain_id: T::NetworkId, + release_delay: Option, + ) -> DispatchResult { + T::UpdateOrigin::ensure_origin_or_root(origin)?; + Self::do_update_network_release_delay( + chain_id, + release_delay, + ) + } + + #[pallet::call_index(5)] + #[pallet::weight(T::WeightInfo::update_network_type())] + pub fn update_network_type( + origin: OriginFor, + chain_id: T::NetworkId, + network_type: NetworkType, + ) -> DispatchResult { + T::UpdateOrigin::ensure_origin_or_root(origin)?; + Self::do_update_network_type( + chain_id, + network_type, + ) + } + + #[pallet::call_index(6)] + #[pallet::weight(T::WeightInfo::update_network_gatekeeper())] + pub fn update_network_gatekeeper( + origin: OriginFor, + chain_id: T::NetworkId, + gatekeeper: Vec, + ) -> DispatchResult { + T::UpdateOrigin::ensure_origin_or_root(origin)?; + Self::do_update_network_gatekeeper( + chain_id, + gatekeeper, + ) + } + + #[pallet::call_index(7)] + #[pallet::weight(T::WeightInfo::update_network_topic_name())] + pub fn update_network_topic_name( + origin: OriginFor, + chain_id: T::NetworkId, + topic_name: Vec, + ) -> DispatchResult { + T::UpdateOrigin::ensure_origin_or_root(origin)?; + Self::do_update_network_topic_name( + chain_id, + topic_name, + ) + } + + #[pallet::call_index(8)] + #[pallet::weight(T::WeightInfo::update_incoming_network_fee())] + pub fn update_incoming_network_fee( + origin: OriginFor, + chain_id: T::NetworkId, + incoming_fee: u32, + ) -> DispatchResult { + T::UpdateOrigin::ensure_origin_or_root(origin)?; + Self::do_update_incoming_network_fee( + chain_id, + incoming_fee, + ) + } + + #[pallet::call_index(9)] + #[pallet::weight(T::WeightInfo::update_outgoing_network_fee())] + pub fn update_outgoing_network_fee( + origin: OriginFor, + chain_id: T::NetworkId, + outgoing_fee: u32, + ) -> DispatchResult { + T::UpdateOrigin::ensure_origin_or_root(origin)?; + Self::do_update_outgoing_network_fee( + chain_id, + outgoing_fee, + ) + } + + #[pallet::call_index(10)] + #[pallet::weight(T::WeightInfo::remove_network())] + pub fn remove_network( + origin: OriginFor, + chain_id: T::NetworkId, + ) -> DispatchResult { + T::RemoveOrigin::ensure_origin_or_root(origin)?; + Self::do_remove_network(chain_id) + } + } +} + +impl Pallet { + /// Register a new network. + pub fn do_register_network( + chain_id: T::NetworkId, + network: NetworkData, + ) -> DispatchResult { + Networks::::try_mutate(&chain_id, |maybe_network| -> DispatchResult { + ensure!(maybe_network.is_none(), Error::::NetworkAlreadyRegistered); + *maybe_network = Some(network.clone()); + Ok(()) + })?; + + Self::deposit_event(Event::::NetworkRegistered { chain_id, network }); + Ok(()) + } + + /// Remove existent network. + pub fn do_remove_network(chain_id: T::NetworkId) -> DispatchResult { + Networks::::try_mutate(&chain_id, |maybe_network| -> DispatchResult { + ensure!(maybe_network.is_some(), Error::::NetworkDoesNotExist); + *maybe_network = None; + Ok(()) + })?; + + Self::deposit_event(Event::::NetworkRemoved { chain_id }); + Ok(()) + } + + /// Update existent network name. + pub fn do_update_network_name( + chain_id: T::NetworkId, + chain_name: Vec, + ) -> DispatchResult { + Networks::::try_mutate(&chain_id, |maybe_network| -> DispatchResult { + ensure!(maybe_network.is_some(), Error::::NetworkDoesNotExist); + let net = maybe_network.as_mut().unwrap(); + net.chain_name = chain_name.clone(); + *maybe_network = Some(net.clone()); + Ok(()) + })?; + + Self::deposit_event(Event::::NetworkNameUpdated { + chain_id, + chain_name, + }); + Ok(()) + } + + /// Update existent network default endpoint. + pub fn do_update_network_endpoint( + chain_id: T::NetworkId, + default_endpoint: Vec, + ) -> DispatchResult { + Networks::::try_mutate(&chain_id, |maybe_network| -> DispatchResult { + ensure!(maybe_network.is_some(), Error::::NetworkDoesNotExist); + let net = maybe_network.as_mut().unwrap(); + net.default_endpoint = default_endpoint.clone(); + *maybe_network = Some(net.clone()); + Ok(()) + })?; + Self::deposit_event(Event::::NetworkEndpointUpdated { + chain_id, + default_endpoint, + }); + Ok(()) + } + + /// Update existent network default endpoint. + pub fn do_update_network_finality_delay( + chain_id: T::NetworkId, + finality_delay: Option, + ) -> DispatchResult { + Networks::::try_mutate(&chain_id, |maybe_network| -> DispatchResult { + ensure!(maybe_network.is_some(), Error::::NetworkDoesNotExist); + let net = maybe_network.as_mut().unwrap(); + net.finality_delay = finality_delay; + *maybe_network = Some(net.clone()); + Ok(()) + })?; + Self::deposit_event(Event::::NetworkFinalityDelayUpdated { + chain_id, + finality_delay, + }); + Ok(()) + } + + /// Update existent network default endpoint. + pub fn do_update_network_release_delay( + chain_id: T::NetworkId, + release_delay: Option, + ) -> DispatchResult { + Networks::::try_mutate(&chain_id, |maybe_network| -> DispatchResult { + ensure!(maybe_network.is_some(), Error::::NetworkDoesNotExist); + let net = maybe_network.as_mut().unwrap(); + net.release_delay = release_delay; + *maybe_network = Some(net.clone()); + Ok(()) + })?; + Self::deposit_event(Event::::NetworkReleaseDelayUpdated { + chain_id, + release_delay, + }); + Ok(()) + } + + /// Update existent network type. + pub fn do_update_network_type( + chain_id: T::NetworkId, + network_type: NetworkType, + ) -> DispatchResult { + Networks::::try_mutate(&chain_id, |maybe_network| -> DispatchResult { + ensure!(maybe_network.is_some(), Error::::NetworkDoesNotExist); + let net = maybe_network.as_mut().unwrap(); + net.network_type = network_type.clone(); + *maybe_network = Some(net.clone()); + Ok(()) + })?; + Self::deposit_event(Event::::NetworkTypeUpdated { + chain_id, + network_type, + }); + Ok(()) + } + + /// Update existent network gatekeeper. + pub fn do_update_network_gatekeeper( + chain_id: T::NetworkId, + gatekeeper: Vec, + ) -> DispatchResult { + ensure!(gatekeeper.len() == 42 && gatekeeper[0] == 48 && gatekeeper[1] == 120, + Error::::WrongGatekeeperAddress); + Networks::::try_mutate(&chain_id, |maybe_network| -> DispatchResult { + ensure!(maybe_network.is_some(), Error::::NetworkDoesNotExist); + let net = maybe_network.as_mut().unwrap(); + net.gatekeeper = gatekeeper.clone(); + *maybe_network = Some(net.clone()); + Ok(()) + })?; + Self::deposit_event(Event::::NetworkGatekeeperUpdated { + chain_id, + gatekeeper, + }); + Ok(()) + } + + /// Update existent network gatekeeper's topic name. + pub fn do_update_network_topic_name( + chain_id: T::NetworkId, + topic_name: Vec, + ) -> DispatchResult { + ensure!(topic_name.len() == 66 && topic_name[0] == 48 && topic_name[1] == 120, + Error::::WrongTopicName); + Networks::::try_mutate(&chain_id, |maybe_network| -> DispatchResult { + ensure!(maybe_network.is_some(), Error::::NetworkDoesNotExist); + let net = maybe_network.as_mut().unwrap(); + net.topic_name = topic_name.clone(); + *maybe_network = Some(net.clone()); + Ok(()) + })?; + Self::deposit_event(Event::::NetworkTopicNameUpdated { + chain_id, + topic_name, + }); + Ok(()) + } + + pub fn do_update_incoming_network_fee( + chain_id: T::NetworkId, + incoming_fee: u32, + ) -> DispatchResult { + Networks::::try_mutate(&chain_id, |maybe_network| -> DispatchResult { + ensure!(maybe_network.is_some(), Error::::NetworkDoesNotExist); + let net = maybe_network.as_mut().unwrap(); + net.incoming_fee = incoming_fee.clone(); + *maybe_network = Some(net.clone()); + Ok(()) + })?; + Self::deposit_event(Event::::NetworkIncomingFeeUpdated { + chain_id, + incoming_fee, + }); + Ok(()) + } + + pub fn do_update_outgoing_network_fee( + chain_id: T::NetworkId, + outgoing_fee: u32, + ) -> DispatchResult { + Networks::::try_mutate(&chain_id, |maybe_network| -> DispatchResult { + ensure!(maybe_network.is_some(), Error::::NetworkDoesNotExist); + let net = maybe_network.as_mut().unwrap(); + net.outgoing_fee = outgoing_fee.clone(); + *maybe_network = Some(net.clone()); + Ok(()) + })?; + Self::deposit_event(Event::::NetworkOutgoingFeeUpdated { + chain_id, + outgoing_fee, + }); + Ok(()) + } +} + +impl NetworkDataBasicHandler for Pallet { + type NetworkId = T::NetworkId; +} + +impl NetworkDataInspectHandler for Pallet { + fn get(n: &Self::NetworkId) -> Option { + Networks::::get(n) + } + + fn iter() -> PrefixIterator<(Self::NetworkId, NetworkData)> { + Networks::::iter() + } +} + +impl NetworkDataMutateHandler for Pallet { + fn register(chain_id: Self::NetworkId, network: NetworkData) -> DispatchResult { + Self::do_register_network(chain_id, network) + } + + fn remove(chain_id: Self::NetworkId) -> DispatchResult { + Self::do_remove_network(chain_id) + } +} diff --git a/pallets/networks/src/mock.rs b/pallets/networks/src/mock.rs new file mode 100755 index 0000000..96579d6 --- /dev/null +++ b/pallets/networks/src/mock.rs @@ -0,0 +1,104 @@ +use crate as ghost_networks; +use frame_system::EnsureSignedBy; +use frame_support::{ + construct_runtime, ord_parameter_types, parameter_types, traits::{ConstU128, ConstU32, Everything} +}; +pub use primitives::{ + AccountId, Balance, Nonce, BlockNumber, Hash, + ReserveIdentifier, FreezeIdentifier, +}; +use sp_runtime::{ + traits::{BlakeTwo256, AccountIdLookup}, + BuildStorage, +}; + +parameter_types! { + pub const BlockHashCount: BlockNumber = 250; +} + +impl frame_system::Config for Test { + type RuntimeEvent = RuntimeEvent; + type BaseCallFilter = Everything; + type BlockWeights = (); + type BlockLength = (); + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type RuntimeTask = (); + type Nonce = Nonce; + type Hash = Hash; + type Hashing = BlakeTwo256; + type AccountId = AccountId; + type Lookup = AccountIdLookup; + type Block = Block; + type BlockHashCount = BlockHashCount; + type DbWeight = (); + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = ConstU32<16>; + type SingleBlockMigrations = (); + type MultiBlockMigrator = (); + type PreInherents = (); + type PostInherents = (); + type PostTransactions = (); +} + +impl pallet_balances::Config for Test { + type RuntimeEvent = RuntimeEvent; + type RuntimeHoldReason = (); + type RuntimeFreezeReason = (); + type WeightInfo = (); + type Balance = Balance; + type DustRemoval = (); + type ExistentialDeposit = ConstU128<1>; + type AccountStore = System; + type ReserveIdentifier = ReserveIdentifier; + type FreezeIdentifier = FreezeIdentifier; + type MaxLocks = (); + type MaxReserves = ConstU32<50>; + type MaxFreezes = ConstU32<50>; +} + +ord_parameter_types! { + pub const RegistererAccount: AccountId = AccountId::from([1u8; 32]); + pub const UpdaterAccount: AccountId = AccountId::from([2u8; 32]); + pub const RemoverAccount: AccountId = AccountId::from([3u8; 32]); + pub const RandomAccount: AccountId = AccountId::from([4u8; 32]); +} + +impl ghost_networks::Config for Test { + type RuntimeEvent = RuntimeEvent; + type NetworkId = u32; + type RegisterOrigin = EnsureSignedBy::; + type UpdateOrigin = EnsureSignedBy::; + type RemoveOrigin = EnsureSignedBy::; + type WeightInfo = crate::weights::SubstrateWeight; +} + +type Block = frame_system::mocking::MockBlockU32; + +construct_runtime!( + pub enum Test { + System: frame_system, + Balances: pallet_balances, + GhostNetworks: ghost_networks, + } +); + +pub(crate) struct ExtBuilder(); +impl ExtBuilder { + pub(crate) fn build() -> sp_io::TestExternalities { + let t = frame_system::GenesisConfig::::default() + .build_storage() + .expect("Frame system builds valid default genesis config; qed"); + + let mut ext: sp_io::TestExternalities = t.into(); + ext.execute_with(|| System::set_block_number(1)); + ext + } +} diff --git a/pallets/networks/src/tests.rs b/pallets/networks/src/tests.rs new file mode 100755 index 0000000..407784f --- /dev/null +++ b/pallets/networks/src/tests.rs @@ -0,0 +1,637 @@ +use mock::{ + ExtBuilder, System, RegistererAccount, UpdaterAccount, RemoverAccount, + RandomAccount, GhostNetworks, Test, RuntimeEvent, RuntimeOrigin, +}; +use frame_support::{assert_err, assert_ok}; +use sp_runtime::DispatchError; +use super::*; + +fn prepare_network_data() -> (u32, NetworkData) { + (1u32, NetworkData { + chain_name: "Ethereum".into(), + default_endpoint: + "https:://some-endpoint.my-server.com/v1/my-super-secret-key".into(), + finality_delay: Some(69), + release_delay: Some(69), + network_type: NetworkType::Evm, + gatekeeper: b"0x1234567891234567891234567891234567891234".to_vec(), + topic_name: b"0x12345678912345678912345678912345678912345678912345678912345678".to_vec(), + incoming_fee: 0, + outgoing_fee: 0, + }) +} + +fn register_and_check_network(chain_id: u32, network: NetworkData) { + assert_ok!(GhostNetworks::register_network( + RuntimeOrigin::signed(RegistererAccount::get()), + chain_id, + network.clone())); + assert_eq!(Networks::::get(chain_id), Some(network.clone())); +} + +#[test] +fn could_add_network_from_authority() { + ExtBuilder::build() + .execute_with(|| { + let (chain_id, network) = prepare_network_data(); + assert_eq!(Networks::::get(chain_id), None); + assert_ok!(GhostNetworks::register_network( + RuntimeOrigin::signed(RegistererAccount::get()), + chain_id, + network.clone(), + )); + System::assert_last_event(RuntimeEvent::GhostNetworks( + crate::Event::NetworkRegistered { + chain_id, network: network.clone() + })); + assert_eq!(Networks::::get(chain_id), Some(network)); + }); +} + +#[test] +fn could_not_add_network_from_random_account() { + ExtBuilder::build() + .execute_with(|| { + let (chain_id, network) = prepare_network_data(); + assert_eq!(Networks::::get(chain_id), None); + assert_err!(GhostNetworks::register_network( + RuntimeOrigin::signed(RandomAccount::get()), + chain_id, + network.clone(), + ), DispatchError::BadOrigin); + assert_err!(GhostNetworks::register_network( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, + network.clone(), + ), DispatchError::BadOrigin); + assert_err!(GhostNetworks::register_network( + RuntimeOrigin::signed(RemoverAccount::get()), + chain_id, + network, + ), DispatchError::BadOrigin); + assert_eq!(Networks::::get(chain_id), None); + }); +} + +#[test] +fn could_update_network_name_from_authority_account() { + ExtBuilder::build() + .execute_with(|| { + let new_name = b"Polygon".to_vec(); + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_ok!(GhostNetworks::update_network_name( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, new_name.clone())); + System::assert_last_event(RuntimeEvent::GhostNetworks( + crate::Event::NetworkNameUpdated { + chain_id, + chain_name: new_name.clone() })); + let mut final_network = network.clone(); + final_network.chain_name = new_name; + assert_eq!(Networks::::get(chain_id), Some(final_network.clone())); + assert_ne!(network, final_network); + }); +} + +#[test] +fn could_update_network_endpoint_from_authority_account() { + ExtBuilder::build() + .execute_with(|| { + let new_endpoint = b"https:://google.com".to_vec(); + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_ok!(GhostNetworks::update_network_endpoint( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, new_endpoint.clone())); + System::assert_last_event(RuntimeEvent::GhostNetworks( + crate::Event::NetworkEndpointUpdated { + chain_id, + default_endpoint: new_endpoint.clone() })); + let mut final_network = network.clone(); + final_network.default_endpoint = new_endpoint; + assert_eq!(Networks::::get(chain_id), Some(final_network.clone())); + assert_ne!(network, final_network); + }); +} + +#[test] +fn could_update_network_finality_delay_from_authority_account() { + ExtBuilder::build() + .execute_with(|| { + let new_finality_delay = Some(1337); + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_ok!(GhostNetworks::update_network_finality_delay( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, new_finality_delay)); + System::assert_last_event(RuntimeEvent::GhostNetworks( + crate::Event::NetworkFinalityDelayUpdated { + chain_id, + finality_delay: new_finality_delay })); + let mut final_network = network.clone(); + final_network.finality_delay = new_finality_delay; + assert_eq!(Networks::::get(chain_id), Some(final_network.clone())); + assert_ne!(network, final_network); + }); +} + +#[test] +fn could_update_network_release_delay_from_authority_account() { + ExtBuilder::build() + .execute_with(|| { + let new_release_delay = Some(1337); + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_ok!(GhostNetworks::update_network_release_delay( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, new_release_delay)); + System::assert_last_event(RuntimeEvent::GhostNetworks( + crate::Event::NetworkReleaseDelayUpdated { + chain_id, + release_delay: new_release_delay })); + let mut final_network = network.clone(); + final_network.release_delay = new_release_delay; + assert_eq!(Networks::::get(chain_id), Some(final_network.clone())); + assert_ne!(network, final_network); + }); +} + +#[test] +fn could_update_network_type_from_authority_account() { + ExtBuilder::build() + .execute_with(|| { + let new_type = NetworkType::Utxo; + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_ok!(GhostNetworks::update_network_type( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, new_type.clone())); + System::assert_last_event(RuntimeEvent::GhostNetworks( + crate::Event::NetworkTypeUpdated { + chain_id, + network_type: new_type.clone() })); + let mut final_network = network.clone(); + final_network.network_type = new_type; + assert_eq!(Networks::::get(chain_id), Some(final_network.clone())); + assert_ne!(network, final_network); + }); +} + +#[test] +fn could_update_network_gatekeeper_from_authority_account() { + ExtBuilder::build() + .execute_with(|| { + let new_gatekeeper = b"0x9876543219876543219876543219876543219876".to_vec(); + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_ok!(GhostNetworks::update_network_gatekeeper( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, new_gatekeeper.clone())); + System::assert_last_event(RuntimeEvent::GhostNetworks( + crate::Event::NetworkGatekeeperUpdated { + chain_id, + gatekeeper: new_gatekeeper.clone() })); + let mut final_network = network.clone(); + final_network.gatekeeper = new_gatekeeper; + assert_eq!(Networks::::get(chain_id), Some(final_network.clone())); + assert_ne!(network, final_network); + }); +} + +#[test] +fn could_update_network_topic_name_from_authority_account() { + ExtBuilder::build() + .execute_with(|| { + let new_topic_name = b"0x9876543219876543219876543219876543219876543219876543219876543219".to_vec(); + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_ok!(GhostNetworks::update_network_topic_name( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, new_topic_name.clone())); + System::assert_last_event(RuntimeEvent::GhostNetworks( + crate::Event::NetworkTopicNameUpdated { + chain_id, + topic_name: new_topic_name.clone() })); + let mut final_network = network.clone(); + final_network.topic_name = new_topic_name; + assert_eq!(Networks::::get(chain_id), Some(final_network.clone())); + assert_ne!(network, final_network); + }); +} + +#[test] +fn could_update_incoming_network_fee_from_authority_account() { + ExtBuilder::build() + .execute_with(|| { + let new_incoming_fee = 69; + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_ok!(GhostNetworks::update_incoming_network_fee( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, new_incoming_fee)); + System::assert_last_event(RuntimeEvent::GhostNetworks( + crate::Event::NetworkIncomingFeeUpdated { + chain_id, + incoming_fee: new_incoming_fee })); + let mut final_network = network.clone(); + final_network.incoming_fee = new_incoming_fee; + assert_eq!(Networks::::get(chain_id), Some(final_network.clone())); + assert_ne!(network, final_network); + }); +} + +#[test] +fn could_update_outgoing_network_fee_from_authority_account() { + ExtBuilder::build() + .execute_with(|| { + let new_outgoing_fee = 69; + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_ok!(GhostNetworks::update_outgoing_network_fee( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, new_outgoing_fee)); + System::assert_last_event(RuntimeEvent::GhostNetworks( + crate::Event::NetworkOutgoingFeeUpdated { + chain_id, + outgoing_fee: new_outgoing_fee })); + let mut final_network = network.clone(); + final_network.outgoing_fee = new_outgoing_fee; + assert_eq!(Networks::::get(chain_id), Some(final_network.clone())); + assert_ne!(network, final_network); + }); +} + +#[test] +fn could_not_update_network_name_from_random_account() { + ExtBuilder::build() + .execute_with(|| { + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_err!(GhostNetworks::update_network_name( + RuntimeOrigin::signed(RegistererAccount::get()), + chain_id, "Binance".into()), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_name( + RuntimeOrigin::signed(RemoverAccount::get()), + chain_id, "Binance".into()), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_name( + RuntimeOrigin::signed(RandomAccount::get()), + chain_id, "Binance".into()), + DispatchError::BadOrigin); + assert_eq!(Networks::::get(chain_id), Some(network)); + }); +} + +#[test] +fn could_not_update_network_endpoint_from_random_account() { + ExtBuilder::build() + .execute_with(|| { + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_err!(GhostNetworks::update_network_endpoint( + RuntimeOrigin::signed(RegistererAccount::get()), + chain_id, "https:://google.com".into()), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_endpoint( + RuntimeOrigin::signed(RemoverAccount::get()), + chain_id, "https:://google.com".into()), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_endpoint( + RuntimeOrigin::signed(RandomAccount::get()), + chain_id, "https:://google.com".into()), + DispatchError::BadOrigin); + assert_eq!(Networks::::get(chain_id), Some(network)); + }); +} + +#[test] +fn could_not_update_network_finality_delay_from_random_account() { + ExtBuilder::build() + .execute_with(|| { + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_err!(GhostNetworks::update_network_finality_delay( + RuntimeOrigin::signed(RegistererAccount::get()), + chain_id, Some(1337)), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_finality_delay( + RuntimeOrigin::signed(RemoverAccount::get()), + chain_id, Some(1337)), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_finality_delay( + RuntimeOrigin::signed(RandomAccount::get()), + chain_id, Some(1337)), + DispatchError::BadOrigin); + assert_eq!(Networks::::get(chain_id), Some(network)); + }); +} + +#[test] +fn could_not_update_network_release_delay_from_random_account() { + ExtBuilder::build() + .execute_with(|| { + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_err!(GhostNetworks::update_network_release_delay( + RuntimeOrigin::signed(RegistererAccount::get()), + chain_id, Some(1337)), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_release_delay( + RuntimeOrigin::signed(RemoverAccount::get()), + chain_id, Some(1337)), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_release_delay( + RuntimeOrigin::signed(RandomAccount::get()), + chain_id, Some(1337)), + DispatchError::BadOrigin); + assert_eq!(Networks::::get(chain_id), Some(network)); + }); +} + +#[test] +fn could_not_update_network_type_from_random_account() { + ExtBuilder::build() + .execute_with(|| { + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_err!(GhostNetworks::update_network_type( + RuntimeOrigin::signed(RegistererAccount::get()), + chain_id, NetworkType::Utxo), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_type( + RuntimeOrigin::signed(RemoverAccount::get()), + chain_id, NetworkType::Utxo), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_type( + RuntimeOrigin::signed(RandomAccount::get()), + chain_id, NetworkType::Utxo), + DispatchError::BadOrigin); + assert_eq!(Networks::::get(chain_id), Some(network)); + }); +} + +#[test] +fn could_not_update_network_gatekeeper_from_random_account() { + ExtBuilder::build() + .execute_with(|| { + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_err!(GhostNetworks::update_network_gatekeeper( + RuntimeOrigin::signed(RegistererAccount::get()), + chain_id, b"0x9876543219876543219876543219876543219876".to_vec()), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_gatekeeper( + RuntimeOrigin::signed(RemoverAccount::get()), + chain_id, b"0x9876543219876543219876543219876543219876".to_vec()), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_gatekeeper( + RuntimeOrigin::signed(RandomAccount::get()), + chain_id, b"0x9876543219876543219876543219876543219876".to_vec()), + DispatchError::BadOrigin); + assert_eq!(Networks::::get(chain_id), Some(network)); + }); +} + +#[test] +fn could_not_update_network_topic_name_from_random_account() { + ExtBuilder::build() + .execute_with(|| { + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_err!(GhostNetworks::update_network_topic_name( + RuntimeOrigin::signed(RegistererAccount::get()), + chain_id, b"0x9876543219876543219876543219876543219876543219876543219876543219".to_vec()), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_topic_name( + RuntimeOrigin::signed(RemoverAccount::get()), + chain_id, b"0x9876543219876543219876543219876543219876543219876543219876543219".to_vec()), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_network_topic_name( + RuntimeOrigin::signed(RandomAccount::get()), + chain_id, b"0x9876543219876543219876543219876543219876543219876543219876543219".to_vec()), + DispatchError::BadOrigin); + assert_eq!(Networks::::get(chain_id), Some(network)); + }); +} + +#[test] +fn could_not_update_network_incoming_fee_from_random_account() { + ExtBuilder::build() + .execute_with(|| { + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_err!(GhostNetworks::update_incoming_network_fee( + RuntimeOrigin::signed(RegistererAccount::get()), + chain_id, 69), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_incoming_network_fee( + RuntimeOrigin::signed(RemoverAccount::get()), + chain_id, 69), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_incoming_network_fee( + RuntimeOrigin::signed(RandomAccount::get()), + chain_id, 69), + DispatchError::BadOrigin); + assert_eq!(Networks::::get(chain_id), Some(network)); + }); +} + +#[test] +fn could_not_update_network_outgoing_fee_from_random_account() { + ExtBuilder::build() + .execute_with(|| { + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_err!(GhostNetworks::update_outgoing_network_fee( + RuntimeOrigin::signed(RegistererAccount::get()), + chain_id, 69), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_outgoing_network_fee( + RuntimeOrigin::signed(RemoverAccount::get()), + chain_id, 69), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::update_outgoing_network_fee( + RuntimeOrigin::signed(RandomAccount::get()), + chain_id, 69), + DispatchError::BadOrigin); + assert_eq!(Networks::::get(chain_id), Some(network)); + }); +} + +#[test] +fn could_not_update_name_for_non_existent_network() { + ExtBuilder::build() + .execute_with(|| { + let chain_id: u32 = 1; + assert_eq!(Networks::::get(chain_id), None); + assert_err!(GhostNetworks::update_network_name( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, "Binance".into()), + crate::Error::::NetworkDoesNotExist); + assert_eq!(Networks::::get(chain_id), None); + }); +} + +#[test] +fn could_not_update_endpoint_for_non_existent_network() { + ExtBuilder::build() + .execute_with(|| { + let chain_id: u32 = 1; + assert_eq!(Networks::::get(chain_id), None); + assert_err!(GhostNetworks::update_network_endpoint( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, "https:://google.com".into()), + crate::Error::::NetworkDoesNotExist); + assert_eq!(Networks::::get(chain_id), None); + }); +} + +#[test] +fn could_not_update_finality_delay_for_non_existent_network() { + ExtBuilder::build() + .execute_with(|| { + let chain_id: u32 = 1; + assert_eq!(Networks::::get(chain_id), None); + assert_err!(GhostNetworks::update_network_finality_delay( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, Some(1337)), + crate::Error::::NetworkDoesNotExist); + assert_eq!(Networks::::get(chain_id), None); + }); +} + +#[test] +fn could_not_update_release_delay_for_non_existent_network() { + ExtBuilder::build() + .execute_with(|| { + let chain_id: u32 = 1; + assert_eq!(Networks::::get(chain_id), None); + assert_err!(GhostNetworks::update_network_release_delay( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, Some(1337)), + crate::Error::::NetworkDoesNotExist); + assert_eq!(Networks::::get(chain_id), None); + }); +} + +#[test] +fn could_not_update_type_for_non_existent_network() { + ExtBuilder::build() + .execute_with(|| { + let chain_id: u32 = 1; + assert_eq!(Networks::::get(chain_id), None); + assert_err!(GhostNetworks::update_network_type( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, NetworkType::Utxo), + crate::Error::::NetworkDoesNotExist); + assert_eq!(Networks::::get(chain_id), None); + }); +} + +#[test] +fn could_not_update_gatekeeper_for_non_existent_network() { + ExtBuilder::build() + .execute_with(|| { + let chain_id: u32 = 1; + assert_eq!(Networks::::get(chain_id), None); + assert_err!(GhostNetworks::update_network_gatekeeper( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, b"0x9876543219876543219876543219876543219876".to_vec()), + crate::Error::::NetworkDoesNotExist); + assert_eq!(Networks::::get(chain_id), None); + }); +} + +#[test] +fn could_not_update_topic_name_for_non_existent_network() { + ExtBuilder::build() + .execute_with(|| { + let chain_id: u32 = 1; + assert_eq!(Networks::::get(chain_id), None); + assert_err!(GhostNetworks::update_network_topic_name( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, b"0x9876543219876543219876543219876543219876543219876543219876543219".to_vec()), + crate::Error::::NetworkDoesNotExist); + assert_eq!(Networks::::get(chain_id), None); + }); +} + +#[test] +fn could_not_update_incoming_fee_for_non_existent_network() { + ExtBuilder::build() + .execute_with(|| { + let chain_id: u32 = 1; + assert_eq!(Networks::::get(chain_id), None); + assert_err!(GhostNetworks::update_incoming_network_fee( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, 1337), + crate::Error::::NetworkDoesNotExist); + assert_eq!(Networks::::get(chain_id), None); + }); +} + +#[test] +fn could_not_update_outgoing_fee_for_non_existent_network() { + ExtBuilder::build() + .execute_with(|| { + let chain_id: u32 = 1; + assert_eq!(Networks::::get(chain_id), None); + assert_err!(GhostNetworks::update_outgoing_network_fee( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id, 1337), + crate::Error::::NetworkDoesNotExist); + assert_eq!(Networks::::get(chain_id), None); + }); +} + +#[test] +fn could_remove_network_from_authority_account() { + ExtBuilder::build() + .execute_with(|| { + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_ok!(GhostNetworks::remove_network( + RuntimeOrigin::signed(RemoverAccount::get()), + chain_id, + )); + assert_eq!(Networks::::get(chain_id), None); + }); +} + +#[test] +fn could_not_remove_network_from_random_account() { + ExtBuilder::build() + .execute_with(|| { + let (chain_id, network) = prepare_network_data(); + register_and_check_network(chain_id, network.clone()); + assert_err!(GhostNetworks::remove_network( + RuntimeOrigin::signed(RegistererAccount::get()), + chain_id), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::remove_network( + RuntimeOrigin::signed(UpdaterAccount::get()), + chain_id), + DispatchError::BadOrigin); + assert_err!(GhostNetworks::remove_network( + RuntimeOrigin::signed(RandomAccount::get()), + chain_id), + DispatchError::BadOrigin); + assert_eq!(Networks::::get(chain_id), Some(network)); + }); +} + +#[test] +fn could_not_remove_non_existent_network() { + ExtBuilder::build() + .execute_with(|| { + let chain_id: u32 = 1; + assert_eq!(Networks::::get(chain_id), None); + assert_err!(GhostNetworks::remove_network( + RuntimeOrigin::signed(RemoverAccount::get()), + chain_id), + crate::Error::::NetworkDoesNotExist); + assert_eq!(Networks::::get(chain_id), None); + }); +} diff --git a/pallets/networks/src/weights.rs b/pallets/networks/src/weights.rs new file mode 100755 index 0000000..c18305e --- /dev/null +++ b/pallets/networks/src/weights.rs @@ -0,0 +1,325 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `ghost_networks` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-11-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghost`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("casper-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=ghost_networks +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/ghost_networks.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{ + traits::Get, + weights::{ + Weight, constants::RocksDbWeight + } +}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for ghost_networks +pub trait WeightInfo { + fn register_network(n: u32, m: u32, ) -> Weight; + fn update_network_name(n: u32, ) -> Weight; + fn update_network_endpoint(n: u32, ) -> Weight; + fn update_network_finality_delay() -> Weight; + fn update_network_release_delay() -> Weight; + fn update_network_type() -> Weight; + fn update_network_gatekeeper() -> Weight; + fn update_network_topic_name() -> Weight; + fn update_incoming_network_fee() -> Weight; + fn update_outgoing_network_fee() -> Weight; + fn remove_network() -> Weight; +} + +/// Weight for ghost_networks using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + /// The range of component `n` is `[1, 20]`. + /// The range of component `m` is `[1, 150]`. + fn register_network(_n: u32, _m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `2551` + // Minimum execution time: 32_086 nanoseconds. + Weight::from_parts(33_092_855, 2551) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + /// The range of component `n` is `[1, 20]`. + fn update_network_name(_n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_496 nanoseconds. + Weight::from_parts(35_728_230, 2616) + // Standard Error: 2_591 + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + /// The range of component `n` is `[1, 150]`. + fn update_network_endpoint(_n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_666 nanoseconds. + Weight::from_parts(35_959_961, 2616) + // Standard Error: 381 + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_network_finality_delay() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 33_860 nanoseconds. + Weight::from_parts(34_995_000, 2616) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_network_release_delay() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 33_860 nanoseconds. + Weight::from_parts(34_995_000, 2616) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_network_type() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_976 nanoseconds. + Weight::from_parts(36_182_000, 2616) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_network_gatekeeper() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_768 nanoseconds. + Weight::from_parts(35_580_000, 2616) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_network_topic_name() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_768 nanoseconds. + Weight::from_parts(35_580_000, 2616) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_incoming_network_fee() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_768 nanoseconds. + Weight::from_parts(35_580_000, 2616) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_outgoing_network_fee() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_768 nanoseconds. + Weight::from_parts(35_580_000, 2616) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn remove_network() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 33_336 nanoseconds. + Weight::from_parts(34_609_000, 2616) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} + +impl WeightInfo for () { + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + /// The range of component `n` is `[1, 20]`. + /// The range of component `m` is `[1, 150]`. + fn register_network(_n: u32, _m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `2551` + // Minimum execution time: 32_086 nanoseconds. + Weight::from_parts(33_092_855, 2551) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + /// The range of component `n` is `[1, 20]`. + fn update_network_name(_n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_496 nanoseconds. + Weight::from_parts(35_728_230, 2616) + // Standard Error: 2_591 + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + /// The range of component `n` is `[1, 150]`. + fn update_network_endpoint(_n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_666 nanoseconds. + Weight::from_parts(35_959_961, 2616) + // Standard Error: 381 + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_network_finality_delay() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 33_860 nanoseconds. + Weight::from_parts(34_995_000, 2616) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_network_release_delay() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 33_860 nanoseconds. + Weight::from_parts(34_995_000, 2616) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_network_type() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_976 nanoseconds. + Weight::from_parts(36_182_000, 2616) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_network_gatekeeper() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_768 nanoseconds. + Weight::from_parts(35_580_000, 2616) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_network_topic_name() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_768 nanoseconds. + Weight::from_parts(35_580_000, 2616) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_incoming_network_fee() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_768 nanoseconds. + Weight::from_parts(35_580_000, 2616) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn update_outgoing_network_fee() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 34_768 nanoseconds. + Weight::from_parts(35_580_000, 2616) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + /// Storage: GhostNetworks Networks (r:1 w:1) + /// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) + fn remove_network() -> Weight { + // Proof Size summary in bytes: + // Measured: `141` + // Estimated: `2616` + // Minimum execution time: 33_336 nanoseconds. + Weight::from_parts(34_609_000, 2616) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } +} diff --git a/pallets/slow-clap/Cargo.toml b/pallets/slow-clap/Cargo.toml new file mode 100755 index 0000000..1947232 --- /dev/null +++ b/pallets/slow-clap/Cargo.toml @@ -0,0 +1,71 @@ +[package] +name = "ghost-slow-clap" +version = "0.3.14" +description = "Applause protocol for the EVM bridge" +license.workspace = true +authors.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true + +[dependencies] +codec = { workspace = true, features = ["max-encoded-len"] } +scale-info = { workspace = true, features = ["derive"] } + +log = { workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true, features = ["alloc"] } + +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } + +sp-application-crypto = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true } +sp-staking = { workspace = true } +sp-io = { workspace = true } +sp-std = { workspace = true } + +pallet-balances = { workspace = true } +ghost-networks = { workspace = true } + +[dev-dependencies] +pallet-session = { workspace = true, default-features = true } + +[features] +default = ["std"] +std = [ + "frame-benchmarking?/std", + "log/std", + "codec/std", + "scale-info/std", + "frame-support/std", + "frame-system/std", + "sp-application-crypto/std", + "sp-core/std", + "sp-runtime/std", + "sp-staking/std", + "sp-io/std", + "sp-std/std", + "pallet-session/std", + "pallet-balances/std", + "ghost-networks/std", +] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "sp-staking/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "ghost-networks/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "sp-runtime/try-runtime", + "pallet-session/try-runtime", + "pallet-balances/try-runtime", + "ghost-networks/try-runtime", +] diff --git a/pallets/slow-clap/src/benchmarking.rs b/pallets/slow-clap/src/benchmarking.rs new file mode 100644 index 0000000..581fd74 --- /dev/null +++ b/pallets/slow-clap/src/benchmarking.rs @@ -0,0 +1,205 @@ +#![cfg(feature = "runtime-benchmarks")] + +use super::*; +use frame_benchmarking::v1::*; + +use frame_system::RawOrigin; +use frame_support::traits::fungible::{Inspect, Mutate}; + +use crate::Pallet as SlowClap; + +const MAX_CLAPS: u32 = 100; +const MAX_COMPANIONS: u32 = 20; + +pub fn create_account() -> T::AccountId { + let account_bytes = Vec::from([1u8; 32]); + T::AccountId::decode(&mut &account_bytes[0..32]) + .expect("32 bytes always construct an AccountId32") +} + +pub fn create_companions( + total: usize, + network_id: NetworkIdOf, + user_account: T::AccountId, + fee: H256, + receiver: H160, +) -> Result { + T::NetworkDataHandler::register(network_id.into(), NetworkData { + chain_name: "Ethereum".into(), + default_endpoint: + "https://base-mainnet.core.chainstack.com/2fc1de7f08c0465f6a28e3c355e0cb14/".into(), + finality_delay: Some(0), + release_delay: Some(0), + network_type: Default::default(), + gatekeeper: b"0x1234567891234567891234567891234567891234".to_vec(), + topic_name: b"0x12345678912345678912345678912345678912345678912345678912345678".to_vec(), + incoming_fee: 0, + outgoing_fee: 0, + }).map_err(|_| BenchmarkError::Weightless)?; + + let mut last_companion_id = 0; + for _ in 0..total { + let minimum_balance = <::Currency>::minimum_balance(); + let balance = minimum_balance + minimum_balance; + let companion = Companion::, BalanceOf::> { + network_id: network_id.into(), receiver, + fee, amount: balance, + }; + + let _ = <::Currency>::mint_into(&user_account, balance); + let companion_id = SlowClap::::current_companion_id(); + let _ = SlowClap::::propose_companion( + RawOrigin::Signed(user_account.clone()).into(), + network_id, + companion, + )?; + last_companion_id = companion_id; + } + Ok(last_companion_id) +} + +pub fn create_claps(i: u32, j: u32) -> Result< + ( + Vec, BalanceOf>>, + ::Signature, + ), + &'static str, +> { + let minimum_balance = <::Currency>::minimum_balance(); + let amount = minimum_balance + minimum_balance; + let total_amount = amount.saturating_mul(j.into()); + let network_id = NetworkIdOf::::default(); + + let mut claps = Vec::new(); + let mut companions = BTreeMap::new(); + + let authorities = vec![T::AuthorityId::generate_pair(None)]; + let bounded_authorities = + WeakBoundedVec::<_, T::MaxAuthorities>::try_from(authorities.clone()) + .map_err(|()| "more than the maximum number of keys provided")?; + Authorities::::put(bounded_authorities); + + for index in 0..j { + companions.insert( + index.into(), + amount, + ); + } + + for _ in 0..i { + claps.push(Clap { + session_index: 1, + authority_index: 0, + network_id, + transaction_hash: H256::repeat_byte(1u8), + block_number: 69, + removed: true, + receiver: create_account::(), + amount: total_amount, + companions: companions.clone(), + }); + } + + let authority_id = authorities + .get(0usize) + .expect("first authority should exist"); + let encoded_claps = claps.encode(); + let signature = authority_id.sign(&encoded_claps) + .ok_or("couldn't make signature")?; + + Ok((claps, signature)) +} + +benchmarks! { + slow_clap { + let k in 1 .. MAX_CLAPS; + let j in 1 .. MAX_COMPANIONS; + + let receiver = H160::repeat_byte(69u8); + let fee = H256::repeat_byte(0u8); + let user_account: T::AccountId = whitelisted_caller(); + let network_id = <::NetworkDataHandler as NetworkDataBasicHandler>::NetworkId::default(); + + let (claps, signature) = create_claps::(k, j)?; + let _ = create_companions::(j as usize, network_id, user_account, fee, receiver)?; + }: _(RawOrigin::None, claps, signature) + verify { + let minimum_balance = <::Currency>::minimum_balance(); + let total_amount = (minimum_balance + minimum_balance).saturating_mul(j.into()); + } + + propose_companion { + let receiver = H160::repeat_byte(69u8); + let fee = H256::repeat_byte(0u8); + let user_account: T::AccountId = whitelisted_caller(); + let network_id = <::NetworkDataHandler as NetworkDataBasicHandler>::NetworkId::default(); + // T::NetworkDataHandler::register(network_id.into(), NetworkData { + // chain_name: "Ethereum".into(), + // // https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/ + // default_endpoint: + // "https://base-mainnet.core.chainstack.com/2fc1de7f08c0465f6a28e3c355e0cb14/".into(), + // finality_delay: Some(50), + // release_delay: Some(100), + // network_type: Default::default(), + // gatekeeper: b"0x1234567891234567891234567891234567891234".to_vec(), + // topic_name: b"0x12345678912345678912345678912345678912345678912345678912345678".to_vec(), + // incoming_fee: 0, + // outgoing_fee: 0, + // }).map_err(|_| BenchmarkError::Weightless)?; + let companion_id = create_companions::(1, network_id, user_account.clone(), fee, receiver)?; + let companion_id = SlowClap::::current_companion_id(); + let minimum_balance = <::Currency>::minimum_balance(); + let balance = minimum_balance + minimum_balance; + let companion = Companion::, BalanceOf::> { + network_id: network_id.into(), receiver, + fee, amount: balance, + }; + let _ = <::Currency>::mint_into(&user_account, balance); + assert_eq!(SlowClap::::current_companion_id(), companion_id); + }: _(RawOrigin::Signed(user_account), network_id.into(), companion) + verify { + assert_eq!(SlowClap::::current_companion_id(), companion_id + 1); + } + + release_companion { + let receiver = H160::repeat_byte(69u8); + let fee = H256::repeat_byte(0u8); + let user_account: T::AccountId = whitelisted_caller(); + let network_id = <::NetworkDataHandler as NetworkDataBasicHandler>::NetworkId::default(); + let companion_id = create_companions::(1, network_id, user_account.clone(), fee, receiver)?; + assert_eq!(SlowClap::::release_blocks(companion_id), BlockNumberFor::::default()); + }: _(RawOrigin::Signed(user_account), network_id.into(), companion_id) + verify { + assert_ne!(SlowClap::::release_blocks(companion_id), BlockNumberFor::::default()); + } + + kill_companion { + let receiver = H160::repeat_byte(69u8); + let fee = H256::repeat_byte(0u8); + let user_account: T::AccountId = whitelisted_caller(); + let network_id = <::NetworkDataHandler as NetworkDataBasicHandler>::NetworkId::default(); + let companion_id = create_companions::(1, network_id, user_account.clone(), fee, receiver)?; + SlowClap::::release_companion( + RawOrigin::Signed(user_account.clone()).into(), + network_id, + companion_id, + )?; + let block_shift = + <::NetworkDataHandler as NetworkDataInspectHandler>::get(&network_id) + .unwrap() + .release_delay + .unwrap(); + frame_system::Pallet::::set_block_number((block_shift + 1).saturated_into()); + }: _(RawOrigin::Signed(user_account), network_id.into(), companion_id) + verify { + assert_eq!(SlowClap::::companions(network_id, companion_id), None); + assert_eq!(SlowClap::::companion_details(companion_id), None); + assert_eq!(SlowClap::::current_companion_id(), companion_id + 1); + } + + impl_benchmark_test_suite!( + Pallet, + crate::mock::new_test_ext(), + crate::mock::Runtime, + ); +} diff --git a/pallets/slow-clap/src/lib.rs b/pallets/slow-clap/src/lib.rs new file mode 100755 index 0000000..baaabf5 --- /dev/null +++ b/pallets/slow-clap/src/lib.rs @@ -0,0 +1,1334 @@ +// Ensure we're `no_std` when compiling for Wasm. +#![cfg_attr(not(feature = "std"), no_std)] + +use codec::{Decode, Encode, MaxEncodedLen}; +use scale_info::TypeInfo; +use serde::{Deserializer, Deserialize}; + +pub use pallet::*; +use frame_support::{ + pallet_prelude::*, + traits::{ + tokens::{ + fungible::{Inspect, Mutate}, + Preservation, Precision, Fortitude, + }, + EstimateNextSessionRotation, ValidatorSet, ValidatorSetWithIdentification, + OneSessionHandler, Get, + }, + PalletId, BoundedSlice, BoundedVec, WeakBoundedVec, + +}; +use frame_system::{ + offchain::{SendTransactionTypes, SubmitTransaction}, + pallet_prelude::*, +}; + +use sp_core::{H160, H256}; +use sp_runtime::{ + traits::{ + TrailingZeroInput, Saturating, BlockNumberProvider, Convert, + AccountIdConversion, + }, + offchain as rt_offchain, + offchain::{ + HttpError, + storage::StorageValueRef, + storage_lock::{BlockAndTime, StorageLock}, + }, + RuntimeAppPublic, Perbill, RuntimeDebug, SaturatedConversion, +}; +use sp_std::{ + vec::Vec, prelude::*, + collections::btree_map::BTreeMap, +}; +use sp_staking::{ + offence::{Kind, Offence, ReportOffence}, + SessionIndex, +}; +use sp_io::hashing::keccak_256; + +use ghost_networks::{ + NetworkData, NetworkDataBasicHandler, NetworkDataInspectHandler, + NetworkDataMutateHandler, +}; + +pub mod weights; +pub use crate::weights::WeightInfo; +mod tests; +mod mock; +mod benchmarking; + +pub mod sr25519 { + mod app_sr25519 { + use sp_application_crypto::{app_crypto, sr25519, KeyTypeId}; + const SLOW_CLAP: KeyTypeId = KeyTypeId(*b"slow"); + app_crypto!(sr25519, SLOW_CLAP); + } + + sp_application_crypto::with_pair! { + /// A staking keypair sr25519 at its crypto. + pub type AuthorityPair = app_sr25519::Pair; + } + + /// A staking signature using sr25519 as its crypto. + pub type AuthoritySignature = app_sr25519::Signature; + /// A staking identifier using sr25519 as its crypto. + pub type AuthorityId = app_sr25519::Public; +} + +const LOG_TARGET: &str = "runtime::ghost-slow-clap"; +const DB_PREFIX: &[u8] = b"slow_clap::"; + +const FETCH_TIMEOUT_PERIOD: u64 = 3_000; +const LOCK_BLOCK_EXPIRATION: u32 = 5; +const LOCK_TIMEOUT_EXPIRATION: u64 = FETCH_TIMEOUT_PERIOD + 1_000; + +const PERCENT_DIVISOR: u32 = 4; +const COMPANIONS_LIMIT: usize = 20; + +pub type CompanionId = u128; +pub type AuthIndex = u32; + +#[derive(RuntimeDebug, Clone, PartialEq, Deserialize, Encode, Decode)] +struct EvmResponse { + #[serde(default)] + id: Option, + #[serde(default, deserialize_with = "de_string_to_bytes")] + jsonrpc: Option>, + #[serde(default, deserialize_with = "de_string_to_bytes")] + error: Option>, + #[serde(default)] + result: Option, +} + +#[derive(RuntimeDebug, Clone, PartialEq, Deserialize, Encode, Decode)] +#[serde(untagged)] +enum EvmResponseType { + #[serde(deserialize_with = "de_string_to_u64_pure")] + BlockNumber(u64), + TransactionLogs(Vec), +} + +#[derive(RuntimeDebug, Clone, Eq, PartialEq, Ord, PartialOrd, Deserialize, Encode, Decode)] +#[serde(rename_all = "camelCase")] +struct Log { + #[serde(default, deserialize_with = "de_string_to_h256")] + transaction_hash: Option, + #[serde(default, deserialize_with = "de_string_to_u64")] + block_number: Option, + #[serde(default, deserialize_with = "de_string_to_vec_of_bytes")] + topics: Vec>, + #[serde(default, deserialize_with = "de_string_to_bytes")] + address: Option>, + #[serde(default, deserialize_with = "de_string_to_btree_map")] + data: BTreeMap, + removed: bool, +} + +pub fn de_string_to_bytes<'de, D>(de: D) -> Result>, D::Error> +where D: Deserializer<'de> { + let s: &str = Deserialize::deserialize(de)?; + Ok(Some(s.as_bytes().to_vec())) +} + +pub fn de_string_to_u64<'de, D>(de: D) -> Result, D::Error> +where D: Deserializer<'de> { + let s: &str = Deserialize::deserialize(de)?; + let s = if s.starts_with("0x") { &s[2..] } else { &s }; + Ok(u64::from_str_radix(s, 16).ok()) +} + +pub fn de_string_to_u64_pure<'de, D>(de: D) -> Result +where D: Deserializer<'de> { + let s: &str = Deserialize::deserialize(de)?; + let s = if s.starts_with("0x") { &s[2..] } else { &s }; + Ok(u64::from_str_radix(s, 16).unwrap_or_default()) +} + +pub fn de_string_to_h256<'de, D>(de: D) -> Result, D::Error> +where D: Deserializer<'de> { + let s: &str = Deserialize::deserialize(de)?; + let start_index = if s.starts_with("0x") { 2 } else { 0 }; + let h256: Vec<_> = (start_index..s.len()) + .step_by(2) + .map(|i| u8::from_str_radix(&s[i..i+2], 16).expect("valid u8 symbol; qed")) + .collect(); + Ok(Some(H256::from_slice(&h256))) +} + +pub fn de_string_to_vec_of_bytes<'de, D>(de: D) -> Result>, D::Error> +where D: Deserializer<'de> { + let strings: Vec<&str> = Deserialize::deserialize(de)?; + Ok(strings + .iter() + .map(|s| { + let start_index = if s.starts_with("0x") { 2 } else { 0 }; + (start_index..s.len()) + .step_by(2) + .map(|i| u8::from_str_radix(&s[i..i+2], 16).expect("valid u8 symbol; qed")) + .collect::>() + }) + .collect::>>()) +} + +pub fn de_string_to_btree_map<'de, D>(de: D) -> Result, D::Error> +where D: Deserializer<'de> { + let s: &str = Deserialize::deserialize(de)?; + let start_index = if s.starts_with("0x") { 2 } else { 0 }; + Ok(BTreeMap::from_iter((start_index..s.len()) + .step_by(64) + .map(|i| ( + u128::from_str_radix(&s[i..i+32], 16).expect("valid u8 symbol; qed"), + u128::from_str_radix(&s[i+32..i+64], 16).expect("valid u8 symbol; qed"), + )))) +} + +#[derive(RuntimeDebug, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, TypeInfo, MaxEncodedLen)] +pub struct Clap { + pub session_index: SessionIndex, + pub authority_index: AuthIndex, + pub transaction_hash: H256, + pub block_number: u64, + pub removed: bool, + pub network_id: NetworkId, + pub receiver: AccountId, + pub amount: Balance, + pub companions: BTreeMap, +} + +#[derive(Encode, Decode, Clone, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)] +pub struct Companion { + pub network_id: NetworkId, + pub receiver: H160, + pub amount: Balance, +} + +#[derive(Encode, Decode, Clone, PartialEq, RuntimeDebug, MaxEncodedLen, TypeInfo)] +pub struct SessionAuthorityInfo { + pub actions: u32, + pub disabled: bool, +} + +#[cfg_attr(test, derive(PartialEq))] +enum OffchainErr { + FailedSigning, + FailedToAcquireLock(NetworkId), + SubmitTransaction, + HttpJsonParsingError, + HttpBytesParsingError, + HttpRequestError(HttpError), + RequestUncompleted, + HttpResponseNotOk(u16), + ErrorInEvmResponse, + NoEvmLogsFound(NetworkId), + OnlyPendingEvmLogs(NetworkId), +} + +impl core::fmt::Debug for OffchainErr { + fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result { + match *self { + OffchainErr::FailedSigning => write!(fmt, "Failed to sign clap."), + OffchainErr::FailedToAcquireLock(ref network_id) => write!(fmt, "Failed to acquire lock for network #{:?}.", network_id), + OffchainErr::SubmitTransaction => write!(fmt, "Failed to submit transaction."), + OffchainErr::HttpJsonParsingError => write!(fmt, "Failed to parse evm response as JSON."), + OffchainErr::HttpBytesParsingError => write!(fmt, "Failed to parse evm response as bytes."), + OffchainErr::HttpRequestError(http_error) => match http_error { + HttpError::DeadlineReached => write!(fmt, "Requested action couldn't been completed within a deadline."), + HttpError::IoError => write!(fmt, "There was an IO error while processing the request."), + HttpError::Invalid => write!(fmt, "The ID of the request is invalid in this context"), + }, + OffchainErr::RequestUncompleted => write!(fmt, "Failed to complete request."), + OffchainErr::HttpResponseNotOk(code) => write!(fmt, "Http response returned code {:?}", code), + OffchainErr::ErrorInEvmResponse => write!(fmt, "Error in evm reponse."), + OffchainErr::NoEvmLogsFound(ref network_id) => write!(fmt, "No incoming evm logs for network #{:?}.", network_id), + OffchainErr::OnlyPendingEvmLogs(ref network_id) => write!(fmt, "Only pending evm logs for network #{:?}.", network_id), + } + } +} + +pub type NetworkIdOf = + <::NetworkDataHandler as NetworkDataBasicHandler>::NetworkId; + +pub type BalanceOf = <::Currency as Inspect< + ::AccountId, +>>::Balance; + +pub type ValidatorId = <::ValidatorSet as ValidatorSet< + ::AccountId, +>>::ValidatorId; + +pub type IdentificationTuple = ( + ValidatorId, + <::ValidatorSet as ValidatorSetWithIdentification< + ::AccountId, + >>::Identification, +); + +type OffchainResult = Result>>; + +#[frame_support::pallet] +pub mod pallet { + use super::*; + + /// The current storage version. + const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + + #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] + #[pallet::without_storage_info] + pub struct Pallet(_); + + #[pallet::config] + pub trait Config: SendTransactionTypes> + frame_system::Config { + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + type AuthorityId: Member + + Parameter + + RuntimeAppPublic + + Ord + + MaybeSerializeDeserialize + + MaxEncodedLen; + + type NextSessionRotation: EstimateNextSessionRotation>; + type ValidatorSet: ValidatorSetWithIdentification; + type Currency: Inspect + Mutate; + type NetworkDataHandler: NetworkDataBasicHandler + + NetworkDataInspectHandler + + NetworkDataMutateHandler; + type BlockNumberProvider: BlockNumberProvider>; + type ReportUnresponsiveness: ReportOffence< + Self::AccountId, + IdentificationTuple, + ThrottlingOffence>, + >; + + #[pallet::constant] + type MaxAuthorities: Get; + + #[pallet::constant] + type MaxAuthorityInfoInSession: Get; + + #[pallet::constant] + type MaxNumberOfClaps: Get; + + #[pallet::constant] + type ApplauseThreshold: Get; + + #[pallet::constant] + type OffenceThreshold: Get; + + #[pallet::constant] + type UnsignedPriority: Get; + + #[pallet::constant] + type TreasuryPalletId: Get; + + type WeightInfo: WeightInfo; + } + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + AllGood, + SomeTrottling { throttling: Vec> }, + Clapped { + authority_id: T::AuthorityId, + network_id: NetworkIdOf, + clap_hash: H256, + transaction_hash: H256, + receiver: T::AccountId, + amount: BalanceOf, + }, + Applaused { + network_id: NetworkIdOf, + receiver: T::AccountId, + received_amount: BalanceOf, + number_of_companions: u32, + }, + CompanionCreated { + companion_id: CompanionId, + owner: T::AccountId, + companion: Companion, BalanceOf>, + }, + CompanionReleased { + network_id: NetworkIdOf, + companion_id: CompanionId, + who: T::AccountId, + release_block: BlockNumberFor, + }, + CompanionKilled { + network_id: NetworkIdOf, + who: T::AccountId, + companion_id: CompanionId, + freed_balance: BalanceOf, + }, + } + + #[pallet::error] + pub enum Error { + NotAnAuthority, + CurrentValidatorIsDisabled, + CouldNotHashCompanions, + AlreadyClapped, + CompanionAlreadyRegistered, + CompanionDetailsAlreadyRegistered, + CompanionDetailsNotRegistered, + CompanionAmountNotExistent, + CompanionAmountUnderflow, + NoMoreCompanions, + NotValidCompanion, + NonRegisteredNetwork, + ReleaseTimeHasNotCome, + } + + #[pallet::storage] + #[pallet::getter(fn received_claps)] + pub(super) type ReceivedClaps = StorageDoubleMap< + _, + Twox64Concat, + H256, + Twox64Concat, + T::AuthorityId, + bool, + ValueQuery + >; + + #[pallet::storage] + #[pallet::getter(fn applauses_for_transaction)] + pub(super) type ApplausesForTransaction = StorageMap< + _, + Twox64Concat, + H256, + bool, + ValueQuery + >; + + #[pallet::storage] + #[pallet::getter(fn authorities_claps)] + pub(super) type AuthoritiesClaps = StorageDoubleMap< + _, + Twox64Concat, + T::AuthorityId, + Twox64Concat, + H256, + bool, + ValueQuery, + >; + + #[pallet::storage] + #[pallet::getter(fn authority_info_in_session)] + pub(super) type AuthorityInfoInSession = StorageMap< + _, + Twox64Concat, + SessionIndex, + BoundedVec, + ValueQuery, + >; + + #[pallet::storage] + #[pallet::getter(fn companions)] + pub(super) type Companions = StorageDoubleMap< + _, + Twox64Concat, + NetworkIdOf, + Twox64Concat, + CompanionId, + T::AccountId, + OptionQuery, + >; + + + #[pallet::storage] + #[pallet::getter(fn companion_details)] + pub(super) type CompanionDetails = StorageMap< + _, + Twox64Concat, + CompanionId, + Companion, BalanceOf>, + OptionQuery, + >; + + #[pallet::storage] + #[pallet::getter(fn release_blocks)] + pub(super) type ReleaseBlocks = StorageMap< + _, + Twox64Concat, + CompanionId, + BlockNumberFor, + ValueQuery, + >; + + #[pallet::storage] + #[pallet::getter(fn current_companion_id)] + pub(super) type CurrentCompanionId = + StorageValue<_, CompanionId, ValueQuery>; + + #[pallet::storage] + #[pallet::getter(fn keys)] + pub(super) type Authorities = + StorageValue<_, WeakBoundedVec, ValueQuery>; + + #[pallet::genesis_config] + #[derive(frame_support::DefaultNoBound)] + pub struct GenesisConfig { + pub keys: Vec, + } + + #[pallet::genesis_build] + impl BuildGenesisConfig for GenesisConfig { + fn build(&self) { + Pallet::::initialize_authorities(&self.keys); + Pallet::::restart_clap_round(1, self.keys.len()); + } + } + + #[pallet::call] + impl Pallet { + #[pallet::call_index(0)] + #[pallet::weight(( + T::WeightInfo::slow_clap( + claps.len() as u32, + claps.iter().fold(0u32, |acc, c| { + acc + c.companions.len() as u32 + }) + ), + frame_support::dispatch::Pays::No, + ))] + pub fn slow_clap( + origin: OriginFor, + claps: Vec, BalanceOf>>, + // since signature verification is done in `validate_unsigned` + // we can skip doing it here again. + _signature: ::Signature, + ) -> DispatchResult { + ensure_none(origin)?; + Self::clap_if_possible(claps)?; + Ok(()) + } + + #[pallet::call_index(1)] + #[pallet::weight(T::WeightInfo::propose_companion())] + pub fn propose_companion( + origin: OriginFor, + network_id: NetworkIdOf, + companion: Companion, BalanceOf>, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + let companion_id = CurrentCompanionId::::get(); + + ensure!(companion.amount > T::Currency::minimum_balance(), + Error::::CompanionAmountNotExistent); + ensure!(T::NetworkDataHandler::get(&network_id).is_some(), + Error::::NonRegisteredNetwork); + + T::Currency::burn_from( + &who, + companion.amount, + Preservation::Expendable, + Precision::Exact, + Fortitude::Force, + )?; + + Companions::::set(network_id, companion_id, Some(who.clone())); + CompanionDetails::::set(companion_id, Some(companion.clone())); + CurrentCompanionId::::set(companion_id + .checked_add(1) + .ok_or(Error::::NoMoreCompanions)?); + + Self::deposit_event(Event::::CompanionCreated { + companion_id, + owner: who, + companion, + }); + + Ok(()) + } + + #[pallet::call_index(2)] + #[pallet::weight(T::WeightInfo::release_companion())] + pub fn release_companion( + origin: OriginFor, + network_id: NetworkIdOf, + companion_id: CompanionId, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + + let owner = Companions::::get(network_id, companion_id); + let network = T::NetworkDataHandler::get(&network_id); + + ensure!(owner.is_some_and(|o| o == who), Error::::NotValidCompanion); + ensure!(CompanionDetails::::get(companion_id).is_some(), + Error::::CompanionDetailsNotRegistered); + + let offset = T::BlockNumberProvider::current_block_number() + + network + .ok_or(Error::::NonRegisteredNetwork)? + .release_delay + .unwrap_or_default() + .saturated_into::>(); + + ReleaseBlocks::::set(companion_id, offset); + + Self::deposit_event(Event::::CompanionReleased { + network_id, + companion_id, + who, + release_block: offset, + }); + + Ok(()) + } + + #[pallet::call_index(3)] + #[pallet::weight(T::WeightInfo::kill_companion())] + pub fn kill_companion( + origin: OriginFor, + network_id: NetworkIdOf, + companion_id: CompanionId, + ) -> DispatchResult { + let who = ensure_signed(origin)?; + + ensure!(ReleaseBlocks::::get(companion_id) <= + T::BlockNumberProvider::current_block_number(), + Error::::ReleaseTimeHasNotCome); + + ensure!(Companions::::get(network_id, companion_id).is_some_and(|o| o == who), + Error::::NotValidCompanion); + + let companion = CompanionDetails::::get(companion_id) + .ok_or(Error::::CompanionDetailsNotRegistered)?; + + Companions::::remove(network_id, companion_id); + CompanionDetails::::remove(companion_id); + + T::Currency::mint_into(&who, companion.amount)?; + + Self::deposit_event(Event::::CompanionKilled { + network_id, + who, + companion_id, + freed_balance: companion.amount, + }); + + Ok(()) + } + } + + #[pallet::hooks] + impl Hooks> for Pallet { + fn offchain_worker(now: BlockNumberFor) { + // Only send messages of we are a potential validator. + if sp_io::offchain::is_validator() { + let networks_len = T::NetworkDataHandler::iter().count(); + if networks_len == 0 { + log::info!( + target: LOG_TARGET, + "👏 Skipping slow clap at {:?}: no evm networks", + now, + ); + } else { + for result in Self::start_slow_clapping(now, networks_len).into_iter().flatten() { + if let Err(e) = result { + log::debug!( + target: LOG_TARGET, + "👏 Skipping slow clap at {:?}: {:?}", + now, + e, + ); + } + } + } + } else { + log::info!( + target: LOG_TARGET, + "🤥 Not a validator, skipping slow clap at {:?}.", + now, + ); + } + } + } + + #[pallet::validate_unsigned] + impl ValidateUnsigned for Pallet { + type Call = Call; + + fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity { + if let Call::slow_clap { claps, signature } = call { + if claps.is_empty() || claps.len() > T::MaxNumberOfClaps::get() as usize { + return InvalidTransaction::BadProof.into(); + } + + if claps + .iter() + .fold(0usize, |max_len, c| { + usize::max(max_len, c.companions.len()) + }) > COMPANIONS_LIMIT { + return InvalidTransaction::BadProof.into(); + } + + let authority_index = match &claps[..] { + [head, tail @ ..] => tail + .iter() + .all(|x| x.authority_index == head.authority_index) + .then(|| head.authority_index), + _ => None, + }; + + if authority_index.is_none() { + return InvalidTransaction::BadProof.into(); + } + + let authority_index = authority_index + .expect("authority index info already checked; qed"); + + let authorities = Authorities::::get(); + let authority = match authorities.get(authority_index as usize) { + Some(id) => id, + None => return InvalidTransaction::BadProof.into(), + }; + + let signature_valid = claps.using_encoded(|encoded_claps| { + authority.verify(&encoded_claps, signature) + }); + + if !signature_valid { + return InvalidTransaction::BadProof.into(); + } + + ValidTransaction::with_tag_prefix("SlowClap") + .priority(T::UnsignedPriority::get()) + .and_provides(authority) + .longevity(LOCK_BLOCK_EXPIRATION.saturated_into::()) + .propagate(true) + .build() + } else { + InvalidTransaction::Call.into() + } + } + } +} + +impl Pallet { + fn treasury_account_id() -> T::AccountId { + T::TreasuryPalletId::get().into_account_truncating() + } + + fn clap_if_possible( + claps: Vec, BalanceOf>>, + ) -> DispatchResult { + let current_authorities = Authorities::::get(); + for clap in claps.iter() { + let Ok(mut clap_str) = serde_json::to_vec(&clap.companions) else { + continue; + }; + clap_str.extend(clap.transaction_hash.to_fixed_bytes()); + clap_str.extend(clap.network_id.encode()); + let clap_hash = H256::from_slice(&keccak_256(&clap_str)[..]); + + let Some(public) = current_authorities.get(clap.authority_index as usize) else { + continue; + }; + + + let mut claps_in_session = AuthorityInfoInSession::::get(&clap.session_index); + if let Some(_) = claps_in_session.get(clap.authority_index as usize) { + if claps_in_session[clap.authority_index as usize].disabled { + continue; + } + + let received_clap = ReceivedClaps::::get(&clap_hash, &public); + match (received_clap, clap.removed) { + (true, false) => ReceivedClaps::::set(&clap_hash, &public, false), + (false, true) => ReceivedClaps::::set(&clap_hash, &public, true), + _ => continue, + } + + claps_in_session[clap.authority_index as usize].actions.saturating_inc(); + AuthorityInfoInSession::::set(&clap.session_index, claps_in_session); + + Self::deposit_event(Event::::Clapped { + authority_id: public.clone(), + network_id: clap.network_id, + clap_hash, + transaction_hash: clap.transaction_hash, + receiver: clap.receiver.clone(), + amount: clap.amount, + }); + } + + Self::applause_if_possible(clap_hash, &clap, current_authorities.clone())?; + } + + Ok(()) + } + + fn applause_if_possible( + clap_hash: H256, + clap: &Clap, BalanceOf>, + current_authorities: WeakBoundedVec, + ) -> DispatchResult { + if !ApplausesForTransaction::::get(&clap_hash) { + let clappers_len = ReceivedClaps::::iter_prefix(&clap_hash) + .filter(|(authority, yes_vote)| current_authorities.contains(authority) && *yes_vote) + .count(); + + let enough_authorities = Perbill::from_rational( + clappers_len as u32, + current_authorities.len() as u32, + ) > Perbill::from_percent(T::ApplauseThreshold::get()); + + if enough_authorities { + Self::reward_companions( + clap.network_id, + clap.receiver.clone(), + clap.amount, + clap.companions.clone(), + )?; + } + } + + Ok(()) + } + + fn reward_companions( + network_id: NetworkIdOf, + receiver: T::AccountId, + amount: BalanceOf, + companions: BTreeMap>, + ) -> DispatchResult { + let mut final_bridge_amount = amount; + let mut number_of_companions: u32 = 0; + + let existential_balance = T::Currency::minimum_balance(); + + for (companion_id, companion_amount) in companions.iter() { + if final_bridge_amount < existential_balance { break; } + number_of_companions.saturating_inc(); + CompanionDetails::::mutate(companion_id, |maybe_stored_companion| { + match maybe_stored_companion { + Some(stored_companion) if (stored_companion.amount >= *companion_amount) => { + stored_companion.amount = stored_companion + .amount + .saturating_sub(*companion_amount); + if stored_companion.amount > existential_balance { + *maybe_stored_companion = Some(stored_companion.clone()); + } else { + *maybe_stored_companion = None; + } + }, + _ => { + final_bridge_amount = final_bridge_amount + .saturating_sub(*companion_amount); + }, + } + }); + } + + let incoming_fee = match T::NetworkDataHandler::get(&network_id) { + Some(network_data) => network_data.incoming_fee, + None => 0, + }; + + let gatekeeper_fees = Perbill::from_parts(incoming_fee) + .mul_floor(final_bridge_amount); + + let final_bridge_amount = final_bridge_amount + .saturating_sub(gatekeeper_fees); + + if gatekeeper_fees >= existential_balance { + T::Currency::mint_into( + &Self::treasury_account_id(), + gatekeeper_fees, + )?; + } + + if final_bridge_amount >= existential_balance { + T::Currency::mint_into( + &receiver, + final_bridge_amount, + )?; + } + + Self::deposit_event(Event::::Applaused { + network_id, + receiver, + received_amount: final_bridge_amount, + number_of_companions, + }); + + Ok(()) + } + + fn create_key(first: Vec, second: Vec) -> Vec { + let mut key = DB_PREFIX.to_vec(); + key.extend(first); + key.extend(second); + key + } + + fn start_slow_clapping( + block_number: BlockNumberFor, + networks_len: usize, + ) -> OffchainResult>> { + let session_index = T::ValidatorSet::session_index(); + let index = block_number.into().as_u128() % networks_len as u128; + let network_in_use = T::NetworkDataHandler::iter() + .nth(index as usize) + .expect("network should exist; qed"); + + let network_id = network_in_use.0; + let gatekeeper = network_in_use.1.gatekeeper; + let topic_name = network_in_use.1.topic_name; + + let key = Self::create_key(network_id.encode(), b"endpoint".to_vec()); + let rpc_endpoint = match StorageValueRef::persistent(&key).get() { + Ok(Some(endpoint)) => endpoint, + _ => network_in_use.1.default_endpoint, + }; + + let finality_delay = + network_in_use.1.finality_delay.unwrap_or(1u64); + + Ok(Self::local_authorities().map(move |(authority_index, authority_key)| { + Self::do_evm_claps_or_save_block( + authority_index, + authority_key, + session_index, + network_id, + finality_delay, + gatekeeper.clone(), + topic_name.clone(), + rpc_endpoint.clone(), + ) + })) + } + + fn do_evm_claps_or_save_block( + authority_index: AuthIndex, + authority_key: T::AuthorityId, + session_index: SessionIndex, + network_id: NetworkIdOf, + finality_delay: u64, + gatekeeper: Vec, + topic_name: Vec, + rpc_endpoint: Vec, + ) -> OffchainResult { + let key = Self::create_key(network_id.encode(), b"lock".to_vec()); + let mut network_lock = StorageLock::>::with_block_and_time_deadline( + &key, + LOCK_BLOCK_EXPIRATION, + rt_offchain::Duration::from_millis(LOCK_TIMEOUT_EXPIRATION), + ); + + network_lock + .try_lock() + .map_err(|_| OffchainErr::FailedToAcquireLock(network_id))? + .forget(); + + let key = Self::create_key(network_id.encode(), b"block".to_vec()); + let mut evm_block_info = StorageValueRef::persistent(&key); + let evm_block: Option = match evm_block_info.get() { + Ok(option_block) => option_block, + _ => None, + }; + + let evm_response = Self::fetch_and_parse( + evm_block, finality_delay, + gatekeeper, topic_name, rpc_endpoint + )?; + + match evm_response { + EvmResponseType::BlockNumber(evm_block) => { + let deviation = Self::random_u64_deviation(finality_delay); + let evm_start_block = evm_block.saturating_sub(deviation); + evm_block_info.set(&evm_start_block); + log::info!( + target: LOG_TARGET, + "🧐 New evm block #{:?} found for {:?} network", + evm_start_block, + network_id, + ); + }, + EvmResponseType::TransactionLogs(evm_logs) => { + if evm_logs.is_empty() { + return Err(OffchainErr::NoEvmLogsFound(network_id).into()); + } + + let evm_logs: Vec<_> = evm_logs + .iter() + .filter(|log| { + log.block_number.is_some() && + log.transaction_hash.is_some() && + log.topics.len() == 3 && + log.data.len() <= COMPANIONS_LIMIT + }) + .collect(); + + if evm_logs.is_empty() { + return Err(OffchainErr::OnlyPendingEvmLogs(network_id)); + } + + log::info!( + target: LOG_TARGET, + "🧐 {:?} evm logs found for network #{:?}", + evm_logs.len(), + network_id, + ); + + let mut claps: Vec<_> = evm_logs + .iter() + .map(|log| Clap { + authority_index, + session_index, + network_id, + removed: log.removed, + receiver: T::AccountId::decode(&mut &log.topics[1][0..32]) + .expect("32 bytes always construct an AccountId32"), + amount: u128::from_be_bytes(log.topics[2][16..32] + .try_into() + .expect("amount is valid hex; qed")) + .saturated_into::>(), + companions: log + .data + .clone() + .into_iter() + .map(|(key, value)| ( + key.saturated_into::(), + value.saturated_into::>(), + )) + .collect(), + transaction_hash: log + .transaction_hash + .clone() + .expect("tx hash exists; qed"), + block_number: log + .block_number + .expect("block number exists; qed"), + }) + .collect(); + + claps.sort_by(|a, b| a.block_number.cmp(&b.block_number)); + + let maximum_claps = T::MaxNumberOfClaps::get() as usize; + claps.truncate(maximum_claps); + match claps.get(maximum_claps) { + Some(last_clap) => { + evm_block_info.set(&last_clap.block_number); + log::info!( + target: LOG_TARGET, + "🧐 New evm block #{:?} found for {:?} network", + last_clap.block_number, + network_id, + ); + }, + None => evm_block_info.clear(), + } + + let signature = authority_key.sign(&claps.encode()) + .ok_or(OffchainErr::FailedSigning)?; + let call = Call::slow_clap { claps, signature }; + + SubmitTransaction::>::submit_unsigned_transaction(call.into()) + .map_err(|_| OffchainErr::SubmitTransaction)?; + } + } + Ok(()) + } + + fn random_u64_deviation(original: u64) -> u64 { + let seed = sp_io::offchain::random_seed(); + let random = ::decode(&mut TrailingZeroInput::new(seed.as_ref())) + .expect("input is padded with zeroes; qed"); + + let maximum = Perbill::one() + .saturating_div( + Perbill::from_parts(PERCENT_DIVISOR), + sp_runtime::Rounding::Down, + ) + .deconstruct(); + + let random = Perbill::from_parts(random % maximum); + original.saturating_add(random.mul_ceil(original)) + } + + fn local_authorities() -> impl Iterator { + let authorities = Authorities::::get(); + let mut local_authorities = T::AuthorityId::all(); + local_authorities.sort(); + authorities.into_iter().enumerate().filter_map(move |(index, authority)| { + local_authorities + .binary_search(&authority) + .ok() + .map(|location| (index as u32, local_authorities[location].clone())) + }) + } + + fn fetch_from_remote( + rpc_endpoint: Vec, + request_body: Vec, + ) -> OffchainResult> { + let rpc_str = core::str::from_utf8(&rpc_endpoint) + .expect("rpc endpoint valid str; qed"); + + let body_str = core::str::from_utf8(&request_body) + .expect("request body valid str: qed"); + + let deadline = sp_io::offchain::timestamp() + .add(rt_offchain::Duration::from_millis(FETCH_TIMEOUT_PERIOD)); + + let pending = rt_offchain::http::Request::post(&rpc_str, vec![body_str]) + .add_header("ACCEPT", "APPLICATION/JSON") + .add_header("CONTENT-TYPE", "APPLICATION/JSON") + .deadline(deadline) + .send() + .map_err(|err| OffchainErr::HttpRequestError(err))?; + + let response = pending + .try_wait(deadline) + .map_err(|_| OffchainErr::RequestUncompleted)? + .map_err(|_| OffchainErr::RequestUncompleted)?; + + if response.code != 200 { + return Err(OffchainErr::HttpResponseNotOk(response.code)) + } + + Ok(response.body().collect::>()) + } + + fn prepare_request_body( + maybe_block: Option, + finality_delay: u64, + gatekeeper: Vec, + topic_name: Vec, + ) -> Vec { + match maybe_block { + Some(to_block) => { + let from_block: u64 = to_block.saturating_sub(finality_delay); + let convert_number_to_hex_vector = |value: u64| -> Vec { + let mut r = Vec::new(); + let mut value = value; + loop { + r.push((value % 10 + 48) as u8); + value /= 10; + if value == 0 { break; } + } + r.reverse(); + r + }; + + let mut body = b"{\"id\":0,\"jsonrpc\":\"2.0\",\"method\":\"eth_getLogs\",\"params\":[{".to_vec(); + body.extend(b"\"fromBlock\":".to_vec()); + body.extend(convert_number_to_hex_vector(from_block)); + body.extend(b",\"toBlock\":".to_vec()); + body.extend(convert_number_to_hex_vector(to_block)); + body.extend(b",\"address\":\"".to_vec()); + body.extend(gatekeeper); + body.extend(b"\",\"topics\":[\"".to_vec()); + body.extend(topic_name); + body.extend(b"\"]}]}".to_vec()); + body + }, + None => b"{\"id\":0,\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\"}".to_vec() + }.to_vec() + } + + fn fetch_and_parse( + evm_block: Option, + finality_delay: u64, + gatekeeper: Vec, + topic_name: Vec, + rpc_endpoint: Vec, + ) -> OffchainResult { + let request_body = Self::prepare_request_body( + evm_block, finality_delay, gatekeeper, topic_name); + + let resp_bytes = Self::fetch_from_remote(rpc_endpoint, request_body)?; + + let resp_str = sp_std::str::from_utf8(&resp_bytes) + .map_err(|_| OffchainErr::HttpBytesParsingError)?; + + let result: EvmResponse = serde_json::from_str(&resp_str) + .map_err(|_| OffchainErr::HttpJsonParsingError)?; + + if result.error.is_some() { + return Err(OffchainErr::ErrorInEvmResponse); + } + + Ok(result.result.ok_or(OffchainErr::ErrorInEvmResponse)?) + } + + fn is_good_actor( + authority_index: usize, + session_index: SessionIndex, + average_claps: u32, + ) -> bool { + let claps_in_session = AuthorityInfoInSession::::get(session_index); + match claps_in_session.get(authority_index) { + Some(clap_in_session) => { + let number_of_claps = &clap_in_session.actions; + let authority_deviation = if *number_of_claps < average_claps { + Perbill::from_rational(*number_of_claps, average_claps) + } else { Perbill::from_rational(average_claps, *number_of_claps) }; + authority_deviation < Perbill::from_percent(T::OffenceThreshold::get()) + }, + _ => false, + } + } + + fn initialize_authorities(authorities: &[T::AuthorityId]) { + if !authorities.is_empty() { + assert!(Authorities::::get().is_empty(), "Authorities are already initilized!"); + let bounded_authorities = BoundedSlice::<'_, _, T::MaxAuthorities>::try_from(authorities) + .expect("more than the maximum number of clappers"); + Authorities::::put(bounded_authorities); + } + } + + fn restart_clap_round(session_index: SessionIndex, length: usize) { + let empty_authority_info = SessionAuthorityInfo { + actions: 0u32, + disabled: false, + }; + let empty_authorities_vec = + BoundedVec::::try_from( + vec![empty_authority_info; length]) + .expect("authorities length should be correct"); + AuthorityInfoInSession::::set(session_index, empty_authorities_vec); + } + + // #[cfg(test)] + // fn set_authorities(authorities: Vec) { + // let bounded_authorities = WeakBoundedVec::<_, T::MaxAuthorities>::try_from(authorities) + // .expect("more than the maximum number of clappers"); + // Authorities::::put(&bounded_authorities); + // Self::restart_clap_round(T::ValidatorSet::session_index(), bounded_authorities.len()); + // } +} + +impl sp_runtime::BoundToRuntimeAppPublic for Pallet { + type Public = T::AuthorityId; +} + +impl BlockNumberProvider for Pallet { + type BlockNumber = BlockNumberFor; + fn current_block_number() -> Self::BlockNumber { + T::BlockNumberProvider::current_block_number() + } +} + +impl OneSessionHandler for Pallet { + type Key = T::AuthorityId; + + fn on_genesis_session<'a, I: 'a>(validators: I) + where + I: Iterator, + { + let authorities = validators.map(|x| x.1).collect::>(); + Self::initialize_authorities(&authorities); + Self::restart_clap_round(1, authorities.len()); + } + + fn on_new_session<'a, I: 'a>(_changed: bool, validators: I, _queued_validators: I) + where + I: Iterator, + { + let authorities = validators.map(|x| x.1).collect::>(); + let bounded_authorities = WeakBoundedVec::<_, T::MaxAuthorities>::force_from( + authorities, + Some( + "Warning: The session has more authorities than expected. \ + A runtime configuration adjustment may be needed.", + ), + ); + let bounded_authorities_len = (&bounded_authorities).len(); + Authorities::::put(bounded_authorities); + Self::restart_clap_round(T::ValidatorSet::session_index(), bounded_authorities_len); + } + + fn on_before_session_ending() { + let session_index = T::ValidatorSet::session_index(); + let validators = T::ValidatorSet::validators(); + let authorities = Authorities::::get(); + let claps_in_session = AuthorityInfoInSession::::get(session_index); + + let average_claps = claps_in_session + .iter() + .filter(|x| !x.disabled) + .fold(0u32, |acc, x| acc + x.actions) + .checked_div(claps_in_session.len() as u32) + .unwrap_or_default(); + + let offenders = validators + .into_iter() + .enumerate() + .filter(|(index, _)| !Self::is_good_actor(*index, session_index, average_claps)) + .filter_map(|(_, id)| { + >::IdentificationOf::convert( + id.clone(), + ).map(|full_id| (id, full_id)) + }) + .collect::>>(); + + if offenders.is_empty() { + Self::deposit_event(Event::::AllGood); + } else { + Self::deposit_event(Event::::SomeTrottling { throttling: offenders.clone() }); + + let validator_set_count = authorities.len() as u32; + let offence = ThrottlingOffence { session_index, validator_set_count, offenders }; + if let Err(e) = T::ReportUnresponsiveness::report_offence(vec![], offence) { + sp_runtime::print(e) + } + } + } + + fn on_disabled(validator_index: u32) { + let session_index = T::ValidatorSet::session_index(); + let mut claps_in_session = AuthorityInfoInSession::::get(&session_index); + if let Some(_) = claps_in_session.get(validator_index as usize) { + claps_in_session[validator_index as usize].disabled = true; + AuthorityInfoInSession::::set(&session_index, claps_in_session); + } + } +} + +#[derive(RuntimeDebug, TypeInfo)] +#[cfg_attr(feature = "std", derive(Clone, PartialEq, Eq))] +pub struct ThrottlingOffence { + /// Current session index in which we report the unresponsive validators. + pub session_index: SessionIndex, + /// The size pf the validator set in current session. + pub validator_set_count: u32, + /// Authorities that were unresponsive during the current session. + pub offenders: Vec +} + +impl Offence for ThrottlingOffence { + const ID: Kind = *b"slow-clap:throtl"; + type TimeSlot = SessionIndex; + + fn offenders(&self) -> Vec { + self.offenders.clone() + } + + fn session_index(&self) -> SessionIndex { + self.session_index + } + + fn validator_set_count(&self) -> u32 { + self.validator_set_count + } + + fn time_slot(&self) -> Self::TimeSlot { + self.session_index + } + + fn slash_fraction(&self, offenders_count: u32) -> Perbill { + if let Some(threshold) = offenders_count.checked_sub(self.validator_set_count / 10 + 1) { + let x = Perbill::from_rational(3 * threshold, self.validator_set_count); + x.saturating_mul(Perbill::from_percent(7)) + } else { + Perbill::default() + } + } +} diff --git a/pallets/slow-clap/src/mock.rs b/pallets/slow-clap/src/mock.rs new file mode 100644 index 0000000..d9a99bc --- /dev/null +++ b/pallets/slow-clap/src/mock.rs @@ -0,0 +1,253 @@ +#![cfg(test)] + +use frame_support::{ + derive_impl, parameter_types, + traits::{ConstU32, ConstU64}, + weights::Weight, + PalletId, +}; +use frame_system::EnsureRoot; +use pallet_session::historical as pallet_session_historical; +use sp_runtime::{ + testing::{TestXt, UintAuthorityId}, + traits::ConvertInto, + BuildStorage, Permill, +}; +use sp_staking::{ + offence::{OffenceError, ReportOffence}, + SessionIndex, +}; + +use crate as slow_clap; +use crate::Config; + +type Block = frame_system::mocking::MockBlock; + +frame_support::construct_runtime!( + pub enum Runtime { + System: frame_system, + Session: pallet_session, + Historical: pallet_session_historical, + Balances: pallet_balances, + Networks: ghost_networks, + SlowClap: slow_clap, + } +); + +parameter_types! { + pub static Validators: Option> = Some(vec![ + 1, + 2, + 3, + ]); +} + +pub struct TestSessionManager; +impl pallet_session::SessionManager for TestSessionManager { + fn new_session(_new_index: SessionIndex) -> Option> { + Validators::mutate(|l| l.take()) + } + fn end_session(_: SessionIndex) {} + fn start_session(_: SessionIndex) {} +} + +impl pallet_session::historical::SessionManager for TestSessionManager { + fn new_session(_new_index: SessionIndex) -> Option> { + Validators::mutate(|l| l + .take() + .map(|validators| validators + .iter() + .map(|v| (*v, *v)) + .collect()) + ) + } + fn end_session(_: SessionIndex) {} + fn start_session(_: SessionIndex) {} +} + +type IdentificationTuple = (u64, u64); +type Offence = crate::ThrottlingOffence; + +parameter_types! { + pub static Offences: Vec<(Vec, Offence)> = vec![]; +} + +pub struct OffenceHandler; +impl ReportOffence for OffenceHandler { + fn report_offence(reporters: Vec, offence: Offence) -> Result<(), OffenceError> { + Offences::mutate(|l| l.push((reporters, offence))); + Ok(()) + } + + fn is_known_offence(_offenders: &[IdentificationTuple], _time_slot: &SessionIndex) -> bool { + false + } +} + +pub fn alice_account_id() -> ::AccountId { 69 } +pub fn eve_account_id() -> ::AccountId { 1337 } + +pub fn new_test_ext() -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::::default() + .build_storage() + .unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![ (alice_account_id(), 100) ], + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut result = sp_io::TestExternalities::new(t); + + result.execute_with(|| { + System::set_block_number(1); + }); + + result +} + +#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] +impl frame_system::Config for Runtime { + type Block = Block; + type AccountData = pallet_balances::AccountData; +} + +parameter_types! { + pub const Period: u64 = 1; + pub const Offset: u64 = 0; +} + +impl pallet_session::Config for Runtime { + type ShouldEndSession = pallet_session::PeriodicSessions; + type SessionManager = + pallet_session::historical::NoteHistoricalRoot; + type SessionHandler = (SlowClap,); + type ValidatorId = u64; + type ValidatorIdOf = ConvertInto; + type Keys = UintAuthorityId; + type RuntimeEvent = RuntimeEvent; + type NextSessionRotation = pallet_session::PeriodicSessions; + type WeightInfo = (); +} + +impl pallet_session::historical::Config for Runtime { + type FullIdentification = u64; + type FullIdentificationOf = ConvertInto; +} + +parameter_types! { + pub static MockCurrentSessionProgress: Option> = None; +} + +parameter_types! { + pub static MockAverageSessionLength: Option = None; +} + +pub struct TestNextSessionRotation; +impl frame_support::traits::EstimateNextSessionRotation for TestNextSessionRotation { + fn average_session_length() -> u64 { + let mock = MockAverageSessionLength::mutate(|p| p.take()); + mock.unwrap_or(pallet_session::PeriodicSessions::::average_session_length()) + } + + fn estimate_current_session_progress(now: u64) -> (Option, Weight) { + let (estimate, weight) = + pallet_session::PeriodicSessions::::estimate_current_session_progress( + now, + ); + let mock = MockCurrentSessionProgress::mutate(|p| p.take()); + (mock.unwrap_or(estimate), weight) + } + + fn estimate_next_session_rotation(now: u64) -> (Option, Weight) { + pallet_session::PeriodicSessions::::estimate_next_session_rotation(now) + } +} + +impl ghost_networks::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type NetworkId = u32; + type RegisterOrigin = EnsureRoot; + type UpdateOrigin = EnsureRoot; + type RemoveOrigin = EnsureRoot; + type WeightInfo = (); +} + +parameter_types! { + pub static ExistentialDeposit: u64 = 2; + pub const TreasuryPalletId: PalletId = PalletId(*b"mck/test"); +} + +#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)] +impl pallet_balances::Config for Runtime { + type ExistentialDeposit = ExistentialDeposit; + type MaxReserves = ConstU32<2>; + type AccountStore = System; + type WeightInfo = (); +} + +impl Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AuthorityId = UintAuthorityId; + + type NextSessionRotation = TestNextSessionRotation; + type ValidatorSet = Historical; + type Currency = Balances; + type NetworkDataHandler = Networks; + type BlockNumberProvider = System; + type ReportUnresponsiveness = OffenceHandler; + + type MaxAuthorities = ConstU32<5>; + type MaxNumberOfClaps = ConstU32<100>; + type ApplauseThreshold = ConstU32<0>; + type MaxAuthorityInfoInSession = ConstU32<5_000>; + type OffenceThreshold = ConstU32<40>; + type UnsignedPriority = ConstU64<{ 1 << 20 }>; + type TreasuryPalletId = TreasuryPalletId; + + type WeightInfo = (); +} + +pub type Extrinsic = TestXt; + +// impl frame_system::offchain::SigningTypes for Runtime { +// type Public = ::Signer; +// type Signature = Signature; +// } + +impl frame_system::offchain::SendTransactionTypes for Runtime +where + RuntimeCall: From, +{ + type OverarchingCall = RuntimeCall; + type Extrinsic = Extrinsic; +} + +// impl frame_system::offchain::CreateSignedTransaction for Runtime +// where +// RuntimeCall: From, +// { +// fn create_transaction>( +// call: Self::OverarchingCall, +// _public: Self::Public, +// _account: Self::AccountId, +// nonce: Self::Nonce, +// ) -> Option<(RuntimeCall, ::SignaturePayload)> { +// Some((call, (nonce.into(), ()))) +// } +// } + +// pub fn advance_session() { +// let now = System::block_number().max(1); +// System::set_block_number(now + 1); +// Session::rotate_session(); +// +// let authorities = Session::validators() +// .into_iter() +// .map(UintAuthorityId) +// .collect(); +// +// SlowClap::set_authorities(authorities); +// assert_eq!(Session::current_index(), (now / Period::get()) as u32); +// } diff --git a/pallets/slow-clap/src/tests.rs b/pallets/slow-clap/src/tests.rs new file mode 100644 index 0000000..5af06d6 --- /dev/null +++ b/pallets/slow-clap/src/tests.rs @@ -0,0 +1,696 @@ +#![cfg(test)] + +use super::*; +use crate::mock::*; +use frame_support::{assert_err, assert_ok}; +use sp_core::offchain::{ + testing, + testing::TestOffchainExt, OffchainWorkerExt, + // OffchainDbExt, TransactionPoolExt, +}; +// use sp_runtime::testing::UintAuthorityId; + +fn prepare_networks() -> (u32, u32) { + let network = NetworkData { + chain_name: "Ethereum".into(), + default_endpoint: get_rpc_endpoint(), + finality_delay: Some(69), + release_delay: Some(69), + network_type: ghost_networks::NetworkType::Evm, + gatekeeper: get_gatekeeper(), + topic_name: get_topic_name(), + incoming_fee: 0, + outgoing_fee: 0, + }; + + assert_ok!(Networks::register_network( + RuntimeOrigin::root(), + get_network_id(), + network)); + + (1, 69) +} + +fn prepare_companion(amount: u64) -> Companion, BalanceOf> { + Companion { + network_id: 1, + receiver: H160::from_low_u64_ne(1337), + fee: H256::from_low_u64_ne(40_000), + amount: amount, + } +} + +#[test] +fn test_throttling_slash_function() { + let dummy_offence = ThrottlingOffence { + session_index: 0, + validator_set_count: 50, + offenders: vec![()], + }; + + assert_eq!(dummy_offence.slash_fraction(1), Perbill::zero()); + assert_eq!(dummy_offence.slash_fraction(5), Perbill::zero()); + assert_eq!(dummy_offence.slash_fraction(7), Perbill::from_parts(4200000)); + assert_eq!(dummy_offence.slash_fraction(17), Perbill::from_parts(46200000)); +} + +#[test] +fn propose_companion_works_as_expected() { + new_test_ext().execute_with(|| { + let actor = alice_account_id(); + let companion_id = SlowClap::current_companion_id(); + let (valid_network_id, _) = prepare_networks(); + let companion = prepare_companion(100); + + assert_eq!(Balances::balance(&actor), 100); + assert_eq!(Balances::total_issuance(), 100); + assert_eq!(SlowClap::companions(valid_network_id, companion_id), None); + assert_eq!(SlowClap::companion_details(companion_id), None); + assert_eq!(SlowClap::current_companion_id(), companion_id); + + assert_ok!(SlowClap::propose_companion(RuntimeOrigin::signed(actor), valid_network_id, companion.clone())); + + assert_eq!(Balances::balance(&actor), 0); + assert_eq!(Balances::total_issuance(), 0); + assert_eq!(SlowClap::companions(valid_network_id, companion_id), Some(actor)); + assert_eq!(SlowClap::companion_details(companion_id), Some(companion)); + assert_eq!(SlowClap::current_companion_id(), companion_id + 1); + }); +} + +#[test] +fn propose_companion_emits_event() { + new_test_ext().execute_with(|| { + let actor = alice_account_id(); + let companion_id = SlowClap::current_companion_id(); + let (valid_network_id, _) = prepare_networks(); + let companion = prepare_companion(100); + + System::reset_events(); + assert_ok!(SlowClap::propose_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion.clone())); + System::assert_has_event(RuntimeEvent::SlowClap( + crate::Event::CompanionCreated { + companion_id, + owner: actor, + companion, + })); + }); +} + +#[test] +fn could_not_propose_if_not_enough_funds() { + new_test_ext().execute_with(|| { + let actor = alice_account_id(); + let (valid_network_id, _) = prepare_networks(); + let companion = prepare_companion(1_000); + assert_err!(SlowClap::propose_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion.clone()), + sp_runtime::TokenError::FundsUnavailable); + + let companion = prepare_companion(100 / 2); + let prev_balance = Balances::balance(&actor); + assert_ok!(SlowClap::propose_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion.clone())); + assert_eq!(Balances::balance(&actor), prev_balance / 2); + + }); +} + +#[test] +fn companion_amount_should_be_existent() { + new_test_ext().execute_with(|| { + let actor = alice_account_id(); + let (valid_network_id, _) = prepare_networks(); + let companion = prepare_companion(1); + + assert_err!(SlowClap::propose_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion.clone()), + crate::Error::::CompanionAmountNotExistent); + }); +} + +#[test] +fn could_not_register_companion_if_network_not_registered() { + new_test_ext().execute_with(|| { + let actor = alice_account_id(); + let (_, invalid_network_id) = prepare_networks(); + let companion = prepare_companion(100); + + assert_err!(SlowClap::propose_companion( + RuntimeOrigin::signed(actor), + invalid_network_id, + companion.clone()), + crate::Error::::NonRegisteredNetwork); + }); +} + +#[test] +fn release_companion_works() { + new_test_ext().execute_with(|| { + let actor = alice_account_id(); + let companion_id = SlowClap::current_companion_id(); + let (valid_network_id, _) = prepare_networks(); + let companion = prepare_companion(50); + assert_ok!(SlowClap::propose_companion( + RuntimeOrigin::signed(actor), + valid_network_id, + companion.clone())); + + assert_eq!(SlowClap::release_blocks(companion_id), 0); + assert_ok!(SlowClap::release_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion_id)); + assert_eq!(SlowClap::release_blocks(companion_id), 69 + 1); + }); +} + +#[test] +fn release_companion_emits_event() { + new_test_ext().execute_with(|| { + let actor = alice_account_id(); + let companion_id = SlowClap::current_companion_id(); + let (valid_network_id, _) = prepare_networks(); + let companion = prepare_companion(50); + assert_ok!(SlowClap::propose_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion.clone())); + + System::reset_events(); + assert_ok!(SlowClap::release_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion_id)); + System::assert_has_event(RuntimeEvent::SlowClap( + crate::Event::CompanionReleased { + companion_id, + network_id: valid_network_id, + who: actor, + release_block: 69 + 1 })); + }); +} + +#[test] +fn could_not_release_from_random_account() { + new_test_ext().execute_with(|| { + let actor = alice_account_id(); + let companion_id = SlowClap::current_companion_id(); + let (valid_network_id, _) = prepare_networks(); + let companion = prepare_companion(50); + assert_ok!(SlowClap::propose_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion.clone())); + + assert_err!(SlowClap::release_companion( + RuntimeOrigin::signed(eve_account_id()), + valid_network_id, companion_id), + crate::Error::::NotValidCompanion); + }); +} + +#[test] +fn kill_companion_works() { + new_test_ext().execute_with(|| { + let actor = alice_account_id(); + let companion_id = SlowClap::current_companion_id(); + let (valid_network_id, _) = prepare_networks(); + let companion = prepare_companion(50); + assert_ok!(SlowClap::propose_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion.clone())); + + assert_ok!(SlowClap::release_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion_id)); + let release_block = ReleaseBlocks::::get(companion_id); + + assert_eq!(SlowClap::companions(valid_network_id, companion_id), Some(actor)); + assert_eq!(SlowClap::companion_details(companion_id), Some(companion)); + assert_eq!(Balances::balance(&actor), 50); + assert_eq!(Balances::total_issuance(), 50); + + System::set_block_number(release_block + 1); + assert_ok!(SlowClap::kill_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion_id)); + + assert_eq!(SlowClap::companions(valid_network_id, companion_id), None); + assert_eq!(SlowClap::companion_details(companion_id), None); + assert_eq!(Balances::balance(&actor), 100); + assert_eq!(Balances::total_issuance(), 100); + }); +} + +#[test] +fn kill_companion_emits_event() { + new_test_ext().execute_with(|| { + let actor = alice_account_id(); + let companion_id = SlowClap::current_companion_id(); + let (valid_network_id, _) = prepare_networks(); + let companion = prepare_companion(50); + + assert_ok!(SlowClap::propose_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion.clone())); + assert_ok!(SlowClap::release_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion_id)); + System::set_block_number( + ReleaseBlocks::::get(companion_id) + 1); + + System::reset_events(); + assert_ok!(SlowClap::kill_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion_id)); + System::assert_has_event(RuntimeEvent::SlowClap( + crate::Event::CompanionKilled { + network_id: valid_network_id, + who: actor, + companion_id, + freed_balance: 50, + })); + }); +} + +#[test] +fn could_not_kill_companion_that_was_not_released() { + new_test_ext().execute_with(|| { + let actor = alice_account_id(); + let companion_id = SlowClap::current_companion_id(); + let (valid_network_id, _) = prepare_networks(); + let companion = prepare_companion(50); + + assert_ok!(SlowClap::propose_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion.clone())); + assert_ok!(SlowClap::release_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion_id)); + let release_block = ReleaseBlocks::::get(companion_id); + + assert_eq!(SlowClap::companions(valid_network_id, companion_id), Some(actor)); + assert_eq!(SlowClap::companion_details(companion_id), Some(companion.clone())); + assert_eq!(Balances::balance(&actor), 50); + assert_eq!(Balances::total_issuance(), 50); + + System::set_block_number(release_block / 2); + assert_err!(SlowClap::kill_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion_id), + crate::Error::::ReleaseTimeHasNotCome); + + assert_eq!(SlowClap::companions(valid_network_id, companion_id), Some(actor)); + assert_eq!(SlowClap::companion_details(companion_id), Some(companion)); + assert_eq!(Balances::balance(&actor), 50); + assert_eq!(Balances::total_issuance(), 50); + }); +} + +#[test] +fn could_not_kill_companion_from_random_account() { + new_test_ext().execute_with(|| { + let actor = alice_account_id(); + let companion_id = SlowClap::current_companion_id(); + let (valid_network_id, _) = prepare_networks(); + let companion = prepare_companion(50); + + assert_ok!(SlowClap::propose_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion.clone())); + assert_ok!(SlowClap::release_companion( + RuntimeOrigin::signed(actor), + valid_network_id, companion_id)); + let release_block = ReleaseBlocks::::get(companion_id); + + assert_eq!(SlowClap::companions(valid_network_id, companion_id), Some(actor)); + assert_eq!(SlowClap::companion_details(companion_id), Some(companion.clone())); + assert_eq!(Balances::balance(&actor), 50); + assert_eq!(Balances::total_issuance(), 50); + + System::set_block_number(release_block + 1); + assert_err!(SlowClap::kill_companion( + RuntimeOrigin::signed(eve_account_id()), + valid_network_id, companion_id), + crate::Error::::NotValidCompanion); + + assert_eq!(SlowClap::companions(valid_network_id, companion_id), Some(actor)); + assert_eq!(SlowClap::companion_details(companion_id), Some(companion)); + assert_eq!(Balances::balance(&actor), 50); + assert_eq!(Balances::total_issuance(), 50); + }); +} + +#[test] +fn request_body_is_correct_for_get_block_number() { + let (offchain, _) = TestOffchainExt::new(); + let mut t = sp_io::TestExternalities::default(); + t.register_extension(OffchainWorkerExt::new(offchain)); + + t.execute_with(|| { + let request_body = SlowClap::prepare_request_body( + None, 0, Vec::new(), Vec::new()); + assert_eq!(core::str::from_utf8(&request_body).unwrap(), + r#"{"id":0,"jsonrpc":"2.0","method":"eth_blockNumber"}"#); + }); +} + +#[test] +fn request_body_is_correct_for_get_logs() { + let (offchain, _) = TestOffchainExt::new(); + let mut t = sp_io::TestExternalities::default(); + t.register_extension(OffchainWorkerExt::new(offchain)); + + t.execute_with(|| { + let request_body = SlowClap::prepare_request_body( + Some(1337), 69, get_gatekeeper(), get_topic_name()); + assert_eq!( + core::str::from_utf8(&request_body).unwrap(), + r#"{"id":0,"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock":1268,"toBlock":1337,"address":"0x4d224452801ACEd8B2F0aebE155379bb5D594381","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}]}"#, + ); + }); +} + +#[test] +fn should_make_http_call_for_block_number() { + let (offchain, state) = TestOffchainExt::new(); + let mut t = sp_io::TestExternalities::default(); + t.register_extension(OffchainWorkerExt::new(offchain)); + + evm_block_response(&mut state.write()); + + t.execute_with(|| { + let request_body = SlowClap::prepare_request_body( + None, 0, Vec::new(), Vec::new()); + let raw_response = SlowClap::fetch_from_remote( + get_rpc_endpoint(), request_body).unwrap(); + assert_eq!(raw_response.len(), 45usize); // precalculated + }); +} + +#[test] +fn should_make_http_call_for_logs() { + let (offchain, state) = TestOffchainExt::new(); + let mut t = sp_io::TestExternalities::default(); + t.register_extension(OffchainWorkerExt::new(offchain)); + + evm_logs_response(&mut state.write()); + + t.execute_with(|| { + let request_body = SlowClap::prepare_request_body( + Some(20335857), 84, get_gatekeeper(), get_topic_name()); + let raw_response = SlowClap::fetch_from_remote( + get_rpc_endpoint(), request_body).unwrap(); + assert_eq!(raw_response.len(), 1805); // precalculated + }); +} + +#[test] +fn should_make_http_call_and_parse_block_number() { + let (offchain, state) = TestOffchainExt::new(); + let mut t = sp_io::TestExternalities::default(); + t.register_extension(OffchainWorkerExt::new(offchain)); + + evm_block_response(&mut state.write()); + + t.execute_with(|| { + let evm_response = SlowClap::fetch_and_parse( + None, 0, Vec::::new(), + Vec::::new(), get_rpc_endpoint()).unwrap(); + let evm_block_number = match evm_response { + EvmResponseType::BlockNumber(evm_block) => Some(evm_block), + _ => None, + }; + assert_eq!(evm_block_number.unwrap_or_default(), 20335745); + }); +} + +#[test] +fn should_make_http_call_and_parse_logs() { + let (offchain, state) = TestOffchainExt::new(); + let mut t = sp_io::TestExternalities::default(); + t.register_extension(OffchainWorkerExt::new(offchain)); + + evm_logs_response(&mut state.write()); + let expected_logs = get_expected_logs(); + + t.execute_with(|| { + let evm_response = SlowClap::fetch_and_parse( + Some(20335857), 84, get_gatekeeper(), + get_topic_name(), get_rpc_endpoint() + ).unwrap(); + let evm_logs = match evm_response { + EvmResponseType::TransactionLogs(logs) => Some(logs), + _ => None, + }; + assert!(evm_logs.is_some()); + let evm_logs = evm_logs.unwrap(); + assert_eq!(evm_logs, expected_logs); + }); +} + +#[test] +fn should_catch_error_in_json_response() { + let (offchain, state) = TestOffchainExt::new(); + let mut t = sp_io::TestExternalities::default(); + t.register_extension(OffchainWorkerExt::new(offchain)); + + evm_error_response(&mut state.write()); + + t.execute_with(|| { + assert_err!(SlowClap::fetch_and_parse( + None, 0, Vec::::new(), + Vec::::new(), get_rpc_endpoint()), + OffchainErr::ErrorInEvmResponse); + }); +} + +// #[test] +// fn conversion_to_claps_is_correct() { +// todo!(); +// } +// +// #[test] +// fn evm_block_storage_is_empty_by_default() { +// todo!(); +// } +// +// #[test] +// fn evm_block_is_stored_locally_after_first_response() { +// todo!(); +// } +// +// #[test] +// fn evm_block_storage_is_none_after_logs() { +// todo!(); +// } +// +// #[test] +// fn send_evm_usigned_transaction_from_authority() { +// todo!(); +// } + +// #[test] +// fn should_report_offline_validators() { +// new_test_ext().execute_with(|| { +// let block = 1; +// System::set_block_number(block); +// advance_session(); +// let validators = vec![1, 2, 3, 4, 5, 6]; +// Validators::mutate(|l| *l = Some(validators.clone())); +// advance_session(); +// +// advance_session(); +// +// let offences = Offences::take(); +// assert_eq!( +// offences, +// vec![( +// vec![], +// ThrottlingOffence { +// session_index: 2, +// validator_set_count: 3, +// offenders: vec![(1, 1), (2, 2), (3, 3)], +// } +// )] +// ); +// +// for (idx, v) in validators.into_iter().take(4).enumerate() { +// let _ = clap(); +// } +// +// advance_session(); +// +// let offences = Offences::take(); +// assert_eq!( +// offences, +// vec![( +// vec![], +// ThrottlingOffence { +// session_index: 3, +// validator_set_count: 6, +// offenders: vec![(5, 5), (6, 6)], +// } +// )] +// ); +// }); +// } +// +// #[test] +// fn should_increase_actions_of_validators_when_clap_is_received() { +// } +// +// #[test] +// fn same_claps_should_not_increase_actions() { +// } +// +// #[test] +// fn should_cleanup_received_claps_on_session_end() { +// } +// +// #[test] +// fn should_mark_validator_if_disabled() { +// } + +fn get_rpc_endpoint() -> Vec { + b"https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/".to_vec() +} + +fn get_gatekeeper() -> Vec { + b"0x4d224452801ACEd8B2F0aebE155379bb5D594381".to_vec() +} + +fn get_topic_name() -> Vec { + b"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".to_vec() +} + +fn get_network_id() -> u32 { + // let mut network_id: NetworkIdOf = Default::default(); + // network_id.saturating_inc(); + // network_id + 1u32 +} + +fn evm_block_response(state: &mut testing::OffchainState) { + let expected_body = br#"{"id":0,"jsonrpc":"2.0","method":"eth_blockNumber"}"#.to_vec(); + state.expect_request(testing::PendingRequest { + method: "POST".into(), + uri: "https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/".into(), + headers: vec![ + ("ACCEPT".to_string(), "APPLICATION/JSON".to_string()), + ("CONTENT-TYPE".to_string(), "APPLICATION/JSON".to_string()), + ], + response: Some(b"{\"id\":0,\"jsonrpc\":\"2.0\",\"result\":\"0x1364c81\"}".to_vec()), + body: expected_body, + sent: true, + ..Default::default() + }); +} + +fn evm_error_response(state: &mut testing::OffchainState) { + let expected_body = br#"{"id":0,"jsonrpc":"2.0","method":"eth_blockNumber"}"#.to_vec(); + state.expect_request(testing::PendingRequest { + method: "POST".into(), + uri: "https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/".into(), + headers: vec![ + ("ACCEPT".to_string(), "APPLICATION/JSON".to_string()), + ("CONTENT-TYPE".to_string(), "APPLICATION/JSON".to_string()), + ], + response: Some(b"{\"id\":0,\"jsonrpc\":\"2.0\",\"error\":\"some bad error occures :-(\"}".to_vec()), + body: expected_body, + sent: true, + ..Default::default() + }); +} + +fn evm_logs_response(state: &mut testing::OffchainState) { + let expected_body = br#"{"id":0,"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock":20335773,"toBlock":20335857,"address":"0x4d224452801ACEd8B2F0aebE155379bb5D594381","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}]}"#.to_vec(); + + let expected_response = br#"{ + "jsonrpc":"2.0", + "id":0, + "result":[ + { + "address":"0x4d224452801aced8b2f0aebe155379bb5d594381", + "topics":[ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x000000000000000000000000d91efec7e42f80156d1d9f660a69847188950747", + "0x0000000000000000000000005e611dfbe71b988cf2a3e5fe4191b5e3d4c4212a" + ], + "data":"0x000000000000000000000000000000000000000000000046f0d522a71fdac000", + "blockNumber":"0x1364c9d", + "transactionHash":"0xa82f2fe87f4ba01ab3bd2cd4d0fe75a26f0e9a37e2badc004a0e38f9d088a758", + "transactionIndex":"0x11", + "blockHash":"0x4b08f82d5a948c0bc5c23c8ddce55e5b4536d7454be53668bbd985ef13dca04a", + "logIndex":"0x92", + "removed":false + }, + { + "address":"0x4d224452801aced8b2f0aebe155379bb5d594381", + "topics":[ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000005954ab967bc958940b7eb73ee84797dc8a2afbb9", + "0x000000000000000000000000465165be7cacdbd2cbc8334f549fab9783ad6e7a" + ], + "data":"0x0000000000000000000000000000000000000000000000027c790defec959e75", + "blockNumber":"0x1364cf1", + "transactionHash":"0xd9f02b79a90db7536b0afb5e24bbc1f4319dc3d8c57af7c39941acd249ec053a", + "transactionIndex":"0x2c", + "blockHash":"0x6876b18f5081b5d24d5a73107a667a7713256f6e51edbbe52bf8df24e340b0f7", + "logIndex":"0x14b", + "removed":false + } + ] + }"#.to_vec(); + + state.expect_request(testing::PendingRequest { + method: "POST".into(), + uri: "https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/".into(), + headers: vec![ + ("ACCEPT".to_string(), "APPLICATION/JSON".to_string()), + ("CONTENT-TYPE".to_string(), "APPLICATION/JSON".to_string()), + ], + body: expected_body, + response: Some(expected_response), + sent: true, + ..Default::default() + }); +} + +fn get_expected_logs() -> Vec { + let byte_converter = |s: &str| -> Vec { + (2..s.len()) + .step_by(2) + .map(|i| u8::from_str_radix(&s[i..i+2], 16).expect("valid u8 symbol; qed")) + .collect() + }; + + vec![ + Log { + transaction_hash: Some(H256::from_slice(&byte_converter("0xa82f2fe87f4ba01ab3bd2cd4d0fe75a26f0e9a37e2badc004a0e38f9d088a758"))), + block_number: Some(20335773), + topics: vec![ + byte_converter("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"), + byte_converter("0x000000000000000000000000d91efec7e42f80156d1d9f660a69847188950747"), + byte_converter("0x0000000000000000000000005e611dfbe71b988cf2a3e5fe4191b5e3d4c4212a"), + ], + address: Some(b"0x4d224452801aced8b2f0aebe155379bb5d594381".to_vec()), + data: sp_std::collections::btree_map::BTreeMap::from([(0, 1308625900000000000000)]), + removed: false, + }, + Log { + transaction_hash: Some(H256::from_slice(&byte_converter("0xd9f02b79a90db7536b0afb5e24bbc1f4319dc3d8c57af7c39941acd249ec053a"))), + block_number: Some(20335857), + topics: vec![ + byte_converter("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"), + byte_converter("0x0000000000000000000000005954ab967bc958940b7eb73ee84797dc8a2afbb9"), + byte_converter("0x000000000000000000000000465165be7cacdbd2cbc8334f549fab9783ad6e7a"), + ], + address: Some(b"0x4d224452801aced8b2f0aebe155379bb5d594381".to_vec()), + data: sp_std::collections::btree_map::BTreeMap::from([(0, 45862703604421729909)]), + removed: false, + }, + ] +} diff --git a/pallets/slow-clap/src/weights.rs b/pallets/slow-clap/src/weights.rs new file mode 100644 index 0000000..3eb62b0 --- /dev/null +++ b/pallets/slow-clap/src/weights.rs @@ -0,0 +1,18 @@ +use frame_support::weights::Weight; + +pub trait WeightInfo { + fn slow_clap(claps_len: u32, companions_len: u32) -> Weight; + fn propose_companion() -> Weight; + fn release_companion() -> Weight; + fn kill_companion() -> Weight; +} + +impl WeightInfo for () { + fn slow_clap( + _claps_len: u32, + _companions_len: u32, + ) -> Weight { Weight::zero() } + fn propose_companion() -> Weight { Weight::zero() } + fn release_companion() -> Weight { Weight::zero() } + fn kill_companion() -> Weight { Weight::zero() } +} diff --git a/pallets/traits/Cargo.toml b/pallets/traits/Cargo.toml new file mode 100755 index 0000000..fdc5a0e --- /dev/null +++ b/pallets/traits/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "ghost-traits" +version = "0.3.19" +license.workspace = true +authors.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true + +[dependencies] +frame-support = { workspace = true } +sp-runtime = { workspace = true } + +[features] +default = ["std"] +std = [ + "frame-support/std", + "sp-runtime/std", +] diff --git a/pallets/traits/src/lib.rs b/pallets/traits/src/lib.rs new file mode 100755 index 0000000..4d8e9f7 --- /dev/null +++ b/pallets/traits/src/lib.rs @@ -0,0 +1,3 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +pub mod networks; diff --git a/pallets/traits/src/networks.rs b/pallets/traits/src/networks.rs new file mode 100755 index 0000000..858ca6c --- /dev/null +++ b/pallets/traits/src/networks.rs @@ -0,0 +1,29 @@ +use frame_support::{ + pallet_prelude::*, + storage::PrefixIterator, +}; +use sp_runtime::{ + DispatchResult, + traits::{AtLeast32BitUnsigned, Member}, +}; + +pub trait NetworkDataBasicHandler { + type NetworkId: Parameter + + Member + + AtLeast32BitUnsigned + + Default + + Copy + + TypeInfo + + MaybeSerializeDeserialize + + MaxEncodedLen; +} + +pub trait NetworkDataInspectHandler: NetworkDataBasicHandler { + fn get(n: &Self::NetworkId) -> Option; + fn iter() -> PrefixIterator<(Self::NetworkId, Network)>; +} + +pub trait NetworkDataMutateHandler: NetworkDataInspectHandler { + fn register(chain_id: Self::NetworkId, network: Network) -> DispatchResult; + fn remove(chain_id: Self::NetworkId) -> DispatchResult; +} diff --git a/primitives/machine/Cargo.toml b/primitives/machine/Cargo.toml new file mode 100644 index 0000000..e403181 --- /dev/null +++ b/primitives/machine/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "ghost-machine-primitives" +description = "Minimal requirements for Ghost Node" +version.workspace = true +edition.workspace = true +authors.workspace = true +license.workspace = true +repository.workspace = true +homepage.workspace = true + +[dependencies] +lazy_static = { workspace = true } +sc-sysinfo = { workspace = true } +serde_json = { workspace = true, default-features = true } diff --git a/primitives/machine/src/ghost_node_hardware.json b/primitives/machine/src/ghost_node_hardware.json new file mode 100644 index 0000000..deb438b --- /dev/null +++ b/primitives/machine/src/ghost_node_hardware.json @@ -0,0 +1,22 @@ +[ + { + "metric": "Blake2256", + "minimum": 257.00 + }, + { + "metric": "Sr25519Verify", + "minimum": 0.145339297 + }, + { + "metric": "MemCopy", + "minimum": 6070.00 + }, + { + "metric": "DiskSeqWrite", + "minimum": 950.00 + }, + { + "metric": "DiskRndWrite", + "minimum": 420.00 + } +] diff --git a/primitives/machine/src/lib.rs b/primitives/machine/src/lib.rs new file mode 100644 index 0000000..63a4bb0 --- /dev/null +++ b/primitives/machine/src/lib.rs @@ -0,0 +1,6 @@ +lazy_static::lazy_static! { + pub static ref GHOST_NODE_REFERENCE_HARDWARE: sc_sysinfo::Requirements = { + let raw = include_bytes!("ghost_node_hardware.json").as_slice(); + serde_json::from_slice(raw).expect("Hardcoded machine data is known good; qed") + }; +} diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml new file mode 100755 index 0000000..0ba4d4d --- /dev/null +++ b/rpc/Cargo.toml @@ -0,0 +1,36 @@ +[package] +name = "ghost-rpc" +description = "Ghost specific RPC functionality" +version.workspace = true +edition.workspace = true +authors.workspace = true +repository.workspace = true +homepage.workspace = true +license.workspace = true + +[dependencies] +jsonrpsee = { workspace = true, features = ["server"] } +sc-client-api = { workspace = true, default-features = true } +sc-chain-spec = { workspace = true, default-features = true } +sc-rpc = { workspace = true, default-features = true } +sc-rpc-spec-v2 = { workspace = true, default-features = true } +babe = { workspace = true, default-features = true } +babe-rpc = { workspace = true, default-features = true } +grandpa = { workspace = true, default-features = true } +grandpa-rpc = { workspace = true, default-features = true } +sc-consensus-epochs = { workspace = true, default-features = true } +sc-sync-state-rpc = { workspace = true, default-features = true } + +tx-pool-api = { workspace = true, default-features = true } +sp-blockchain = { workspace = true, default-features = true } +sp-keystore = { workspace = true, default-features = true } +sp-runtime = { workspace = true, default-features = true } +sp-api = { workspace = true, default-features = true } +consensus-common = { workspace = true, default-features = true } +babe-primitives = { workspace = true, default-features = true } +block-builder-api = { workspace = true, default-features = true } + +frame-rpc-system = { workspace = true, default-features = true } +pallet-transaction-payment-rpc = { workspace = true, default-features = true } +substrate-state-trie-migration-rpc = { workspace = true, default-features = true } +primitives = { workspace = true, default-features = true } diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs new file mode 100755 index 0000000..c31345b --- /dev/null +++ b/rpc/src/lib.rs @@ -0,0 +1,145 @@ +use std::sync::Arc; + +use jsonrpsee::RpcModule; +use primitives::{ + AccountId, Balance, Block, BlockNumber, Hash, Nonce, +}; +use sc_client_api::AuxStore; +use grandpa::FinalityProofProvider; +pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; +use sp_api::ProvideRuntimeApi; +use block_builder_api::BlockBuilder; +use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; +use consensus_common::SelectChain; +use babe_primitives::BabeApi; +use sp_keystore::KeystorePtr; +use tx_pool_api::TransactionPool; + +/// A type representing all RPC extensions. +pub type RpcExtension = RpcModule<()>; + +/// Extra dependencies for BABE. +pub struct BabeDeps { + /// A handle to the BABE worker for issuing requests. + pub babe_worker_handle: babe::BabeWorkerHandle, + /// The keystore that manages the keys of the node. + pub keystore: KeystorePtr, +} + +/// Extra dependencies for GRANDPA. +pub struct GrandpaDeps { + /// Voting round info. + pub shared_voter_state: grandpa::SharedVoterState, + /// Authority set info. + pub shared_authority_set: grandpa::SharedAuthoritySet, + /// Receives notifications about justification events from GRANDPA, + pub justification_stream: grandpa::GrandpaJustificationStream, + /// Subscription manager to keep track of pubsub subscribers. + pub subscription_executor: sc_rpc::SubscriptionTaskExecutor, + /// Finality proof provider. + pub finality_provider: Arc>, +} + +/// Full client dependencies +pub struct FullDeps { + /// The client instance to use. + pub client: Arc, + /// Transaction pool instance. + pub pool: Arc

, + /// The [`SelectChain`] Strategy + pub select_chain: SC, + /// A copy of the chain spec. + pub chain_spec: Box, + /// Whether to deny unsafe calls. + pub deny_unsafe: DenyUnsafe, + /// BABE specific dependencies + pub babe: BabeDeps, + /// GRANDPA specific dependencies + pub grandpa: GrandpaDeps, + /// Backend used by the node. + pub backend: Arc, +} + +pub fn create_full_rpc( + FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa, backend } : FullDeps, +) -> Result> +where + C: ProvideRuntimeApi + + HeaderBackend + + AuxStore + + HeaderMetadata + + Send + + Sync + + 'static, + C::Api: frame_rpc_system::AccountNonceApi, + C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, + C::Api: BlockBuilder, + C::Api: BabeApi, + P: TransactionPool + Sync + Send + 'static, + SC: SelectChain + 'static, + B: sc_client_api::Backend + Send + Sync + 'static, + B::State: sc_client_api::StateBackend>, +{ + use frame_rpc_system::{System, SystemApiServer}; + use pallet_transaction_payment_rpc::{ + TransactionPayment, TransactionPaymentApiServer, + }; + use babe_rpc::{Babe, BabeApiServer}; + use grandpa_rpc::{Grandpa, GrandpaApiServer}; + use sc_rpc_spec_v2::chain_spec::{ChainSpec, ChainSpecApiServer}; + use sc_sync_state_rpc::{SyncState, SyncStateApiServer}; + use substrate_state_trie_migration_rpc::{ + StateMigration, StateMigrationApiServer, + }; + + let mut io = RpcModule::new(()); + let BabeDeps { babe_worker_handle, keystore } = babe; + let GrandpaDeps { + shared_voter_state, + shared_authority_set, + justification_stream, + subscription_executor, + finality_provider, + } = grandpa; + + let chain_name = chain_spec.name().to_string(); + let genesis_hash = client.hash(0).ok().flatten().expect("Genesis block exists; qed;"); + let properties = chain_spec.properties(); + + + io.merge(ChainSpec::new(chain_name, genesis_hash, properties).into_rpc())?; + io.merge(StateMigration::new(client.clone(), backend.clone(), deny_unsafe).into_rpc())?; + io.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?; + io.merge(TransactionPayment::new(client.clone()).into_rpc())?; + + io.merge( + Babe::new( + client.clone(), + babe_worker_handle.clone(), + keystore, + select_chain, + deny_unsafe, + ).into_rpc() + )?; + + io.merge( + Grandpa::new( + subscription_executor, + shared_authority_set.clone(), + shared_voter_state, + justification_stream, + finality_provider, + ).into_rpc(), + )?; + + io.merge( + SyncState::new( + chain_spec, + client.clone(), + shared_authority_set, + babe_worker_handle + )?.into_rpc(), + )?; + + Ok(io) +} diff --git a/runtime/casper/Cargo.toml b/runtime/casper/Cargo.toml new file mode 100755 index 0000000..3bbe83e --- /dev/null +++ b/runtime/casper/Cargo.toml @@ -0,0 +1,301 @@ +[package] +name = "casper-runtime" +version = "3.5.17" +build = "build.rs" +description = "Runtime of the Casper Network" +edition.workspace = true +authors.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true + +[build-dependencies] +substrate-wasm-builder = { workspace = true } + +[dependencies] +codec = { features = ["derive", "max-encoded-len"], workspace = true } +scale-info = { features = ["derive"], workspace = true } +log = { workspace = true } +serde_json = { workspace = true } + +frame-support = { workspace = true } +frame-system = { workspace = true } +frame-system-rpc-runtime-api = { workspace = true } +frame-executive = { workspace = true } +frame-election-provider-support = { workspace = true } + +authority-discovery-primitives = { workspace = true } +babe-primitives = { workspace = true } +grandpa-primitives = { workspace = true } +block-builder-api = { workspace = true } +inherents = { workspace = true } +offchain-primitives = { workspace = true } +sp-transaction-pool = { workspace = true } +sp-arithmetic = { workspace = true } +sp-api = { workspace = true } +sp-genesis-builder = { workspace = true } +sp-std = { workspace = true } +sp-application-crypto = { workspace = true } +sp-io = { workspace = true } +sp-runtime = { workspace = true } +sp-staking = { workspace = true } +sp-core = { workspace = true } +sp-session = { workspace = true } +sp-storage = { workspace = true } +sp-version = { workspace = true } +sp-npos-elections = { workspace = true } + +pallet-alliance = { workspace = true } +pallet-authority-discovery = { workspace = true } +pallet-authorship = { workspace = true } +pallet-babe = { workspace = true } +pallet-bags-list = { workspace = true } +pallet-balances = { workspace = true } +pallet-bounties = { workspace = true } +pallet-child-bounties = { workspace = true } +pallet-collective = { workspace = true } +pallet-core-fellowship = { workspace = true } +pallet-election-provider-multi-phase = { workspace = true } +pallet-fast-unstake = { workspace = true } +pallet-grandpa = { workspace = true } +pallet-identity = { workspace = true } +pallet-indices = { workspace = true } +pallet-multisig = { workspace = true } +pallet-nomination-pools = { workspace = true } +pallet-nomination-pools-runtime-api = { workspace = true } +pallet-offences = { workspace = true } +pallet-preimage = { workspace = true } +pallet-proxy = { workspace = true } +pallet-ranked-collective = { workspace = true } +pallet-referenda = { workspace = true } +pallet-salary = { workspace = true } +pallet-scheduler = { workspace = true } +pallet-session = { workspace = true } +pallet-staking = { workspace = true } +pallet-staking-reward-fn = { workspace = true } +pallet-staking-reward-curve = { workspace = true } +pallet-staking-runtime-api = { workspace = true } +pallet-timestamp = { workspace = true } +pallet-transaction-payment = { workspace = true } +pallet-transaction-payment-rpc-runtime-api = { workspace = true } +pallet-treasury = { workspace = true } +pallet-utility = { workspace = true } +pallet-vesting = { workspace = true } +pallet-whitelist = { workspace = true } + +# Ghost pallets +ghost-networks = { workspace = true } +ghost-claims = { workspace = true } +ghost-slow-clap = { workspace = true } +casper-runtime-constants = { workspace = true } +runtime-common = { workspace = true } +primitives = { workspace = true } + +# Benchmarking +frame-benchmarking = { optional = true, workspace = true } +frame-try-runtime = { optional = true, workspace = true } +frame-system-benchmarking = { optional = true, workspace = true } +pallet-election-provider-support-benchmarking = { optional = true, workspace = true } +pallet-offences-benchmarking = { optional = true, workspace = true } +pallet-session-benchmarking = { optional = true, workspace = true } +pallet-nomination-pools-benchmarking = { optional = true, workspace = true } +sp-debug-derive = { workspace = true } + +[dev-dependencies] +keyring = { workspace = true } +sp-trie = { workspace = true } +separator = { workspace = true } +remote-externalities = { workspace = true } +tokio = { features = ["macros"], workspace = true } +sp-tracing = { workspace = true } + + +[features] +default = [ "std" ] +no_std = [] + +only-staking = [] + +# A feature that should be neabled when the runtime should be build for +# on-chain deployment. This will disable stuff that shouldn't be part of the +# on-chain wasm to make it smaller like logging for example. +on-chain-release-build = [ "sp-api/disable-logging" ] + +# Set timing constants (e.g. session period) to faster versions to speed up testing. +fast-runtime = [] + +force-debug = ["sp-debug-derive/force-debug"] + +std = [ + "authority-discovery-primitives/std", + "babe-primitives/std", + "grandpa-primitives/std", + "block-builder-api/std", + "codec/std", + "frame-benchmarking?/std", + "frame-election-provider-support/std", + "frame-executive/std", + "frame-support/std", + "frame-system-benchmarking?/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime?/std", + "inherents/std", + "log/std", + "keyring/std", + "offchain-primitives/std", + "pallet-alliance/std", + "pallet-authority-discovery/std", + "pallet-authorship/std", + "pallet-babe/std", + "pallet-bags-list/std", + "pallet-balances/std", + "pallet-bounties/std", + "pallet-child-bounties/std", + "pallet-core-fellowship/std", + "pallet-collective/std", + "pallet-election-provider-multi-phase/std", + "pallet-election-provider-support-benchmarking?/std", + "pallet-fast-unstake/std", + "pallet-grandpa/std", + "pallet-identity/std", + "pallet-indices/std", + "pallet-multisig/std", + "pallet-nomination-pools/std", + "pallet-nomination-pools-benchmarking?/std", + "pallet-nomination-pools-runtime-api/std", + "pallet-offences/std", + "pallet-offences-benchmarking?/std", + "pallet-preimage/std", + "pallet-proxy/std", + "pallet-ranked-collective/std", + "pallet-referenda/std", + "pallet-salary/std", + "pallet-scheduler/std", + "pallet-session/std", + "pallet-session-benchmarking?/std", + "pallet-staking/std", + "pallet-staking-reward-fn/std", + "pallet-staking-runtime-api/std", + "pallet-timestamp/std", + "pallet-transaction-payment/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-treasury/std", + "pallet-utility/std", + "pallet-vesting/std", + "pallet-whitelist/std", + "scale-info/std", + "sp-api/std", + "sp-application-crypto/std", + "sp-arithmetic/std", + "sp-core/std", + "sp-debug-derive/std", + "sp-genesis-builder/std", + "sp-io/std", + "sp-npos-elections/std", + "sp-runtime/std", + "sp-session/std", + "sp-staking/std", + "sp-std/std", + "sp-storage/std", + "sp-tracing/std", + "sp-trie/std", + "sp-version/std", + "sp-transaction-pool/std", + "ghost-networks/std", + "ghost-claims/std", + "ghost-slow-clap/std", + "casper-runtime-constants/std", + "runtime-common/std", + "primitives/std", +] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-election-provider-support/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "pallet-alliance/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-core-fellowship/runtime-benchmarks", + "pallet-collective/runtime-benchmarks", + "pallet-election-provider-multi-phase/runtime-benchmarks", + "pallet-election-provider-support-benchmarking/runtime-benchmarks", + "pallet-fast-unstake/runtime-benchmarks", + "pallet-grandpa/runtime-benchmarks", + "pallet-identity/runtime-benchmarks", + "pallet-indices/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-nomination-pools/runtime-benchmarks", + "pallet-nomination-pools-benchmarking/runtime-benchmarks", + "pallet-offences/runtime-benchmarks", + "pallet-offences-benchmarking/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-ranked-collective/runtime-benchmarks", + "pallet-referenda/runtime-benchmarks", + "pallet-salary/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-session-benchmarking/runtime-benchmarks", + "pallet-staking/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-vesting/runtime-benchmarks", + "pallet-whitelist/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "sp-staking/runtime-benchmarks", + "ghost-networks/runtime-benchmarks", + "ghost-claims/runtime-benchmarks", + "ghost-slow-clap/runtime-benchmarks", + "runtime-common/runtime-benchmarks", +] +try-runtime = [ + "frame-election-provider-support/try-runtime", + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "frame-try-runtime", + "frame-try-runtime/try-runtime", + "pallet-alliance/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-core-fellowship/try-runtime", + "pallet-collective/try-runtime", + "pallet-election-provider-multi-phase/try-runtime", + "pallet-fast-unstake/try-runtime", + "pallet-grandpa/try-runtime", + "pallet-identity/try-runtime", + "pallet-indices/try-runtime", + "pallet-multisig/try-runtime", + "pallet-nomination-pools/try-runtime", + "pallet-offences/try-runtime", + "pallet-preimage/try-runtime", + "pallet-proxy/try-runtime", + "pallet-ranked-collective/try-runtime", + "pallet-referenda/try-runtime", + "pallet-salary/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-staking/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", + "pallet-utility/try-runtime", + "pallet-vesting/try-runtime", + "pallet-whitelist/try-runtime", + "sp-runtime/try-runtime", + "ghost-networks/try-runtime", + "ghost-claims/try-runtime", + "ghost-slow-clap/try-runtime", + "runtime-common/try-runtime", +] diff --git a/runtime/casper/build.rs b/runtime/casper/build.rs new file mode 100755 index 0000000..86f1b5b --- /dev/null +++ b/runtime/casper/build.rs @@ -0,0 +1,7 @@ +fn main() { + substrate_wasm_builder::WasmBuilder::new() + .with_current_project() + .import_memory() + .export_heap_base() + .build() +} diff --git a/runtime/casper/constants/Cargo.toml b/runtime/casper/constants/Cargo.toml new file mode 100755 index 0000000..67b6f6c --- /dev/null +++ b/runtime/casper/constants/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "casper-runtime-constants" +version = "0.3.25" +authors.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true +license.workspace = true + +[dependencies] +smallvec = { workspace = true } + +frame-support = { workspace = true } +primitives = { workspace = true } +runtime-common = { workspace = true } + +sp-runtime = { workspace = true } +sp-weights = { workspace = true } +sp-core = { workspace = true } + +[features] +default = ["std"] +std = [ + "frame-support/std", + "primitives/std", + "runtime-common/std", + "sp-core/std", + "sp-runtime/std", + "sp-weights/std", +] diff --git a/runtime/casper/constants/src/lib.rs b/runtime/casper/constants/src/lib.rs new file mode 100755 index 0000000..75a8f9f --- /dev/null +++ b/runtime/casper/constants/src/lib.rs @@ -0,0 +1,110 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +pub mod weights; + +pub use self::currency::CSPR; + +/// Monetary constants. +pub mod currency { + use primitives::Balance; + + /// Constant values used within runtime. + pub const FTSO: Balance = 1_000_000_000; // 10^9 + pub const STNK: Balance = 1_000 * FTSO; // 10^12 + pub const STRH: Balance = 1_000 * STNK; // 10^15 + pub const CSPR: Balance = 1_000 * STRH; // 10^18 + + /// The existential deposit. + pub const EXISTENTIAL_DEPOSIT: Balance = STNK; + + pub const fn deposit(items: u32, bytes: u32) -> Balance { + (items as Balance) * 200 * STRH + (bytes as Balance) * 1000 * STNK + } +} + +/// Time and blocks. +pub mod time { + use primitives::{BlockNumber, Moment}; + use runtime_common::prod_or_fast; + + pub const MILLISECS_PER_BLOCK: Moment = 6_000; + pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK; + pub const EPOCH_DURATION_IN_SLOTS: BlockNumber = prod_or_fast!(4 * HOURS, 1 * MINUTES); + + // These time units are defined in number of blocks. + pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); + pub const HOURS: BlockNumber = MINUTES * 60; + pub const DAYS: BlockNumber = HOURS * 24; + pub const WEEKS: BlockNumber = DAYS * 7; + + // 1 in 4 blocks (on average, not counting collisions) woll be primary babe + // blocks.The choice of is done on accordance to the slot duration and expected + // target block tim, for safely resisting network delays of maximum two + // seconds. + pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); +} + +/// Fee-related. +pub mod fee { + use crate::weights::ExtrinsicBaseWeight; + use frame_support::weights::{ + WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, + }; + use primitives::Balance; + use smallvec::smallvec; + pub use sp_runtime::Perbill; + + /// The block saturation level. Fees will be updates based on this value. + pub const TARGET_BLOCK_FULLNESS: Perbill = Perbill::from_percent(25); + + /// Handles converting a weight scalar to a fee value, based on the scale + /// and granularity of the node's balance type. + /// + /// This should typically create a mapping between the following ranges: + /// - [0, `MAXIMUM_BLOCK_WEIGHT`] + /// - [Balance::min, Balance::max] + /// + /// Yet, it can be used for any other sort of change to weight-fee. + pub struct WeightToFee; + impl WeightToFeePolynomial for WeightToFee { + type Balance = Balance; + + fn polynomial() -> WeightToFeeCoefficients { + let p = super::currency::STRH; + let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); + + smallvec![WeightToFeeCoefficient { + degree: 1, + negative: false, + coeff_frac: Perbill::from_rational(p % q, q), + coeff_integer: p / q, + }] + } + } +} + +#[cfg(test)] +mod tests { + use super::{ + currency::{STNK, STRH, CSPR}, + fee::WeightToFee, + }; + use crate::weights::ExtrinsicBaseWeight; + use frame_support::weights::WeightToFee as WeightToFeeT; + use runtime_common::MAXIMUM_BLOCK_WEIGHT; + + #[test] + fn full_block_fee_is_correct() { + let full_block = WeightToFee::weight_to_fee(&MAXIMUM_BLOCK_WEIGHT); + assert!(full_block >= 10 * CSPR); + assert!(full_block <= 100 * CSPR); + } + + #[test] + fn extrinsic_base_fee_is_correct() { + println!("Base: {}", ExtrinsicBaseWeight::get()); + let x = WeightToFee::weight_to_fee(&ExtrinsicBaseWeight::get()); + let y = STNK / 10; + assert!(x.max(y) - x.min(y) < STRH); + } +} diff --git a/runtime/casper/constants/src/weights/block_weights.rs b/runtime/casper/constants/src/weights/block_weights.rs new file mode 100644 index 0000000..2676df5 --- /dev/null +++ b/runtime/casper/constants/src/weights/block_weights.rs @@ -0,0 +1,79 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-30 (Y/M/D) +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! +//! SHORT-NAME: `block`, LONG-NAME: `BlockExecution`, RUNTIME: `Development` +//! WARMUPS: `10`, REPEAT: `100` +//! WEIGHT-PATH: `./runtime/casper/constants/src/weights/` +//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1.0`, WEIGHT-ADD: `0` + +// Executed Command: +// ./target/release/ghost +// benchmark +// overhead +// --chain=casper-dev +// --wasm-execution=compiled +// --weight-path=./runtime/casper/constants/src/weights/ +// --header=./file_header.txt +// --warmup=10 +// --repeat=100 + +use sp_core::parameter_types; +use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight}; + +parameter_types! { + /// Time to execute an empty block. + /// Calculated by multiplying the *Average* with `1.0` and adding `0`. + /// + /// Stats nanoseconds: + /// Min, Max: 64_363_191, 66_078_314 + /// Average: 64_551_214 + /// Median: 64_500_078 + /// Std-Dev: 229678.99 + /// + /// Percentiles nanoseconds: + /// 99th: 65_668_012 + /// 95th: 64_888_421 + /// 75th: 64_563_448 + pub const BlockExecutionWeight: Weight = + Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(64_551_214), 0); +} + +#[cfg(test)] +mod test_weights { + use sp_weights::constants; + + /// Checks that the weight exists and is sane. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + let w = super::BlockExecutionWeight::get(); + + // At least 100 µs. + assert!( + w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS, + "Weight should be at least 100 µs." + ); + // At most 50 ms. + assert!( + w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS, + "Weight should be at most 50 ms." + ); + } +} diff --git a/runtime/casper/constants/src/weights/extrinsic_weights.rs b/runtime/casper/constants/src/weights/extrinsic_weights.rs new file mode 100644 index 0000000..d8c68d0 --- /dev/null +++ b/runtime/casper/constants/src/weights/extrinsic_weights.rs @@ -0,0 +1,79 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-30 (Y/M/D) +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! +//! SHORT-NAME: `extrinsic`, LONG-NAME: `ExtrinsicBase`, RUNTIME: `Development` +//! WARMUPS: `10`, REPEAT: `100` +//! WEIGHT-PATH: `./runtime/casper/constants/src/weights/` +//! WEIGHT-METRIC: `Average`, WEIGHT-MUL: `1.0`, WEIGHT-ADD: `0` + +// Executed Command: +// ./target/release/ghost +// benchmark +// overhead +// --chain=casper-dev +// --wasm-execution=compiled +// --weight-path=./runtime/casper/constants/src/weights/ +// --header=./file_header.txt +// --warmup=10 +// --repeat=100 + +use sp_core::parameter_types; +use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight}; + +parameter_types! { + /// Time to execute a NO-OP extrinsic, for example `System::remark`. + /// Calculated by multiplying the *Average* with `1.0` and adding `0`. + /// + /// Stats nanoseconds: + /// Min, Max: 402_868, 1_292_427 + /// Average: 565_926 + /// Median: 414_626 + /// Std-Dev: 283192.19 + /// + /// Percentiles nanoseconds: + /// 99th: 1_251_123 + /// 95th: 1_196_903 + /// 75th: 491_329 + pub const ExtrinsicBaseWeight: Weight = + Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(565_926), 0); +} + +#[cfg(test)] +mod test_weights { + use sp_weights::constants; + + /// Checks that the weight exists and is sane. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn sane() { + let w = super::ExtrinsicBaseWeight::get(); + + // At least 10 µs. + assert!( + w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS, + "Weight should be at least 10 µs." + ); + // At most 1 ms. + assert!( + w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, + "Weight should be at most 1 ms." + ); + } +} diff --git a/runtime/casper/constants/src/weights/mod.rs b/runtime/casper/constants/src/weights/mod.rs new file mode 100644 index 0000000..148e07b --- /dev/null +++ b/runtime/casper/constants/src/weights/mod.rs @@ -0,0 +1,9 @@ +pub mod block_weights; +pub mod extrinsic_weights; +pub mod rocksdb_weights; +pub mod paritydb_weights; + +pub use block_weights::BlockExecutionWeight; +pub use extrinsic_weights::ExtrinsicBaseWeight; +pub use rocksdb_weights::constants::RocksDbWeight; +pub use paritydb_weights::constants::ParityDbWeight; diff --git a/runtime/casper/constants/src/weights/paritydb_weights.rs b/runtime/casper/constants/src/weights/paritydb_weights.rs new file mode 100644 index 0000000..22be330 --- /dev/null +++ b/runtime/casper/constants/src/weights/paritydb_weights.rs @@ -0,0 +1,83 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-30 (Y/M/D) +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! +//! DATABASE: `ParityDb`, RUNTIME: `Development` +//! BLOCK-NUM: `BlockId::Number(0)` +//! SKIP-WRITE: `false`, SKIP-READ: `false`, WARMUPS: `1` +//! STATE-VERSION: `V0`, STATE-CACHE-SIZE: `` +//! WEIGHT-PATH: `./runtime/casper/constants/src/weights/` +//! METRIC: `Average`, WEIGHT-MUL: `1.1`, WEIGHT-ADD: `0` + +// Executed Command: +// ./target/release/ghost +// benchmark +// storage +// --chain=casper-dev +// --state-version=0 +// --mul=1.1 +// --database=paritydb +// --weight-path=./runtime/casper/constants/src/weights/ +// --header=./file_header.txt + +/// Storage DB weights for the `Development` runtime and `ParityDb`. +pub mod constants { + use frame_support::weights::constants; + use sp_core::parameter_types; + use sp_weights::RuntimeDbWeight; + + parameter_types! { + /// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights + /// are available for brave runtime engineers who may want to try this out as default. + pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight { + read: 40_820 * constants::WEIGHT_REF_TIME_PER_NANOS, + write: 293_659 * constants::WEIGHT_REF_TIME_PER_NANOS, + }; + } + + #[cfg(test)] + mod test_db_weights { + use super::constants::ParityDbWeight as W; + use sp_weights::constants; + + /// Checks that all weights exist and have sane values. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn bound() { + // At least 1 µs. + assert!( + W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, + "Read weight should be at least 1 µs." + ); + assert!( + W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, + "Write weight should be at least 1 µs." + ); + // At most 1 ms. + assert!( + W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, + "Read weight should be at most 1 ms." + ); + assert!( + W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, + "Write weight should be at most 1 ms." + ); + } + } +} diff --git a/runtime/casper/constants/src/weights/rocksdb_weights.rs b/runtime/casper/constants/src/weights/rocksdb_weights.rs new file mode 100644 index 0000000..112ad0e --- /dev/null +++ b/runtime/casper/constants/src/weights/rocksdb_weights.rs @@ -0,0 +1,82 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-30 (Y/M/D) +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! +//! DATABASE: `RocksDb`, RUNTIME: `Development` +//! BLOCK-NUM: `BlockId::Number(0)` +//! SKIP-WRITE: `false`, SKIP-READ: `false`, WARMUPS: `1` +//! STATE-VERSION: `V0`, STATE-CACHE-SIZE: `` +//! WEIGHT-PATH: `./runtime/casper/constants/src/weights/` +//! METRIC: `Average`, WEIGHT-MUL: `1.1`, WEIGHT-ADD: `0` + +// Executed Command: +// ./target/release/ghost +// benchmark +// storage +// --chain=casper-dev +// --state-version=0 +// --mul=1.1 +// --weight-path=./runtime/casper/constants/src/weights/ +// --header=./file_header.txt + +/// Storage DB weights for the `Development` runtime and `RocksDb`. +pub mod constants { + use frame_support::weights::constants; + use sp_core::parameter_types; + use sp_weights::RuntimeDbWeight; + + parameter_types! { + /// By default, Substrate uses `RocksDB`, so this will be the weight used throughout + /// the runtime. + pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { + read: 31_627 * constants::WEIGHT_REF_TIME_PER_NANOS, + write: 412_279 * constants::WEIGHT_REF_TIME_PER_NANOS, + }; + } + + #[cfg(test)] + mod test_db_weights { + use super::constants::RocksDbWeight as W; + use sp_weights::constants; + + /// Checks that all weights exist and have sane values. + // NOTE: If this test fails but you are sure that the generated values are fine, + // you can delete it. + #[test] + fn bound() { + // At least 1 µs. + assert!( + W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, + "Read weight should be at least 1 µs." + ); + assert!( + W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS, + "Write weight should be at least 1 µs." + ); + // At most 1 ms. + assert!( + W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, + "Read weight should be at most 1 ms." + ); + assert!( + W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, + "Write weight should be at most 1 ms." + ); + } + } +} diff --git a/runtime/casper/src/bag_thresholds.rs b/runtime/casper/src/bag_thresholds.rs new file mode 100644 index 0000000..db22661 --- /dev/null +++ b/runtime/casper/src/bag_thresholds.rs @@ -0,0 +1,222 @@ + +//! Autogenerated bag thresholds. +//! +//! Generated on 2024-06-30T17:36:29.986756974+00:00 +//! Arguments +//! Total issuance: 50000000000000000000000000 +//! Minimum balance: 1000000000000 +//! for the casper runtime. + +/// Existential weight for this runtime. +#[cfg(any(test, feature = "std"))] +#[allow(unused)] +pub const EXISTENTIAL_WEIGHT: u64 = 368_934; + +/// Constant ratio between bags for this runtime. +#[cfg(any(test, feature = "std"))] +#[allow(unused)] +pub const CONSTANT_RATIO: f64 = 1.1717610304252650; + +/// Upper thresholds delimiting the bag list. +pub const THRESHOLDS: [u64; 200] = [ + 368_934, + 432_302, + 506_555, + 593_561, + 695_512, + 814_974, + 954_955, + 1_118_979, + 1_311_176, + 1_536_385, + 1_800_276, + 2_109_493, + 2_471_822, + 2_896_385, + 3_393_871, + 3_976_806, + 4_659_866, + 5_460_249, + 6_398_107, + 7_497_052, + 8_784_753, + 10_293_631, + 12_061_676, + 14_133_402, + 16_560_970, + 19_405_499, + 22_738_608, + 26_644_215, + 31_220_653, + 36_583_145, + 42_866_704, + 50_229_533, + 58_857_009, + 68_966_350, + 80_812_081, + 94_692_447, + 110_956_919, + 130_014_994, + 152_346_503, + 178_513_695, + 209_175_391, + 245_103_572, + 287_202_814, + 336_533_065, + 394_336_331, + 462_067_946, + 541_433_213, + 634_430_340, + 743_400_749, + 871_088_028, + 1_020_707_005, + 1_196_024_692, + 1_401_455_126, + 1_642_170_503, + 1_924_231_401, + 2_254_739_369, + 2_642_015_726, + 3_095_811_069, + 3_627_550_768, + 4_250_622_626, + 4_980_713_948, + 5_836_206_508, + 6_838_639_352, + 8_013_251_094, + 9_389_615_359, + 11_002_385_368, + 12_892_166_416, + 15_106_538_204, + 17_701_252_772, + 20_741_638_188, + 24_304_243_336, + 28_478_765_215, + 33_370_307_274, + 39_102_025_637, + 45_818_229_852, + 53_688_016_224, + 62_909_525_212, + 73_714_930_086, + 86_376_282_435, + 101_212_361_710, + 118_596_701_249, + 138_966_992_861, + 162_836_106_750, + 190_805_004_236, + 223_577_868_374, + 261_979_833_426, + 306_977_759_566, + 359_704_575_867, + 421_487_804_467, + 493_882_984_074, + 578_712_834_328, + 678_113_147_073, + 794_586_559_959, + 931_065_566_260, + 1_090_986_347_314, + 1_278_375_286_509, + 1_497_950_342_990, + 1_755_239_837_428, + 2_056_721_640_548, + 2_409_986_268_826, + 2_823_927_993_670, + 3_308_968_775_710, + 3_877_320_662_271, + 4_543_293_254_512, + 5_323_653_985_431, + 6_238_050_279_596, + 7_309_504_223_464, + 8_564_992_200_784, + 10_036_124_086_775, + 11_759_939_101_395, + 13_779_838_359_189, + 16_146_677_594_857, + 18_920_047_576_494, + 22_169_774_443_928, + 25_977_677_746_713, + 30_439_630_444_544, + 35_667_972_735_463, + 41_794_340_485_686, + 48_972_979_473_452, + 57_384_628_890_807, + 67_241_071_879_663, + 78_790_467_672_613, + 92_323_599_587_750, + 108_181_196_185_512, + 126_762_509_914_973, + 148_535_369_237_262, + 174_047_957_312_051, + 203_942_613_803_381, + 238_972_007_297_872, + 280_018_085_514_148, + 328_114_280_419_768, + 384_471_527_321_912, + 450_508_753_023_899, + 527_888_600_658_885, + 618_559_290_657_806, + 724_803_671_800_312, + 849_296_697_324_749, + 995_172_773_194_022, + 1_166_104_674_168_996, + 1_366_396_014_587_981, + 1_601_089_602_022_588, + 1_876_094_401_869_165, + 2_198_334_309_509_284, + 2_575_922_475_729_812, + 3_018_365_574_456_765, + 3_536_803_155_725_606, + 4_144_288_110_164_365, + 4_856_115_306_345_371, + 5_690_206_675_227_153, + 6_667_562_437_096_890, + 7_812_789_831_717_443, + 9_154_722_663_709_264, + 10_727_147_261_685_494, + 12_569_653_128_876_154, + 14_728_629_702_380_078, + 17_258_434_316_813_044, + 20_222_760_778_595_608, + 23_696_243_007_970_824, + 27_766_334_124_227_376, + 32_535_508_284_536_868, + 38_123_840_712_898_664, + 44_672_030_877_514_808, + 52_344_944_932_226_008, + 61_335_766_611_338_904, + 71_870_861_086_426_040, + 84_215_474_244_181_664, + 98_680_410_878_114_672, + 115_629_859_933_328_176, + 135_490_563_823_405_696, + 158_762_562_678_613_984, + 186_031_784_037_248_448, + 217_984_794_955_336_608, + 255_426_087_953_905_344, + 299_298_336_018_362_496, + 350_706_126_617_443_648, + 410_943_772_301_709_248, + 481_527_898_079_096_320, + 564_235_626_031_673_920, + 661_149_318_561_518_720, + 774_709_006_782_606_976, + 907_773_824_067_321_216, + 1_063_693_991_482_207_616, + 1_246_395_167_516_354_560, + 1_460_477_285_806_034_432, + 1_711_330_369_328_773_120, + 2_005_270_236_962_732_544, + 2_349_697_519_144_566_784, + 2_753_283_986_220_526_592, + 3_226_190_880_747_145_216, + 3_780_324_750_772_868_096, + 4_429_637_225_307_749_376, + 5_190_476_279_536_719_872, + 6_081_997_833_707_842_560, + 7_126_648_048_669_730_816, + 8_350_728_460_987_448_320, + 9_785_058_186_248_239_104, + 11_465_749_863_089_412_096, + 13_435_118_874_171_990_016, + 15_742_748_735_885_697_024, + 18_446_744_073_709_551_615, +]; diff --git a/runtime/casper/src/cult/mod.rs b/runtime/casper/src/cult/mod.rs new file mode 100755 index 0000000..4a3c291 --- /dev/null +++ b/runtime/casper/src/cult/mod.rs @@ -0,0 +1,164 @@ +use super::*; +use frame_support::{ + parameter_types, + traits::{ + EitherOf, EitherOfDiverse, MapSuccess, OriginTrait, TryWithMorphedArg, + tokens::pay::PayFromAccount, + }, +}; +use frame_system::EnsureRootWithSuccess; +use sp_core::{ConstU128, ConstU32}; +use sp_runtime::traits::{ConstU16, TakeFirst}; +use pallet_ranked_collective::EnsureOfRank; + +use crate::{ + // weights, + RuntimeCall, RuntimeEvent, Scheduler, DAYS, CSPR, AccountId, Balance, + TreasuryAccount, Balances, Preimage, Runtime, +}; + +mod origins; +pub use origins::{ + pallet_cult_origins, Geniuses, Degens, Zombies, Skeletons, Ghosts, + EnsureCanRetainAt, EnsureCanPromoteTo, EnsureCult, ToVoice, CultTreasurySpender, +}; + +mod tracks; +pub use tracks::TracksInfo; + +pub mod ranks { + use pallet_ranked_collective::Rank; + + pub const LEVEL_1: Rank = 1; + pub const LEVEL_2: Rank = 2; + pub const LEVEL_3: Rank = 3; + pub const LEVEL_4: Rank = 4; + pub const LEVEL_5: Rank = 5; +} + +impl pallet_cult_origins::Config for Runtime {} + +parameter_types! { + pub const VoteLockingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1); +} + +impl pallet_whitelist::Config for Runtime { + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type WhitelistOrigin = EitherOfDiverse< + EnsureRootWithSuccess>, + Skeletons, + >; + type DispatchWhitelistedOrigin = EitherOf< + EnsureRootWithSuccess>, + Geniuses, + >; + type Preimages = Preimage; + type WeightInfo = weights::pallet_whitelist::WeightInfo; +} + +parameter_types! { + pub const AlarmInterval: BlockNumber = 1; + pub const UndecidingTimeout: BlockNumber = 7 * DAYS; + pub const SubmissionDeposit: Balance = CSPR; +} + +pub type CultReferendaInstance = pallet_referenda::Instance1; +impl pallet_referenda::Config for Runtime { + type WeightInfo = (); + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type Scheduler = Scheduler; + type Currency = Balances; + type SubmitOrigin = EitherOf< + pallet_ranked_collective::EnsureMember, + MapSuccess< + TryWithMorphedArg< + RuntimeOrigin, + ::PalletsOrigin, + ToVoice, + EnsureOfRank, + (AccountId, u16), + >, + TakeFirst, + > + >; + type CancelOrigin = Skeletons; + type KillOrigin = Ghosts; + type Slash = Treasury; + type Votes = pallet_ranked_collective::Votes; + type Tally = pallet_ranked_collective::TallyOf; + type SubmissionDeposit = SubmissionDeposit; + type MaxQueued = ConstU32<100>; + type UndecidingTimeout = UndecidingTimeout; + type AlarmInterval = AlarmInterval; + type Tracks = TracksInfo; + type Preimages = Preimage; +} + +pub type CultCollectiveInstance = pallet_ranked_collective::Instance1; +impl pallet_ranked_collective::Config for Runtime { + type WeightInfo = weights::pallet_ranked_collective::WeightInfo; + type RuntimeEvent = RuntimeEvent; + + #[cfg(not(feature = "runtime-benchmarks"))] + type PromoteOrigin = frame_system::EnsureNever; + #[cfg(feature = "runtime-benchmarks")] + type PromoteOrigin = EnsureRootWithSuccess>; + + #[cfg(not(feature = "runtime-benchmarks"))] + type AddOrigin = frame_system::EnsureNever; + #[cfg(feature = "runtime-benchmarks")] + type AddOrigin = EnsureRootWithSuccess>; + + #[cfg(not(feature = "runtime-benchmarks"))] + type RemoveOrigin = frame_system::EnsureNever; + #[cfg(feature = "runtime-benchmarks")] + type RemoveOrigin = EnsureRootWithSuccess>; + + type DemoteOrigin = EitherOf>, Ghosts>; + type ExchangeOrigin = EitherOf>, Ghosts>; + + type Polls = CultReferenda; + type MinRankOfClass = tracks::MinRankOfClass; + type MemberSwappedHandler = (crate::CultCore, crate::CultSalary); + type VoteWeight = pallet_ranked_collective::Geometric; + + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkSetup = (crate::CultCore, crate::CultSalary); +} + +pub type CultCoreInstance = pallet_core_fellowship::Instance1; +impl pallet_core_fellowship::Config for Runtime { + type WeightInfo = weights::pallet_core_fellowship::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type Members = pallet_ranked_collective::Pallet; + type Balance = Balance; + + type ParamsOrigin = EitherOf>, Skeletons>; + type InductOrigin = EitherOf>, Zombies>; + type ApproveOrigin = EitherOf>, EnsureCanRetainAt>; + type PromoteOrigin = EitherOf>, EnsureCanPromoteTo>; + + type EvidenceSize = ConstU32<65536>; +} + +pub type CultSalaryInstance = pallet_salary::Instance1; +impl pallet_salary::Config for Runtime { + type WeightInfo = weights::pallet_salary::WeightInfo; + type RuntimeEvent = RuntimeEvent; + + type Paymaster = PayFromAccount; + type Members = pallet_ranked_collective::Pallet; + + #[cfg(not(feature = "runtime-benchmarks"))] + type Salary = pallet_core_fellowship::Pallet; + #[cfg(feature = "runtime-benchmarks")] + type Salary = frame_support::traits::tokens::ConvertRank< + crate::impls::benchmarks::RankToSalary, + >; + + type RegistrationPeriod = ConstU32<{ 15 * DAYS }>; + type PayoutPeriod = ConstU32<{ 15 * DAYS }>; + type Budget = ConstU128<{ 100 * CSPR }>; +} diff --git a/runtime/casper/src/cult/origins.rs b/runtime/casper/src/cult/origins.rs new file mode 100755 index 0000000..3cb917d --- /dev/null +++ b/runtime/casper/src/cult/origins.rs @@ -0,0 +1,168 @@ +//! Custom origins for general governance interventions. + +use super::ranks; +pub use pallet_cult_origins::*; + +#[frame_support::pallet] +pub mod pallet_cult_origins { + use crate::{Balance, CSPR}; + use super::ranks; + use frame_support::pallet_prelude::*; + use pallet_ranked_collective::Rank; + + #[pallet::config] + pub trait Config: frame_system::Config {} + + #[pallet::pallet] + pub struct Pallet(_); + + #[derive(PartialEq, Eq, Clone, MaxEncodedLen, Encode, Decode, TypeInfo, RuntimeDebug)] + #[pallet::origin] + pub enum Origin { + Geniuses, + Degens, + Zombies, + Skeletons, + Ghosts, + + RetainAt1Level, + RetainAt2Level, + RetainAt3Level, + RetainAt4Level, + RetainAt5Level, + + PromoteTo1Level, + PromoteTo2Level, + PromoteTo3Level, + PromoteTo4Level, + PromoteTo5Level, + } + + impl Origin { + pub fn as_voice(&self) -> Option { + Some(match &self { + Origin::Geniuses => ranks::LEVEL_1, + Origin::Degens => ranks::LEVEL_2, + Origin::Zombies => ranks::LEVEL_3, + Origin::Skeletons => ranks::LEVEL_4, + Origin::Ghosts => ranks::LEVEL_5, + _ => return None, + }) + } + } + + pub struct ToVoice; + impl<'a, O: 'a + TryInto<&'a Origin>> sp_runtime::traits::TryMorph for ToVoice { + type Outcome = pallet_ranked_collective::Rank; + fn try_morph(o: O) -> Result { + o.try_into().ok().and_then(Origin::as_voice).ok_or(()) + } + } + + macro_rules! decl_unit_ensures { + ( $name:ident: $success_type:ty = $success:expr ) => { + pub struct $name; + impl> + From> EnsureOrigin for $name { + type Success = $success_type; + fn try_origin(o: O) -> Result { + o.into().and_then(|o| match o { + Origin::$name => Ok($success), + r => Err(O::from(r)), + }) + } + #[cfg(feature = "runtime-benchmarks")] + fn try_successful_origin() -> Result { + Ok(O::from(Origin::$name)) + } + } + }; + ( $name:ident ) => { decl_unit_ensures! { $name : () = () } }; + ( $name:ident: $success_type:ty = $success:expr, $( $rest:tt )* ) => { + decl_unit_ensures! { $name: $success_type = $success } + decl_unit_ensures! { $( $rest )* } + }; + ( $name:ident, $( $rest:tt )* ) => { + decl_unit_ensures! { $name } + decl_unit_ensures! { $( $rest )* } + }; + () => {} + } + decl_unit_ensures!( + Geniuses: Rank = ranks::LEVEL_1, + Degens: Rank = ranks::LEVEL_2, + Zombies: Rank = ranks::LEVEL_3, + Skeletons: Rank = ranks::LEVEL_4, + Ghosts: Rank = ranks::LEVEL_5, + ); + + macro_rules! decl_ensure { + ( + $vis:vis type $name:ident: EnsureOrigin { + $( $item:ident = $success:expr, )* + } + ) => { + $vis struct $name; + impl> + From> EnsureOrigin for $name { + type Success = $success_type; + fn try_origin(o: O) -> Result { + o.into().and_then(|o| match o { + $( + Origin::$item => Ok($success), + )* + r => Err(O::from(r)), + }) + } + #[cfg(feature = "runtime-benchmarks")] + fn try_successful_origin() -> Result { + // By convention the more privileged origins go later, + // so for greatest chance of success, we want the last one. + let _result: Result = Err(()); + $( + let _result: Result = Ok(O::from(Origin::$item)); + )* + _result + } + } + } + } + + decl_ensure! { + pub type EnsureCult: EnsureOrigin { + Geniuses = ranks::LEVEL_1, + Degens = ranks::LEVEL_2, + Zombies = ranks::LEVEL_3, + Skeletons = ranks::LEVEL_4, + Ghosts = ranks::LEVEL_5, + } + } + + decl_ensure! { + pub type EnsureCanRetainAt: EnsureOrigin { + RetainAt1Level = ranks::LEVEL_1, + RetainAt2Level = ranks::LEVEL_2, + RetainAt3Level = ranks::LEVEL_3, + RetainAt4Level = ranks::LEVEL_4, + RetainAt5Level = ranks::LEVEL_5, + } + } + + decl_ensure! { + pub type EnsureCanPromoteTo: EnsureOrigin { + PromoteTo1Level = ranks::LEVEL_1, + PromoteTo2Level = ranks::LEVEL_2, + PromoteTo3Level = ranks::LEVEL_3, + PromoteTo4Level = ranks::LEVEL_4, + PromoteTo5Level = ranks::LEVEL_5, + } + } + + decl_ensure! { + pub type CultTreasurySpender: EnsureOrigin { + Geniuses = 50 * CSPR, + Degens = 100 * CSPR, + Zombies = 500 * CSPR, + Skeletons = 1_000 * CSPR, + Ghosts = 10_000 * CSPR, + } + } +} diff --git a/runtime/casper/src/cult/tracks.rs b/runtime/casper/src/cult/tracks.rs new file mode 100755 index 0000000..703fa87 --- /dev/null +++ b/runtime/casper/src/cult/tracks.rs @@ -0,0 +1,377 @@ +use crate::{Balance, BlockNumber, RuntimeOrigin, DAYS, CSPR, HOURS, MINUTES}; +use pallet_ranked_collective::Rank; +use sp_runtime::{traits::Convert, Perbill}; + +pub type TrackId = u16; + +pub mod constants { + use super::TrackId; + + pub const GENIUSES: TrackId = 1; + pub const DEGENS: TrackId = 2; + pub const ZOMBIES: TrackId = 3; + pub const SKELETONS: TrackId = 4; + pub const GHOSTS: TrackId = 5; + + pub const RETAIN_AT_GENIUSES: TrackId = 10; + pub const RETAIN_AT_DEGENS: TrackId = 11; + pub const RETAIN_AT_ZOMBIES: TrackId = 12; + pub const RETAIN_AT_SKELETONS: TrackId = 13; + pub const RETAIN_AT_GHOSTS: TrackId = 14; + + pub const PROMOTE_TO_GENIUSES: TrackId = 20; + pub const PROMOTE_TO_DEGENS: TrackId = 21; + pub const PROMOTE_TO_ZOMBIES: TrackId = 22; + pub const PROMOTE_TO_SKELETONS: TrackId = 23; + pub const PROMOTE_TO_GHOSTS: TrackId = 24; +} + +/// Convert the track ID (defined above) into the minimum rank required. +pub struct MinRankOfClass; +impl Convert for MinRankOfClass { + fn convert(a: TrackId) -> Rank { + match a { + regular @ 1..=5 => regular, + retention @ 10..=13 => retention - 8, + promotion @ 20..=23 => promotion - 18, + 14 | 24 => 5, + _ => Rank::MAX, + } + } +} + +const RETAIN_MAX_DECIDING: u32 = 25; +const RETAIN_DECISION_DEPOSIT: Balance = 5 * CSPR; +const RETAIN_PREPARE_PERIOD: BlockNumber = 0; +const RETAIN_DECISION_PERIOD: BlockNumber = 14 * DAYS; +const RETAIN_CONFIRM_PERIOD: BlockNumber = HOURS; +const RETAIN_MIN_ENACTMENT_PERIOD: BlockNumber = 0; +const RETAIN_MIN_APPROVAL: pallet_referenda::Curve = pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(60), + ceil: Perbill::from_percent(100), +}; +const RETAIN_MIN_SUPPORT: pallet_referenda::Curve = pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(10), + ceil: Perbill::from_percent(100), +}; + +const PROMOTE_MAX_DECIDING: u32 = 10; +const PROMOTE_DECISION_DEPOSIT: Balance = 5 * CSPR; +const PROMOTE_PREPARE_PERIOD: BlockNumber = 0; +const PROMOTE_DECISION_PERIOD: BlockNumber = 30 * DAYS; +const PROMOTE_CONFIRM_PERIOD: BlockNumber = HOURS; +const PROMOTE_MIN_ENACTMENT_PERIOD: BlockNumber = 0; +const PROMOTE_MIN_APPROVAL: pallet_referenda::Curve = pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(60), + ceil: Perbill::from_percent(100), +}; +const PROMOTE_MIN_SUPPORT: pallet_referenda::Curve = pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(10), + ceil: Perbill::from_percent(100), +}; + +const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 15] = [ + ( + constants::GENIUSES, + pallet_referenda::TrackInfo { + name: "geniuses", + max_deciding: 10, + decision_deposit: 5 * CSPR, + prepare_period: 30 * MINUTES, + decision_period: 7 * DAYS, + confirm_period: 30 * MINUTES, + min_enactment_period: 5 * MINUTES, + min_approval: pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), + }, + min_support: pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(0), + ceil: Perbill::from_percent(100), + }, + }, + ), + ( + constants::DEGENS, + pallet_referenda::TrackInfo { + name: "degens", + max_deciding: 10, + decision_deposit: 5 * CSPR, + prepare_period: 30 * MINUTES, + decision_period: 7 * DAYS, + confirm_period: 30 * MINUTES, + min_enactment_period: 5 * MINUTES, + min_approval: pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), + }, + min_support: pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(0), + ceil: Perbill::from_percent(100), + }, + }, + ), + ( + constants::ZOMBIES, + pallet_referenda::TrackInfo { + name: "zombies", + max_deciding: 10, + decision_deposit: 5 * CSPR, + prepare_period: 30 * MINUTES, + decision_period: 7 * DAYS, + confirm_period: 30 * MINUTES, + min_enactment_period: 5 * MINUTES, + min_approval: pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), + }, + min_support: pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(0), + ceil: Perbill::from_percent(100), + }, + }, + ), + ( + constants::SKELETONS, + pallet_referenda::TrackInfo { + name: "skeletons", + max_deciding: 10, + decision_deposit: 5 * CSPR, + prepare_period: 30 * MINUTES, + decision_period: 7 * DAYS, + confirm_period: 30 * MINUTES, + min_enactment_period: 5 * MINUTES, + min_approval: pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), + }, + min_support: pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(0), + ceil: Perbill::from_percent(100), + }, + }, + ), + ( + constants::GHOSTS, + pallet_referenda::TrackInfo { + name: "skeletons", + max_deciding: 10, + decision_deposit: 5 * CSPR, + prepare_period: 30 * MINUTES, + decision_period: 7 * DAYS, + confirm_period: 30 * MINUTES, + min_enactment_period: 5 * MINUTES, + min_approval: pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), + }, + min_support: pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(0), + ceil: Perbill::from_percent(100), + }, + }, + ), + ( + constants::RETAIN_AT_GENIUSES, + pallet_referenda::TrackInfo { + name: "retain a genius", + max_deciding: RETAIN_MAX_DECIDING, + decision_deposit: RETAIN_DECISION_DEPOSIT, + prepare_period: RETAIN_PREPARE_PERIOD, + decision_period: RETAIN_DECISION_PERIOD, + confirm_period: RETAIN_CONFIRM_PERIOD, + min_enactment_period: RETAIN_MIN_ENACTMENT_PERIOD, + min_approval: RETAIN_MIN_APPROVAL, + min_support: RETAIN_MIN_SUPPORT, + }, + ), + ( + constants::RETAIN_AT_DEGENS, + pallet_referenda::TrackInfo { + name: "retain a degen", + max_deciding: RETAIN_MAX_DECIDING, + decision_deposit: RETAIN_DECISION_DEPOSIT, + prepare_period: RETAIN_PREPARE_PERIOD, + decision_period: RETAIN_DECISION_PERIOD, + confirm_period: RETAIN_CONFIRM_PERIOD, + min_enactment_period: RETAIN_MIN_ENACTMENT_PERIOD, + min_approval: RETAIN_MIN_APPROVAL, + min_support: RETAIN_MIN_SUPPORT, + }, + ), + ( + constants::RETAIN_AT_ZOMBIES, + pallet_referenda::TrackInfo { + name: "retain a zombie", + max_deciding: RETAIN_MAX_DECIDING, + decision_deposit: RETAIN_DECISION_DEPOSIT, + prepare_period: RETAIN_PREPARE_PERIOD, + decision_period: RETAIN_DECISION_PERIOD, + confirm_period: RETAIN_CONFIRM_PERIOD, + min_enactment_period: RETAIN_MIN_ENACTMENT_PERIOD, + min_approval: RETAIN_MIN_APPROVAL, + min_support: RETAIN_MIN_SUPPORT, + }, + ), + ( + constants::RETAIN_AT_SKELETONS, + pallet_referenda::TrackInfo { + name: "retain a skeleton", + max_deciding: RETAIN_MAX_DECIDING, + decision_deposit: RETAIN_DECISION_DEPOSIT, + prepare_period: RETAIN_PREPARE_PERIOD, + decision_period: RETAIN_DECISION_PERIOD, + confirm_period: RETAIN_CONFIRM_PERIOD, + min_enactment_period: RETAIN_MIN_ENACTMENT_PERIOD, + min_approval: RETAIN_MIN_APPROVAL, + min_support: RETAIN_MIN_SUPPORT, + }, + ), + ( + constants::RETAIN_AT_GHOSTS, + pallet_referenda::TrackInfo { + name: "retain a ghost", + max_deciding: RETAIN_MAX_DECIDING, + decision_deposit: RETAIN_DECISION_DEPOSIT, + prepare_period: RETAIN_PREPARE_PERIOD, + decision_period: RETAIN_DECISION_PERIOD, + confirm_period: RETAIN_CONFIRM_PERIOD, + min_enactment_period: RETAIN_MIN_ENACTMENT_PERIOD, + min_approval: RETAIN_MIN_APPROVAL, + min_support: RETAIN_MIN_SUPPORT, + }, + ), + + ( + constants::PROMOTE_TO_GENIUSES, + pallet_referenda::TrackInfo { + name: "promote to genius", + max_deciding: PROMOTE_MAX_DECIDING, + decision_deposit: PROMOTE_DECISION_DEPOSIT, + prepare_period: PROMOTE_PREPARE_PERIOD, + decision_period: PROMOTE_DECISION_PERIOD, + confirm_period: PROMOTE_CONFIRM_PERIOD, + min_enactment_period: PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: PROMOTE_MIN_APPROVAL, + min_support: PROMOTE_MIN_SUPPORT, + }, + ), + ( + constants::PROMOTE_TO_DEGENS, + pallet_referenda::TrackInfo { + name: "promote to degen", + max_deciding: PROMOTE_MAX_DECIDING, + decision_deposit: PROMOTE_DECISION_DEPOSIT, + prepare_period: PROMOTE_PREPARE_PERIOD, + decision_period: PROMOTE_DECISION_PERIOD, + confirm_period: PROMOTE_CONFIRM_PERIOD, + min_enactment_period: PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: PROMOTE_MIN_APPROVAL, + min_support: PROMOTE_MIN_SUPPORT, + }, + ), + ( + constants::PROMOTE_TO_ZOMBIES, + pallet_referenda::TrackInfo { + name: "promote to zombie", + max_deciding: PROMOTE_MAX_DECIDING, + decision_deposit: PROMOTE_DECISION_DEPOSIT, + prepare_period: PROMOTE_PREPARE_PERIOD, + decision_period: PROMOTE_DECISION_PERIOD, + confirm_period: PROMOTE_CONFIRM_PERIOD, + min_enactment_period: PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: PROMOTE_MIN_APPROVAL, + min_support: PROMOTE_MIN_SUPPORT, + }, + ), + ( + constants::PROMOTE_TO_SKELETONS, + pallet_referenda::TrackInfo { + name: "promote to skeleton", + max_deciding: PROMOTE_MAX_DECIDING, + decision_deposit: PROMOTE_DECISION_DEPOSIT, + prepare_period: PROMOTE_PREPARE_PERIOD, + decision_period: PROMOTE_DECISION_PERIOD, + confirm_period: PROMOTE_CONFIRM_PERIOD, + min_enactment_period: PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: PROMOTE_MIN_APPROVAL, + min_support: PROMOTE_MIN_SUPPORT, + }, + ), + ( + constants::PROMOTE_TO_GHOSTS, + pallet_referenda::TrackInfo { + name: "promote to ghost", + max_deciding: PROMOTE_MAX_DECIDING, + decision_deposit: PROMOTE_DECISION_DEPOSIT, + prepare_period: PROMOTE_PREPARE_PERIOD, + decision_period: PROMOTE_DECISION_PERIOD, + confirm_period: PROMOTE_CONFIRM_PERIOD, + min_enactment_period: PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: PROMOTE_MIN_APPROVAL, + min_support: PROMOTE_MIN_SUPPORT, + }, + ), +]; + +pub struct TracksInfo; +impl pallet_referenda::TracksInfo for TracksInfo { + type Id = TrackId; + type RuntimeOrigin = ::PalletsOrigin; + + fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo)] { + &TRACKS_DATA[..] + } + + fn track_for(id: &Self::RuntimeOrigin) -> Result { + use super::origins::Origin; + use constants as tracks; + + #[cfg(feature = "runtime-benchmarks")] + { + // For benchmark we enable root origin. + // It is important that this is NOT availiable in production! + let root: Self::RuntimeOrigin = frame_system::RawOrigin::Root.into(); + if &root == id { + return Ok(tracks::GHOSTS) + } + } + + match Origin::try_from(id.clone()) { + Ok(Origin::Geniuses) => Ok(tracks::GENIUSES), + Ok(Origin::Degens) => Ok(tracks::DEGENS), + Ok(Origin::Zombies) => Ok(tracks::ZOMBIES), + Ok(Origin::Skeletons) => Ok(tracks::SKELETONS), + Ok(Origin::Ghosts) => Ok(tracks::GHOSTS), + + Ok(Origin::RetainAt1Level) => Ok(tracks::RETAIN_AT_GENIUSES), + Ok(Origin::RetainAt2Level) => Ok(tracks::RETAIN_AT_DEGENS), + Ok(Origin::RetainAt3Level) => Ok(tracks::RETAIN_AT_ZOMBIES), + Ok(Origin::RetainAt4Level) => Ok(tracks::RETAIN_AT_SKELETONS), + Ok(Origin::RetainAt5Level) => Ok(tracks::RETAIN_AT_GHOSTS), + + Ok(Origin::PromoteTo1Level) => Ok(tracks::PROMOTE_TO_GENIUSES), + Ok(Origin::PromoteTo2Level) => Ok(tracks::PROMOTE_TO_GENIUSES), + Ok(Origin::PromoteTo3Level) => Ok(tracks::PROMOTE_TO_ZOMBIES), + Ok(Origin::PromoteTo4Level) => Ok(tracks::PROMOTE_TO_SKELETONS), + Ok(Origin::PromoteTo5Level) => Ok(tracks::PROMOTE_TO_GHOSTS), + + _ => Err(()), + } + } +} +pallet_referenda::impl_tracksinfo_get!(TracksInfo, Balance, BlockNumber); diff --git a/runtime/casper/src/genesis_config_presets.rs b/runtime/casper/src/genesis_config_presets.rs new file mode 100644 index 0000000..61f8ea5 --- /dev/null +++ b/runtime/casper/src/genesis_config_presets.rs @@ -0,0 +1,237 @@ +use codec::Encode; + +use crate::{opaque::SessionKeys, BABE_GENESIS_EPOCH_CONFIG}; +use primitives::{AccountId, AccountPublic}; +use casper_runtime_constants::currency::CSPR; + +use ghost_slow_clap::sr25519::AuthorityId as SlowClapId; +use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; +use babe_primitives::AuthorityId as BabeId; +use grandpa_primitives::AuthorityId as GrandpaId; + +#[cfg(not(feature = "std"))] +use sp_std::alloc::format; +use sp_std::vec::Vec; +use sp_std::prelude::*; +use sp_core::{sr25519, Pair, Public}; +use sp_runtime::traits::IdentifyAccount; + +#[derive(Encode, Clone)] +struct PreparedNetworkData { + chain_name: Vec, + default_endpoint: Vec, + finality_delay: Option, + release_delay: Option, + network_type: u8, + gatekeeper: Vec, + topic_name: Vec, + incoming_fee: u32, + outgoing_fee: u32, +} + +fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +fn get_account_id_from_seed(seed: &str) -> AccountId +where + AccountPublic: From<::Public>, +{ + AccountPublic::from(get_from_seed::(seed)).into_account() +} + +fn get_authority_keys_from_seed( + seed: &str, +) -> ( + AccountId, + AccountId, + BabeId, + GrandpaId, + AuthorityDiscoveryId, + SlowClapId, +) { + ( + get_account_id_from_seed::(&format!("{}//stash", seed)), + get_account_id_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + ) +} + +fn testnet_accounts() -> Vec { + Vec::from([ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Feride"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Feride//stash"), + ]) +} + +fn testnet_evm_accounts() -> Vec<(AccountId, u128, u8)> { + vec![ + // 01c928771aea942a1e7ac06adf2b73dfbc9a25d9eaa516e3673116af7f345198 + (get_account_id_from_seed::("1A69d2D5568D1878023EeB121a73d33B9116A760"), 1337 * CSPR, 1), + // b19a435901872f817185f7234a1484eae837613f9d10cf21927a23c2d8cb9139 + (get_account_id_from_seed::("2f86cfBED3fbc1eCf2989B9aE5fc019a837A9C12"), 1337 * CSPR, 2), + // d3baf57b74d65719b2dc33f5a464176022d0cc5edbca002234229f3e733875fc + (get_account_id_from_seed::("e83f67361Ac74D42A48E2DAfb6706eb047D8218D"), 69 * CSPR, 3), + // c4683d566436af6b58b4a59c8f501319226e85b21869bf93d5eeb4596d4791d4 + (get_account_id_from_seed::("827ee4ad9b259b6fa1390ed60921508c78befd63"), 69 * CSPR, 4), + ] +} + +fn testnet_evm_networks() -> Vec<(u32, Vec)> { + vec![ + (1, PreparedNetworkData { + chain_name: "ethereum-mainnet".into(), + default_endpoint: "https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/".into(), + finality_delay: Some(40), + release_delay: Some(80), + network_type: Default::default(), + gatekeeper: "0x4d224452801aced8b2f0aebe155379bb5d594381".into(), + topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(), + incoming_fee: 0, + outgoing_fee: 0, + }.encode()), + (56, PreparedNetworkData { + chain_name: "bnb-mainnet".into(), + default_endpoint: "https://bsc-mainnet.core.chainstack.com/35848e183f3e3303c8cfeacbea831cab/".into(), + finality_delay: Some(20), + release_delay: Some(40), + network_type: Default::default(), + gatekeeper: "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82".into(), + topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(), + incoming_fee: 0, + outgoing_fee: 0, + }.encode()) + ] +} + +fn casper_session_keys( + babe: BabeId, + grandpa: GrandpaId, + authority_discovery: AuthorityDiscoveryId, + slow_clap: SlowClapId, +) -> SessionKeys { + SessionKeys { babe, grandpa, authority_discovery, slow_clap } +} + +fn casper_testnet_genesis( + initial_authorities: Vec<( + AccountId, + AccountId, + BabeId, + GrandpaId, + AuthorityDiscoveryId, + SlowClapId, + )>, + endowed_accounts: Option>, + ghost_accounts: Option>, + evm_networks: Option)>>, +) -> serde_json::Value { + let endowed_accounts: Vec = + endowed_accounts.unwrap_or_else(testnet_accounts); + + let ghost_accounts: Vec<(AccountId, u128, u8)> = + ghost_accounts.unwrap_or_else(testnet_evm_accounts); + + let evm_networks: Vec<(u32, Vec)> = + evm_networks.unwrap_or_else(testnet_evm_networks); + + const ENDOWMENT: u128 = 1_000 * CSPR; + + serde_json::json!({ + "balances": { + "balances": endowed_accounts + .iter() + .map(|k| (k.clone(), ENDOWMENT)) + .chain(ghost_accounts + .iter() + .map(|k| (k.0.clone(), k.1.clone()))) + .collect::>(), + }, + "session": { + "keys": initial_authorities + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + casper_session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + ), + ) + }) + .collect::>(), + }, + "babe": { + "epochConfig": Some(BABE_GENESIS_EPOCH_CONFIG), + }, + "ghostNetworks": { + "networks": evm_networks, + }, + "ghostClaims": { + "total": ghost_accounts + .iter() + .fold(0, |acc, k| acc + k.1), + "membersAndRanks": ghost_accounts + .iter() + .map(|k| (k.0.clone(), k.2.clone())) + .collect::>(), + }, + }) +} + +// development +fn casper_development_config_genesis() -> serde_json::Value { + casper_testnet_genesis( + vec![get_authority_keys_from_seed("Alice")], + None, None, None, + ) +} + +// local +fn casper_local_config_genesis() -> serde_json::Value { + casper_testnet_genesis( + vec![ + get_authority_keys_from_seed("Alice"), + get_authority_keys_from_seed("Bob"), + ], + None, None, None, + ) +} + +/// Provides the JSON representation of predefined genesis config for given `id`. +pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { + let patch = match id.try_into() { + Ok("development") => casper_development_config_genesis(), + Ok("local_testnet") => casper_local_config_genesis(), + _ => return None, + }; + Some(serde_json::to_string(&patch) + .expect("serialization to json is expected to work; qed") + .into_bytes()) +} + +/// Returns a list of identifiers for available builtin `RuntimeGenesisConfig` presets. +pub fn preset_names() -> Vec { + Vec::from([ + sp_genesis_builder::PresetId::from("local_testnet"), + sp_genesis_builder::PresetId::from("development"), + ]) +} diff --git a/runtime/casper/src/impls.rs b/runtime/casper/src/impls.rs new file mode 100644 index 0000000..8728457 --- /dev/null +++ b/runtime/casper/src/impls.rs @@ -0,0 +1,93 @@ +use super::*; +use frame_support::{ + dispatch::DispatchResultWithPostInfo, + traits::PrivilegeCmp, +}; +use pallet_alliance::{ProposalIndex, ProposalProvider}; +use sp_runtime::DispatchError; +use sp_std::{cmp::Ordering, marker::PhantomData}; + +type AccountIdOf = ::AccountId; +type ProposalOf = >::Proposal; +type HashOf = ::Hash; + +/// Proposal provider for alliance pallet. +/// Adapter from collective pallet to alliance proposal provider trait. +pub struct AllianceProposalProvider(PhantomData<(T, I)>); +impl ProposalProvider, HashOf, ProposalOf> for AllianceProposalProvider +where + T: pallet_collective::Config + frame_system::Config, + I: 'static, +{ + fn propose_proposal( + who: AccountIdOf, + threshold: u32, + proposal: Box>, + length_bound: u32, + ) -> Result<(u32, u32), DispatchError> { + pallet_collective::Pallet::::do_propose_proposed(who, threshold, proposal, length_bound) + } + + fn vote_proposal( + who: AccountIdOf, + proposal: HashOf, + index: ProposalIndex, + approve: bool, + ) -> Result { + pallet_collective::Pallet::::do_vote(who, proposal, index, approve) + } + + fn close_proposal( + proposal_hash: HashOf, + proposal_index: ProposalIndex, + proposal_weight_bound: Weight, + length_bound: u32, + ) -> DispatchResultWithPostInfo { + pallet_collective::Pallet::::do_close( + proposal_hash, + proposal_index, + proposal_weight_bound, + length_bound, + ) + } + + fn proposal_of(proposal_hash: HashOf) -> Option> { + pallet_collective::ProposalOf::::get(proposal_hash) + } +} + +/// Used the compare the privilege of an origin inside the scheduler. +pub struct EqualOrGreatestRootCmp; +impl PrivilegeCmp for EqualOrGreatestRootCmp { + fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option { + if left == right { + return Some(Ordering::Equal) + } + + match (left, right) { + // Root is greater than anything + (OriginCaller::system(frame_system::RawOrigin::Root), _) => Some(Ordering::Greater), + // For every other we don't care, as they are not used for `ScheduleOrigin`. + _ => None, + } + } +} + +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarks { + use super::*; + use frame_support::traits::fungible; + use pallet_ranked_collective::Rank; + use sp_runtime::traits::Convert; + + /// Rank to salary conversion helper type + pub struct RankToSalary(PhantomData); + impl Convert for RankToSalary + where + Fungible: fungible::Inspect, + { + fn convert(r: Rank) -> Balance { + Balance::from(r).saturating_mul(Fungible::minimum_balance()) + } + } +} diff --git a/runtime/casper/src/lib.rs b/runtime/casper/src/lib.rs new file mode 100755 index 0000000..b0439a6 --- /dev/null +++ b/runtime/casper/src/lib.rs @@ -0,0 +1,1915 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +// `construct_runtime!` does a lot of recursion and requires us to increase +// the limit to 256 +#![recursion_limit = "256"] + +use frame_system::{EnsureRoot, EnsureRootWithSuccess}; +use runtime_common::{ + impls::DealWithFees, BlockHashCount, BlockLength, CurrencyToVote, + SlowAdjustingFeeUpdate, impl_runtime_weights, prod_or_fast, +}; +use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; +use frame_election_provider_support::{ + generate_solution_type, onchain, SequentialPhragmen, + bounds::ElectionBoundsBuilder, +}; +use frame_support::{ + construct_runtime, parameter_types, + genesis_builder_helper::{build_state, get_preset}, + traits::{ + fungible::HoldConsideration, + tokens::UnityAssetBalanceConversion, + ConstU128, ConstU32, EitherOf, EitherOfDiverse, InstanceFilter, + KeyOwnerProofSystem, LinearStoragePrice, WithdrawReasons, + }, + weights::ConstantMultiplier, PalletId +}; + +#[cfg(feature = "runtime-benchmarks")] +use runtime_common::benchmarking::BenchmarkTreasuryHelper; +// #[cfg(not(feature = "runtime-benchmarks"))] +use frame_support::traits::tokens::pay::PayFromAccount; + +use pallet_transaction_payment::FungibleAdapter; +use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId}; +use pallet_identity::legacy::IdentityInfo; +use ghost_slow_clap::sr25519::AuthorityId as SlowClapId; +use pallet_session::historical as session_historical; +use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo}; +use codec::{Decode, Encode, MaxEncodedLen}; + +use primitives::{ + AccountId, AccountIndex, Balance, BlockNumber, Hash, Moment, Nonce, + Signature, ReserveIdentifier, +}; +use sp_core::OpaqueMetadata; +use sp_runtime::{ + create_runtime_str, generic, impl_opaque_keys, FixedU128, + curve::PiecewiseLinear, + traits::{ + AccountIdLookup, BlakeTwo256, Block as BlockT, Extrinsic as ExtrinsicT, + OpaqueKeys, SaturatedConversion, Verify, IdentityLookup, ConvertInto, + ConstU16, + }, + transaction_validity::{ + TransactionPriority, TransactionSource, TransactionValidity, + }, + ApplyExtrinsicResult, KeyTypeId, Perbill, Percent, Permill, + RuntimeDebug, +}; +use sp_genesis_builder::PresetId; +use sp_std::prelude::*; +#[cfg(any(feature = "std", test))] +use sp_version::NativeVersion; +use sp_version::RuntimeVersion; + +pub use frame_system::Call as SystemCall; +pub use pallet_balances::Call as BalancesCall; +pub use pallet_election_provider_multi_phase::{Call as EPMCall, GeometricDepositBase}; + +#[cfg(feature = "std")] +pub use pallet_staking::StakerStatus; +use pallet_staking::UseValidatorsMap; +pub use pallet_timestamp::Call as TimestampCall; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; + +/// Constant values used within the runtime. +use casper_runtime_constants::{currency::*, time::*, fee::*}; + +mod weights; +mod bag_thresholds; +mod impls; +mod genesis_config_presets; + +pub use impls::{AllianceProposalProvider, EqualOrGreatestRootCmp}; + +// Governance configuration. +pub mod cult; +use cult::{ + pallet_cult_origins, CultCollectiveInstance, CultTreasurySpender, + Geniuses, Degens, Zombies, Skeletons, Ghosts, +}; + +pub const LOG_TARGET: &str = "runtime::casper"; + +impl_runtime_weights!(casper_runtime_constants); + +// Make the WASM binary available. +#[cfg(feature = "std")] +include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + +pub mod opaque { + use super::*; + + pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; + pub type Block = generic::Block; + + impl_opaque_keys! { + pub struct SessionKeys { + pub grandpa: Grandpa, + pub babe: Babe, + pub authority_discovery: AuthorityDiscovery, + pub slow_clap: GhostSlowClaps, + } + } +} + +/// Runtime version (Casper). +#[sp_version::runtime_version] +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name: create_runtime_str!("casper"), + impl_name: create_runtime_str!("casper-svengali"), + authoring_version: 0, + spec_version: 1, + impl_version : 0, + apis: RUNTIME_API_VERSIONS, + transaction_version: 1, + state_version: 0, +}; + +/// The BABE epoch configuration at genesis. +pub const BABE_GENESIS_EPOCH_CONFIG: babe_primitives::BabeEpochConfiguration = + babe_primitives::BabeEpochConfiguration { + c: PRIMARY_PROBABILITY, + allowed_slots: babe_primitives::AllowedSlots::PrimaryAndSecondaryVRFSlots, + }; + +/// The version information used to identify this runtime when compiled natively. +#[cfg(any(feature = "std", test))] +pub fn native_version() -> NativeVersion { + NativeVersion { + runtime_version: VERSION, + can_author_with: Default::default(), + } +} + +parameter_types! { + pub const Version: RuntimeVersion = VERSION; + pub const SS58Prefix: u16 = 1996; +} + +// Configure FRAME pallets to include in runtime. +impl frame_system::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BaseCallFilter = frame_support::traits::Everything; + type BlockWeights = BlockWeights; + type BlockLength = BlockLength; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type RuntimeTask = RuntimeTask; + type Nonce = Nonce; + type Hash = Hash; + type Hashing = BlakeTwo256; + type AccountId = AccountId; + type Lookup = AccountIdLookup; + type Block = Block; + type BlockHashCount = BlockHashCount; + type DbWeight = RocksDbWeight; + type Version = Version; + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = weights::frame_system::WeightInfo; + type SS58Prefix = SS58Prefix; + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; + type SingleBlockMigrations = (); + type MultiBlockMigrator = (); + type PreInherents = (); + type PostInherents = (); + type PostTransactions = (); +} + +parameter_types! { + pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * + BlockWeights::get().max_block; + pub const MaxScheduledPerBlock: u32 = 50; +} + +impl pallet_scheduler::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; + type PalletsOrigin = OriginCaller; + type RuntimeCall = RuntimeCall; + type MaximumWeight = MaximumSchedulerWeight; + type ScheduleOrigin = EnsureRoot; + type MaxScheduledPerBlock = MaxScheduledPerBlock; + type OriginPrivilegeCmp = EqualOrGreatestRootCmp; + type Preimages = Preimage; + type WeightInfo = weights::pallet_scheduler::WeightInfo; +} + +parameter_types! { + pub const PreimageBaseDeposit: Balance = deposit(2, 64); + pub const PreimageByteDeposit: Balance = deposit(0, 1); + pub const PreimageHoldReason: RuntimeHoldReason = + RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage); +} + +impl pallet_preimage::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type ManagerOrigin = EnsureRoot; + type Consideration = HoldConsideration< + AccountId, + Balances, + PreimageHoldReason, + LinearStoragePrice, + >; + type WeightInfo = weights::pallet_preimage::WeightInfo; +} + +parameter_types! { + pub const EpochDuration: u64 = prod_or_fast!( + EPOCH_DURATION_IN_SLOTS as u64, + 2 * MINUTES as u64 + ); + pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK; + pub const ReportLongevity: u64 = + BondingDuration::get() as u64 * + SessionsPerEra::get() as u64 * + EpochDuration::get(); +} + +impl pallet_babe::Config for Runtime { + type EpochDuration = EpochDuration; + type ExpectedBlockTime = ExpectedBlockTime; + + // Session module trigger + type EpochChangeTrigger = pallet_babe::ExternalTrigger; + + type DisabledValidators = Session; + type WeightInfo = (); + + type MaxAuthorities = MaxAuthorities; + type MaxNominators = MaxNominators; + + type KeyOwnerProof = + >::Proof; + + type EquivocationReportSystem = + pallet_babe::EquivocationReportSystem; +} + +parameter_types! { + pub const IndexDeposit: Balance = 10 * CSPR; +} + +impl pallet_indices::Config for Runtime { + type AccountIndex = AccountIndex; + type Currency = Balances; + type Deposit = IndexDeposit; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_indices::WeightInfo; +} + +parameter_types! { + pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT; + pub const MaxLocks: u32 = 50; + pub const MaxReserves: u32 = 50; +} + +impl pallet_balances::Config for Runtime { + type Balance = Balance; + type DustRemoval = (); + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type MaxLocks = MaxLocks; + type MaxReserves = MaxReserves; + type ReserveIdentifier = ReserveIdentifier; + type WeightInfo = weights::pallet_balances::WeightInfo; + + type RuntimeHoldReason = RuntimeHoldReason; + type RuntimeFreezeReason = RuntimeFreezeReason; + type FreezeIdentifier = RuntimeFreezeReason; + type MaxFreezes = ConstU32<1>; +} + +parameter_types! { + pub const TransactionByteFee: Balance = 10 * STNK; + pub const OperationalFeeMultiplier: u8 = 5; +} + +impl pallet_transaction_payment::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type OnChargeTransaction = FungibleAdapter>; + type OperationalFeeMultiplier = OperationalFeeMultiplier; + type WeightToFee = WeightToFee; + type LengthToFee = ConstantMultiplier; + type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; +} + +parameter_types! { + pub const MinimumPeriod: u64 = SLOT_DURATION / 2; +} + +impl pallet_timestamp::Config for Runtime { + type Moment = Moment; + type OnTimestampSet = Babe; + type MinimumPeriod = MinimumPeriod; + type WeightInfo = weights::pallet_timestamp::WeightInfo; +} + +impl pallet_authorship::Config for Runtime { + type FindAuthor = pallet_session::FindAccountFromAuthorIndex; + type EventHandler = Staking; +} + +impl pallet_session::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type ValidatorId = AccountId; + type ValidatorIdOf = pallet_staking::StashOf; + type ShouldEndSession = Babe; + type NextSessionRotation = Babe; + type SessionManager = pallet_session::historical::NoteHistoricalRoot; + type SessionHandler = ::KeyTypeIdProviders; + type Keys = opaque::SessionKeys; + type WeightInfo = weights::pallet_session::WeightInfo; +} + +impl pallet_session::historical::Config for Runtime { + type FullIdentification = pallet_staking::Exposure; + type FullIdentificationOf = pallet_staking::ExposureOf; +} + +parameter_types! { + pub SignedPhase: u32 = prod_or_fast!( + EPOCH_DURATION_IN_SLOTS / 4, + (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2) + ); + pub UnsignedPhase: u32 = prod_or_fast!( + EPOCH_DURATION_IN_SLOTS / 4, + (1 * MINUTES).min(EpochDuration::get().saturated_into::() / 2) + ); + + // signed config + pub const SignedMaxSubmissions: u32 = 16; + pub const SignedMaxRefunds: u32 = 16 / 4; + pub const SignedFixedDeposit: Balance = deposit(2, 0); + pub const SignedDepositIncreaseFactor: Percent = Percent::from_percent(10); + // 0.01 CSPR per KB of solution data. + pub const SignedDepositByte: Balance = deposit(0, 10) / 1024; + // Each good submission will get 1 CSPR as reward + pub SignedRewardBase: Balance = 1 * CSPR; + + // 4 hour session, 1 hour unsigned phase, 32 ofchain executions. + pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 32; + + // We take the top 22_500 nominators as electing voters. + pub const MaxElectingVoters: u32 = 22_500; + // ... and all of the validators as electable targets. Whilist this is the + // case, we cannot and shall increase the size of the validator intentions. + pub ElectionBounds: frame_election_provider_support::bounds::ElectionBounds = + ElectionBoundsBuilder::default().voters_count(MaxElectingVoters::get().into()).build(); + // Setup election pallet to support maximum winners upto 1_200. This will + // mean Staking Pallet cannot have active validators higher than this count. + pub const MaxActiveValidators: u32 = 1_200; +} + +generate_solution_type!( + #[compact] + pub struct NposCompactSolution16::< + VoterIndex = u32, + TargetIndex = u16, + Accuracy = sp_runtime::PerU16, + MaxVoters = MaxElectingVoters, + >(16) +); + +pub struct OnChainSeqPhragmen; +impl onchain::Config for OnChainSeqPhragmen { + type System = Runtime; + type Solver = SequentialPhragmen; + type DataProvider = Staking; + type MaxWinners = MaxActiveValidators; + type Bounds = ElectionBounds; + type WeightInfo = weights::frame_election_provider_support::WeightInfo; +} + +impl pallet_election_provider_multi_phase::MinerConfig for Runtime { + type AccountId = AccountId; + type MaxLength = OffchainSolutionLengthLimit; + type MaxWeight = OffchainSolutionWeightLimit; + type Solution = NposCompactSolution16; + type MaxVotesPerVoter = < + ::DataProvider + as + frame_election_provider_support::ElectionDataProvider + >::MaxVotesPerVoter; + type MaxWinners = MaxActiveValidators; + + // The unsigned submissions have to respect the weight of the + // submit_unsigned call, thus their weight estimate function is wired to + // this call's weight. + fn solution_weight(v: u32, t: u32, a: u32, d: u32) -> Weight { + < + ::WeightInfo + as + pallet_election_provider_multi_phase::WeightInfo + >::submit_unsigned(v, t, a, d) + } +} + +impl pallet_election_provider_multi_phase::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type EstimateCallFee = TransactionPayment; + type SignedPhase = SignedPhase; + type UnsignedPhase = UnsignedPhase; + type SignedMaxSubmissions = SignedMaxSubmissions; + type SignedMaxRefunds = SignedMaxRefunds; + type SignedRewardBase = SignedRewardBase; + type SignedDepositBase = GeometricDepositBase; + type SignedDepositByte = SignedDepositByte; + type SignedDepositWeight = (); + type SignedMaxWeight = ::MaxWeight; + type MinerConfig = Self; + type SlashHandler = (); + type RewardHandler= (); + type BetterSignedThreshold = (); + type OffchainRepeat = OffchainRepeat; + type MinerTxPriority = NposSolutionPriority; + type DataProvider = Staking; + #[cfg(any(feature = "fast-runtime", feature = "runtime-benchmarks"))] + type Fallback = onchain::OnChainExecution; + #[cfg(not(any(feature = "fast-runtime", feature = "runtime-benchmarks")))] + type Fallback = frame_election_provider_support::NoElection<( + AccountId, + BlockNumber, + Staking, + MaxActiveValidators, + )>; + type GovernanceFallback = onchain::OnChainExecution; + type Solver = SequentialPhragmen< + AccountId, + pallet_election_provider_multi_phase::SolutionAccuracyOf, + (), + >; + type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig; + type ForceOrigin = EitherOf< + EnsureRootWithSuccess>, + Zombies, + >; + type MaxWinners = MaxActiveValidators; + type ElectionBounds = ElectionBounds; + type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo; +} + +parameter_types! { + pub const BagThresholds: &'static [u64] = &bag_thresholds::THRESHOLDS; +} + +type VoterBagsListInstance = pallet_bags_list::Instance1; +impl pallet_bags_list::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type ScoreProvider = Staking; + type BagThresholds = BagThresholds; + type Score = sp_npos_elections::VoteWeight; + type WeightInfo = weights::pallet_bags_list::WeightInfo; +} + +pallet_staking_reward_curve::build! { + const REWARD_CURVE: PiecewiseLinear<'static> = curve!( + min_inflation: 0_025_000, + max_inflation: 0_100_000, + ideal_stake: 0_750_000, + falloff: 0_050_000, + max_piece_count: 40, + test_precision: 0_005_000, + ); +} + +parameter_types! { + pub const SessionsPerEra: sp_staking::SessionIndex = prod_or_fast!(6, 1); + pub const BondingDuration: sp_staking::EraIndex = prod_or_fast!(28, 28); + pub const SlashDeferDuration: sp_staking::EraIndex = prod_or_fast!(27, 27); + pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; + pub const MaxExposurePageSize: u32 = 512; + pub const MaxNominators: u32 = 512; + pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); + pub const MaxNominations: u32 = + ::LIMIT as u32; +} + +impl pallet_staking::Config for Runtime { + type Currency = Balances; + type CurrencyBalance = Balance; + type UnixTime = Timestamp; + type CurrencyToVote = CurrencyToVote; + type RewardRemainder = Treasury; + type RuntimeEvent = RuntimeEvent; + type Slash = Treasury; + type Reward = (); // rewards are minted from the void + type SessionsPerEra = SessionsPerEra; + type BondingDuration = BondingDuration; + type SlashDeferDuration = SlashDeferDuration; + type AdminOrigin = EitherOf< + EnsureRootWithSuccess>, + Skeletons, + >; + type SessionInterface = Self; + type EraPayout = pallet_staking::ConvertCurve; + type MaxExposurePageSize = MaxExposurePageSize; + type DisablingStrategy = pallet_staking::UpToLimitDisablingStrategy; + type NextNewSession = Session; + type ElectionProvider = ElectionProviderMultiPhase; + type GenesisElectionProvider = onchain::OnChainExecution; + type VoterList = VoterList; + type TargetList = UseValidatorsMap; + type NominationsQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>; + type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; + type HistoryDepth = frame_support::traits::ConstU32<84>; + type MaxControllersInDeprecationBatch = ConstU32<5314>; + type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; + type EventListeners = NominationPools; + type WeightInfo = weights::pallet_staking::WeightInfo; +} + +impl pallet_fast_unstake::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type BatchSize = frame_support::traits::ConstU32<16>; + type Deposit = ConstU128<{ STRH }>; + type ControlOrigin = EitherOf< + EnsureRootWithSuccess>, + Zombies, + >; + type Staking = Staking; + type MaxErasToCheckPerBlock = ConstU32<1>; + type WeightInfo = weights::pallet_fast_unstake::WeightInfo; +} + +parameter_types! { + pub const BasicDeposit: Balance = deposit(1, 258); + pub const ByteDeposit: Balance = deposit(0, 1); + pub const SubAccountDeposit: Balance = deposit(1, 53); + pub const MaxSubAccounts: u32 = 100; + pub const MaxAdditionalFields: u32 = 100; + pub const MaxRegistrars: u32 = 100; +} + +impl pallet_identity::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type BasicDeposit = BasicDeposit; + type ByteDeposit = ByteDeposit; + type SubAccountDeposit = SubAccountDeposit; + type MaxSubAccounts = MaxSubAccounts; + type IdentityInformation = IdentityInfo; + type MaxRegistrars = MaxRegistrars; + type Slashed = Treasury; + + type ForceOrigin = Geniuses; + type RegistrarOrigin = Geniuses; + type UsernameAuthorityOrigin = Geniuses; + + type OffchainSignature = Signature; + type SigningPublicKey = ::Signer; + type PendingUsernameExpiration = ConstU32<{ 7 * DAYS }>; + type MaxSuffixLength = ConstU32<7>; + type MaxUsernameLength = ConstU32<32>; + type WeightInfo = weights::pallet_identity::WeightInfo; +} + +parameter_types! { + pub const ProposalBond: Permill = Permill::from_percent(5); + pub const ProposalBondMinimum: Balance = 10 * CSPR; + pub const ProposalBondMaximum: Balance = 50 * CSPR; + pub const SpendPeriod: BlockNumber = 24 * DAYS; + pub const Burn: Permill = Permill::from_percent(0); + pub const MaxBalance: Balance = Balance::MAX; + pub const PayoutPeriod: BlockNumber = 30 * DAYS; + pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); + + pub const DataDepositPerByte: Balance = 1 * STRH; + pub const MaxApprovals: u32 = 100; + pub const MaxAuthorities: u32 = 100_000; +} + +impl pallet_treasury::Config for Runtime { + type PalletId = TreasuryPalletId; + type Currency = Balances; + + #[cfg(not(feature = "runtime-benchmarks"))] + type ApproveOrigin = frame_support::traits::NeverEnsureOrigin; + #[cfg(feature = "runtime-benchmarks")] + type ApproveOrigin = EnsureRoot; + type RejectOrigin = EitherOf< + EnsureRootWithSuccess>, + Degens, + >; + + type RuntimeEvent = RuntimeEvent; + type OnSlash = Treasury; + type ProposalBond = ProposalBond; + + #[cfg(not(feature = "runtime-benchmarks"))] + type ProposalBondMinimum = ProposalBondMinimum; + #[cfg(feature = "runtime-benchmarks")] + type ProposalBondMinimum = ConstU128<{ ExistentialDeposit::get() * 100 }>; + + #[cfg(not(feature = "runtime-benchmarks"))] + type ProposalBondMaximum = ProposalBondMaximum; + #[cfg(feature = "runtime-benchmarks")] + type ProposalBondMaximum = ConstU128<{ ExistentialDeposit::get() * 500 }>; + + type SpendPeriod = SpendPeriod; + type Burn = Burn; + type BurnDestination = (); + type SpendFunds = Bounties; + type MaxApprovals = MaxApprovals; + type WeightInfo = (); + + type SpendOrigin = EitherOf< + EnsureRootWithSuccess, + CultTreasurySpender + >; + + type AssetKind = (); + type Beneficiary = AccountId; + type BeneficiaryLookup = IdentityLookup; + + type Paymaster = PayFromAccount; + + type BalanceConverter = UnityAssetBalanceConversion; + type PayoutPeriod = PayoutPeriod; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = BenchmarkTreasuryHelper; +} + +parameter_types! { + pub const BountyDepositBase: Balance = 10 * CSPR; + pub const BountyDepositPayoutDelay: BlockNumber = DAYS; + pub const BountyUpdatePeriod: BlockNumber = 2 * WEEKS; + pub const MaximumReasonLength: u32 = 16_384; + pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); + pub const CuratorDepositMin: Balance = 10 * CSPR; + pub const CuratorDepositMax: Balance = 200 * CSPR; + pub const BountyValueMinimum: Balance = 10 * CSPR; +} + +impl pallet_bounties::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BountyDepositBase = BountyDepositBase; + type BountyDepositPayoutDelay = BountyDepositPayoutDelay; + type BountyUpdatePeriod = BountyUpdatePeriod; + type CuratorDepositMultiplier = CuratorDepositMultiplier; + type CuratorDepositMin = CuratorDepositMin; + type CuratorDepositMax = CuratorDepositMax; + type BountyValueMinimum = BountyValueMinimum; + type ChildBountyManager = ChildBounties; + type DataDepositPerByte = DataDepositPerByte; + type MaximumReasonLength = MaximumReasonLength; + type WeightInfo = (); +} + +parameter_types! { + pub const MaxActiveChildBountyCount: u32 = 100; + pub const ChildBountyValueMinimum: Balance = BountyValueMinimum::get() / 10; +} + +impl pallet_child_bounties::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type MaxActiveChildBountyCount = MaxActiveChildBountyCount; + type ChildBountyValueMinimum = ChildBountyValueMinimum; + type WeightInfo = (); +} + +impl pallet_offences::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type OnOffenceHandler = Staking; + type IdentificationTuple = pallet_session::historical::IdentificationTuple; +} + +impl pallet_authority_discovery::Config for Runtime { + type MaxAuthorities = MaxAuthorities; +} + +parameter_types! { + pub NposSolutionPriority: TransactionPriority = + Perbill::from_percent(90) * TransactionPriority::MAX; + +} +parameter_types! { + pub MaxSetIdSessionEntries: u32 = + BondingDuration::get() * SessionsPerEra::get(); +} + +impl pallet_grandpa::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); + + type MaxAuthorities = MaxAuthorities; + type MaxNominators = MaxNominators; + type MaxSetIdSessionEntries = MaxSetIdSessionEntries; + + type KeyOwnerProof = + >::Proof; + + type EquivocationReportSystem = + pallet_grandpa::EquivocationReportSystem; +} + +/// Submits a transaction with the node's public and signature type. Adheres +/// to the signed extension format of the chain. +impl frame_system::offchain::CreateSignedTransaction for Runtime +where + RuntimeCall: From, +{ + fn create_transaction>( + call: RuntimeCall, + public: ::Signer, + account: AccountId, + nonce: ::Nonce, + ) -> Option<(RuntimeCall, ::SignaturePayload)> { + use sp_runtime::traits::StaticLookup; + + // take the biggest period possible + let period = BlockHashCount::get() + .checked_next_power_of_two() + .map(|c| c / 2).unwrap_or(2) as u64; + + let current_block = System::block_number() + .saturated_into::() + // The `System::block_number` is initialized with `n+1`, + // so the actual block number is `n`. + .saturating_sub(1); + + let tip = 0; + let extra: SignedExtra = ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckMortality::::from( + generic::Era::mortal(period, current_block), + ), + frame_system::CheckNonce::::from(nonce), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(tip), + ); + let raw_payload = SignedPayload::new(call, extra) + .map_err(|e| { + log::warn!(target: LOG_TARGET, "🫢 Unable to create signed payload: {:?}", e); + }) + .ok()?; + let signature = raw_payload.using_encoded(|payload| C::sign(payload, public))?; + let (call, extra, _) = raw_payload.deconstruct(); + let address = ::Lookup::unlookup(account); + Some((call, (address, signature, extra))) + } +} + +impl frame_system::offchain::SigningTypes for Runtime { + type Public = ::Signer; + type Signature = Signature; +} + +impl frame_system::offchain::SendTransactionTypes for Runtime +where + RuntimeCall: From, +{ + type Extrinsic = UncheckedExtrinsic; + type OverarchingCall = RuntimeCall; +} + +parameter_types! { + pub const MinVestedTransfer: Balance = CSPR; + pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = + WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); +} + +impl pallet_vesting::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type BlockNumberToBalance = ConvertInto; + type MinVestedTransfer = MinVestedTransfer; + type WeightInfo = weights::pallet_vesting::WeightInfo; + + type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; + type BlockNumberProvider = System; + const MAX_VESTING_SCHEDULES: u32 = 28; +} + +impl pallet_utility::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type PalletsOrigin = OriginCaller; + type WeightInfo = weights::pallet_utility::WeightInfo; +} + +parameter_types! { + pub const DepositBase: Balance = deposit(1, 88); + pub const DepositFactor: Balance = deposit(0, 32); + pub const MaxSignatories: u32 = 100; +} + +impl pallet_multisig::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type Currency = Balances; + type DepositBase = DepositBase; + type DepositFactor = DepositFactor; + type MaxSignatories = MaxSignatories; + type WeightInfo = weights::pallet_multisig::WeightInfo; +} + +parameter_types! { + pub const ProxyDepositBase: Balance = deposit(1, 8); + pub const ProxyDepositFactor: Balance = deposit(0, 33); + pub const MaxProxies: u16 = 32; + pub const AnnouncementDepositBase: Balance = deposit(1, 8); + pub const AnnouncementDepositFactor: Balance = deposit(0, 66); + pub const MaxPending: u16 = 32; +} + +/// The type used to represent the kinds of proxying allowed. +#[derive( + Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, + Decode, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo, +)] +pub enum ProxyType { + Any = 0, + NonTransfer = 1, + Governance = 2, + Staking = 3, + CancelProxy = 4, + IdentityJudgement = 5, + NominationPools = 6, +} + +impl Default for ProxyType { + fn default() -> Self { + Self::Any + } +} + +impl InstanceFilter for ProxyType { + fn filter(&self, c: &RuntimeCall) -> bool { + match self { + ProxyType::Any => true, + ProxyType::NonTransfer => matches!(c, RuntimeCall::Balances { .. }), + ProxyType::Governance => matches!( + c, + RuntimeCall::Bounties { .. } | + RuntimeCall::Utility { .. } | + RuntimeCall::ChildBounties { .. } | + RuntimeCall::CultReferenda { .. } | + RuntimeCall::CultCollective { .. } | + RuntimeCall::Whitelist { .. } | + RuntimeCall::AllianceMotion { .. } | + RuntimeCall::Alliance { .. } | + RuntimeCall::Multisig { .. } + ), + ProxyType::Staking => matches!( + c, + RuntimeCall::Staking { .. } | + RuntimeCall::Session { .. } | + RuntimeCall::Utility { .. } | + RuntimeCall::FastUnstake { .. } | + RuntimeCall::VoterList { .. } | + RuntimeCall::NominationPools { .. } + ), + ProxyType::IdentityJudgement => matches!( + c, + RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. }) | + RuntimeCall::Utility { .. } + ), + ProxyType::CancelProxy => matches!( + c, + RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }) | + RuntimeCall::Utility { .. } | + RuntimeCall::Multisig { .. } + ), + ProxyType::NominationPools => matches!( + c, + RuntimeCall::NominationPools { .. } | + RuntimeCall::Utility { .. } + ), + + } + } + + fn is_superset(&self, o: &Self) -> bool { + match (self, o) { + (x, y) if x == y => true, + (ProxyType::Any, _) => true, + (_, ProxyType::Any) => false, + (ProxyType::NonTransfer, _) => true, + _ => false, + } + } +} + +impl pallet_proxy::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type Currency = Balances; + type ProxyType = ProxyType; + type ProxyDepositBase = ProxyDepositBase; + type ProxyDepositFactor = ProxyDepositFactor; + type MaxProxies = MaxProxies; + type MaxPending = MaxPending; + type CallHasher = BlakeTwo256; + type AnnouncementDepositBase = AnnouncementDepositBase; + type AnnouncementDepositFactor = AnnouncementDepositFactor; + type WeightInfo = weights::pallet_proxy::WeightInfo; +} + +parameter_types! { + pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls"); + // Allow pools that got slashed up to 90% to remain operational + pub const MaxPointsToBalance: u8 = 10; +} + +impl pallet_nomination_pools::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type RuntimeFreezeReason = RuntimeFreezeReason; + type RewardCounter = FixedU128; + type BalanceToU256 = runtime_common::BalanceToU256; + type U256ToBalance = runtime_common::U256ToBalance; + type Staking = Staking; + type PostUnbondingPoolsWindow = frame_support::traits::ConstU32<4>; + type MaxMetadataLen = frame_support::traits::ConstU32<256>; + type MaxUnbonding = ::MaxUnlockingChunks; + type PalletId = PoolsPalletId; + type MaxPointsToBalance = MaxPointsToBalance; + type AdminOrigin = EitherOf< + EnsureRootWithSuccess>, + Zombies, + >; + type WeightInfo = weights::pallet_nomination_pools::WeightInfo; +} + +pub struct InitiateNominationPools; +impl frame_support::traits::OnRuntimeUpgrade for InitiateNominationPools { + fn on_runtime_upgrade() -> Weight { + // we use one as an indicator if this has already been set. + if pallet_nomination_pools::MaxPools::::get().is_none() { + pallet_nomination_pools::MinJoinBond::::put(5 * CSPR); + pallet_nomination_pools::MinCreateBond::::put(100 * CSPR); + + pallet_nomination_pools::MaxPools::::put(0); + pallet_nomination_pools::MaxPoolMembersPerPool::::put(0); + pallet_nomination_pools::MaxPoolMembers::::put(0); + + log::info!(target: LOG_TARGET, "🎉 pools config initiated"); + ::DbWeight::get().reads_writes(1, 5) + } else { + log::info!(target: LOG_TARGET, "😏 pools config already initiated"); + ::DbWeight::get().reads(1) + } + } +} + +pub const ALLIANCE_MOTION_DURATION: BlockNumber = 5 * DAYS; + +parameter_types! { + pub const AllianceMotionDuration: BlockNumber = ALLIANCE_MOTION_DURATION; + pub MaxProposalWeight: Weight = Perbill::from_percent(50) * BlockWeights::get().max_block; +} + +pub const ALLIANCE_MAX_PROPOSALS: u32 = 100; +pub const ALLIANCE_MAX_MEMBERS: u32 = 100; + +type AllianceCollective = pallet_collective::Instance1; +impl pallet_collective::Config for Runtime { + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type MotionDuration = AllianceMotionDuration; + type MaxProposals = ConstU32; + type MaxMembers = ConstU32; + type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; + type SetMembersOrigin = EnsureRoot; + type MaxProposalWeight = MaxProposalWeight; + type WeightInfo = weights::pallet_collective::WeightInfo; +} + +pub const MAX_FELLOWS: u32 = ALLIANCE_MAX_MEMBERS; +pub const MAX_ALLIES: u32 = 100; + +parameter_types! { + pub const AllyDeposit: Balance = 1_000 * CSPR; + pub TreasuryAccount: AccountId = Treasury::account_id(); + // The number of blocks a member must wait between giving a retirement notice + // and retiring. Supposed to be greater than time required to `kick_member` + // with alliance motion. + pub const AllianceRetriementPeriod: BlockNumber = (4 * WEEKS) + ALLIANCE_MOTION_DURATION; +} + +pub type RootOrAllianceTwoThirdsMajority = EitherOfDiverse< + EnsureRoot, + pallet_collective::EnsureProportionMoreThan, +>; + +impl pallet_alliance::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Proposal = RuntimeCall; + type AdminOrigin = RootOrAllianceTwoThirdsMajority; + type MembershipManager = RootOrAllianceTwoThirdsMajority; + type AnnouncementOrigin = RootOrAllianceTwoThirdsMajority; + type Currency = Balances; + type Slashed = Treasury; + type InitializeMembers = AllianceMotion; + type MembershipChanged = AllianceMotion; + type RetirementPeriod = AllianceRetriementPeriod; + type IdentityVerifier = (); + type ProposalProvider = AllianceProposalProvider; + type MaxProposals = ConstU32; + type MaxFellows = ConstU32; + type MaxAllies = ConstU32; + type MaxUnscrupulousItems = ConstU32<100>; + type MaxWebsiteUrlLength = ConstU32<255>; + type MaxAnnouncementsCount = ConstU32<100>; + type MaxMembersCount = ConstU32; + type AllyDeposit = AllyDeposit; + type WeightInfo = weights::pallet_alliance::WeightInfo; +} + +// Ghosts specific pallets +impl ghost_networks::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type NetworkId = u64; + + type RegisterOrigin = EitherOf< + EnsureRootWithSuccess>, + Ghosts, + >; + type UpdateOrigin = EitherOf< + EnsureRootWithSuccess>, + Zombies, + >; + type RemoveOrigin = EitherOf< + EnsureRootWithSuccess>, + Skeletons, + >; + + type WeightInfo = weights::ghost_networks::WeightInfo; +} + +parameter_types! { + pub ClaimPrefix: &'static [u8] = b"CasperAccountId:"; + pub MaximumWithdrawAmount: Balance = 500 * CSPR; + pub VestingBlocks: u32 = 10 * WEEKS; +} + + +impl ghost_claims::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type VestingSchedule = Vesting; + type BlockNumberProvider = System; + type MemberSwappedHandler = (); + + type Prefix = ClaimPrefix; + type MaximumWithdrawAmount = MaximumWithdrawAmount; + type VestingBlocks = VestingBlocks; + + type WeightInfo = weights::ghost_claims::WeightInfo; +} + +parameter_types! { + // maximum number of claps in one tx + pub MaxNumberOfClaps: u32 = 5; + // will be used in `Perbill::from_percent()` + pub ApplauseThreshold: u32 = 70; + // will be used in `Perbill::from_percent()` + pub OffenceThreshold: u32 = 40; + pub const SlowClapUnsignedPriority: TransactionPriority = + TransactionPriority::max_value(); +} + +impl ghost_slow_clap::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AuthorityId = SlowClapId; + + type NextSessionRotation = Babe; + type ValidatorSet = Historical; + type Currency = Balances; + type NetworkDataHandler = GhostNetworks; + type BlockNumberProvider = System; + type ReportUnresponsiveness = Offences; + + type MaxAuthorities = MaxAuthorities; + type MaxNumberOfClaps = MaxNumberOfClaps; + type ApplauseThreshold = ApplauseThreshold; + type MaxAuthorityInfoInSession = MaxAuthorities; + type OffenceThreshold = OffenceThreshold; + + type UnsignedPriority = SlowClapUnsignedPriority; + type TreasuryPalletId = TreasuryPalletId; + + type WeightInfo = weights::ghost_slow_clap::WeightInfo; +} + +construct_runtime! { + pub enum Runtime + { + // Basic stuff; balances is uncallable initially. + System: frame_system = 0, + Scheduler: pallet_scheduler = 1, + Preimage: pallet_preimage = 10, + + // Babe must be before session. + Babe: pallet_babe = 2, + + Timestamp: pallet_timestamp = 3, + Indices: pallet_indices = 4, + Balances: pallet_balances = 5, + TransactionPayment: pallet_transaction_payment = 28, + + // Consensus support. + // Authorship must be before session in order to note authoer in the + // correct session and era for im-online and staking. + Authorship: pallet_authorship = 6, + Staking: pallet_staking = 7, + Offences: pallet_offences = 8, + Historical: session_historical = 29, + + Session: pallet_session = 9, + Grandpa: pallet_grandpa = 11, + AuthorityDiscovery: pallet_authority_discovery = 12, + + // Governance stuff. + Treasury: pallet_treasury = 19, + CultOrigins: pallet_cult_origins = 21, + Whitelist: pallet_whitelist = 22, + Vesting: pallet_vesting = 23, + Utility: pallet_utility = 24, + + Identity: pallet_identity = 25, + Proxy: pallet_proxy = 26, + Multisig: pallet_multisig = 27, + + Bounties: pallet_bounties = 30, + ChildBounties: pallet_child_bounties = 31, + + // Election pallet. Only works with staking, but places here to + // maintain indicies. + ElectionProviderMultiPhase: pallet_election_provider_multi_phase = 32, + + // Provides a semi-sorted list of nominators for staking. + VoterList: pallet_bags_list:: = 33, + NominationPools: pallet_nomination_pools = 34, + FastUnstake: pallet_fast_unstake = 35, + + // Governance + Alliance: pallet_alliance = 36, + AllianceMotion: pallet_collective:: = 37, + + CultCollective: pallet_ranked_collective:: = 38, + CultReferenda: pallet_referenda:: = 39, + CultCore: pallet_core_fellowship:: = 40, + CultSalary: pallet_salary:: = 41, + + // Ghosts stuff. Start indicies at 50 to leave room. + GhostNetworks: ghost_networks = 50, + GhostClaims: ghost_claims:: = 51, + GhostSlowClaps: ghost_slow_clap = 52, + } +} + +/// The address format for describing accounts. +pub type Address = sp_runtime::MultiAddress; +/// Block header type as expected by this runtime. +pub type Header = generic::Header; +/// Block type as expected by this runtime. +pub type Block = generic::Block; +/// A block signed with a Justification. +pub type SignedBlock = generic::SignedBlock; +/// `BlockId` type as expected by this runtime. +pub type BlockId = generic::BlockId; +/// The `SignedExtension` to the basic transaction logic. +pub type SignedExtra = ( + frame_system::CheckNonZeroSender, + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckMortality, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment, +); + +/// All migrations that will run on the next runtime upgrade. +/// Should be cleared after release. +pub type Migrations = (); + +/// Unchecked extrinsic type as expected by this runtime. +pub type UncheckedExtrinsic = + generic::UncheckedExtrinsic; + +/// Executive: handles dispatch to the various modules. +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, + Migrations, +>; + +/// The payload being signed in transaction. +pub type SignedPayload = generic::SignedPayload; + +#[cfg(feature = "runtime-benchmarks")] +mod benches { + frame_benchmarking::define_benchmarks!( + // Ghosts + // Note: Make sure to prefix these with `runtime_common::` so + // that path resolves correctly in the generated file. + + // Substrate + [pallet_alliance, Alliance] + [pallet_babe, Babe] + [pallet_bags_list, VoterList] + [pallet_balances, Balances] + [frame_benchmarking::baseline, Baseline::] + [pallet_bounties, Bounties] + [pallet_child_bounties, ChildBounties] + [pallet_collective, AllianceMotion] + [pallet_core_fellowship, CultCore] + [pallet_election_provider_multi_phase, ElectionProviderMultiPhase] + [frame_election_provider_support, ElectionProviderBench::] + [pallet_fast_unstake, FastUnstake] + [pallet_grandpa, Grandpa] + [pallet_identity, Identity] + [pallet_indices, Indices] + [pallet_multisig, Multisig] + [pallet_nomination_pools, NominationPoolsBench::] + [pallet_offences, OffencesBench::] + [pallet_preimage, Preimage] + [pallet_proxy, Proxy] + [pallet_ranked_collective, CultCollective] + [pallet_referenda, CultReferenda] + [pallet_salary, CultSalary] + [pallet_scheduler, Scheduler] + [pallet_session, SessionBench::] + [pallet_staking, Staking] + [frame_system, SystemBench::] + [pallet_timestamp, Timestamp] + [pallet_treasury, Treasury] + [pallet_utility, Utility] + [pallet_vesting, Vesting] + [pallet_whitelist, Whitelist] + + // Ghosts + [ghost_networks, GhostNetworks] + [ghost_claims, GhostClaims] + [ghost_slow_clap, GhostSlowClaps] + ); +} + +sp_api::impl_runtime_apis! { + impl sp_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn execute_block(block: Block) { + Executive::execute_block(block); + } + + fn initialize_block(header: &::Header) -> sp_runtime::ExtrinsicInclusionMode { + Executive::initialize_block(header) + } + } + + impl sp_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + OpaqueMetadata::new(Runtime::metadata().into()) + } + + fn metadata_at_version(version: u32) -> Option { + Runtime::metadata_at_version(version) + } + + fn metadata_versions() -> sp_std::vec::Vec { + Runtime::metadata_versions() + } + } + + impl block_builder_api::BlockBuilder for Runtime { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult { + Executive::apply_extrinsic(extrinsic) + } + + fn finalize_block() -> ::Header { + Executive::finalize_block() + } + + fn inherent_extrinsics(data: inherents::InherentData) -> Vec<::Extrinsic> { + data.create_extrinsics() + } + + fn check_inherents( + block: Block, + data: inherents::InherentData, + ) -> inherents::CheckInherentsResult { + data.check_extrinsics(&block) + } + } + + impl pallet_nomination_pools_runtime_api::NominationPoolsApi< + Block, + AccountId, + Balance, + > for Runtime { + fn pending_rewards(member: AccountId) -> Balance { + NominationPools::api_pending_rewards(member).unwrap_or_default() + } + + fn points_to_balance(pool_id: pallet_nomination_pools::PoolId, points: Balance) -> Balance { + NominationPools::api_points_to_balance(pool_id, points) + } + + fn balance_to_points(pool_id: pallet_nomination_pools::PoolId, new_funds: Balance) -> Balance { + NominationPools::api_balance_to_points(pool_id, new_funds) + } + } + + impl pallet_staking_runtime_api::StakingApi for Runtime { + fn nominations_quota(balance: Balance) -> u32 { + Staking::api_nominations_quota(balance) + } + + fn eras_stakers_page_count(era: sp_staking::EraIndex, account: AccountId) -> sp_staking::Page { + Staking::api_eras_stakers_page_count(era, account) + } + + fn pending_rewards(era: sp_staking::EraIndex, account: AccountId) -> bool { + Staking::api_pending_rewards(era, account) + } + } + + impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { + fn validate_transaction( + source: TransactionSource, + tx: ::Extrinsic, + block_hash: ::Hash, + ) -> TransactionValidity { + Executive::validate_transaction(source, tx, block_hash) + } + } + + impl offchain_primitives::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + + impl fg_primitives::GrandpaApi for Runtime { + fn grandpa_authorities() -> Vec<(GrandpaId, u64)> { + Grandpa::grandpa_authorities() + } + + fn current_set_id() -> fg_primitives::SetId { + Grandpa::current_set_id() + } + + fn submit_report_equivocation_unsigned_extrinsic( + equivocation_proof: fg_primitives::EquivocationProof< + ::Hash, + sp_runtime::traits::NumberFor, + >, + key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof, + ) -> Option<()> { + let key_owner_proof = key_owner_proof.decode()?; + + Grandpa::submit_unsigned_equivocation_report( + equivocation_proof, + key_owner_proof, + ) + } + + fn generate_key_ownership_proof( + _set_id: fg_primitives::SetId, + authority_id: fg_primitives::AuthorityId, + ) -> Option { + use codec::Encode; + + Historical::prove((fg_primitives::KEY_TYPE, authority_id)) + .map(|p| p.encode()) + .map(fg_primitives::OpaqueKeyOwnershipProof::new) + } + } + + impl babe_primitives::BabeApi for Runtime { + fn configuration() -> babe_primitives::BabeConfiguration { + let epoch_config = Babe::epoch_config().unwrap_or(BABE_GENESIS_EPOCH_CONFIG); + babe_primitives::BabeConfiguration { + slot_duration: Babe::slot_duration(), + epoch_length: EpochDuration::get(), + c: epoch_config.c, + authorities: Babe::authorities().to_vec(), + randomness: Babe::randomness(), + allowed_slots: epoch_config.allowed_slots, + } + } + + fn current_epoch_start() -> babe_primitives::Slot { + Babe::current_epoch_start() + } + + fn current_epoch() -> babe_primitives::Epoch { + Babe::current_epoch() + } + + fn next_epoch() -> babe_primitives::Epoch { + Babe::next_epoch() + } + + fn generate_key_ownership_proof( + _slot: babe_primitives::Slot, + authority_id: babe_primitives::AuthorityId, + ) -> Option { + use codec::Encode; + + Historical::prove((babe_primitives::KEY_TYPE, authority_id)) + .map(|p| p.encode()) + .map(babe_primitives::OpaqueKeyOwnershipProof::new) + } + + fn submit_report_equivocation_unsigned_extrinsic( + equivocation_proof: babe_primitives::EquivocationProof<::Header>, + key_owner_proof: babe_primitives::OpaqueKeyOwnershipProof, + ) -> Option<()> { + let key_owner_proof = key_owner_proof.decode()?; + + Babe::submit_unsigned_equivocation_report( + equivocation_proof, + key_owner_proof, + ) + } + } + + impl authority_discovery_primitives::AuthorityDiscoveryApi for Runtime { + fn authorities() -> Vec { + AuthorityDiscovery::authorities() + } + } + + impl sp_session::SessionKeys for Runtime { + fn generate_session_keys(seed: Option>) -> Vec { + opaque::SessionKeys::generate(seed) + } + + fn decode_session_keys(encoded: Vec) -> Option, sp_core::crypto::KeyTypeId)>> { + opaque::SessionKeys::decode_into_raw_public_keys(&encoded) + } + } + + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { + System::account_nonce(account) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { + fn query_info(uxt: ::Extrinsic, len: u32) -> RuntimeDispatchInfo { + TransactionPayment::query_info(uxt, len) + } + + fn query_fee_details(uxt: ::Extrinsic, len: u32) -> FeeDetails { + TransactionPayment::query_fee_details(uxt, len) + } + + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi for Runtime { + fn query_call_info(call: RuntimeCall, len: u32) -> RuntimeDispatchInfo { + TransactionPayment::query_call_info(call, len) + } + + fn query_call_fee_details(call: RuntimeCall, len: u32) -> FeeDetails { + TransactionPayment::query_call_fee_details(call, len) + } + + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } + } + + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn build_state(json: Vec) -> sp_genesis_builder::Result { + build_state::(json) + } + + fn get_preset(id: &Option) -> Option> { + get_preset::(id, &genesis_config_presets::get_preset) + } + + fn preset_names() -> Vec { + genesis_config_presets::preset_names() + } + } + + #[cfg(feature = "try-runtime")] + impl frame_try_runtime::TryRuntime for Runtime { + fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { + log::info!(target: LOG_TARGET, "😏 try-runtime::on_runtime_upgrade casper."); + let weight = Executive::try_runtime_upgrade(checks).unwrap(); + (weight, BlockWeights::get().max_block) + } + + fn execute_block( + block: Block, + state_root_check: bool, + signature_check: bool, + select: frame_try_runtime::TryStateSelect, + ) -> Weight { + log::info!( + target: LOG_TARGET, + "😏 try-runtime::executing block {:?} / root checks: {:?} / try-state-select: {:?}", + block.header.hash(), + state_root_check, + select, + ); + Executive::try_executive_block(block, state_root_check, signature_check, select).unwrap() + } + } + + #[cfg(feature = "runtime-benchmarks")] + impl frame_benchmarking::Benchmark for Runtime { + fn benchmark_metadata(extra: bool) -> ( + Vec, + Vec, + ) { + use frame_benchmarking::{Benchmarking, BenchmarkList}; + use frame_support::traits::StorageInfoTrait; + + use pallet_session_benchmarking::Pallet as SessionBench; + use pallet_offences_benchmarking::Pallet as OffencesBench; + use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; + use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; + use frame_system_benchmarking::Pallet as SystemBench; + use frame_benchmarking::baseline::Pallet as Baseline; + + let mut list = Vec::::new(); + list_benchmarks!(list, extra); + + let storage_info = AllPalletsWithSystem::storage_info(); + (list, storage_info) + } + + fn dispatch_benchmark( + config: frame_benchmarking::BenchmarkConfig, + ) -> Result< + Vec, + sp_runtime::RuntimeString + > { + use frame_support::traits::WhitelistedStorageKeys; + use frame_benchmarking::{Benchmarking, BenchmarkBatch}; + use sp_storage::TrackedStorageKey; + // Trying to add benchmarks directly to some pallets caused cyclic + // dependency issues. To get around that, we separated the + // benchmarks into its own crate. + use pallet_session_benchmarking::Pallet as SessionBench; + use pallet_offences_benchmarking::Pallet as OffencesBench; + use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench; + use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench; + use frame_system_benchmarking::Pallet as SystemBench; + use frame_benchmarking::baseline::Pallet as Baseline; + + impl pallet_session_benchmarking::Config for Runtime {} + impl pallet_offences_benchmarking::Config for Runtime {} + impl pallet_election_provider_support_benchmarking::Config for Runtime {} + impl pallet_nomination_pools_benchmarking::Config for Runtime {} + impl frame_system_benchmarking::Config for Runtime {} + impl frame_benchmarking::baseline::Config for Runtime {} + + let mut whitelist: Vec = AllPalletsWithSystem::whitelisted_storage_keys(); + let treasury_key = frame_system::Account::::hashed_key_for(Treasury::account_id()); + whitelist.push(treasury_key.to_vec().into()); + + let mut batches = Vec::::new(); + let params = (&config, &whitelist); + + add_benchmarks!(params, batches); + + Ok(batches) + } + } +} + +#[cfg(test)] +mod test_fees { + use super::*; + use frame_support::{dispatch::GetDispatchInfo, weights::WeightToFee as WeightToFeeT}; + use keyring::Sr25519Keyring::{Alice, Charlie}; + use pallet_transaction_payment::Multiplier; + use runtime_common::MinimumMultiplier; + use separator::Separatable; + use sp_runtime::{assert_eq_error_rate, FixedPointNumber, MultiAddress, MultiSignature}; + + #[test] + fn payout_weight_portion() { + use pallet_staking::WeightInfo; + let payout_weight = + ::WeightInfo::payout_stakers_alive_staked( + MaxNominatorRewardedPerValidator::get(), + ) + .ref_time() as f64; + let block_weight = BlockWeights::get().max_block.ref_time() as f64; + + println!( + "a full payout takes {:.2} of the block weight [{} / {}]", + payout_weight / block_weight, + payout_weight, + block_weight + ); + assert!(payout_weight * 2f64 < block_weight); + } + + #[test] + fn block_cost() { + let max_block_weight = BlockWeights::get().max_block; + let raw_fee = WeightToFee::weight_to_fee(&max_block_weight); + + let fee_with_multiplier = |m: Multiplier| { + println!( + "Full Block weight == {} // multiplier: {:?} // WeightToFee(full_block) == {} plank", + max_block_weight, + m, + m.saturating_mul_int(raw_fee).separated_string(), + ); + }; + fee_with_multiplier(MinimumMultiplier::get()); + fee_with_multiplier(Multiplier::from_rational(1, 2)); + fee_with_multiplier(Multiplier::from_u32(1)); + fee_with_multiplier(Multiplier::from_u32(2)); + } + + #[test] + fn transfer_cost_min_multiplier() { + let min_multiplier = MinimumMultiplier::get(); + let call = pallet_balances::Call::::transfer_keep_alive { + dest: Charlie.to_account_id().into(), + value: Default::default(), + }; + let info = call.get_dispatch_info(); + println!("call = {:?} / info = {:?}", call, info); + // convert to runtime call. + let call = RuntimeCall::Balances(call); + let extra: SignedExtra = ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckMortality::::from(generic::Era::immortal()), + frame_system::CheckNonce::::from(1), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(0), + ); + let uxt = UncheckedExtrinsic { + function: call, + signature: Some(( + MultiAddress::Id(Alice.to_account_id()), + MultiSignature::Sr25519(Alice.sign(b"foo")), + extra, + )), + }; + let len = uxt.encoded_size(); + + let mut ext = sp_io::TestExternalities::new_empty(); + let mut test_with_multiplier = |m: Multiplier| { + ext.execute_with(|| { + pallet_transaction_payment::NextFeeMultiplier::::put(m); + let fee = TransactionPayment::query_fee_details(uxt.clone(), len as u32); + println!( + "multiplier = {:?} // fee details = {:?} // final fee = {:?}", + pallet_transaction_payment::NextFeeMultiplier::::get(), + fee, + fee.final_fee().separated_string(), + ); + }); + }; + + test_with_multiplier(min_multiplier); + test_with_multiplier(Multiplier::saturating_from_rational(1u128, 1u128)); + test_with_multiplier(Multiplier::saturating_from_rational(1u128, 1_0u128)); + test_with_multiplier(Multiplier::saturating_from_rational(1u128, 1_00u128)); + test_with_multiplier(Multiplier::saturating_from_rational(1u128, 1_000u128)); + test_with_multiplier(Multiplier::saturating_from_rational(1u128, 1_000_000u128)); + test_with_multiplier(Multiplier::saturating_from_rational(1u128, 1_000_000_000u128)); + } + + #[test] + fn nominator_limit() { + use pallet_election_provider_multi_phase::WeightInfo; + // starting point of the nominators. + let target_voters: u32 = 50_000; + + // assuming we want around 5k candidates and 1k active validators. (March 31, 2021) + let all_targets: u32 = 5_000; + let desired: u32 = 1_000; + let weight_with = |active| { + ::WeightInfo::submit_unsigned( + active, + all_targets, + active, + desired, + ) + }; + + let mut active = target_voters; + while weight_with(active).all_lte(OffchainSolutionWeightLimit::get()) || + active == target_voters + { + active += 1; + } + + println!("can support {} nominators to yield a weight of {}", active, weight_with(active)); + assert!(active > target_voters, "we need to reevaluate the weight of the election system"); + } + + #[test] + fn signed_deposit_is_sensible() { + // ensure this number does not change, or that it is checked after each change. + // a 1 MB solution should take (40 + 10) DOTs of deposit. + let deposit = SignedDepositBase::get() + (SignedDepositByte::get() * 1024 * 1024); + assert_eq_error_rate!(deposit, 50 * DOLLARS, DOLLARS); + } +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn call_size() { + RuntimeCall::assert_size_under(256) + } + + #[test] + fn check_whitelist() { + let whitelist: HashSet = AllPalletsWithSystem::whitelisted_storage_keys() + .iter() + .map(|e| HexDisplay::from(&e.key).to_string()) + .collect(); + + // Block number + assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac")); + // Total issuance + assert!(whitelist.contains("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80")); + // Execution phase + assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a")); + // Event count + assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850")); + // System events + assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7")); + } + + #[test] + fn check_treasury_pallet_id() { + assert_eq!( + ::index() as u8, + casper_runtime_constants::TREASURY_PALLET_ID + ); + } +} + +#[cfg(test)] +mod multiplier_tests { + use super::*; + use frame_support::{dispatch::DispatchInfo, traits::OnFinalize}; + use runtime_common::{MinimumMultiplier, TargetBlockFullness}; + use separator::Separatable; + use sp_runtime::traits::Convert; + + fn run_with_system_weight(w: Weight, mut assertions: F) + where + F: FnMut() -> (), + { + let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() + .build_storage::() + .unwrap() + .into(); + t.execute_with(|| { + System::set_block_consumed_resources(w, 0); + assertions() + }); + } + + #[test] + fn multiplier_can_grow_from_zero() { + let minimum_multiplier = MinimumMultiplier::get(); + let target = TargetBlockFullness::get() * + BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap(); + // if the min is too small, then this will not change, and we are doomed forever. + // the weight is 1/100th bigger than target. + run_with_system_weight(target.saturating_mul(101) / 100, || { + let next = SlowAdjustingFeeUpdate::::convert(minimum_multiplier); + assert!(next > minimum_multiplier, "{:?} !>= {:?}", next, minimum_multiplier); + }) + } + + #[test] + fn fast_unstake_estimate() { + use pallet_fast_unstake::WeightInfo; + let block_time = BlockWeights::get().max_block.ref_time() as f32; + let on_idle = weights::pallet_fast_unstake::WeightInfo::::on_idle_check( + 300, + ::BatchSize::get(), + ) + .ref_time() as f32; + println!("ratio of block weight for full batch fast-unstake {}", on_idle / block_time); + assert!(on_idle / block_time <= 0.5f32) + } + + #[test] + #[ignore] + fn multiplier_growth_simulator() { + // assume the multiplier is initially set to its minimum. We update it with values twice the + //target (target is 25%, thus 50%) and we see at which point it reaches 1. + let mut multiplier = MinimumMultiplier::get(); + let block_weight = BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap(); + let mut blocks = 0; + let mut fees_paid = 0; + + frame_system::Pallet::::set_block_consumed_resources(Weight::MAX, 0); + let info = DispatchInfo { weight: Weight::MAX, ..Default::default() }; + + let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() + .build_storage::() + .unwrap() + .into(); + // set the minimum + t.execute_with(|| { + pallet_transaction_payment::NextFeeMultiplier::::set(MinimumMultiplier::get()); + }); + + while multiplier <= Multiplier::from_u32(1) { + t.execute_with(|| { + // imagine this tx was called. + let fee = TransactionPayment::compute_fee(0, &info, 0); + fees_paid += fee; + + // this will update the multiplier. + System::set_block_consumed_resources(block_weight, 0); + TransactionPayment::on_finalize(1); + let next = TransactionPayment::next_fee_multiplier(); + + assert!(next > multiplier, "{:?} !>= {:?}", next, multiplier); + multiplier = next; + + println!( + "block = {} / multiplier {:?} / fee = {:?} / fess so far {:?}", + blocks, + multiplier, + fee.separated_string(), + fees_paid.separated_string() + ); + }); + blocks += 1; + } + } + + #[test] + #[ignore] + fn multiplier_cool_down_simulator() { + // assume the multiplier is initially set to its minimum. We update it with values twice the + //target (target is 25%, thus 50%) and we see at which point it reaches 1. + let mut multiplier = Multiplier::from_u32(2); + let mut blocks = 0; + + let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() + .build_storage::() + .unwrap() + .into(); + // set the minimum + t.execute_with(|| { + pallet_transaction_payment::NextFeeMultiplier::::set(multiplier); + }); + + while multiplier > Multiplier::from_u32(0) { + t.execute_with(|| { + // this will update the multiplier. + TransactionPayment::on_finalize(1); + let next = TransactionPayment::next_fee_multiplier(); + + assert!(next < multiplier, "{:?} !>= {:?}", next, multiplier); + multiplier = next; + + println!("block = {} / multiplier {:?}", blocks, multiplier); + }); + blocks += 1; + } + } +} diff --git a/runtime/casper/src/weights/frame_benchmarking_baseline.rs b/runtime/casper/src/weights/frame_benchmarking_baseline.rs new file mode 100644 index 0000000..3fd4a36 --- /dev/null +++ b/runtime/casper/src/weights/frame_benchmarking_baseline.rs @@ -0,0 +1,104 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `frame_benchmarking::baseline` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=frame_benchmarking::baseline +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/frame_benchmarking::baseline.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `frame_benchmarking::baseline`. +pub struct WeightInfo(PhantomData); +impl frame_benchmarking::baseline::WeightInfo for WeightInfo { + /// The range of component `i` is `[0, 1000000]`. + fn addition(_i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 581_000 picoseconds. + Weight::from_parts(630_062, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// The range of component `i` is `[0, 1000000]`. + fn subtraction(_i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 577_000 picoseconds. + Weight::from_parts(639_502, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// The range of component `i` is `[0, 1000000]`. + fn multiplication(_i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 588_000 picoseconds. + Weight::from_parts(643_988, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// The range of component `i` is `[0, 1000000]`. + fn division(_i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 587_000 picoseconds. + Weight::from_parts(646_411, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + fn hashing() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 86_383_930_000 picoseconds. + Weight::from_parts(86_405_327_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// The range of component `i` is `[0, 100]`. + fn sr25519_verification(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 617_000 picoseconds. + Weight::from_parts(9_197_912, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 11_936 + .saturating_add(Weight::from_parts(134_040_960, 0).saturating_mul(i.into())) + } +} diff --git a/runtime/casper/src/weights/frame_election_provider_support.rs b/runtime/casper/src/weights/frame_election_provider_support.rs new file mode 100644 index 0000000..568e0f2 --- /dev/null +++ b/runtime/casper/src/weights/frame_election_provider_support.rs @@ -0,0 +1,79 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `frame_election_provider_support` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=frame_election_provider_support +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/frame_election_provider_support.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `frame_election_provider_support`. +pub struct WeightInfo(PhantomData); +impl frame_election_provider_support::WeightInfo for WeightInfo { + /// The range of component `v` is `[1000, 2000]`. + /// The range of component `t` is `[500, 1000]`. + /// The range of component `d` is `[5, 16]`. + fn phragmen(v: u32, _t: u32, d: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 25_492_475_000 picoseconds. + Weight::from_parts(25_652_778_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 610_576 + .saturating_add(Weight::from_parts(26_134_836, 0).saturating_mul(v.into())) + // Standard Error: 62_423_156 + .saturating_add(Weight::from_parts(6_191_776_057, 0).saturating_mul(d.into())) + } + /// The range of component `v` is `[1000, 2000]`. + /// The range of component `t` is `[500, 1000]`. + /// The range of component `d` is `[5, 16]`. + fn phragmms(v: u32, _t: u32, d: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 17_311_486_000 picoseconds. + Weight::from_parts(17_425_500_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 525_907 + .saturating_add(Weight::from_parts(21_191_580, 0).saturating_mul(v.into())) + // Standard Error: 53_766_908 + .saturating_add(Weight::from_parts(5_509_535_886, 0).saturating_mul(d.into())) + } +} diff --git a/runtime/casper/src/weights/frame_system.rs b/runtime/casper/src/weights/frame_system.rs new file mode 100644 index 0000000..fc4f1f7 --- /dev/null +++ b/runtime/casper/src/weights/frame_system.rs @@ -0,0 +1,170 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `frame_system` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=frame_system +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/frame_system.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `frame_system`. +pub struct WeightInfo(PhantomData); +impl frame_system::WeightInfo for WeightInfo { + /// The range of component `b` is `[0, 3932160]`. + fn remark(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 10_130_000 picoseconds. + Weight::from_parts(10_233_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_073, 0).saturating_mul(b.into())) + } + /// The range of component `b` is `[0, 3932160]`. + fn remark_with_event(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 24_295_000 picoseconds. + Weight::from_parts(25_129_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 61 + .saturating_add(Weight::from_parts(6_128, 0).saturating_mul(b.into())) + } + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a686561707061676573` (r:0 w:1) + fn set_heap_pages() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1485` + // Minimum execution time: 17_361_000 picoseconds. + Weight::from_parts(18_127_000, 0) + .saturating_add(Weight::from_parts(0, 1485)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + fn set_code() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `1485` + // Minimum execution time: 276_621_374_000 picoseconds. + Weight::from_parts(465_333_875_000, 0) + .saturating_add(Weight::from_parts(0, 1485)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `i` is `[0, 1000]`. + fn set_storage(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 10_235_000 picoseconds. + Weight::from_parts(216_405_157, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 33_989 + .saturating_add(Weight::from_parts(2_132_990, 0).saturating_mul(i.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `i` is `[0, 1000]`. + fn kill_storage(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 10_172_000 picoseconds. + Weight::from_parts(10_294_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 2_842 + .saturating_add(Weight::from_parts(1_680_628, 0).saturating_mul(i.into())) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `p` is `[0, 1000]`. + fn kill_prefix(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `88 + p * (69 ±0)` + // Estimated: `102 + p * (70 ±0)` + // Minimum execution time: 19_692_000 picoseconds. + Weight::from_parts(19_817_000, 0) + .saturating_add(Weight::from_parts(0, 102)) + // Standard Error: 5_183 + .saturating_add(Weight::from_parts(3_138_053, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) + } + /// Storage: `System::AuthorizedUpgrade` (r:0 w:1) + /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + fn authorize_upgrade() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 41_596_000 picoseconds. + Weight::from_parts(42_415_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `System::AuthorizedUpgrade` (r:1 w:1) + /// Proof: `System::AuthorizedUpgrade` (`max_values`: Some(1), `max_size`: Some(33), added: 528, mode: `MaxEncodedLen`) + /// Storage: `System::Digest` (r:1 w:1) + /// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + /// Proof: UNKNOWN KEY `0x3a636f6465` (r:0 w:1) + fn apply_authorized_upgrade() -> Weight { + // Proof Size summary in bytes: + // Measured: `22` + // Estimated: `1518` + // Minimum execution time: 281_871_139_000 picoseconds. + Weight::from_parts(288_412_158_000, 0) + .saturating_add(Weight::from_parts(0, 1518)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/casper/src/weights/ghost_claims.rs b/runtime/casper/src/weights/ghost_claims.rs new file mode 100644 index 0000000..1a46832 --- /dev/null +++ b/runtime/casper/src/weights/ghost_claims.rs @@ -0,0 +1,71 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `ghost_claims` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=ghost_claims +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/ghost_claims.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `ghost_claims`. +pub struct WeightInfo(PhantomData); +impl ghost_claims::WeightInfo for WeightInfo { + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `GhostClaims::Total` (r:1 w:1) + /// Proof: `GhostClaims::Total` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `CultCollective::Members` (r:2 w:2) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:6 w:6) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IdToIndex` (r:6 w:12) + /// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IndexToId` (r:0 w:6) + /// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + fn claim() -> Weight { + // Proof Size summary in bytes: + // Measured: `896` + // Estimated: `16164` + // Minimum execution time: 754_086_000 picoseconds. + Weight::from_parts(756_147_000, 0) + .saturating_add(Weight::from_parts(0, 16164)) + .saturating_add(T::DbWeight::get().reads(17)) + .saturating_add(T::DbWeight::get().writes(29)) + } +} diff --git a/runtime/casper/src/weights/ghost_networks.rs b/runtime/casper/src/weights/ghost_networks.rs new file mode 100644 index 0000000..46749ac --- /dev/null +++ b/runtime/casper/src/weights/ghost_networks.rs @@ -0,0 +1,191 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `ghost_networks` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=ghost_networks +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/ghost_networks.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `ghost_networks`. +pub struct WeightInfo(PhantomData); +impl ghost_networks::WeightInfo for WeightInfo { + /// Storage: `GhostNetworks::Networks` (r:1 w:1) + /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `i` is `[1, 20]`. + /// The range of component `j` is `[1, 150]`. + fn register_network(i: u32, j: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `109` + // Estimated: `3574` + // Minimum execution time: 44_464_000 picoseconds. + Weight::from_parts(44_802_179, 0) + .saturating_add(Weight::from_parts(0, 3574)) + // Standard Error: 11_381 + .saturating_add(Weight::from_parts(42_872, 0).saturating_mul(i.into())) + // Standard Error: 1_492 + .saturating_add(Weight::from_parts(8_794, 0).saturating_mul(j.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `GhostNetworks::Networks` (r:1 w:1) + /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[1, 20]`. + fn update_network_name(_n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `295` + // Estimated: `3760` + // Minimum execution time: 50_224_000 picoseconds. + Weight::from_parts(54_405_362, 0) + .saturating_add(Weight::from_parts(0, 3760)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `GhostNetworks::Networks` (r:1 w:1) + /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[1, 150]`. + fn update_network_endpoint(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `295` + // Estimated: `3760` + // Minimum execution time: 50_598_000 picoseconds. + Weight::from_parts(54_951_352, 0) + .saturating_add(Weight::from_parts(0, 3760)) + // Standard Error: 10_596 + .saturating_add(Weight::from_parts(11_691, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `GhostNetworks::Networks` (r:1 w:1) + /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn update_network_finality_delay() -> Weight { + // Proof Size summary in bytes: + // Measured: `295` + // Estimated: `3760` + // Minimum execution time: 49_089_000 picoseconds. + Weight::from_parts(50_797_000, 0) + .saturating_add(Weight::from_parts(0, 3760)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `GhostNetworks::Networks` (r:1 w:1) + /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn update_network_release_delay() -> Weight { + // Proof Size summary in bytes: + // Measured: `295` + // Estimated: `3760` + // Minimum execution time: 49_606_000 picoseconds. + Weight::from_parts(50_371_000, 0) + .saturating_add(Weight::from_parts(0, 3760)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `GhostNetworks::Networks` (r:1 w:1) + /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn update_network_type() -> Weight { + // Proof Size summary in bytes: + // Measured: `295` + // Estimated: `3760` + // Minimum execution time: 48_135_000 picoseconds. + Weight::from_parts(48_619_000, 0) + .saturating_add(Weight::from_parts(0, 3760)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `GhostNetworks::Networks` (r:1 w:1) + /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn update_network_gatekeeper() -> Weight { + // Proof Size summary in bytes: + // Measured: `295` + // Estimated: `3760` + // Minimum execution time: 50_027_000 picoseconds. + Weight::from_parts(51_212_000, 0) + .saturating_add(Weight::from_parts(0, 3760)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `GhostNetworks::Networks` (r:1 w:1) + /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn update_network_topic_name() -> Weight { + // Proof Size summary in bytes: + // Measured: `295` + // Estimated: `3760` + // Minimum execution time: 50_686_000 picoseconds. + Weight::from_parts(52_276_000, 0) + .saturating_add(Weight::from_parts(0, 3760)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `GhostNetworks::Networks` (r:1 w:1) + /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn update_incoming_network_fee() -> Weight { + // Proof Size summary in bytes: + // Measured: `295` + // Estimated: `3760` + // Minimum execution time: 48_485_000 picoseconds. + Weight::from_parts(49_672_000, 0) + .saturating_add(Weight::from_parts(0, 3760)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `GhostNetworks::Networks` (r:1 w:1) + /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn update_outgoing_network_fee() -> Weight { + // Proof Size summary in bytes: + // Measured: `295` + // Estimated: `3760` + // Minimum execution time: 48_926_000 picoseconds. + Weight::from_parts(49_482_000, 0) + .saturating_add(Weight::from_parts(0, 3760)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `GhostNetworks::Networks` (r:1 w:1) + /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn remove_network() -> Weight { + // Proof Size summary in bytes: + // Measured: `295` + // Estimated: `3760` + // Minimum execution time: 45_163_000 picoseconds. + Weight::from_parts(45_822_000, 0) + .saturating_add(Weight::from_parts(0, 3760)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/casper/src/weights/ghost_slow_clap.rs b/runtime/casper/src/weights/ghost_slow_clap.rs new file mode 100644 index 0000000..1dd61cb --- /dev/null +++ b/runtime/casper/src/weights/ghost_slow_clap.rs @@ -0,0 +1,125 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `ghost_slow_clap` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=ghost_slow_clap +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/ghost_slow_clap.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `ghost_slow_clap`. +pub struct WeightInfo(PhantomData); +impl ghost_slow_clap::WeightInfo for WeightInfo { + /// Storage: `GhostSlowClaps::Authorities` (r:1 w:0) + /// Proof: `GhostSlowClaps::Authorities` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `GhostSlowClaps::AuthorityInfoInSession` (r:1 w:0) + /// Proof: `GhostSlowClaps::AuthorityInfoInSession` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `GhostSlowClaps::ApplausesForTransaction` (r:1 w:0) + /// Proof: `GhostSlowClaps::ApplausesForTransaction` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `GhostSlowClaps::ReceivedClaps` (r:1 w:0) + /// Proof: `GhostSlowClaps::ReceivedClaps` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `k` is `[1, 100]`. + /// The range of component `j` is `[1, 20]`. + fn slow_clap(k: u32, j: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `372 + j * (19 ±0)` + // Estimated: `3853 + j * (19 ±0)` + // Minimum execution time: 95_459_000 picoseconds. + Weight::from_parts(96_224_000, 0) + .saturating_add(Weight::from_parts(0, 3853)) + // Standard Error: 152_014 + .saturating_add(Weight::from_parts(32_092_278, 0).saturating_mul(k.into())) + // Standard Error: 761_228 + .saturating_add(Weight::from_parts(22_412_712, 0).saturating_mul(j.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(Weight::from_parts(0, 19).saturating_mul(j.into())) + } + /// Storage: `GhostSlowClaps::CurrentCompanionId` (r:1 w:1) + /// Proof: `GhostSlowClaps::CurrentCompanionId` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `GhostNetworks::Networks` (r:1 w:0) + /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `GhostSlowClaps::Companions` (r:0 w:1) + /// Proof: `GhostSlowClaps::Companions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `GhostSlowClaps::CompanionDetails` (r:0 w:1) + /// Proof: `GhostSlowClaps::CompanionDetails` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn propose_companion() -> Weight { + // Proof Size summary in bytes: + // Measured: `634` + // Estimated: `4099` + // Minimum execution time: 167_770_000 picoseconds. + Weight::from_parts(168_826_000, 0) + .saturating_add(Weight::from_parts(0, 4099)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `GhostSlowClaps::Companions` (r:1 w:0) + /// Proof: `GhostSlowClaps::Companions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `GhostNetworks::Networks` (r:1 w:0) + /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `GhostSlowClaps::CompanionDetails` (r:1 w:0) + /// Proof: `GhostSlowClaps::CompanionDetails` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `GhostSlowClaps::ReleaseBlocks` (r:0 w:1) + /// Proof: `GhostSlowClaps::ReleaseBlocks` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn release_companion() -> Weight { + // Proof Size summary in bytes: + // Measured: `839` + // Estimated: `4304` + // Minimum execution time: 82_884_000 picoseconds. + Weight::from_parts(84_135_000, 0) + .saturating_add(Weight::from_parts(0, 4304)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `GhostSlowClaps::ReleaseBlocks` (r:1 w:0) + /// Proof: `GhostSlowClaps::ReleaseBlocks` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `GhostSlowClaps::Companions` (r:1 w:1) + /// Proof: `GhostSlowClaps::Companions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `GhostSlowClaps::CompanionDetails` (r:1 w:1) + /// Proof: `GhostSlowClaps::CompanionDetails` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn kill_companion() -> Weight { + // Proof Size summary in bytes: + // Measured: `514` + // Estimated: `3979` + // Minimum execution time: 152_418_000 picoseconds. + Weight::from_parts(153_436_000, 0) + .saturating_add(Weight::from_parts(0, 3979)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/casper/src/weights/mod.rs b/runtime/casper/src/weights/mod.rs new file mode 100644 index 0000000..ca0b701 --- /dev/null +++ b/runtime/casper/src/weights/mod.rs @@ -0,0 +1,28 @@ +pub mod frame_election_provider_support; +pub mod frame_system; +pub mod ghost_claims; +pub mod ghost_networks; +pub mod ghost_slow_clap; +pub mod pallet_alliance; +pub mod pallet_bags_list; +pub mod pallet_balances; +pub mod pallet_collective; +pub mod pallet_core_fellowship; +pub mod pallet_election_provider_multi_phase; +pub mod pallet_fast_unstake; +pub mod pallet_identity; +pub mod pallet_indices; +pub mod pallet_multisig; +pub mod pallet_nomination_pools; +pub mod pallet_preimage; +pub mod pallet_proxy; +pub mod pallet_ranked_collective; +// pub mod pallet_referenda; +pub mod pallet_salary; +pub mod pallet_scheduler; +pub mod pallet_session; +pub mod pallet_staking; +pub mod pallet_timestamp; +pub mod pallet_utility; +pub mod pallet_vesting; +pub mod pallet_whitelist; diff --git a/runtime/casper/src/weights/pallet_alliance.rs b/runtime/casper/src/weights/pallet_alliance.rs new file mode 100644 index 0000000..200f667 --- /dev/null +++ b/runtime/casper/src/weights/pallet_alliance.rs @@ -0,0 +1,483 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_alliance` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_alliance +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_alliance.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_alliance`. +pub struct WeightInfo(PhantomData); +impl pallet_alliance::WeightInfo for WeightInfo { + /// Storage: `Alliance::Members` (r:1 w:0) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::ProposalOf` (r:1 w:1) + /// Proof: `AllianceMotion::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:1) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::ProposalCount` (r:1 w:1) + /// Proof: `AllianceMotion::ProposalCount` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Voting` (r:0 w:1) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `b` is `[1, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `471 + m * (32 ±0) + p * (36 ±0)` + // Estimated: `6676 + m * (33 ±0) + p * (36 ±0)` + // Minimum execution time: 97_002_000 picoseconds. + Weight::from_parts(98_453_208, 0) + .saturating_add(Weight::from_parts(0, 6676)) + // Standard Error: 326 + .saturating_add(Weight::from_parts(1_861, 0).saturating_mul(b.into())) + // Standard Error: 3_409 + .saturating_add(Weight::from_parts(104_553, 0).saturating_mul(m.into())) + // Standard Error: 3_366 + .saturating_add(Weight::from_parts(554_928, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(Weight::from_parts(0, 33).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) + } + /// Storage: `Alliance::Members` (r:1 w:0) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::Voting` (r:1 w:1) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `m` is `[5, 100]`. + fn vote(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `944 + m * (64 ±0)` + // Estimated: `6676 + m * (64 ±0)` + // Minimum execution time: 83_771_000 picoseconds. + Weight::from_parts(86_230_346, 0) + .saturating_add(Weight::from_parts(0, 6676)) + // Standard Error: 2_403 + .saturating_add(Weight::from_parts(129_802, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) + } + /// Storage: `Alliance::Members` (r:1 w:0) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::Voting` (r:1 w:1) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Members` (r:1 w:0) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:1) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::ProposalOf` (r:0 w:1) + /// Proof: `AllianceMotion::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `429 + m * (96 ±0) + p * (36 ±0)` + // Estimated: `6676 + m * (97 ±0) + p * (36 ±0)` + // Minimum execution time: 113_902_000 picoseconds. + Weight::from_parts(107_712_061, 0) + .saturating_add(Weight::from_parts(0, 6676)) + // Standard Error: 4_237 + .saturating_add(Weight::from_parts(184_456, 0).saturating_mul(m.into())) + // Standard Error: 4_132 + .saturating_add(Weight::from_parts(590_832, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 97).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) + } + /// Storage: `Alliance::Members` (r:1 w:0) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::Voting` (r:1 w:1) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Members` (r:1 w:0) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::ProposalOf` (r:1 w:1) + /// Proof: `AllianceMotion::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:1) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `b` is `[1, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `679 + m * (96 ±0) + p * (42 ±0)` + // Estimated: `6676 + m * (98 ±0) + p * (41 ±0)` + // Minimum execution time: 161_378_000 picoseconds. + Weight::from_parts(156_939_196, 0) + .saturating_add(Weight::from_parts(0, 6676)) + // Standard Error: 327 + .saturating_add(Weight::from_parts(3_093, 0).saturating_mul(b.into())) + // Standard Error: 3_460 + .saturating_add(Weight::from_parts(142_907, 0).saturating_mul(m.into())) + // Standard Error: 3_373 + .saturating_add(Weight::from_parts(574_727, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 98).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 41).saturating_mul(p.into())) + } + /// Storage: `Alliance::Members` (r:1 w:0) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::Voting` (r:1 w:1) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Members` (r:1 w:0) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Prime` (r:1 w:0) + /// Proof: `AllianceMotion::Prime` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::ProposalOf` (r:1 w:1) + /// Proof: `AllianceMotion::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:1) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Alliance::Rule` (r:0 w:1) + /// Proof: `Alliance::Rule` (`max_values`: Some(1), `max_size`: Some(87), added: 582, mode: `MaxEncodedLen`) + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_disapproved(m: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `647 + m * (96 ±0) + p * (41 ±0)` + // Estimated: `6676 + m * (109 ±0) + p * (43 ±0)` + // Minimum execution time: 163_874_000 picoseconds. + Weight::from_parts(155_209_353, 0) + .saturating_add(Weight::from_parts(0, 6676)) + // Standard Error: 12_962 + .saturating_add(Weight::from_parts(325_062, 0).saturating_mul(m.into())) + // Standard Error: 12_804 + .saturating_add(Weight::from_parts(638_122, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(Weight::from_parts(0, 109).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 43).saturating_mul(p.into())) + } + /// Storage: `Alliance::Members` (r:1 w:0) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::Voting` (r:1 w:1) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Members` (r:1 w:0) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Prime` (r:1 w:0) + /// Proof: `AllianceMotion::Prime` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:1) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::ProposalOf` (r:0 w:1) + /// Proof: `AllianceMotion::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `b` is `[1, 1024]`. + /// The range of component `m` is `[5, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `428 + m * (96 ±0) + p * (37 ±0)` + // Estimated: `6676 + m * (97 ±0) + p * (36 ±0)` + // Minimum execution time: 117_142_000 picoseconds. + Weight::from_parts(110_028_926, 0) + .saturating_add(Weight::from_parts(0, 6676)) + // Standard Error: 331 + .saturating_add(Weight::from_parts(2_288, 0).saturating_mul(b.into())) + // Standard Error: 3_551 + .saturating_add(Weight::from_parts(172_027, 0).saturating_mul(m.into())) + // Standard Error: 3_423 + .saturating_add(Weight::from_parts(582_787, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 97).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) + } + /// Storage: `Alliance::Members` (r:2 w:2) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::Members` (r:1 w:1) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `m` is `[1, 100]`. + /// The range of component `z` is `[0, 100]`. + fn init_members(m: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `115` + // Estimated: `12362` + // Minimum execution time: 94_196_000 picoseconds. + Weight::from_parts(65_225_469, 0) + .saturating_add(Weight::from_parts(0, 12362)) + // Standard Error: 3_118 + .saturating_add(Weight::from_parts(383_319, 0).saturating_mul(m.into())) + // Standard Error: 3_081 + .saturating_add(Weight::from_parts(322_848, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Alliance::Members` (r:2 w:2) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:0) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Alliance::DepositOf` (r:200 w:50) + /// Proof: `Alliance::DepositOf` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:50 w:50) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::Members` (r:0 w:1) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Prime` (r:0 w:1) + /// Proof: `AllianceMotion::Prime` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `x` is `[1, 100]`. + /// The range of component `y` is `[0, 100]`. + /// The range of component `z` is `[0, 50]`. + fn disband(x: u32, y: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + x * (48 ±0) + y * (51 ±0) + z * (251 ±0)` + // Estimated: `12362 + x * (2539 ±0) + y * (2539 ±0) + z * (2603 ±1)` + // Minimum execution time: 1_234_256_000 picoseconds. + Weight::from_parts(16_239_078, 0) + .saturating_add(Weight::from_parts(0, 12362)) + // Standard Error: 21_211 + .saturating_add(Weight::from_parts(6_672_158, 0).saturating_mul(x.into())) + // Standard Error: 20_961 + .saturating_add(Weight::from_parts(6_811_767, 0).saturating_mul(y.into())) + // Standard Error: 41_888 + .saturating_add(Weight::from_parts(64_921_111, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(y.into()))) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(z.into()))) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(z.into()))) + .saturating_add(Weight::from_parts(0, 2539).saturating_mul(x.into())) + .saturating_add(Weight::from_parts(0, 2539).saturating_mul(y.into())) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(z.into())) + } + /// Storage: `Alliance::Rule` (r:0 w:1) + /// Proof: `Alliance::Rule` (`max_values`: Some(1), `max_size`: Some(87), added: 582, mode: `MaxEncodedLen`) + fn set_rule() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 24_181_000 picoseconds. + Weight::from_parts(24_667_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Alliance::Announcements` (r:1 w:1) + /// Proof: `Alliance::Announcements` (`max_values`: Some(1), `max_size`: Some(8702), added: 9197, mode: `MaxEncodedLen`) + fn announce() -> Weight { + // Proof Size summary in bytes: + // Measured: `180` + // Estimated: `10187` + // Minimum execution time: 38_619_000 picoseconds. + Weight::from_parts(39_318_000, 0) + .saturating_add(Weight::from_parts(0, 10187)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Alliance::Announcements` (r:1 w:1) + /// Proof: `Alliance::Announcements` (`max_values`: Some(1), `max_size`: Some(8702), added: 9197, mode: `MaxEncodedLen`) + fn remove_announcement() -> Weight { + // Proof Size summary in bytes: + // Measured: `253` + // Estimated: `10187` + // Minimum execution time: 42_291_000 picoseconds. + Weight::from_parts(42_908_000, 0) + .saturating_add(Weight::from_parts(0, 10187)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Alliance::Members` (r:3 w:1) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `Alliance::UnscrupulousAccounts` (r:1 w:0) + /// Proof: `Alliance::UnscrupulousAccounts` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Alliance::DepositOf` (r:0 w:1) + /// Proof: `Alliance::DepositOf` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`) + fn join_alliance() -> Weight { + // Proof Size summary in bytes: + // Measured: `440` + // Estimated: `18048` + // Minimum execution time: 157_993_000 picoseconds. + Weight::from_parts(158_860_000, 0) + .saturating_add(Weight::from_parts(0, 18048)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Alliance::Members` (r:3 w:1) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `Alliance::UnscrupulousAccounts` (r:1 w:0) + /// Proof: `Alliance::UnscrupulousAccounts` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + fn nominate_ally() -> Weight { + // Proof Size summary in bytes: + // Measured: `339` + // Estimated: `18048` + // Minimum execution time: 92_924_000 picoseconds. + Weight::from_parts(93_984_000, 0) + .saturating_add(Weight::from_parts(0, 18048)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Alliance::Members` (r:2 w:2) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:0) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Members` (r:0 w:1) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Prime` (r:0 w:1) + /// Proof: `AllianceMotion::Prime` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn elevate_ally() -> Weight { + // Proof Size summary in bytes: + // Measured: `340` + // Estimated: `12362` + // Minimum execution time: 89_941_000 picoseconds. + Weight::from_parts(90_683_000, 0) + .saturating_add(Weight::from_parts(0, 12362)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Alliance::Members` (r:4 w:2) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:0) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Members` (r:0 w:1) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Prime` (r:0 w:1) + /// Proof: `AllianceMotion::Prime` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Alliance::RetiringMembers` (r:0 w:1) + /// Proof: `Alliance::RetiringMembers` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + fn give_retirement_notice() -> Weight { + // Proof Size summary in bytes: + // Measured: `340` + // Estimated: `23734` + // Minimum execution time: 115_079_000 picoseconds. + Weight::from_parts(116_006_000, 0) + .saturating_add(Weight::from_parts(0, 23734)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `Alliance::RetiringMembers` (r:1 w:1) + /// Proof: `Alliance::RetiringMembers` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Alliance::Members` (r:1 w:1) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `Alliance::DepositOf` (r:1 w:1) + /// Proof: `Alliance::DepositOf` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn retire() -> Weight { + // Proof Size summary in bytes: + // Measured: `621` + // Estimated: `6676` + // Minimum execution time: 141_769_000 picoseconds. + Weight::from_parts(142_752_000, 0) + .saturating_add(Weight::from_parts(0, 6676)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Alliance::Members` (r:3 w:1) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:0) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Alliance::DepositOf` (r:1 w:1) + /// Proof: `Alliance::DepositOf` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::Members` (r:0 w:1) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Prime` (r:0 w:1) + /// Proof: `AllianceMotion::Prime` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn kick_member() -> Weight { + // Proof Size summary in bytes: + // Measured: `604` + // Estimated: `18048` + // Minimum execution time: 211_219_000 picoseconds. + Weight::from_parts(212_953_000, 0) + .saturating_add(Weight::from_parts(0, 18048)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `Alliance::UnscrupulousAccounts` (r:1 w:1) + /// Proof: `Alliance::UnscrupulousAccounts` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + /// Storage: `Alliance::UnscrupulousWebsites` (r:1 w:1) + /// Proof: `Alliance::UnscrupulousWebsites` (`max_values`: Some(1), `max_size`: Some(25702), added: 26197, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 100]`. + /// The range of component `l` is `[0, 255]`. + fn add_unscrupulous_items(n: u32, l: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `180` + // Estimated: `27187` + // Minimum execution time: 21_699_000 picoseconds. + Weight::from_parts(21_893_000, 0) + .saturating_add(Weight::from_parts(0, 27187)) + // Standard Error: 10_128 + .saturating_add(Weight::from_parts(3_357_496, 0).saturating_mul(n.into())) + // Standard Error: 3_966 + .saturating_add(Weight::from_parts(216_176, 0).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Alliance::UnscrupulousAccounts` (r:1 w:1) + /// Proof: `Alliance::UnscrupulousAccounts` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`) + /// Storage: `Alliance::UnscrupulousWebsites` (r:1 w:1) + /// Proof: `Alliance::UnscrupulousWebsites` (`max_values`: Some(1), `max_size`: Some(25702), added: 26197, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 100]`. + /// The range of component `l` is `[0, 255]`. + fn remove_unscrupulous_items(n: u32, l: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + l * (100 ±0) + n * (289 ±0)` + // Estimated: `27187` + // Minimum execution time: 21_895_000 picoseconds. + Weight::from_parts(22_138_000, 0) + .saturating_add(Weight::from_parts(0, 27187)) + // Standard Error: 632_441 + .saturating_add(Weight::from_parts(63_177_711, 0).saturating_mul(n.into())) + // Standard Error: 247_692 + .saturating_add(Weight::from_parts(273_557, 0).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Alliance::Members` (r:3 w:2) + /// Proof: `Alliance::Members` (`max_values`: None, `max_size`: Some(3211), added: 5686, mode: `MaxEncodedLen`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:0) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Members` (r:0 w:1) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Prime` (r:0 w:1) + /// Proof: `AllianceMotion::Prime` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn abdicate_fellow_status() -> Weight { + // Proof Size summary in bytes: + // Measured: `340` + // Estimated: `18048` + // Minimum execution time: 111_710_000 picoseconds. + Weight::from_parts(113_642_000, 0) + .saturating_add(Weight::from_parts(0, 18048)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} diff --git a/runtime/casper/src/weights/pallet_babe.rs b/runtime/casper/src/weights/pallet_babe.rs new file mode 100644 index 0000000..03781c2 --- /dev/null +++ b/runtime/casper/src/weights/pallet_babe.rs @@ -0,0 +1,60 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_babe` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_babe +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_babe.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_babe`. +pub struct WeightInfo(PhantomData); +impl pallet_babe::WeightInfo for WeightInfo { + /// The range of component `x` is `[0, 1]`. + fn check_equivocation_proof(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 295_685_000 picoseconds. + Weight::from_parts(296_671_979, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 68_488 + .saturating_add(Weight::from_parts(188_520, 0).saturating_mul(x.into())) + } +} diff --git a/runtime/casper/src/weights/pallet_bags_list.rs b/runtime/casper/src/weights/pallet_bags_list.rs new file mode 100644 index 0000000..37afb9c --- /dev/null +++ b/runtime/casper/src/weights/pallet_bags_list.rs @@ -0,0 +1,105 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_bags_list` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_bags_list +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_bags_list.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_bags_list`. +pub struct WeightInfo(PhantomData); +impl pallet_bags_list::WeightInfo for WeightInfo { + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:4 w:4) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + fn rebag_non_terminal() -> Weight { + // Proof Size summary in bytes: + // Measured: `1612` + // Estimated: `11506` + // Minimum execution time: 216_814_000 picoseconds. + Weight::from_parts(218_794_000, 0) + .saturating_add(Weight::from_parts(0, 11506)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + fn rebag_terminal() -> Weight { + // Proof Size summary in bytes: + // Measured: `1506` + // Estimated: `8877` + // Minimum execution time: 210_157_000 picoseconds. + Weight::from_parts(214_628_000, 0) + .saturating_add(Weight::from_parts(0, 8877)) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `VoterList::ListNodes` (r:4 w:4) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:2 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:2 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + fn put_in_front_of() -> Weight { + // Proof Size summary in bytes: + // Measured: `1815` + // Estimated: `11506` + // Minimum execution time: 255_261_000 picoseconds. + Weight::from_parts(258_576_000, 0) + .saturating_add(Weight::from_parts(0, 11506)) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(6)) + } +} diff --git a/runtime/casper/src/weights/pallet_balances.rs b/runtime/casper/src/weights/pallet_balances.rs new file mode 100644 index 0000000..5a84dcb --- /dev/null +++ b/runtime/casper/src/weights/pallet_balances.rs @@ -0,0 +1,173 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_balances` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_balances +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_balances.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_balances`. +pub struct WeightInfo(PhantomData); +impl pallet_balances::WeightInfo for WeightInfo { + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn transfer_allow_death() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `3593` + // Minimum execution time: 190_705_000 picoseconds. + Weight::from_parts(192_096_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn transfer_keep_alive() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `3593` + // Minimum execution time: 151_366_000 picoseconds. + Weight::from_parts(152_572_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn force_set_balance_creating() -> Weight { + // Proof Size summary in bytes: + // Measured: `240` + // Estimated: `3593` + // Minimum execution time: 60_457_000 picoseconds. + Weight::from_parts(62_112_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn force_set_balance_killing() -> Weight { + // Proof Size summary in bytes: + // Measured: `240` + // Estimated: `3593` + // Minimum execution time: 81_215_000 picoseconds. + Weight::from_parts(82_316_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn force_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `140` + // Estimated: `6196` + // Minimum execution time: 201_571_000 picoseconds. + Weight::from_parts(204_225_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn transfer_all() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `3593` + // Minimum execution time: 187_576_000 picoseconds. + Weight::from_parts(188_504_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn force_unreserve() -> Weight { + // Proof Size summary in bytes: + // Measured: `240` + // Estimated: `3593` + // Minimum execution time: 73_195_000 picoseconds. + Weight::from_parts(74_326_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `System::Account` (r:999 w:999) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `u` is `[1, 1000]`. + fn upgrade_accounts(u: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + u * (135 ±0)` + // Estimated: `990 + u * (2603 ±0)` + // Minimum execution time: 70_352_000 picoseconds. + Weight::from_parts(70_896_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 33_025 + .saturating_add(Weight::from_parts(54_012_098, 0).saturating_mul(u.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into())) + } + fn force_adjust_total_issuance() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 24_157_000 picoseconds. + Weight::from_parts(24_793_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + fn burn_allow_death() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 117_793_000 picoseconds. + Weight::from_parts(119_425_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + fn burn_keep_alive() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 80_675_000 picoseconds. + Weight::from_parts(81_648_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } +} diff --git a/runtime/casper/src/weights/pallet_bounties.rs b/runtime/casper/src/weights/pallet_bounties.rs new file mode 100644 index 0000000..5bbda45 --- /dev/null +++ b/runtime/casper/src/weights/pallet_bounties.rs @@ -0,0 +1,63 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_bounties` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_bounties +// --extrinsic=approve_bounty +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_bounties.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_bounties`. +pub struct WeightInfo(PhantomData); +impl pallet_bounties::WeightInfo for WeightInfo { + /// Storage: `Bounties::Bounties` (r:1 w:1) + /// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`) + /// Storage: `Bounties::BountyApprovals` (r:1 w:1) + /// Proof: `Bounties::BountyApprovals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`) + fn approve_bounty() -> Weight { + // Proof Size summary in bytes: + // Measured: `302` + // Estimated: `3642` + // Minimum execution time: 52_739_000 picoseconds. + Weight::from_parts(53_443_000, 0) + .saturating_add(Weight::from_parts(0, 3642)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/casper/src/weights/pallet_collective.rs b/runtime/casper/src/weights/pallet_collective.rs new file mode 100644 index 0000000..2f4251c --- /dev/null +++ b/runtime/casper/src/weights/pallet_collective.rs @@ -0,0 +1,297 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_collective +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_collective.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_collective::WeightInfo for WeightInfo { + /// Storage: `AllianceMotion::Members` (r:1 w:1) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:0) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Voting` (r:100 w:100) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Prime` (r:0 w:1) + /// Proof: `AllianceMotion::Prime` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `m` is `[0, 100]`. + /// The range of component `n` is `[0, 100]`. + /// The range of component `p` is `[0, 100]`. + fn set_members(m: u32, _n: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + m * (3232 ±0) + p * (3190 ±0)` + // Estimated: `15691 + m * (1967 ±23) + p * (4332 ±23)` + // Minimum execution time: 55_767_000 picoseconds. + Weight::from_parts(56_636_000, 0) + .saturating_add(Weight::from_parts(0, 15691)) + // Standard Error: 160_794 + .saturating_add(Weight::from_parts(11_373_581, 0).saturating_mul(m.into())) + // Standard Error: 160_794 + .saturating_add(Weight::from_parts(24_336_121, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + .saturating_add(Weight::from_parts(0, 1967).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 4332).saturating_mul(p.into())) + } + /// Storage: `AllianceMotion::Members` (r:1 w:0) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn execute(b: u32, m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `32 + m * (32 ±0)` + // Estimated: `1518 + m * (32 ±0)` + // Minimum execution time: 53_501_000 picoseconds. + Weight::from_parts(50_367_784, 0) + .saturating_add(Weight::from_parts(0, 1518)) + // Standard Error: 53 + .saturating_add(Weight::from_parts(4_666, 0).saturating_mul(b.into())) + // Standard Error: 547 + .saturating_add(Weight::from_parts(38_691, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) + } + /// Storage: `AllianceMotion::Members` (r:1 w:0) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::ProposalOf` (r:1 w:0) + /// Proof: `AllianceMotion::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[1, 100]`. + fn propose_execute(b: u32, m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `32 + m * (32 ±0)` + // Estimated: `3498 + m * (32 ±0)` + // Minimum execution time: 64_064_000 picoseconds. + Weight::from_parts(59_986_733, 0) + .saturating_add(Weight::from_parts(0, 3498)) + // Standard Error: 80 + .saturating_add(Weight::from_parts(5_165, 0).saturating_mul(b.into())) + // Standard Error: 833 + .saturating_add(Weight::from_parts(50_309, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into())) + } + /// Storage: `AllianceMotion::Members` (r:1 w:0) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::ProposalOf` (r:1 w:1) + /// Proof: `AllianceMotion::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:1) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::ProposalCount` (r:1 w:1) + /// Proof: `AllianceMotion::ProposalCount` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Voting` (r:0 w:1) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[2, 100]`. + /// The range of component `p` is `[1, 100]`. + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `322 + m * (32 ±0) + p * (36 ±0)` + // Estimated: `3714 + m * (33 ±0) + p * (36 ±0)` + // Minimum execution time: 81_966_000 picoseconds. + Weight::from_parts(76_356_962, 0) + .saturating_add(Weight::from_parts(0, 3714)) + // Standard Error: 250 + .saturating_add(Weight::from_parts(10_378, 0).saturating_mul(b.into())) + // Standard Error: 2_613 + .saturating_add(Weight::from_parts(46_062, 0).saturating_mul(m.into())) + // Standard Error: 2_579 + .saturating_add(Weight::from_parts(612_264, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(Weight::from_parts(0, 33).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) + } + /// Storage: `AllianceMotion::Members` (r:1 w:0) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Voting` (r:1 w:1) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `m` is `[5, 100]`. + fn vote(m: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `771 + m * (64 ±0)` + // Estimated: `4235 + m * (64 ±0)` + // Minimum execution time: 73_065_000 picoseconds. + Weight::from_parts(75_774_038, 0) + .saturating_add(Weight::from_parts(0, 4235)) + // Standard Error: 3_051 + .saturating_add(Weight::from_parts(101_825, 0).saturating_mul(m.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into())) + } + /// Storage: `AllianceMotion::Voting` (r:1 w:1) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Members` (r:1 w:0) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:1) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::ProposalOf` (r:0 w:1) + /// Proof: `AllianceMotion::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `360 + m * (64 ±0) + p * (36 ±0)` + // Estimated: `3805 + m * (65 ±0) + p * (36 ±0)` + // Minimum execution time: 86_413_000 picoseconds. + Weight::from_parts(84_843_269, 0) + .saturating_add(Weight::from_parts(0, 3805)) + // Standard Error: 3_251 + .saturating_add(Weight::from_parts(54_550, 0).saturating_mul(m.into())) + // Standard Error: 3_170 + .saturating_add(Weight::from_parts(539_260, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 65).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) + } + /// Storage: `AllianceMotion::Voting` (r:1 w:1) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Members` (r:1 w:0) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::ProposalOf` (r:1 w:1) + /// Proof: `AllianceMotion::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:1) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `662 + b * (1 ±0) + m * (64 ±0) + p * (40 ±0)` + // Estimated: `3979 + b * (1 ±0) + m * (66 ±0) + p * (40 ±0)` + // Minimum execution time: 123_381_000 picoseconds. + Weight::from_parts(119_321_351, 0) + .saturating_add(Weight::from_parts(0, 3979)) + // Standard Error: 643 + .saturating_add(Weight::from_parts(11_500, 0).saturating_mul(b.into())) + // Standard Error: 6_632 + .saturating_add(Weight::from_parts(717_414, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 66).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(p.into())) + } + /// Storage: `AllianceMotion::Voting` (r:1 w:1) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Members` (r:1 w:0) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Prime` (r:1 w:0) + /// Proof: `AllianceMotion::Prime` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:1) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::ProposalOf` (r:0 w:1) + /// Proof: `AllianceMotion::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_disapproved(m: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `458 + m * (48 ±0) + p * (36 ±0)` + // Estimated: `3898 + m * (49 ±0) + p * (36 ±0)` + // Minimum execution time: 93_038_000 picoseconds. + Weight::from_parts(92_223_927, 0) + .saturating_add(Weight::from_parts(0, 3898)) + // Standard Error: 3_126 + .saturating_add(Weight::from_parts(42_141, 0).saturating_mul(m.into())) + // Standard Error: 3_048 + .saturating_add(Weight::from_parts(555_724, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 49).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 36).saturating_mul(p.into())) + } + /// Storage: `AllianceMotion::Voting` (r:1 w:1) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Members` (r:1 w:0) + /// Proof: `AllianceMotion::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Prime` (r:1 w:0) + /// Proof: `AllianceMotion::Prime` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::ProposalOf` (r:1 w:1) + /// Proof: `AllianceMotion::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Proposals` (r:1 w:1) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `b` is `[2, 1024]`. + /// The range of component `m` is `[4, 100]`. + /// The range of component `p` is `[1, 100]`. + fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `682 + b * (1 ±0) + m * (64 ±0) + p * (40 ±0)` + // Estimated: `3999 + b * (1 ±0) + m * (66 ±0) + p * (40 ±0)` + // Minimum execution time: 129_214_000 picoseconds. + Weight::from_parts(128_136_995, 0) + .saturating_add(Weight::from_parts(0, 3999)) + // Standard Error: 628 + .saturating_add(Weight::from_parts(8_498, 0).saturating_mul(b.into())) + // Standard Error: 6_472 + .saturating_add(Weight::from_parts(726_573, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 66).saturating_mul(m.into())) + .saturating_add(Weight::from_parts(0, 40).saturating_mul(p.into())) + } + /// Storage: `AllianceMotion::Proposals` (r:1 w:1) + /// Proof: `AllianceMotion::Proposals` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::Voting` (r:0 w:1) + /// Proof: `AllianceMotion::Voting` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `AllianceMotion::ProposalOf` (r:0 w:1) + /// Proof: `AllianceMotion::ProposalOf` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `p` is `[1, 100]`. + fn disapprove_proposal(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `189 + p * (32 ±0)` + // Estimated: `1674 + p * (32 ±0)` + // Minimum execution time: 51_418_000 picoseconds. + Weight::from_parts(52_271_519, 0) + .saturating_add(Weight::from_parts(0, 1674)) + // Standard Error: 2_554 + .saturating_add(Weight::from_parts(524_745, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(p.into())) + } +} diff --git a/runtime/casper/src/weights/pallet_core_fellowship.rs b/runtime/casper/src/weights/pallet_core_fellowship.rs new file mode 100644 index 0000000..de95250 --- /dev/null +++ b/runtime/casper/src/weights/pallet_core_fellowship.rs @@ -0,0 +1,226 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_core_fellowship` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_core_fellowship +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_core_fellowship.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_core_fellowship`. +pub struct WeightInfo(PhantomData); +impl pallet_core_fellowship::WeightInfo for WeightInfo { + /// Storage: `CultCore::Params` (r:0 w:1) + /// Proof: `CultCore::Params` (`max_values`: Some(1), `max_size`: Some(364), added: 859, mode: `MaxEncodedLen`) + fn set_params() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 24_436_000 picoseconds. + Weight::from_parts(24_940_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CultCore::Member` (r:1 w:1) + /// Proof: `CultCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::Members` (r:1 w:1) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultCore::Params` (r:1 w:0) + /// Proof: `CultCore::Params` (`max_values`: Some(1), `max_size`: Some(364), added: 859, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:1) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IdToIndex` (r:1 w:1) + /// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `CultCore::MemberEvidence` (r:1 w:1) + /// Proof: `CultCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IndexToId` (r:0 w:1) + /// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + fn bump_offboard() -> Weight { + // Proof Size summary in bytes: + // Measured: `66884` + // Estimated: `69046` + // Minimum execution time: 387_602_000 picoseconds. + Weight::from_parts(391_884_000, 0) + .saturating_add(Weight::from_parts(0, 69046)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `CultCore::Member` (r:1 w:1) + /// Proof: `CultCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::Members` (r:1 w:1) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultCore::Params` (r:1 w:0) + /// Proof: `CultCore::Params` (`max_values`: Some(1), `max_size`: Some(364), added: 859, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:1) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IdToIndex` (r:1 w:1) + /// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `CultCore::MemberEvidence` (r:1 w:1) + /// Proof: `CultCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IndexToId` (r:0 w:1) + /// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + fn bump_demote() -> Weight { + // Proof Size summary in bytes: + // Measured: `66925` + // Estimated: `69046` + // Minimum execution time: 395_467_000 picoseconds. + Weight::from_parts(399_507_000, 0) + .saturating_add(Weight::from_parts(0, 69046)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `CultCollective::Members` (r:1 w:0) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultCore::Member` (r:1 w:1) + /// Proof: `CultCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + fn set_active() -> Weight { + // Proof Size summary in bytes: + // Measured: `565` + // Estimated: `3514` + // Minimum execution time: 66_931_000 picoseconds. + Weight::from_parts(68_036_000, 0) + .saturating_add(Weight::from_parts(0, 3514)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CultCore::Member` (r:1 w:1) + /// Proof: `CultCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::Members` (r:1 w:1) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:1) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IndexToId` (r:0 w:1) + /// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IdToIndex` (r:0 w:1) + /// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + fn induct() -> Weight { + // Proof Size summary in bytes: + // Measured: `530` + // Estimated: `3514` + // Minimum execution time: 113_787_000 picoseconds. + Weight::from_parts(115_087_000, 0) + .saturating_add(Weight::from_parts(0, 3514)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `CultCollective::Members` (r:1 w:1) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultCore::Member` (r:1 w:1) + /// Proof: `CultCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `CultCore::Params` (r:1 w:0) + /// Proof: `CultCore::Params` (`max_values`: Some(1), `max_size`: Some(364), added: 859, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:1) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCore::MemberEvidence` (r:1 w:1) + /// Proof: `CultCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IndexToId` (r:0 w:1) + /// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IdToIndex` (r:0 w:1) + /// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + fn promote() -> Weight { + // Proof Size summary in bytes: + // Measured: `66636` + // Estimated: `69046` + // Minimum execution time: 366_918_000 picoseconds. + Weight::from_parts(369_534_000, 0) + .saturating_add(Weight::from_parts(0, 69046)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `CultCollective::Members` (r:1 w:0) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultCore::Member` (r:1 w:1) + /// Proof: `CultCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `CultCore::MemberEvidence` (r:0 w:1) + /// Proof: `CultCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`) + fn offboard() -> Weight { + // Proof Size summary in bytes: + // Measured: `552` + // Estimated: `3514` + // Minimum execution time: 69_301_000 picoseconds. + Weight::from_parts(70_382_000, 0) + .saturating_add(Weight::from_parts(0, 3514)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `CultCore::Member` (r:1 w:1) + /// Proof: `CultCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::Members` (r:1 w:0) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + fn import() -> Weight { + // Proof Size summary in bytes: + // Measured: `490` + // Estimated: `3514` + // Minimum execution time: 63_841_000 picoseconds. + Weight::from_parts(64_810_000, 0) + .saturating_add(Weight::from_parts(0, 3514)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CultCollective::Members` (r:1 w:0) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultCore::Member` (r:1 w:1) + /// Proof: `CultCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `CultCore::MemberEvidence` (r:1 w:1) + /// Proof: `CultCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`) + fn approve() -> Weight { + // Proof Size summary in bytes: + // Measured: `66172` + // Estimated: `69046` + // Minimum execution time: 301_638_000 picoseconds. + Weight::from_parts(303_373_000, 0) + .saturating_add(Weight::from_parts(0, 69046)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `CultCore::Member` (r:1 w:0) + /// Proof: `CultCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `CultCore::MemberEvidence` (r:1 w:1) + /// Proof: `CultCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`) + fn submit_evidence() -> Weight { + // Proof Size summary in bytes: + // Measured: `151` + // Estimated: `69046` + // Minimum execution time: 253_463_000 picoseconds. + Weight::from_parts(255_091_000, 0) + .saturating_add(Weight::from_parts(0, 69046)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/casper/src/weights/pallet_election_provider_multi_phase.rs b/runtime/casper/src/weights/pallet_election_provider_multi_phase.rs new file mode 100644 index 0000000..bec91b6 --- /dev/null +++ b/runtime/casper/src/weights/pallet_election_provider_multi_phase.rs @@ -0,0 +1,268 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_election_provider_multi_phase` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_election_provider_multi_phase +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_election_provider_multi_phase.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_election_provider_multi_phase`. +pub struct WeightInfo(PhantomData); +impl pallet_election_provider_multi_phase::WeightInfo for WeightInfo { + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentPlannedSession` (r:1 w:0) + /// Proof: `Staking::CurrentPlannedSession` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasStartSessionIndex` (r:1 w:0) + /// Proof: `Staking::ErasStartSessionIndex` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `Babe::EpochIndex` (r:1 w:0) + /// Proof: `Babe::EpochIndex` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Babe::GenesisSlot` (r:1 w:0) + /// Proof: `Babe::GenesisSlot` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Babe::CurrentSlot` (r:1 w:0) + /// Proof: `Babe::CurrentSlot` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Staking::ForceEra` (r:1 w:0) + /// Proof: `Staking::ForceEra` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `ElectionProviderMultiPhase::CurrentPhase` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::CurrentPhase` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn on_initialize_nothing() -> Weight { + // Proof Size summary in bytes: + // Measured: `918` + // Estimated: `3481` + // Minimum execution time: 59_356_000 picoseconds. + Weight::from_parts(60_470_000, 0) + .saturating_add(Weight::from_parts(0, 3481)) + .saturating_add(T::DbWeight::get().reads(8)) + } + /// Storage: `ElectionProviderMultiPhase::Round` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::Round` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::CurrentPhase` (r:1 w:1) + /// Proof: `ElectionProviderMultiPhase::CurrentPhase` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn on_initialize_open_signed() -> Weight { + // Proof Size summary in bytes: + // Measured: `43` + // Estimated: `1528` + // Minimum execution time: 38_516_000 picoseconds. + Weight::from_parts(39_173_000, 0) + .saturating_add(Weight::from_parts(0, 1528)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `ElectionProviderMultiPhase::Round` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::Round` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::CurrentPhase` (r:1 w:1) + /// Proof: `ElectionProviderMultiPhase::CurrentPhase` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn on_initialize_open_unsigned() -> Weight { + // Proof Size summary in bytes: + // Measured: `43` + // Estimated: `1528` + // Minimum execution time: 41_540_000 picoseconds. + Weight::from_parts(42_546_000, 0) + .saturating_add(Weight::from_parts(0, 1528)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `ElectionProviderMultiPhase::QueuedSolution` (r:0 w:1) + /// Proof: `ElectionProviderMultiPhase::QueuedSolution` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn finalize_signed_phase_accept_solution() -> Weight { + // Proof Size summary in bytes: + // Measured: `174` + // Estimated: `3593` + // Minimum execution time: 104_874_000 picoseconds. + Weight::from_parts(106_341_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn finalize_signed_phase_reject_solution() -> Weight { + // Proof Size summary in bytes: + // Measured: `174` + // Estimated: `3593` + // Minimum execution time: 72_128_000 picoseconds. + Weight::from_parts(72_889_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `ElectionProviderMultiPhase::SnapshotMetadata` (r:0 w:1) + /// Proof: `ElectionProviderMultiPhase::SnapshotMetadata` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::DesiredTargets` (r:0 w:1) + /// Proof: `ElectionProviderMultiPhase::DesiredTargets` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::Snapshot` (r:0 w:1) + /// Proof: `ElectionProviderMultiPhase::Snapshot` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `v` is `[1000, 2000]`. + /// The range of component `t` is `[500, 1000]`. + fn create_snapshot_internal(v: u32, _t: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 935_144_000 picoseconds. + Weight::from_parts(946_333_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 4_610 + .saturating_add(Weight::from_parts(742_473, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `ElectionProviderMultiPhase::SignedSubmissionIndices` (r:1 w:1) + /// Proof: `ElectionProviderMultiPhase::SignedSubmissionIndices` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::SignedSubmissionNextIndex` (r:1 w:1) + /// Proof: `ElectionProviderMultiPhase::SignedSubmissionNextIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::SnapshotMetadata` (r:1 w:1) + /// Proof: `ElectionProviderMultiPhase::SnapshotMetadata` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::SignedSubmissionsMap` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::SignedSubmissionsMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::QueuedSolution` (r:1 w:1) + /// Proof: `ElectionProviderMultiPhase::QueuedSolution` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::Round` (r:1 w:1) + /// Proof: `ElectionProviderMultiPhase::Round` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::CurrentPhase` (r:1 w:1) + /// Proof: `ElectionProviderMultiPhase::CurrentPhase` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::DesiredTargets` (r:0 w:1) + /// Proof: `ElectionProviderMultiPhase::DesiredTargets` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::Snapshot` (r:0 w:1) + /// Proof: `ElectionProviderMultiPhase::Snapshot` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `a` is `[500, 800]`. + /// The range of component `d` is `[200, 400]`. + fn elect_queued(a: u32, d: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `266 + a * (768 ±0) + d * (48 ±0)` + // Estimated: `3818 + a * (768 ±0) + d * (49 ±0)` + // Minimum execution time: 807_366_000 picoseconds. + Weight::from_parts(33_682_717, 0) + .saturating_add(Weight::from_parts(0, 3818)) + // Standard Error: 11_235 + .saturating_add(Weight::from_parts(1_310_189, 0).saturating_mul(a.into())) + // Standard Error: 16_841 + .saturating_add(Weight::from_parts(317_382, 0).saturating_mul(d.into())) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(8)) + .saturating_add(Weight::from_parts(0, 768).saturating_mul(a.into())) + .saturating_add(Weight::from_parts(0, 49).saturating_mul(d.into())) + } + /// Storage: `ElectionProviderMultiPhase::CurrentPhase` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::CurrentPhase` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::Round` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::Round` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::SnapshotMetadata` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::SnapshotMetadata` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::SignedSubmissionIndices` (r:1 w:1) + /// Proof: `ElectionProviderMultiPhase::SignedSubmissionIndices` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::SignedSubmissionNextIndex` (r:1 w:1) + /// Proof: `ElectionProviderMultiPhase::SignedSubmissionNextIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `TransactionPayment::NextFeeMultiplier` (r:1 w:0) + /// Proof: `TransactionPayment::NextFeeMultiplier` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `ElectionProviderMultiPhase::SignedSubmissionsMap` (r:0 w:1) + /// Proof: `ElectionProviderMultiPhase::SignedSubmissionsMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn submit() -> Weight { + // Proof Size summary in bytes: + // Measured: `1157` + // Estimated: `2642` + // Minimum execution time: 177_774_000 picoseconds. + Weight::from_parts(180_008_000, 0) + .saturating_add(Weight::from_parts(0, 2642)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `ElectionProviderMultiPhase::CurrentPhase` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::CurrentPhase` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::Round` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::Round` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::DesiredTargets` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::DesiredTargets` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::QueuedSolution` (r:1 w:1) + /// Proof: `ElectionProviderMultiPhase::QueuedSolution` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::SnapshotMetadata` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::SnapshotMetadata` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::Snapshot` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::Snapshot` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::MinimumUntrustedScore` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::MinimumUntrustedScore` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `v` is `[1000, 2000]`. + /// The range of component `t` is `[500, 1000]`. + /// The range of component `a` is `[500, 800]`. + /// The range of component `d` is `[200, 400]`. + fn submit_unsigned(v: u32, t: u32, a: u32, _d: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `148 + t * (32 ±0) + v * (553 ±0)` + // Estimated: `1633 + t * (32 ±0) + v * (553 ±0)` + // Minimum execution time: 13_641_128_000 picoseconds. + Weight::from_parts(13_688_484_000, 0) + .saturating_add(Weight::from_parts(0, 1633)) + // Standard Error: 44_289 + .saturating_add(Weight::from_parts(251_513, 0).saturating_mul(v.into())) + // Standard Error: 131_245 + .saturating_add(Weight::from_parts(12_905_812, 0).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 553).saturating_mul(v.into())) + } + /// Storage: `ElectionProviderMultiPhase::DesiredTargets` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::DesiredTargets` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::Snapshot` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::Snapshot` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::Round` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::Round` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `ElectionProviderMultiPhase::MinimumUntrustedScore` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::MinimumUntrustedScore` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `v` is `[1000, 2000]`. + /// The range of component `t` is `[500, 1000]`. + /// The range of component `a` is `[500, 800]`. + /// The range of component `d` is `[200, 400]`. + fn feasibility_check(v: u32, t: u32, a: u32, _d: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `123 + t * (32 ±0) + v * (553 ±0)` + // Estimated: `1608 + t * (32 ±0) + v * (553 ±0)` + // Minimum execution time: 11_846_347_000 picoseconds. + Weight::from_parts(11_874_580_000, 0) + .saturating_add(Weight::from_parts(0, 1608)) + // Standard Error: 35_292 + .saturating_add(Weight::from_parts(270_578, 0).saturating_mul(v.into())) + // Standard Error: 104_585 + .saturating_add(Weight::from_parts(10_407_792, 0).saturating_mul(a.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(t.into())) + .saturating_add(Weight::from_parts(0, 553).saturating_mul(v.into())) + } +} diff --git a/runtime/casper/src/weights/pallet_fast_unstake.rs b/runtime/casper/src/weights/pallet_fast_unstake.rs new file mode 100644 index 0000000..474cc5a --- /dev/null +++ b/runtime/casper/src/weights/pallet_fast_unstake.rs @@ -0,0 +1,207 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_fast_unstake` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_fast_unstake +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_fast_unstake.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_fast_unstake`. +pub struct WeightInfo(PhantomData); +impl pallet_fast_unstake::WeightInfo for WeightInfo { + /// Storage: `FastUnstake::ErasToCheckPerBlock` (r:1 w:0) + /// Proof: `FastUnstake::ErasToCheckPerBlock` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ValidatorCount` (r:1 w:0) + /// Proof: `Staking::ValidatorCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `FastUnstake::Head` (r:1 w:1) + /// Proof: `FastUnstake::Head` (`max_values`: Some(1), `max_size`: Some(886), added: 1381, mode: `MaxEncodedLen`) + /// Storage: `FastUnstake::CounterForQueue` (r:1 w:0) + /// Proof: `FastUnstake::CounterForQueue` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ElectionProviderMultiPhase::CurrentPhase` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::CurrentPhase` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::SlashingSpans` (r:16 w:0) + /// Proof: `Staking::SlashingSpans` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Staking::Bonded` (r:16 w:16) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:16 w:16) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:16 w:16) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:16 w:16) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:16 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:16 w:16) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:16 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:16 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:16) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// The range of component `b` is `[1, 16]`. + fn on_idle_unstake(b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1002 + b * (469 ±0)` + // Estimated: `2493 + b * (3774 ±0)` + // Minimum execution time: 325_757_000 picoseconds. + Weight::from_parts(88_951_336, 0) + .saturating_add(Weight::from_parts(0, 2493)) + // Standard Error: 109_675 + .saturating_add(Weight::from_parts(230_557_843, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().reads((9_u64).saturating_mul(b.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((6_u64).saturating_mul(b.into()))) + .saturating_add(Weight::from_parts(0, 3774).saturating_mul(b.into())) + } + /// Storage: `FastUnstake::ErasToCheckPerBlock` (r:1 w:0) + /// Proof: `FastUnstake::ErasToCheckPerBlock` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ValidatorCount` (r:1 w:0) + /// Proof: `Staking::ValidatorCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `FastUnstake::Head` (r:1 w:1) + /// Proof: `FastUnstake::Head` (`max_values`: Some(1), `max_size`: Some(886), added: 1381, mode: `MaxEncodedLen`) + /// Storage: `FastUnstake::CounterForQueue` (r:1 w:0) + /// Proof: `FastUnstake::CounterForQueue` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `ElectionProviderMultiPhase::CurrentPhase` (r:1 w:0) + /// Proof: `ElectionProviderMultiPhase::CurrentPhase` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasStakers` (r:1 w:0) + /// Proof: `Staking::ErasStakers` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Staking::ErasStakersPaged` (r:257 w:0) + /// Proof: `Staking::ErasStakersPaged` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `v` is `[1, 256]`. + /// The range of component `b` is `[1, 16]`. + fn on_idle_check(v: u32, b: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1526 + b * (67 ±0) + v * (19529 ±0)` + // Estimated: `4846 + b * (70 ±0) + v * (22005 ±0)` + // Minimum execution time: 2_395_049_000 picoseconds. + Weight::from_parts(2_403_480_000, 0) + .saturating_add(Weight::from_parts(0, 4846)) + // Standard Error: 19_669_778 + .saturating_add(Weight::from_parts(656_455_999, 0).saturating_mul(v.into())) + // Standard Error: 315_640_855 + .saturating_add(Weight::from_parts(9_883_897_913, 0).saturating_mul(b.into())) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 70).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(0, 22005).saturating_mul(v.into())) + } + /// Storage: `FastUnstake::ErasToCheckPerBlock` (r:1 w:0) + /// Proof: `FastUnstake::ErasToCheckPerBlock` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `FastUnstake::Queue` (r:1 w:1) + /// Proof: `FastUnstake::Queue` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `FastUnstake::Head` (r:1 w:0) + /// Proof: `FastUnstake::Head` (`max_values`: Some(1), `max_size`: Some(886), added: 1381, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:1 w:1) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `FastUnstake::CounterForQueue` (r:1 w:1) + /// Proof: `FastUnstake::CounterForQueue` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn register_fast_unstake() -> Weight { + // Proof Size summary in bytes: + // Measured: `1849` + // Estimated: `4764` + // Minimum execution time: 527_315_000 picoseconds. + Weight::from_parts(530_442_000, 0) + .saturating_add(Weight::from_parts(0, 4764)) + .saturating_add(T::DbWeight::get().reads(16)) + .saturating_add(T::DbWeight::get().writes(9)) + } + /// Storage: `FastUnstake::ErasToCheckPerBlock` (r:1 w:0) + /// Proof: `FastUnstake::ErasToCheckPerBlock` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `FastUnstake::Queue` (r:1 w:1) + /// Proof: `FastUnstake::Queue` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `FastUnstake::Head` (r:1 w:0) + /// Proof: `FastUnstake::Head` (`max_values`: Some(1), `max_size`: Some(886), added: 1381, mode: `MaxEncodedLen`) + /// Storage: `FastUnstake::CounterForQueue` (r:1 w:1) + /// Proof: `FastUnstake::CounterForQueue` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn deregister() -> Weight { + // Proof Size summary in bytes: + // Measured: `1243` + // Estimated: `4556` + // Minimum execution time: 167_411_000 picoseconds. + Weight::from_parts(168_605_000, 0) + .saturating_add(Weight::from_parts(0, 4556)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `FastUnstake::ErasToCheckPerBlock` (r:0 w:1) + /// Proof: `FastUnstake::ErasToCheckPerBlock` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn control() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 10_892_000 picoseconds. + Weight::from_parts(11_137_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/casper/src/weights/pallet_grandpa.rs b/runtime/casper/src/weights/pallet_grandpa.rs new file mode 100644 index 0000000..dac364c --- /dev/null +++ b/runtime/casper/src/weights/pallet_grandpa.rs @@ -0,0 +1,71 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_grandpa` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_grandpa +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_grandpa.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_grandpa`. +pub struct WeightInfo(PhantomData); +impl pallet_grandpa::WeightInfo for WeightInfo { + /// The range of component `x` is `[0, 1]`. + fn check_equivocation_proof(x: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 273_518_000 picoseconds. + Weight::from_parts(274_286_032, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 48_031 + .saturating_add(Weight::from_parts(120_967, 0).saturating_mul(x.into())) + } + /// Storage: `Grandpa::Stalled` (r:0 w:1) + /// Proof: `Grandpa::Stalled` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + fn note_stalled() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 11_923_000 picoseconds. + Weight::from_parts(12_217_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/casper/src/weights/pallet_identity.rs b/runtime/casper/src/weights/pallet_identity.rs new file mode 100644 index 0000000..8654fc7 --- /dev/null +++ b/runtime/casper/src/weights/pallet_identity.rs @@ -0,0 +1,434 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_identity` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_identity +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_identity.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_identity`. +pub struct WeightInfo(PhantomData); +impl pallet_identity::WeightInfo for WeightInfo { + /// Storage: `Identity::Registrars` (r:1 w:1) + /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(5702), added: 6197, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 99]`. + fn add_registrar(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `32 + r * (57 ±0)` + // Estimated: `7187` + // Minimum execution time: 36_029_000 picoseconds. + Weight::from_parts(37_138_493, 0) + .saturating_add(Weight::from_parts(0, 7187)) + // Standard Error: 811 + .saturating_add(Weight::from_parts(143_381, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 100]`. + fn set_identity(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `6978 + r * (5 ±0)` + // Estimated: `12718` + // Minimum execution time: 426_855_000 picoseconds. + Weight::from_parts(428_183_540, 0) + .saturating_add(Weight::from_parts(0, 12718)) + // Standard Error: 5_161 + .saturating_add(Weight::from_parts(202_583, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Identity::IdentityOf` (r:1 w:0) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:100 w:100) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 100]`. + fn set_subs_new(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `101` + // Estimated: `12718 + s * (2589 ±0)` + // Minimum execution time: 38_909_000 picoseconds. + Weight::from_parts(93_060_862, 0) + .saturating_add(Weight::from_parts(0, 12718)) + // Standard Error: 13_890 + .saturating_add(Weight::from_parts(13_055_562, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(s.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + .saturating_add(Weight::from_parts(0, 2589).saturating_mul(s.into())) + } + /// Storage: `Identity::IdentityOf` (r:1 w:0) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:0 w:100) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// The range of component `p` is `[0, 100]`. + fn set_subs_old(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `194 + p * (32 ±0)` + // Estimated: `12718` + // Minimum execution time: 38_393_000 picoseconds. + Weight::from_parts(89_242_199, 0) + .saturating_add(Weight::from_parts(0, 12718)) + // Standard Error: 12_183 + .saturating_add(Weight::from_parts(5_292_462, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) + } + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:0 w:100) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 100]`. + /// The range of component `s` is `[0, 100]`. + fn clear_identity(r: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `7070 + r * (5 ±0) + s * (32 ±0)` + // Estimated: `12718` + // Minimum execution time: 210_961_000 picoseconds. + Weight::from_parts(188_823_375, 0) + .saturating_add(Weight::from_parts(0, 12718)) + // Standard Error: 7_526 + .saturating_add(Weight::from_parts(329_188, 0).saturating_mul(r.into())) + // Standard Error: 7_436 + .saturating_add(Weight::from_parts(5_350_981, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + } + /// Storage: `Identity::Registrars` (r:1 w:0) + /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(5702), added: 6197, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 100]`. + fn request_judgement(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `6968 + r * (57 ±0)` + // Estimated: `12718` + // Minimum execution time: 298_678_000 picoseconds. + Weight::from_parts(301_034_667, 0) + .saturating_add(Weight::from_parts(0, 12718)) + // Standard Error: 3_406 + .saturating_add(Weight::from_parts(174_545, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 100]`. + fn cancel_request(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `6999` + // Estimated: `12718` + // Minimum execution time: 292_089_000 picoseconds. + Weight::from_parts(294_952_996, 0) + .saturating_add(Weight::from_parts(0, 12718)) + // Standard Error: 5_162 + .saturating_add(Weight::from_parts(79_491, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Identity::Registrars` (r:1 w:1) + /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(5702), added: 6197, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 99]`. + fn set_fee(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `89 + r * (57 ±0)` + // Estimated: `7187` + // Minimum execution time: 26_819_000 picoseconds. + Weight::from_parts(27_445_527, 0) + .saturating_add(Weight::from_parts(0, 7187)) + // Standard Error: 886 + .saturating_add(Weight::from_parts(132_840, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Identity::Registrars` (r:1 w:1) + /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(5702), added: 6197, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 99]`. + fn set_account_id(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `89 + r * (57 ±0)` + // Estimated: `7187` + // Minimum execution time: 26_061_000 picoseconds. + Weight::from_parts(27_222_451, 0) + .saturating_add(Weight::from_parts(0, 7187)) + // Standard Error: 1_137 + .saturating_add(Weight::from_parts(133_491, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Identity::Registrars` (r:1 w:1) + /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(5702), added: 6197, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 99]`. + fn set_fields(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `89 + r * (57 ±0)` + // Estimated: `7187` + // Minimum execution time: 25_767_000 picoseconds. + Weight::from_parts(26_674_843, 0) + .saturating_add(Weight::from_parts(0, 7187)) + // Standard Error: 1_009 + .saturating_add(Weight::from_parts(133_509, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Identity::Registrars` (r:1 w:0) + /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(5702), added: 6197, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 99]`. + fn provide_judgement(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `7046 + r * (57 ±0)` + // Estimated: `12718` + // Minimum execution time: 371_609_000 picoseconds. + Weight::from_parts(373_810_252, 0) + .saturating_add(Weight::from_parts(0, 12718)) + // Standard Error: 2_210 + .saturating_add(Weight::from_parts(154_120, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:0 w:100) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// The range of component `r` is `[1, 100]`. + /// The range of component `s` is `[0, 100]`. + fn kill_identity(r: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `7277 + r * (5 ±0) + s * (32 ±0)` + // Estimated: `12718` + // Minimum execution time: 265_911_000 picoseconds. + Weight::from_parts(241_271_501, 0) + .saturating_add(Weight::from_parts(0, 12718)) + // Standard Error: 7_518 + .saturating_add(Weight::from_parts(346_780, 0).saturating_mul(r.into())) + // Standard Error: 7_429 + .saturating_add(Weight::from_parts(5_410_067, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + } + /// Storage: `Identity::IdentityOf` (r:1 w:0) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:1 w:1) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 99]`. + fn add_sub(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `475 + s * (36 ±0)` + // Estimated: `12718` + // Minimum execution time: 110_179_000 picoseconds. + Weight::from_parts(121_789_579, 0) + .saturating_add(Weight::from_parts(0, 12718)) + // Standard Error: 5_438 + .saturating_add(Weight::from_parts(176_419, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Identity::IdentityOf` (r:1 w:0) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:1 w:1) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 100]`. + fn rename_sub(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `591 + s * (3 ±0)` + // Estimated: `12718` + // Minimum execution time: 50_639_000 picoseconds. + Weight::from_parts(55_486_355, 0) + .saturating_add(Weight::from_parts(0, 12718)) + // Standard Error: 1_302 + .saturating_add(Weight::from_parts(58_562, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Identity::IdentityOf` (r:1 w:0) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + /// Storage: `Identity::SuperOf` (r:1 w:1) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 100]`. + fn remove_sub(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `638 + s * (35 ±0)` + // Estimated: `12718` + // Minimum execution time: 121_808_000 picoseconds. + Weight::from_parts(125_780_211, 0) + .saturating_add(Weight::from_parts(0, 12718)) + // Standard Error: 1_897 + .saturating_add(Weight::from_parts(146_144, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Identity::SuperOf` (r:1 w:1) + /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// Storage: `Identity::SubsOf` (r:1 w:1) + /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 99]`. + fn quit_sub(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `667 + s * (37 ±0)` + // Estimated: `6723` + // Minimum execution time: 88_672_000 picoseconds. + Weight::from_parts(93_095_231, 0) + .saturating_add(Weight::from_parts(0, 6723)) + // Standard Error: 2_603 + .saturating_add(Weight::from_parts(141_002, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Identity::UsernameAuthorities` (r:0 w:1) + /// Proof: `Identity::UsernameAuthorities` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + fn add_username_authority() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 28_397_000 picoseconds. + Weight::from_parts(28_848_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Identity::UsernameAuthorities` (r:1 w:1) + /// Proof: `Identity::UsernameAuthorities` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + fn remove_username_authority() -> Weight { + // Proof Size summary in bytes: + // Measured: `80` + // Estimated: `3517` + // Minimum execution time: 42_692_000 picoseconds. + Weight::from_parts(43_608_000, 0) + .saturating_add(Weight::from_parts(0, 3517)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Identity::UsernameAuthorities` (r:1 w:1) + /// Proof: `Identity::UsernameAuthorities` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Identity::AccountOfUsername` (r:1 w:1) + /// Proof: `Identity::AccountOfUsername` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) + /// Storage: `Identity::PendingUsernames` (r:1 w:0) + /// Proof: `Identity::PendingUsernames` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + fn set_username_for() -> Weight { + // Proof Size summary in bytes: + // Measured: `80` + // Estimated: `12718` + // Minimum execution time: 238_398_000 picoseconds. + Weight::from_parts(243_093_000, 0) + .saturating_add(Weight::from_parts(0, 12718)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Identity::PendingUsernames` (r:1 w:1) + /// Proof: `Identity::PendingUsernames` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + /// Storage: `Identity::AccountOfUsername` (r:0 w:1) + /// Proof: `Identity::AccountOfUsername` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) + fn accept_username() -> Weight { + // Proof Size summary in bytes: + // Measured: `115` + // Estimated: `12718` + // Minimum execution time: 86_312_000 picoseconds. + Weight::from_parts(87_506_000, 0) + .saturating_add(Weight::from_parts(0, 12718)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Identity::PendingUsernames` (r:1 w:1) + /// Proof: `Identity::PendingUsernames` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) + fn remove_expired_approval() -> Weight { + // Proof Size summary in bytes: + // Measured: `115` + // Estimated: `3550` + // Minimum execution time: 55_177_000 picoseconds. + Weight::from_parts(72_684_000, 0) + .saturating_add(Weight::from_parts(0, 3550)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Identity::AccountOfUsername` (r:1 w:0) + /// Proof: `Identity::AccountOfUsername` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:1) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + fn set_primary_username() -> Weight { + // Proof Size summary in bytes: + // Measured: `257` + // Estimated: `12718` + // Minimum execution time: 70_554_000 picoseconds. + Weight::from_parts(71_242_000, 0) + .saturating_add(Weight::from_parts(0, 12718)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Identity::AccountOfUsername` (r:1 w:1) + /// Proof: `Identity::AccountOfUsername` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) + /// Storage: `Identity::IdentityOf` (r:1 w:0) + /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(9253), added: 11728, mode: `MaxEncodedLen`) + fn remove_dangling_username() -> Weight { + // Proof Size summary in bytes: + // Measured: `98` + // Estimated: `12718` + // Minimum execution time: 50_768_000 picoseconds. + Weight::from_parts(52_044_000, 0) + .saturating_add(Weight::from_parts(0, 12718)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/casper/src/weights/pallet_indices.rs b/runtime/casper/src/weights/pallet_indices.rs new file mode 100644 index 0000000..e1b4aaf --- /dev/null +++ b/runtime/casper/src/weights/pallet_indices.rs @@ -0,0 +1,113 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_indices` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_indices +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_indices.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_indices`. +pub struct WeightInfo(PhantomData); +impl pallet_indices::WeightInfo for WeightInfo { + /// Storage: `Indices::Accounts` (r:1 w:1) + /// Proof: `Indices::Accounts` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + fn claim() -> Weight { + // Proof Size summary in bytes: + // Measured: `142` + // Estimated: `3534` + // Minimum execution time: 88_097_000 picoseconds. + Weight::from_parts(89_172_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Indices::Accounts` (r:1 w:1) + /// Proof: `Indices::Accounts` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `341` + // Estimated: `3593` + // Minimum execution time: 131_395_000 picoseconds. + Weight::from_parts(132_310_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Indices::Accounts` (r:1 w:1) + /// Proof: `Indices::Accounts` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + fn free() -> Weight { + // Proof Size summary in bytes: + // Measured: `238` + // Estimated: `3534` + // Minimum execution time: 87_436_000 picoseconds. + Weight::from_parts(88_420_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Indices::Accounts` (r:1 w:1) + /// Proof: `Indices::Accounts` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn force_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `378` + // Estimated: `3593` + // Minimum execution time: 99_599_000 picoseconds. + Weight::from_parts(100_359_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Indices::Accounts` (r:1 w:1) + /// Proof: `Indices::Accounts` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + fn freeze() -> Weight { + // Proof Size summary in bytes: + // Measured: `238` + // Estimated: `3534` + // Minimum execution time: 91_305_000 picoseconds. + Weight::from_parts(92_154_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/casper/src/weights/pallet_multisig.rs b/runtime/casper/src/weights/pallet_multisig.rs new file mode 100644 index 0000000..1a716f6 --- /dev/null +++ b/runtime/casper/src/weights/pallet_multisig.rs @@ -0,0 +1,161 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_multisig` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_multisig +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_multisig.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_multisig`. +pub struct WeightInfo(PhantomData); +impl pallet_multisig::WeightInfo for WeightInfo { + /// The range of component `z` is `[0, 10000]`. + fn as_multi_threshold_1(z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 43_478_000 picoseconds. + Weight::from_parts(44_609_560, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 12 + .saturating_add(Weight::from_parts(1_401, 0).saturating_mul(z.into())) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_create(s: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `333 + s * (2 ±0)` + // Estimated: `6811` + // Minimum execution time: 142_936_000 picoseconds. + Weight::from_parts(124_108_455, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 2_855 + .saturating_add(Weight::from_parts(221_355, 0).saturating_mul(s.into())) + // Standard Error: 27 + .saturating_add(Weight::from_parts(4_474, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[3, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_approve(s: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `320` + // Estimated: `6811` + // Minimum execution time: 87_713_000 picoseconds. + Weight::from_parts(68_239_498, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 2_226 + .saturating_add(Weight::from_parts(220_950, 0).saturating_mul(s.into())) + // Standard Error: 21 + .saturating_add(Weight::from_parts(4_503, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + /// The range of component `z` is `[0, 10000]`. + fn as_multi_complete(s: u32, z: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `456 + s * (33 ±0)` + // Estimated: `6811` + // Minimum execution time: 157_225_000 picoseconds. + Weight::from_parts(131_602_388, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 2_751 + .saturating_add(Weight::from_parts(287_079, 0).saturating_mul(s.into())) + // Standard Error: 26 + .saturating_add(Weight::from_parts(4_553, 0).saturating_mul(z.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_create(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `334 + s * (2 ±0)` + // Estimated: `6811` + // Minimum execution time: 117_684_000 picoseconds. + Weight::from_parts(118_769_220, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 5_547 + .saturating_add(Weight::from_parts(245_256, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn approve_as_multi_approve(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `320` + // Estimated: `6811` + // Minimum execution time: 63_527_000 picoseconds. + Weight::from_parts(63_245_044, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 3_544 + .saturating_add(Weight::from_parts(233_731, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Multisig::Multisigs` (r:1 w:1) + /// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`) + /// The range of component `s` is `[2, 100]`. + fn cancel_as_multi(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `525 + s * (1 ±0)` + // Estimated: `6811` + // Minimum execution time: 116_122_000 picoseconds. + Weight::from_parts(116_895_408, 0) + .saturating_add(Weight::from_parts(0, 6811)) + // Standard Error: 2_124 + .saturating_add(Weight::from_parts(230_923, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/casper/src/weights/pallet_nomination_pools.rs b/runtime/casper/src/weights/pallet_nomination_pools.rs new file mode 100644 index 0000000..4b0c319 --- /dev/null +++ b/runtime/casper/src/weights/pallet_nomination_pools.rs @@ -0,0 +1,671 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_nomination_pools` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_nomination_pools +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_nomination_pools.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_nomination_pools`. +pub struct WeightInfo(PhantomData); +impl pallet_nomination_pools::WeightInfo for WeightInfo { + /// Storage: `NominationPools::MinJoinBond` (r:1 w:0) + /// Proof: `NominationPools::MinJoinBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::PoolMembers` (r:1 w:1) + /// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::RewardPools` (r:1 w:1) + /// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0) + /// Proof: `NominationPools::GlobalMaxCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::MaxPoolMembersPerPool` (r:1 w:0) + /// Proof: `NominationPools::MaxPoolMembersPerPool` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::MaxPoolMembers` (r:1 w:0) + /// Proof: `NominationPools::MaxPoolMembers` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForPoolMembers` (r:1 w:1) + /// Proof: `NominationPools::CounterForPoolMembers` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::TotalValueLocked` (r:1 w:1) + /// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn join() -> Weight { + // Proof Size summary in bytes: + // Measured: `3318` + // Estimated: `8877` + // Minimum execution time: 716_606_000 picoseconds. + Weight::from_parts(721_123_000, 0) + .saturating_add(Weight::from_parts(0, 8877)) + .saturating_add(T::DbWeight::get().reads(21)) + .saturating_add(T::DbWeight::get().writes(13)) + } + /// Storage: `NominationPools::PoolMembers` (r:1 w:1) + /// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::RewardPools` (r:1 w:1) + /// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0) + /// Proof: `NominationPools::GlobalMaxCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::TotalValueLocked` (r:1 w:1) + /// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn bond_extra_transfer() -> Weight { + // Proof Size summary in bytes: + // Measured: `3328` + // Estimated: `8877` + // Minimum execution time: 716_271_000 picoseconds. + Weight::from_parts(722_192_000, 0) + .saturating_add(Weight::from_parts(0, 8877)) + .saturating_add(T::DbWeight::get().reads(18)) + .saturating_add(T::DbWeight::get().writes(13)) + } + /// Storage: `NominationPools::ClaimPermissions` (r:1 w:0) + /// Proof: `NominationPools::ClaimPermissions` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::PoolMembers` (r:1 w:1) + /// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::RewardPools` (r:1 w:1) + /// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0) + /// Proof: `NominationPools::GlobalMaxCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:3 w:3) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2 w:2) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::TotalValueLocked` (r:1 w:1) + /// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn bond_extra_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `3275` + // Estimated: `8799` + // Minimum execution time: 834_533_000 picoseconds. + Weight::from_parts(840_007_000, 0) + .saturating_add(Weight::from_parts(0, 8799)) + .saturating_add(T::DbWeight::get().reads(18)) + .saturating_add(T::DbWeight::get().writes(13)) + } + /// Storage: `NominationPools::ClaimPermissions` (r:1 w:0) + /// Proof: `NominationPools::ClaimPermissions` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::PoolMembers` (r:1 w:1) + /// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::RewardPools` (r:1 w:1) + /// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0) + /// Proof: `NominationPools::GlobalMaxCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn claim_payout() -> Weight { + // Proof Size summary in bytes: + // Measured: `1243` + // Estimated: `4182` + // Minimum execution time: 295_679_000 picoseconds. + Weight::from_parts(297_682_000, 0) + .saturating_add(Weight::from_parts(0, 4182)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `NominationPools::PoolMembers` (r:1 w:1) + /// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::RewardPools` (r:1 w:1) + /// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0) + /// Proof: `NominationPools::GlobalMaxCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::SubPoolsStorage` (r:1 w:1) + /// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(1197), added: 3672, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForSubPoolsStorage` (r:1 w:1) + /// Proof: `NominationPools::CounterForSubPoolsStorage` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn unbond() -> Weight { + // Proof Size summary in bytes: + // Measured: `3508` + // Estimated: `8877` + // Minimum execution time: 639_377_000 picoseconds. + Weight::from_parts(643_090_000, 0) + .saturating_add(Weight::from_parts(0, 8877)) + .saturating_add(T::DbWeight::get().reads(21)) + .saturating_add(T::DbWeight::get().writes(13)) + } + /// Storage: `NominationPools::BondedPools` (r:1 w:0) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::ReversePoolIdLookup` (r:1 w:0) + /// Proof: `NominationPools::ReversePoolIdLookup` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::TotalValueLocked` (r:1 w:1) + /// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 100]`. + fn pool_withdraw_unbonded(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1739` + // Estimated: `4764` + // Minimum execution time: 262_375_000 picoseconds. + Weight::from_parts(265_593_485, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 7_206 + .saturating_add(Weight::from_parts(92_499, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `NominationPools::PoolMembers` (r:1 w:1) + /// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::SubPoolsStorage` (r:1 w:1) + /// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(1197), added: 3672, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::ReversePoolIdLookup` (r:1 w:0) + /// Proof: `NominationPools::ReversePoolIdLookup` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::TotalValueLocked` (r:1 w:1) + /// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForPoolMembers` (r:1 w:1) + /// Proof: `NominationPools::CounterForPoolMembers` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::ClaimPermissions` (r:0 w:1) + /// Proof: `NominationPools::ClaimPermissions` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 100]`. + fn withdraw_unbonded_update(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2129` + // Estimated: `4764` + // Minimum execution time: 517_498_000 picoseconds. + Weight::from_parts(523_574_962, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 4_682 + .saturating_add(Weight::from_parts(158_922, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(9)) + } + /// Storage: `NominationPools::PoolMembers` (r:1 w:1) + /// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::SubPoolsStorage` (r:1 w:1) + /// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(1197), added: 3672, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::SlashingSpans` (r:1 w:0) + /// Proof: `Staking::SlashingSpans` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Staking::VirtualStakers` (r:1 w:1) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:2 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:2 w:1) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::ReversePoolIdLookup` (r:1 w:1) + /// Proof: `NominationPools::ReversePoolIdLookup` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::TotalValueLocked` (r:1 w:1) + /// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForPoolMembers` (r:1 w:1) + /// Proof: `NominationPools::CounterForPoolMembers` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForReversePoolIdLookup` (r:1 w:1) + /// Proof: `NominationPools::CounterForReversePoolIdLookup` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::RewardPools` (r:1 w:1) + /// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForRewardPools` (r:1 w:1) + /// Proof: `NominationPools::CounterForRewardPools` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForSubPoolsStorage` (r:1 w:1) + /// Proof: `NominationPools::CounterForSubPoolsStorage` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::Metadata` (r:1 w:1) + /// Proof: `NominationPools::Metadata` (`max_values`: None, `max_size`: Some(270), added: 2745, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForBondedPools` (r:1 w:1) + /// Proof: `NominationPools::CounterForBondedPools` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::ClaimPermissions` (r:0 w:1) + /// Proof: `NominationPools::ClaimPermissions` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 100]`. + fn withdraw_unbonded_kill(_s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2487` + // Estimated: `8538` + // Minimum execution time: 915_305_000 picoseconds. + Weight::from_parts(924_951_139, 0) + .saturating_add(Weight::from_parts(0, 8538)) + .saturating_add(T::DbWeight::get().reads(25)) + .saturating_add(T::DbWeight::get().writes(21)) + } + /// Storage: `NominationPools::LastPoolId` (r:1 w:1) + /// Proof: `NominationPools::LastPoolId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::MinCreateBond` (r:1 w:0) + /// Proof: `NominationPools::MinCreateBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::MinJoinBond` (r:1 w:0) + /// Proof: `NominationPools::MinJoinBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::MaxPools` (r:1 w:0) + /// Proof: `NominationPools::MaxPools` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForBondedPools` (r:1 w:1) + /// Proof: `NominationPools::CounterForBondedPools` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::PoolMembers` (r:1 w:1) + /// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::MaxPoolMembersPerPool` (r:1 w:0) + /// Proof: `NominationPools::MaxPoolMembersPerPool` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::MaxPoolMembers` (r:1 w:0) + /// Proof: `NominationPools::MaxPoolMembers` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForPoolMembers` (r:1 w:1) + /// Proof: `NominationPools::CounterForPoolMembers` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:2 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:2 w:1) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::TotalValueLocked` (r:1 w:1) + /// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::RewardPools` (r:1 w:1) + /// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForRewardPools` (r:1 w:1) + /// Proof: `NominationPools::CounterForRewardPools` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::ReversePoolIdLookup` (r:1 w:1) + /// Proof: `NominationPools::ReversePoolIdLookup` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForReversePoolIdLookup` (r:1 w:1) + /// Proof: `NominationPools::CounterForReversePoolIdLookup` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn create() -> Weight { + // Proof Size summary in bytes: + // Measured: `1217` + // Estimated: `8538` + // Minimum execution time: 730_155_000 picoseconds. + Weight::from_parts(734_091_000, 0) + .saturating_add(Weight::from_parts(0, 8538)) + .saturating_add(T::DbWeight::get().reads(25)) + .saturating_add(T::DbWeight::get().writes(17)) + } + /// Storage: `NominationPools::BondedPools` (r:1 w:0) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::PoolMembers` (r:1 w:0) + /// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::MinCreateBond` (r:1 w:0) + /// Proof: `NominationPools::MinCreateBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::MinJoinBond` (r:1 w:0) + /// Proof: `NominationPools::MinJoinBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxNominatorsCount` (r:1 w:0) + /// Proof: `Staking::MaxNominatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:17 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:1 w:1) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 16]`. + fn nominate(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1870` + // Estimated: `4556 + n * (2520 ±0)` + // Minimum execution time: 302_985_000 picoseconds. + Weight::from_parts(302_737_863, 0) + .saturating_add(Weight::from_parts(0, 4556)) + // Standard Error: 22_407 + .saturating_add(Weight::from_parts(5_487_308, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(5)) + .saturating_add(Weight::from_parts(0, 2520).saturating_mul(n.into())) + } + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + fn set_state() -> Weight { + // Proof Size summary in bytes: + // Measured: `1326` + // Estimated: `4556` + // Minimum execution time: 113_053_000 picoseconds. + Weight::from_parts(114_218_000, 0) + .saturating_add(Weight::from_parts(0, 4556)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `NominationPools::BondedPools` (r:1 w:0) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::Metadata` (r:1 w:1) + /// Proof: `NominationPools::Metadata` (`max_values`: None, `max_size`: Some(270), added: 2745, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::CounterForMetadata` (r:1 w:1) + /// Proof: `NominationPools::CounterForMetadata` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 256]`. + fn set_metadata(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `532` + // Estimated: `3735` + // Minimum execution time: 52_132_000 picoseconds. + Weight::from_parts(53_264_279, 0) + .saturating_add(Weight::from_parts(0, 3735)) + // Standard Error: 428 + .saturating_add(Weight::from_parts(2_468, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `NominationPools::MinJoinBond` (r:0 w:1) + /// Proof: `NominationPools::MinJoinBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::MaxPoolMembers` (r:0 w:1) + /// Proof: `NominationPools::MaxPoolMembers` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::MaxPoolMembersPerPool` (r:0 w:1) + /// Proof: `NominationPools::MaxPoolMembersPerPool` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::MinCreateBond` (r:0 w:1) + /// Proof: `NominationPools::MinCreateBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::GlobalMaxCommission` (r:0 w:1) + /// Proof: `NominationPools::GlobalMaxCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::MaxPools` (r:0 w:1) + /// Proof: `NominationPools::MaxPools` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn set_configs() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 16_746_000 picoseconds. + Weight::from_parts(17_151_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + fn update_roles() -> Weight { + // Proof Size summary in bytes: + // Measured: `532` + // Estimated: `3719` + // Minimum execution time: 63_646_000 picoseconds. + Weight::from_parts(64_352_000, 0) + .saturating_add(Weight::from_parts(0, 3719)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `NominationPools::BondedPools` (r:1 w:0) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::PoolMembers` (r:1 w:0) + /// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:1 w:1) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn chill() -> Weight { + // Proof Size summary in bytes: + // Measured: `2037` + // Estimated: `4556` + // Minimum execution time: 274_338_000 picoseconds. + Weight::from_parts(276_519_000, 0) + .saturating_add(Weight::from_parts(0, 4556)) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::RewardPools` (r:1 w:1) + /// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0) + /// Proof: `NominationPools::GlobalMaxCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:0) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn set_commission() -> Weight { + // Proof Size summary in bytes: + // Measured: `804` + // Estimated: `3719` + // Minimum execution time: 123_432_000 picoseconds. + Weight::from_parts(124_207_000, 0) + .saturating_add(Weight::from_parts(0, 3719)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0) + /// Proof: `NominationPools::GlobalMaxCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn set_commission_max() -> Weight { + // Proof Size summary in bytes: + // Measured: `572` + // Estimated: `3719` + // Minimum execution time: 64_040_000 picoseconds. + Weight::from_parts(64_576_000, 0) + .saturating_add(Weight::from_parts(0, 3719)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + fn set_commission_change_rate() -> Weight { + // Proof Size summary in bytes: + // Measured: `532` + // Estimated: `3719` + // Minimum execution time: 63_327_000 picoseconds. + Weight::from_parts(63_759_000, 0) + .saturating_add(Weight::from_parts(0, 3719)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `NominationPools::BondedPools` (r:1 w:1) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + fn set_commission_claim_permission() -> Weight { + // Proof Size summary in bytes: + // Measured: `532` + // Estimated: `3719` + // Minimum execution time: 62_830_000 picoseconds. + Weight::from_parts(63_234_000, 0) + .saturating_add(Weight::from_parts(0, 3719)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `NominationPools::PoolMembers` (r:1 w:0) + /// Proof: `NominationPools::PoolMembers` (`max_values`: None, `max_size`: Some(717), added: 3192, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::ClaimPermissions` (r:1 w:1) + /// Proof: `NominationPools::ClaimPermissions` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`) + fn set_claim_permission() -> Weight { + // Proof Size summary in bytes: + // Measured: `542` + // Estimated: `4182` + // Minimum execution time: 53_239_000 picoseconds. + Weight::from_parts(54_298_000, 0) + .saturating_add(Weight::from_parts(0, 4182)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `NominationPools::BondedPools` (r:1 w:0) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::RewardPools` (r:1 w:1) + /// Proof: `NominationPools::RewardPools` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::GlobalMaxCommission` (r:1 w:0) + /// Proof: `NominationPools::GlobalMaxCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn claim_commission() -> Weight { + // Proof Size summary in bytes: + // Measured: `1073` + // Estimated: `3719` + // Minimum execution time: 246_773_000 picoseconds. + Weight::from_parts(248_359_000, 0) + .saturating_add(Weight::from_parts(0, 3719)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `NominationPools::BondedPools` (r:1 w:0) + /// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:1) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:0) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + fn adjust_pool_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `972` + // Estimated: `4764` + // Minimum execution time: 273_640_000 picoseconds. + Weight::from_parts(275_806_000, 0) + .saturating_add(Weight::from_parts(0, 4764)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/casper/src/weights/pallet_preimage.rs b/runtime/casper/src/weights/pallet_preimage.rs new file mode 100644 index 0000000..40d1acb --- /dev/null +++ b/runtime/casper/src/weights/pallet_preimage.rs @@ -0,0 +1,264 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_preimage` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_preimage +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_preimage.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_preimage`. +pub struct WeightInfo(PhantomData); +impl pallet_preimage::WeightInfo for WeightInfo { + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 4194304]`. + fn note_preimage(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `3556` + // Minimum execution time: 184_982_000 picoseconds. + Weight::from_parts(185_981_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + // Standard Error: 12 + .saturating_add(Weight::from_parts(6_544, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 4194304]`. + fn note_requested_preimage(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `140` + // Estimated: `3556` + // Minimum execution time: 58_660_000 picoseconds. + Weight::from_parts(59_197_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + // Standard Error: 11 + .saturating_add(Weight::from_parts(6_536, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 4194304]`. + fn note_no_deposit_preimage(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `140` + // Estimated: `3556` + // Minimum execution time: 60_486_000 picoseconds. + Weight::from_parts(61_208_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + // Standard Error: 12 + .saturating_add(Weight::from_parts(6_563, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1 w:1) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + fn unnote_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `278` + // Estimated: `3556` + // Minimum execution time: 196_725_000 picoseconds. + Weight::from_parts(198_947_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + fn unnote_no_deposit_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `178` + // Estimated: `3556` + // Minimum execution time: 93_063_000 picoseconds. + Weight::from_parts(94_422_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn request_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `222` + // Estimated: `3556` + // Minimum execution time: 75_641_000 picoseconds. + Weight::from_parts(77_340_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn request_no_deposit_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `178` + // Estimated: `3556` + // Minimum execution time: 59_452_000 picoseconds. + Weight::from_parts(60_649_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn request_unnoted_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `76` + // Estimated: `3556` + // Minimum execution time: 67_319_000 picoseconds. + Weight::from_parts(68_408_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn request_requested_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `140` + // Estimated: `3556` + // Minimum execution time: 43_700_000 picoseconds. + Weight::from_parts(44_342_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:0 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `MaxEncodedLen`) + fn unrequest_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `178` + // Estimated: `3556` + // Minimum execution time: 85_045_000 picoseconds. + Weight::from_parts(86_364_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn unrequest_unnoted_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `140` + // Estimated: `3556` + // Minimum execution time: 43_163_000 picoseconds. + Weight::from_parts(44_239_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn unrequest_multi_referenced_preimage() -> Weight { + // Proof Size summary in bytes: + // Measured: `140` + // Estimated: `3556` + // Minimum execution time: 44_330_000 picoseconds. + Weight::from_parts(45_448_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Preimage::StatusFor` (r:1023 w:1023) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1023 w:1023) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Holds` (r:1023 w:1023) + /// Proof: `Balances::Holds` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:0 w:1023) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 1024]`. + fn ensure_updated(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + n * (227 ±0)` + // Estimated: `990 + n * (2603 ±0)` + // Minimum execution time: 209_069_000 picoseconds. + Weight::from_parts(210_285_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 107_938 + .saturating_add(Weight::from_parts(203_214_364, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into())) + } +} diff --git a/runtime/casper/src/weights/pallet_proxy.rs b/runtime/casper/src/weights/pallet_proxy.rs new file mode 100644 index 0000000..dc251ed --- /dev/null +++ b/runtime/casper/src/weights/pallet_proxy.rs @@ -0,0 +1,222 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_proxy` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_proxy +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_proxy.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_proxy`. +pub struct WeightInfo(PhantomData); +impl pallet_proxy::WeightInfo for WeightInfo { + /// Storage: `Proxy::Proxies` (r:1 w:0) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn proxy(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `227 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 52_102_000 picoseconds. + Weight::from_parts(52_983_652, 0) + .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 2_345 + .saturating_add(Weight::from_parts(123_131, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: `Proxy::Proxies` (r:1 w:0) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// Storage: `Proxy::Announcements` (r:1 w:1) + /// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn proxy_announced(a: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `554 + a * (68 ±0) + p * (37 ±0)` + // Estimated: `5698` + // Minimum execution time: 135_284_000 picoseconds. + Weight::from_parts(133_942_081, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 7_270 + .saturating_add(Weight::from_parts(486_065, 0).saturating_mul(a.into())) + // Standard Error: 7_511 + .saturating_add(Weight::from_parts(93_257, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Proxy::Announcements` (r:1 w:1) + /// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn remove_announcement(a: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `469 + a * (68 ±0)` + // Estimated: `5698` + // Minimum execution time: 92_458_000 picoseconds. + Weight::from_parts(93_228_580, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 3_540 + .saturating_add(Weight::from_parts(496_930, 0).saturating_mul(a.into())) + // Standard Error: 3_658 + .saturating_add(Weight::from_parts(20_009, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Proxy::Announcements` (r:1 w:1) + /// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn reject_announcement(a: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `469 + a * (68 ±0)` + // Estimated: `5698` + // Minimum execution time: 92_412_000 picoseconds. + Weight::from_parts(93_431_190, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 4_974 + .saturating_add(Weight::from_parts(499_958, 0).saturating_mul(a.into())) + // Standard Error: 5_139 + .saturating_add(Weight::from_parts(8_062, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Proxy::Proxies` (r:1 w:0) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// Storage: `Proxy::Announcements` (r:1 w:1) + /// Proof: `Proxy::Announcements` (`max_values`: None, `max_size`: Some(2233), added: 4708, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `a` is `[0, 31]`. + /// The range of component `p` is `[1, 31]`. + fn announce(a: u32, p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `486 + a * (68 ±0) + p * (37 ±0)` + // Estimated: `5698` + // Minimum execution time: 122_066_000 picoseconds. + Weight::from_parts(120_516_865, 0) + .saturating_add(Weight::from_parts(0, 5698)) + // Standard Error: 3_583 + .saturating_add(Weight::from_parts(474_188, 0).saturating_mul(a.into())) + // Standard Error: 3_702 + .saturating_add(Weight::from_parts(89_204, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn add_proxy(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `227 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 90_747_000 picoseconds. + Weight::from_parts(92_224_658, 0) + .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 6_178 + .saturating_add(Weight::from_parts(115_174, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn remove_proxy(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `227 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 90_894_000 picoseconds. + Weight::from_parts(91_907_515, 0) + .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 5_632 + .saturating_add(Weight::from_parts(170_776, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn remove_proxies(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `227 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 82_623_000 picoseconds. + Weight::from_parts(83_682_560, 0) + .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 1_885 + .saturating_add(Weight::from_parts(142_952, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[1, 31]`. + fn create_pure(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `239` + // Estimated: `4706` + // Minimum execution time: 96_987_000 picoseconds. + Weight::from_parts(98_089_930, 0) + .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 2_115 + .saturating_add(Weight::from_parts(36_871, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Proxy::Proxies` (r:1 w:1) + /// Proof: `Proxy::Proxies` (`max_values`: None, `max_size`: Some(1241), added: 3716, mode: `MaxEncodedLen`) + /// The range of component `p` is `[0, 30]`. + fn kill_pure(p: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `264 + p * (37 ±0)` + // Estimated: `4706` + // Minimum execution time: 86_027_000 picoseconds. + Weight::from_parts(87_080_852, 0) + .saturating_add(Weight::from_parts(0, 4706)) + // Standard Error: 1_982 + .saturating_add(Weight::from_parts(142_829, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/casper/src/weights/pallet_ranked_collective.rs b/runtime/casper/src/weights/pallet_ranked_collective.rs new file mode 100644 index 0000000..08c43d3 --- /dev/null +++ b/runtime/casper/src/weights/pallet_ranked_collective.rs @@ -0,0 +1,198 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_ranked_collective` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_ranked_collective +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_ranked_collective.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_ranked_collective`. +pub struct WeightInfo(PhantomData); +impl pallet_ranked_collective::WeightInfo for WeightInfo { + /// Storage: `CultCollective::Members` (r:1 w:1) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:1) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IndexToId` (r:0 w:1) + /// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IdToIndex` (r:0 w:1) + /// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + fn add_member() -> Weight { + // Proof Size summary in bytes: + // Measured: `142` + // Estimated: `3507` + // Minimum execution time: 63_706_000 picoseconds. + Weight::from_parts(64_882_000, 0) + .saturating_add(Weight::from_parts(0, 3507)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `CultCollective::Members` (r:1 w:1) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:11 w:11) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IdToIndex` (r:11 w:22) + /// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IndexToId` (r:11 w:22) + /// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// The range of component `r` is `[0, 10]`. + fn remove_member(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `617 + r * (281 ±0)` + // Estimated: `3519 + r * (2529 ±0)` + // Minimum execution time: 113_000_000 picoseconds. + Weight::from_parts(118_820_574, 0) + .saturating_add(Weight::from_parts(0, 3519)) + // Standard Error: 67_446 + .saturating_add(Weight::from_parts(57_292_374, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(r.into()))) + .saturating_add(T::DbWeight::get().writes(6)) + .saturating_add(T::DbWeight::get().writes((5_u64).saturating_mul(r.into()))) + .saturating_add(Weight::from_parts(0, 2529).saturating_mul(r.into())) + } + /// Storage: `CultCollective::Members` (r:1 w:1) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:1) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IndexToId` (r:0 w:1) + /// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IdToIndex` (r:0 w:1) + /// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// The range of component `r` is `[0, 10]`. + fn promote_member(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `314 + r * (17 ±0)` + // Estimated: `3507` + // Minimum execution time: 73_427_000 picoseconds. + Weight::from_parts(75_571_865, 0) + .saturating_add(Weight::from_parts(0, 3507)) + // Standard Error: 10_496 + .saturating_add(Weight::from_parts(748_369, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `CultCollective::Members` (r:1 w:1) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:1) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IdToIndex` (r:1 w:2) + /// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IndexToId` (r:1 w:2) + /// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// The range of component `r` is `[0, 10]`. + fn demote_member(r: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `632 + r * (72 ±0)` + // Estimated: `3519` + // Minimum execution time: 113_585_000 picoseconds. + Weight::from_parts(119_684_908, 0) + .saturating_add(Weight::from_parts(0, 3519)) + // Standard Error: 46_656 + .saturating_add(Weight::from_parts(1_495_515, 0).saturating_mul(r.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `CultCollective::Members` (r:1 w:0) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::Voting` (r:1 w:1) + /// Proof: `CultCollective::Voting` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn vote() -> Weight { + // Proof Size summary in bytes: + // Measured: `699` + // Estimated: `26866` + // Minimum execution time: 165_614_000 picoseconds. + Weight::from_parts(167_712_000, 0) + .saturating_add(Weight::from_parts(0, 26866)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:0) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::VotingCleanup` (r:1 w:0) + /// Proof: `CultCollective::VotingCleanup` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::Voting` (r:100 w:100) + /// Proof: `CultCollective::Voting` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 100]`. + fn cleanup_poll(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `534 + n * (50 ±0)` + // Estimated: `3795 + n * (2540 ±0)` + // Minimum execution time: 61_194_000 picoseconds. + Weight::from_parts(69_801_249, 0) + .saturating_add(Weight::from_parts(0, 3795)) + // Standard Error: 5_737 + .saturating_add(Weight::from_parts(3_189_746, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2540).saturating_mul(n.into())) + } + /// Storage: `CultCollective::Members` (r:2 w:2) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:2 w:2) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IdToIndex` (r:2 w:4) + /// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + /// Storage: `CultCore::Member` (r:2 w:2) + /// Proof: `CultCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `CultCore::MemberEvidence` (r:1 w:0) + /// Proof: `CultCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`) + /// Storage: `CultSalary::Claimant` (r:2 w:2) + /// Proof: `CultSalary::Claimant` (`max_values`: None, `max_size`: Some(78), added: 2553, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::IndexToId` (r:0 w:2) + /// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`) + fn exchange_member() -> Weight { + // Proof Size summary in bytes: + // Measured: `698` + // Estimated: `69046` + // Minimum execution time: 271_034_000 picoseconds. + Weight::from_parts(273_243_000, 0) + .saturating_add(Weight::from_parts(0, 69046)) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(14)) + } +} diff --git a/runtime/casper/src/weights/pallet_referenda.rs b/runtime/casper/src/weights/pallet_referenda.rs new file mode 100644 index 0000000..568d5a2 --- /dev/null +++ b/runtime/casper/src/weights/pallet_referenda.rs @@ -0,0 +1,537 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_referenda` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_referenda +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_referenda.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_referenda`. +pub struct WeightInfo(PhantomData); +impl pallet_referenda::WeightInfo for WeightInfo { + /// Storage: `CultCollective::Members` (r:1 w:0) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::ReferendumCount` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::ReferendumInfoFor` (r:0 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + fn submit() -> Weight { + // Proof Size summary in bytes: + // Measured: `491` + // Estimated: `13928` + // Minimum execution time: 271_563_000 picoseconds. + Weight::from_parts(306_859_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn place_decision_deposit_preparing() -> Weight { + // Proof Size summary in bytes: + // Measured: `399` + // Estimated: `26866` + // Minimum execution time: 345_999_000 picoseconds. + Weight::from_parts(359_026_000, 0) + .saturating_add(Weight::from_parts(0, 26866)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::DecidingCount` (r:1 w:0) + /// Proof: `CultReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::TrackQueue` (r:1 w:1) + /// Proof: `CultReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(812), added: 3287, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn place_decision_deposit_queued() -> Weight { + // Proof Size summary in bytes: + // Measured: `2037` + // Estimated: `13928` + // Minimum execution time: 407_615_000 picoseconds. + Weight::from_parts(438_553_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::DecidingCount` (r:1 w:0) + /// Proof: `CultReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::TrackQueue` (r:1 w:1) + /// Proof: `CultReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(812), added: 3287, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn place_decision_deposit_not_queued() -> Weight { + // Proof Size summary in bytes: + // Measured: `2078` + // Estimated: `13928` + // Minimum execution time: 261_093_000 picoseconds. + Weight::from_parts(265_172_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::DecidingCount` (r:1 w:1) + /// Proof: `CultReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:0) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn place_decision_deposit_passing() -> Weight { + // Proof Size summary in bytes: + // Measured: `768` + // Estimated: `26866` + // Minimum execution time: 353_944_000 picoseconds. + Weight::from_parts(363_500_000, 0) + .saturating_add(Weight::from_parts(0, 26866)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::DecidingCount` (r:1 w:1) + /// Proof: `CultReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:0) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn place_decision_deposit_failing() -> Weight { + // Proof Size summary in bytes: + // Measured: `734` + // Estimated: `26866` + // Minimum execution time: 220_837_000 picoseconds. + Weight::from_parts(223_023_000, 0) + .saturating_add(Weight::from_parts(0, 26866)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + fn refund_decision_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3795` + // Minimum execution time: 105_825_000 picoseconds. + Weight::from_parts(107_256_000, 0) + .saturating_add(Weight::from_parts(0, 3795)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + fn refund_submission_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `304` + // Estimated: `3795` + // Minimum execution time: 105_222_000 picoseconds. + Weight::from_parts(106_172_000, 0) + .saturating_add(Weight::from_parts(0, 3795)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn cancel() -> Weight { + // Proof Size summary in bytes: + // Measured: `344` + // Estimated: `26866` + // Minimum execution time: 123_694_000 picoseconds. + Weight::from_parts(124_961_000, 0) + .saturating_add(Weight::from_parts(0, 26866)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::MetadataOf` (r:1 w:0) + /// Proof: `CultReferenda::MetadataOf` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn kill() -> Weight { + // Proof Size summary in bytes: + // Measured: `548` + // Estimated: `26866` + // Minimum execution time: 329_538_000 picoseconds. + Weight::from_parts(332_131_000, 0) + .saturating_add(Weight::from_parts(0, 26866)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `CultReferenda::TrackQueue` (r:1 w:0) + /// Proof: `CultReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(812), added: 3287, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::DecidingCount` (r:1 w:1) + /// Proof: `CultReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + fn one_fewer_deciding_queue_empty() -> Weight { + // Proof Size summary in bytes: + // Measured: `174` + // Estimated: `4277` + // Minimum execution time: 38_477_000 picoseconds. + Weight::from_parts(39_216_000, 0) + .saturating_add(Weight::from_parts(0, 4277)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CultReferenda::TrackQueue` (r:1 w:1) + /// Proof: `CultReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(812), added: 3287, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:0) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + fn one_fewer_deciding_failing() -> Weight { + // Proof Size summary in bytes: + // Measured: `2356` + // Estimated: `13928` + // Minimum execution time: 212_067_000 picoseconds. + Weight::from_parts(215_809_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `CultReferenda::TrackQueue` (r:1 w:1) + /// Proof: `CultReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(812), added: 3287, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:0) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + fn one_fewer_deciding_passing() -> Weight { + // Proof Size summary in bytes: + // Measured: `2356` + // Estimated: `13928` + // Minimum execution time: 214_401_000 picoseconds. + Weight::from_parts(216_549_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:0) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::TrackQueue` (r:1 w:1) + /// Proof: `CultReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(812), added: 3287, mode: `MaxEncodedLen`) + fn nudge_referendum_requeued_insertion() -> Weight { + // Proof Size summary in bytes: + // Measured: `1841` + // Estimated: `4277` + // Minimum execution time: 93_699_000 picoseconds. + Weight::from_parts(95_154_000, 0) + .saturating_add(Weight::from_parts(0, 4277)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:0) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::TrackQueue` (r:1 w:1) + /// Proof: `CultReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(812), added: 3287, mode: `MaxEncodedLen`) + fn nudge_referendum_requeued_slide() -> Weight { + // Proof Size summary in bytes: + // Measured: `1808` + // Estimated: `4277` + // Minimum execution time: 92_829_000 picoseconds. + Weight::from_parts(94_785_000, 0) + .saturating_add(Weight::from_parts(0, 4277)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::DecidingCount` (r:1 w:0) + /// Proof: `CultReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::TrackQueue` (r:1 w:1) + /// Proof: `CultReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(812), added: 3287, mode: `MaxEncodedLen`) + fn nudge_referendum_queued() -> Weight { + // Proof Size summary in bytes: + // Measured: `1824` + // Estimated: `4277` + // Minimum execution time: 117_686_000 picoseconds. + Weight::from_parts(119_841_000, 0) + .saturating_add(Weight::from_parts(0, 4277)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::DecidingCount` (r:1 w:0) + /// Proof: `CultReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::TrackQueue` (r:1 w:1) + /// Proof: `CultReferenda::TrackQueue` (`max_values`: None, `max_size`: Some(812), added: 3287, mode: `MaxEncodedLen`) + fn nudge_referendum_not_queued() -> Weight { + // Proof Size summary in bytes: + // Measured: `1865` + // Estimated: `4277` + // Minimum execution time: 118_158_000 picoseconds. + Weight::from_parts(119_943_000, 0) + .saturating_add(Weight::from_parts(0, 4277)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + fn nudge_referendum_no_deposit() -> Weight { + // Proof Size summary in bytes: + // Measured: `296` + // Estimated: `13928` + // Minimum execution time: 83_935_000 picoseconds. + Weight::from_parts(84_946_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + fn nudge_referendum_preparing() -> Weight { + // Proof Size summary in bytes: + // Measured: `344` + // Estimated: `13928` + // Minimum execution time: 83_826_000 picoseconds. + Weight::from_parts(84_883_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + fn nudge_referendum_timed_out() -> Weight { + // Proof Size summary in bytes: + // Measured: `242` + // Estimated: `3795` + // Minimum execution time: 56_837_000 picoseconds. + Weight::from_parts(57_686_000, 0) + .saturating_add(Weight::from_parts(0, 3795)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::DecidingCount` (r:1 w:1) + /// Proof: `CultReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:0) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + fn nudge_referendum_begin_deciding_failing() -> Weight { + // Proof Size summary in bytes: + // Measured: `679` + // Estimated: `13928` + // Minimum execution time: 125_429_000 picoseconds. + Weight::from_parts(127_334_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::DecidingCount` (r:1 w:1) + /// Proof: `CultReferenda::DecidingCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:0) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + fn nudge_referendum_begin_deciding_passing() -> Weight { + // Proof Size summary in bytes: + // Measured: `713` + // Estimated: `13928` + // Minimum execution time: 192_281_000 picoseconds. + Weight::from_parts(195_794_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:0) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + fn nudge_referendum_begin_confirming() -> Weight { + // Proof Size summary in bytes: + // Measured: `764` + // Estimated: `13928` + // Minimum execution time: 230_411_000 picoseconds. + Weight::from_parts(234_602_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:0) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + fn nudge_referendum_end_confirming() -> Weight { + // Proof Size summary in bytes: + // Measured: `749` + // Estimated: `13928` + // Minimum execution time: 211_689_000 picoseconds. + Weight::from_parts(233_824_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:0) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + fn nudge_referendum_continue_not_confirming() -> Weight { + // Proof Size summary in bytes: + // Measured: `764` + // Estimated: `13928` + // Minimum execution time: 222_475_000 picoseconds. + Weight::from_parts(233_253_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:0) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + fn nudge_referendum_continue_confirming() -> Weight { + // Proof Size summary in bytes: + // Measured: `770` + // Estimated: `13928` + // Minimum execution time: 158_148_000 picoseconds. + Weight::from_parts(161_486_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:0) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:2 w:2) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Lookup` (r:1 w:1) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn nudge_referendum_approved() -> Weight { + // Proof Size summary in bytes: + // Measured: `770` + // Estimated: `26866` + // Minimum execution time: 246_542_000 picoseconds. + Weight::from_parts(273_256_000, 0) + .saturating_add(Weight::from_parts(0, 26866)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:1) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::MemberCount` (r:1 w:0) + /// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + fn nudge_referendum_rejected() -> Weight { + // Proof Size summary in bytes: + // Measured: `766` + // Estimated: `13928` + // Minimum execution time: 203_428_000 picoseconds. + Weight::from_parts(228_944_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:0) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:0) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::MetadataOf` (r:0 w:1) + /// Proof: `CultReferenda::MetadataOf` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + fn set_some_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `420` + // Estimated: `3795` + // Minimum execution time: 76_891_000 picoseconds. + Weight::from_parts(78_187_000, 0) + .saturating_add(Weight::from_parts(0, 3795)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CultReferenda::ReferendumInfoFor` (r:1 w:0) + /// Proof: `CultReferenda::ReferendumInfoFor` (`max_values`: None, `max_size`: Some(330), added: 2805, mode: `MaxEncodedLen`) + /// Storage: `CultReferenda::MetadataOf` (r:1 w:1) + /// Proof: `CultReferenda::MetadataOf` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + fn clear_metadata() -> Weight { + // Proof Size summary in bytes: + // Measured: `319` + // Estimated: `3795` + // Minimum execution time: 62_364_000 picoseconds. + Weight::from_parts(63_236_000, 0) + .saturating_add(Weight::from_parts(0, 3795)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/casper/src/weights/pallet_salary.rs b/runtime/casper/src/weights/pallet_salary.rs new file mode 100644 index 0000000..5f931d0 --- /dev/null +++ b/runtime/casper/src/weights/pallet_salary.rs @@ -0,0 +1,153 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_salary` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_salary +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_salary.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_salary`. +pub struct WeightInfo(PhantomData); +impl pallet_salary::WeightInfo for WeightInfo { + /// Storage: `CultSalary::Status` (r:1 w:1) + /// Proof: `CultSalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + fn init() -> Weight { + // Proof Size summary in bytes: + // Measured: `6` + // Estimated: `1541` + // Minimum execution time: 32_706_000 picoseconds. + Weight::from_parts(33_774_000, 0) + .saturating_add(Weight::from_parts(0, 1541)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CultSalary::Status` (r:1 w:1) + /// Proof: `CultSalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + fn bump() -> Weight { + // Proof Size summary in bytes: + // Measured: `87` + // Estimated: `1541` + // Minimum execution time: 36_773_000 picoseconds. + Weight::from_parts(37_441_000, 0) + .saturating_add(Weight::from_parts(0, 1541)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CultSalary::Status` (r:1 w:0) + /// Proof: `CultSalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::Members` (r:1 w:0) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultSalary::Claimant` (r:1 w:1) + /// Proof: `CultSalary::Claimant` (`max_values`: None, `max_size`: Some(78), added: 2553, mode: `MaxEncodedLen`) + fn induct() -> Weight { + // Proof Size summary in bytes: + // Measured: `501` + // Estimated: `3543` + // Minimum execution time: 68_175_000 picoseconds. + Weight::from_parts(69_367_000, 0) + .saturating_add(Weight::from_parts(0, 3543)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `CultCollective::Members` (r:1 w:0) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `CultSalary::Status` (r:1 w:1) + /// Proof: `CultSalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + /// Storage: `CultSalary::Claimant` (r:1 w:1) + /// Proof: `CultSalary::Claimant` (`max_values`: None, `max_size`: Some(78), added: 2553, mode: `MaxEncodedLen`) + fn register() -> Weight { + // Proof Size summary in bytes: + // Measured: `568` + // Estimated: `3543` + // Minimum execution time: 73_214_000 picoseconds. + Weight::from_parts(74_504_000, 0) + .saturating_add(Weight::from_parts(0, 3543)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `CultSalary::Status` (r:1 w:1) + /// Proof: `CultSalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + /// Storage: `CultSalary::Claimant` (r:1 w:1) + /// Proof: `CultSalary::Claimant` (`max_values`: None, `max_size`: Some(78), added: 2553, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::Members` (r:1 w:0) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + fn payout() -> Weight { + // Proof Size summary in bytes: + // Measured: `568` + // Estimated: `3543` + // Minimum execution time: 211_221_000 picoseconds. + Weight::from_parts(212_656_000, 0) + .saturating_add(Weight::from_parts(0, 3543)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `CultSalary::Status` (r:1 w:1) + /// Proof: `CultSalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + /// Storage: `CultSalary::Claimant` (r:1 w:1) + /// Proof: `CultSalary::Claimant` (`max_values`: None, `max_size`: Some(78), added: 2553, mode: `MaxEncodedLen`) + /// Storage: `CultCollective::Members` (r:1 w:0) + /// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + fn payout_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `568` + // Estimated: `3593` + // Minimum execution time: 213_501_000 picoseconds. + Weight::from_parts(214_674_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `CultSalary::Status` (r:1 w:1) + /// Proof: `CultSalary::Status` (`max_values`: Some(1), `max_size`: Some(56), added: 551, mode: `MaxEncodedLen`) + /// Storage: `CultSalary::Claimant` (r:1 w:1) + /// Proof: `CultSalary::Claimant` (`max_values`: None, `max_size`: Some(78), added: 2553, mode: `MaxEncodedLen`) + fn check_payment() -> Weight { + // Proof Size summary in bytes: + // Measured: `171` + // Estimated: `3543` + // Minimum execution time: 41_227_000 picoseconds. + Weight::from_parts(41_594_000, 0) + .saturating_add(Weight::from_parts(0, 3543)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/casper/src/weights/pallet_scheduler.rs b/runtime/casper/src/weights/pallet_scheduler.rs new file mode 100644 index 0000000..1339d44 --- /dev/null +++ b/runtime/casper/src/weights/pallet_scheduler.rs @@ -0,0 +1,286 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_scheduler` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_scheduler +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_scheduler.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_scheduler`. +pub struct WeightInfo(PhantomData); +impl pallet_scheduler::WeightInfo for WeightInfo { + /// Storage: `Scheduler::IncompleteSince` (r:1 w:1) + /// Proof: `Scheduler::IncompleteSince` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn service_agendas_base() -> Weight { + // Proof Size summary in bytes: + // Measured: `30` + // Estimated: `1489` + // Minimum execution time: 14_819_000 picoseconds. + Weight::from_parts(15_186_000, 0) + .saturating_add(Weight::from_parts(0, 1489)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 50]`. + fn service_agenda_base(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `77 + s * (177 ±0)` + // Estimated: `13928` + // Minimum execution time: 18_503_000 picoseconds. + Weight::from_parts(27_515_314, 0) + .saturating_add(Weight::from_parts(0, 13928)) + // Standard Error: 4_293 + .saturating_add(Weight::from_parts(1_235_722, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn service_task_base() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 14_076_000 picoseconds. + Weight::from_parts(14_272_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// Storage: `Preimage::PreimageFor` (r:1 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `Measured`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// The range of component `s` is `[128, 4194304]`. + fn service_task_fetched(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `213 + s * (1 ±0)` + // Estimated: `3678 + s * (1 ±0)` + // Minimum execution time: 69_682_000 picoseconds. + Weight::from_parts(70_459_000, 0) + .saturating_add(Weight::from_parts(0, 3678)) + // Standard Error: 25 + .saturating_add(Weight::from_parts(3_260, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(s.into())) + } + /// Storage: `Scheduler::Lookup` (r:0 w:1) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + fn service_task_named() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 20_275_000 picoseconds. + Weight::from_parts(20_772_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn service_task_periodic() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 14_080_000 picoseconds. + Weight::from_parts(14_259_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + fn execute_dispatch_signed() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 11_075_000 picoseconds. + Weight::from_parts(11_416_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + fn execute_dispatch_unsigned() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 10_983_000 picoseconds. + Weight::from_parts(11_168_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 49]`. + fn schedule(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `77 + s * (177 ±0)` + // Estimated: `13928` + // Minimum execution time: 46_875_000 picoseconds. + Weight::from_parts(54_427_669, 0) + .saturating_add(Weight::from_parts(0, 13928)) + // Standard Error: 5_759 + .saturating_add(Weight::from_parts(1_282_517, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Lookup` (r:0 w:1) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 50]`. + fn cancel(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `77 + s * (177 ±0)` + // Estimated: `13928` + // Minimum execution time: 66_317_000 picoseconds. + Weight::from_parts(64_165_317, 0) + .saturating_add(Weight::from_parts(0, 13928)) + // Standard Error: 6_122 + .saturating_add(Weight::from_parts(1_989_423, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Scheduler::Lookup` (r:1 w:1) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 49]`. + fn schedule_named(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `254 + s * (185 ±0)` + // Estimated: `13928` + // Minimum execution time: 58_571_000 picoseconds. + Weight::from_parts(70_239_408, 0) + .saturating_add(Weight::from_parts(0, 13928)) + // Standard Error: 7_226 + .saturating_add(Weight::from_parts(1_332_263, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Scheduler::Lookup` (r:1 w:1) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 50]`. + fn cancel_named(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `280 + s * (185 ±0)` + // Estimated: `13928` + // Minimum execution time: 73_281_000 picoseconds. + Weight::from_parts(73_250_179, 0) + .saturating_add(Weight::from_parts(0, 13928)) + // Standard Error: 6_858 + .saturating_add(Weight::from_parts(2_049_531, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Scheduler::Agenda` (r:1 w:1) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 50]`. + fn schedule_retry(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `117` + // Estimated: `13928` + // Minimum execution time: 40_949_000 picoseconds. + Weight::from_parts(42_172_132, 0) + .saturating_add(Weight::from_parts(0, 13928)) + // Standard Error: 3_444 + .saturating_add(Weight::from_parts(44_459, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Scheduler::Agenda` (r:1 w:0) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn set_retry() -> Weight { + // Proof Size summary in bytes: + // Measured: `8927` + // Estimated: `13928` + // Minimum execution time: 94_947_000 picoseconds. + Weight::from_parts(96_426_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Scheduler::Lookup` (r:1 w:0) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:0) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn set_retry_named() -> Weight { + // Proof Size summary in bytes: + // Measured: `9605` + // Estimated: `13928` + // Minimum execution time: 111_321_000 picoseconds. + Weight::from_parts(112_931_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Scheduler::Agenda` (r:1 w:0) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn cancel_retry() -> Weight { + // Proof Size summary in bytes: + // Measured: `8939` + // Estimated: `13928` + // Minimum execution time: 91_427_000 picoseconds. + Weight::from_parts(92_904_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Scheduler::Lookup` (r:1 w:0) + /// Proof: `Scheduler::Lookup` (`max_values`: None, `max_size`: Some(48), added: 2523, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Agenda` (r:1 w:0) + /// Proof: `Scheduler::Agenda` (`max_values`: None, `max_size`: Some(10463), added: 12938, mode: `MaxEncodedLen`) + /// Storage: `Scheduler::Retries` (r:0 w:1) + /// Proof: `Scheduler::Retries` (`max_values`: None, `max_size`: Some(30), added: 2505, mode: `MaxEncodedLen`) + fn cancel_retry_named() -> Weight { + // Proof Size summary in bytes: + // Measured: `9617` + // Estimated: `13928` + // Minimum execution time: 108_471_000 picoseconds. + Weight::from_parts(110_205_000, 0) + .saturating_add(Weight::from_parts(0, 13928)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/casper/src/weights/pallet_session.rs b/runtime/casper/src/weights/pallet_session.rs new file mode 100644 index 0000000..452e5e5 --- /dev/null +++ b/runtime/casper/src/weights/pallet_session.rs @@ -0,0 +1,81 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_session` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_session +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_session.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_session`. +pub struct WeightInfo(PhantomData); +impl pallet_session::WeightInfo for WeightInfo { + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Session::NextKeys` (r:1 w:1) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Session::KeyOwner` (r:4 w:4) + /// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn set_keys() -> Weight { + // Proof Size summary in bytes: + // Measured: `1764` + // Estimated: `12654` + // Minimum execution time: 165_108_000 picoseconds. + Weight::from_parts(167_458_000, 0) + .saturating_add(Weight::from_parts(0, 12654)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Session::NextKeys` (r:1 w:1) + /// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Session::KeyOwner` (r:0 w:4) + /// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn purge_keys() -> Weight { + // Proof Size summary in bytes: + // Measured: `1680` + // Estimated: `5145` + // Minimum execution time: 119_549_000 picoseconds. + Weight::from_parts(121_281_000, 0) + .saturating_add(Weight::from_parts(0, 5145)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(5)) + } +} diff --git a/runtime/casper/src/weights/pallet_staking.rs b/runtime/casper/src/weights/pallet_staking.rs new file mode 100644 index 0000000..0084fcb --- /dev/null +++ b/runtime/casper/src/weights/pallet_staking.rs @@ -0,0 +1,847 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_staking` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_staking +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_staking.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_staking`. +pub struct WeightInfo(PhantomData); +impl pallet_staking::WeightInfo for WeightInfo { + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn bond() -> Weight { + // Proof Size summary in bytes: + // Measured: `1004` + // Estimated: `4764` + // Minimum execution time: 338_498_000 picoseconds. + Weight::from_parts(386_720_000, 0) + .saturating_add(Weight::from_parts(0, 4764)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + fn bond_extra() -> Weight { + // Proof Size summary in bytes: + // Measured: `1921` + // Estimated: `8877` + // Minimum execution time: 661_452_000 picoseconds. + Weight::from_parts(712_052_000, 0) + .saturating_add(Weight::from_parts(0, 8877)) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(7)) + } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + fn unbond() -> Weight { + // Proof Size summary in bytes: + // Measured: `2128` + // Estimated: `8877` + // Minimum execution time: 696_538_000 picoseconds. + Weight::from_parts(750_706_000, 0) + .saturating_add(Weight::from_parts(0, 8877)) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(7)) + } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `NominationPools::ReversePoolIdLookup` (r:1 w:0) + /// Proof: `NominationPools::ReversePoolIdLookup` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 100]`. + fn withdraw_unbonded_update(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1189` + // Estimated: `4764` + // Minimum execution time: 240_569_000 picoseconds. + Weight::from_parts(373_957_113, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 24_005 + .saturating_add(Weight::from_parts(504_716, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(7)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::SlashingSpans` (r:1 w:1) + /// Proof: `Staking::SlashingSpans` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Staking::VirtualStakers` (r:1 w:1) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2 w:2) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Staking::SpanSlash` (r:0 w:100) + /// Proof: `Staking::SpanSlash` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 100]`. + fn withdraw_unbonded_kill(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2127 + s * (4 ±0)` + // Estimated: `6248 + s * (4 ±0)` + // Minimum execution time: 431_599_000 picoseconds. + Weight::from_parts(815_489_622, 0) + .saturating_add(Weight::from_parts(0, 6248)) + // Standard Error: 383_786 + .saturating_add(Weight::from_parts(3_974_343, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(14)) + .saturating_add(T::DbWeight::get().writes(12)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + .saturating_add(Weight::from_parts(0, 4).saturating_mul(s.into())) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:1 w:0) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinCommission` (r:1 w:0) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:1) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxValidatorsCount` (r:1 w:0) + /// Proof: `Staking::MaxValidatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:1 w:1) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForValidators` (r:1 w:1) + /// Proof: `Staking::CounterForValidators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn validate() -> Weight { + // Proof Size summary in bytes: + // Measured: `1266` + // Estimated: `4556` + // Minimum execution time: 218_840_000 picoseconds. + Weight::from_parts(237_793_000, 0) + .saturating_add(Weight::from_parts(0, 4556)) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:128 w:128) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// The range of component `k` is `[1, 128]`. + fn kick(k: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1709 + k * (572 ±0)` + // Estimated: `4556 + k * (3033 ±0)` + // Minimum execution time: 127_973_000 picoseconds. + Weight::from_parts(597_225_750, 0) + .saturating_add(Weight::from_parts(0, 4556)) + // Standard Error: 324_699 + .saturating_add(Weight::from_parts(19_393_381, 0).saturating_mul(k.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into()))) + .saturating_add(Weight::from_parts(0, 3033).saturating_mul(k.into())) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxNominatorsCount` (r:1 w:0) + /// Proof: `Staking::MaxNominatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:17 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2 w:2) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 16]`. + fn nominate(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1760 + n * (102 ±0)` + // Estimated: `6248 + n * (2520 ±0)` + // Minimum execution time: 249_923_000 picoseconds. + Weight::from_parts(244_536_929, 0) + .saturating_add(Weight::from_parts(0, 6248)) + // Standard Error: 44_547 + .saturating_add(Weight::from_parts(13_536_858, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(6)) + .saturating_add(Weight::from_parts(0, 2520).saturating_mul(n.into())) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2 w:2) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn chill() -> Weight { + // Proof Size summary in bytes: + // Measured: `1710` + // Estimated: `6248` + // Minimum execution time: 217_259_000 picoseconds. + Weight::from_parts(222_020_000, 0) + .saturating_add(Weight::from_parts(0, 6248)) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn set_payee() -> Weight { + // Proof Size summary in bytes: + // Measured: `796` + // Estimated: `4556` + // Minimum execution time: 78_429_000 picoseconds. + Weight::from_parts(80_713_000, 0) + .saturating_add(Weight::from_parts(0, 4556)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:1 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + fn update_payee() -> Weight { + // Proof Size summary in bytes: + // Measured: `863` + // Estimated: `4556` + // Minimum execution time: 91_087_000 picoseconds. + Weight::from_parts(93_237_000, 0) + .saturating_add(Weight::from_parts(0, 4556)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:2 w:2) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + fn set_controller() -> Weight { + // Proof Size summary in bytes: + // Measured: `796` + // Estimated: `8122` + // Minimum execution time: 88_084_000 picoseconds. + Weight::from_parts(89_025_000, 0) + .saturating_add(Weight::from_parts(0, 8122)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Staking::ValidatorCount` (r:0 w:1) + /// Proof: `Staking::ValidatorCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn set_validator_count() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 12_031_000 picoseconds. + Weight::from_parts(12_270_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::ForceEra` (r:0 w:1) + /// Proof: `Staking::ForceEra` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn force_no_eras() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 37_611_000 picoseconds. + Weight::from_parts(38_280_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::ForceEra` (r:0 w:1) + /// Proof: `Staking::ForceEra` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn force_new_era() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 37_820_000 picoseconds. + Weight::from_parts(39_125_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::ForceEra` (r:0 w:1) + /// Proof: `Staking::ForceEra` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + fn force_new_era_always() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 37_282_000 picoseconds. + Weight::from_parts(38_356_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::Invulnerables` (r:0 w:1) + /// Proof: `Staking::Invulnerables` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// The range of component `v` is `[0, 1000]`. + fn set_invulnerables(v: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 13_308_000 picoseconds. + Weight::from_parts(14_766_882, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 294 + .saturating_add(Weight::from_parts(31_704, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::Ledger` (r:10628 w:10628) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:5314 w:5314) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:5314 w:0) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// The range of component `i` is `[0, 5314]`. + fn deprecate_controller_batch(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1631 + i * (227 ±0)` + // Estimated: `990 + i * (7132 ±0)` + // Minimum execution time: 21_760_000 picoseconds. + Weight::from_parts(22_276_000, 0) + .saturating_add(Weight::from_parts(0, 990)) + // Standard Error: 147_182 + .saturating_add(Weight::from_parts(97_693_277, 0).saturating_mul(i.into())) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(i.into()))) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(i.into()))) + .saturating_add(Weight::from_parts(0, 7132).saturating_mul(i.into())) + } + /// Storage: `Staking::SlashingSpans` (r:1 w:1) + /// Proof: `Staking::SlashingSpans` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:1) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2 w:2) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Staking::SpanSlash` (r:0 w:100) + /// Proof: `Staking::SpanSlash` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 100]`. + fn force_unstake(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2127 + s * (4 ±0)` + // Estimated: `6248 + s * (4 ±0)` + // Minimum execution time: 323_185_000 picoseconds. + Weight::from_parts(337_339_097, 0) + .saturating_add(Weight::from_parts(0, 6248)) + // Standard Error: 11_397 + .saturating_add(Weight::from_parts(4_408_240, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(14)) + .saturating_add(T::DbWeight::get().writes(13)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + .saturating_add(Weight::from_parts(0, 4).saturating_mul(s.into())) + } + /// Storage: `Staking::UnappliedSlashes` (r:1 w:1) + /// Proof: `Staking::UnappliedSlashes` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `s` is `[1, 1000]`. + fn cancel_deferred_slash(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `66568` + // Estimated: `70033` + // Minimum execution time: 437_005_000 picoseconds. + Weight::from_parts(3_003_988_272, 0) + .saturating_add(Weight::from_parts(0, 70033)) + // Standard Error: 185_994 + .saturating_add(Weight::from_parts(15_645_000, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::Bonded` (r:513 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:513 w:513) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasStakersClipped` (r:1 w:0) + /// Proof: `Staking::ErasStakersClipped` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Staking::ErasStakersOverview` (r:1 w:0) + /// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `Staking::ClaimedRewards` (r:1 w:1) + /// Proof: `Staking::ClaimedRewards` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasValidatorReward` (r:1 w:0) + /// Proof: `Staking::ErasValidatorReward` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:513 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:513 w:513) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:513 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:513 w:513) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasStakersPaged` (r:1 w:0) + /// Proof: `Staking::ErasStakersPaged` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Staking::ErasRewardPoints` (r:1 w:0) + /// Proof: `Staking::ErasRewardPoints` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Staking::ErasValidatorPrefs` (r:1 w:0) + /// Proof: `Staking::ErasValidatorPrefs` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:513 w:0) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 512]`. + fn payout_stakers_alive_staked(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `58361 + n * (391 ±0)` + // Estimated: `53178 + n * (3774 ±0)` + // Minimum execution time: 583_180_000 picoseconds. + Weight::from_parts(842_483_973, 0) + .saturating_add(Weight::from_parts(0, 53178)) + // Standard Error: 216_817 + .saturating_add(Weight::from_parts(207_149_899, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(15)) + .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 3774).saturating_mul(n.into())) + } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:3 w:3) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:2 w:2) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// The range of component `l` is `[1, 32]`. + fn rebond(l: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1922 + l * (7 ±0)` + // Estimated: `8877` + // Minimum execution time: 336_912_000 picoseconds. + Weight::from_parts(340_230_283, 0) + .saturating_add(Weight::from_parts(0, 8877)) + // Standard Error: 8_240 + .saturating_add(Weight::from_parts(485_568, 0).saturating_mul(l.into())) + .saturating_add(T::DbWeight::get().reads(10)) + .saturating_add(T::DbWeight::get().writes(7)) + } + /// Storage: `Staking::VirtualStakers` (r:1 w:1) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::SlashingSpans` (r:1 w:1) + /// Proof: `Staking::SlashingSpans` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2 w:2) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Payee` (r:0 w:1) + /// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`) + /// Storage: `Staking::SpanSlash` (r:0 w:100) + /// Proof: `Staking::SpanSlash` (`max_values`: None, `max_size`: Some(76), added: 2551, mode: `MaxEncodedLen`) + /// The range of component `s` is `[1, 100]`. + fn reap_stash(s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2127 + s * (4 ±0)` + // Estimated: `6248 + s * (4 ±0)` + // Minimum execution time: 369_161_000 picoseconds. + Weight::from_parts(369_247_756, 0) + .saturating_add(Weight::from_parts(0, 6248)) + // Standard Error: 7_786 + .saturating_add(Weight::from_parts(4_374_782, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(13)) + .saturating_add(T::DbWeight::get().writes(12)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) + .saturating_add(Weight::from_parts(0, 4).saturating_mul(s.into())) + } + /// Storage: `VoterList::CounterForListNodes` (r:1 w:0) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:134 w:0) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:110 w:0) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:110 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:110 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:110 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:11 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForValidators` (r:1 w:0) + /// Proof: `Staking::CounterForValidators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ValidatorCount` (r:1 w:0) + /// Proof: `Staking::ValidatorCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinimumValidatorCount` (r:1 w:0) + /// Proof: `Staking::MinimumValidatorCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::CurrentEra` (r:1 w:1) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasValidatorPrefs` (r:0 w:10) + /// Proof: `Staking::ErasValidatorPrefs` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasStakersPaged` (r:0 w:10) + /// Proof: `Staking::ErasStakersPaged` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Staking::ErasStakersOverview` (r:0 w:10) + /// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasTotalStake` (r:0 w:1) + /// Proof: `Staking::ErasTotalStake` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + /// Storage: `Staking::ErasStartSessionIndex` (r:0 w:1) + /// Proof: `Staking::ErasStartSessionIndex` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinimumActiveStake` (r:0 w:1) + /// Proof: `Staking::MinimumActiveStake` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// The range of component `v` is `[1, 10]`. + /// The range of component `n` is `[0, 100]`. + fn new_era(v: u32, n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0 + n * (718 ±0) + v * (3596 ±0)` + // Estimated: `343628 + n * (3566 ±0) + v * (3566 ±0)` + // Minimum execution time: 1_815_047_000 picoseconds. + Weight::from_parts(1_828_204_000, 0) + .saturating_add(Weight::from_parts(0, 343628)) + // Standard Error: 6_726_450 + .saturating_add(Weight::from_parts(224_873_492, 0).saturating_mul(v.into())) + // Standard Error: 670_253 + .saturating_add(Weight::from_parts(69_720_585, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(140)) + .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(v.into()))) + .saturating_add(Weight::from_parts(0, 3566).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 3566).saturating_mul(v.into())) + } + /// Storage: `VoterList::CounterForListNodes` (r:1 w:0) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:134 w:0) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2000 w:0) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:2000 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:2000 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:2000 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1000 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinimumActiveStake` (r:0 w:1) + /// Proof: `Staking::MinimumActiveStake` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// The range of component `v` is `[500, 1000]`. + /// The range of component `n` is `[500, 1000]`. + fn get_npos_voters(v: u32, n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `3071 + n * (909 ±0) + v * (393 ±0)` + // Estimated: `343628 + n * (3566 ±0) + v * (3566 ±0)` + // Minimum execution time: 122_916_627_000 picoseconds. + Weight::from_parts(123_492_844_000, 0) + .saturating_add(Weight::from_parts(0, 343628)) + // Standard Error: 1_263_122 + .saturating_add(Weight::from_parts(18_060_245, 0).saturating_mul(v.into())) + // Standard Error: 1_263_122 + .saturating_add(Weight::from_parts(11_472_643, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(135)) + .saturating_add(T::DbWeight::get().reads((5_u64).saturating_mul(v.into()))) + .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes(1)) + .saturating_add(Weight::from_parts(0, 3566).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 3566).saturating_mul(v.into())) + } + /// Storage: `Staking::CounterForValidators` (r:1 w:0) + /// Proof: `Staking::CounterForValidators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1001 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// The range of component `v` is `[500, 1000]`. + fn get_npos_targets(v: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `875 + v * (50 ±0)` + // Estimated: `3510 + v * (2520 ±0)` + // Minimum execution time: 9_765_731_000 picoseconds. + Weight::from_parts(115_775_558, 0) + .saturating_add(Weight::from_parts(0, 3510)) + // Standard Error: 23_034 + .saturating_add(Weight::from_parts(19_694_945, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into()))) + .saturating_add(Weight::from_parts(0, 2520).saturating_mul(v.into())) + } + /// Storage: `Staking::MinCommission` (r:0 w:1) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:0 w:1) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxValidatorsCount` (r:0 w:1) + /// Proof: `Staking::MaxValidatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxStakedRewards` (r:0 w:1) + /// Proof: `Staking::MaxStakedRewards` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::ChillThreshold` (r:0 w:1) + /// Proof: `Staking::ChillThreshold` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxNominatorsCount` (r:0 w:1) + /// Proof: `Staking::MaxNominatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:0 w:1) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_staking_configs_all_set() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 18_211_000 picoseconds. + Weight::from_parts(18_717_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(7)) + } + /// Storage: `Staking::MinCommission` (r:0 w:1) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinValidatorBond` (r:0 w:1) + /// Proof: `Staking::MinValidatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxValidatorsCount` (r:0 w:1) + /// Proof: `Staking::MaxValidatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxStakedRewards` (r:0 w:1) + /// Proof: `Staking::MaxStakedRewards` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::ChillThreshold` (r:0 w:1) + /// Proof: `Staking::ChillThreshold` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxNominatorsCount` (r:0 w:1) + /// Proof: `Staking::MaxNominatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:0 w:1) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + fn set_staking_configs_all_remove() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 17_036_000 picoseconds. + Weight::from_parts(17_619_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(7)) + } + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `Staking::ChillThreshold` (r:1 w:0) + /// Proof: `Staking::ChillThreshold` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) + /// Storage: `Staking::MaxNominatorsCount` (r:1 w:0) + /// Proof: `Staking::MaxNominatorsCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListNodes` (r:2 w:2) + /// Proof: `VoterList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `VoterList::ListBags` (r:1 w:1) + /// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `VoterList::CounterForListNodes` (r:1 w:1) + /// Proof: `VoterList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn chill_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `1833` + // Estimated: `6248` + // Minimum execution time: 257_282_000 picoseconds. + Weight::from_parts(259_826_000, 0) + .saturating_add(Weight::from_parts(0, 6248)) + .saturating_add(T::DbWeight::get().reads(12)) + .saturating_add(T::DbWeight::get().writes(6)) + } + /// Storage: `Staking::MinCommission` (r:1 w:0) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Staking::Validators` (r:1 w:1) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + fn force_apply_min_commission() -> Weight { + // Proof Size summary in bytes: + // Measured: `587` + // Estimated: `3510` + // Minimum execution time: 46_151_000 picoseconds. + Weight::from_parts(46_807_000, 0) + .saturating_add(Weight::from_parts(0, 3510)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::MinCommission` (r:0 w:1) + /// Proof: `Staking::MinCommission` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + fn set_min_commission() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 12_083_000 picoseconds. + Weight::from_parts(23_149_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `Staking::VirtualStakers` (r:1 w:0) + /// Proof: `Staking::VirtualStakers` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:1) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + fn restore_ledger() -> Weight { + // Proof Size summary in bytes: + // Measured: `943` + // Estimated: `4764` + // Minimum execution time: 186_152_000 picoseconds. + Weight::from_parts(187_010_000, 0) + .saturating_add(Weight::from_parts(0, 4764)) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(4)) + } +} diff --git a/runtime/casper/src/weights/pallet_timestamp.rs b/runtime/casper/src/weights/pallet_timestamp.rs new file mode 100644 index 0000000..03ce56a --- /dev/null +++ b/runtime/casper/src/weights/pallet_timestamp.rs @@ -0,0 +1,71 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_timestamp` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_timestamp +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_timestamp.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_timestamp`. +pub struct WeightInfo(PhantomData); +impl pallet_timestamp::WeightInfo for WeightInfo { + /// Storage: `Timestamp::Now` (r:1 w:1) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Babe::CurrentSlot` (r:1 w:0) + /// Proof: `Babe::CurrentSlot` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + fn set() -> Weight { + // Proof Size summary in bytes: + // Measured: `345` + // Estimated: `1493` + // Minimum execution time: 35_760_000 picoseconds. + Weight::from_parts(36_868_000, 0) + .saturating_add(Weight::from_parts(0, 1493)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn on_finalize() -> Weight { + // Proof Size summary in bytes: + // Measured: `128` + // Estimated: `0` + // Minimum execution time: 15_654_000 picoseconds. + Weight::from_parts(16_117_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } +} diff --git a/runtime/casper/src/weights/pallet_treasury.rs b/runtime/casper/src/weights/pallet_treasury.rs new file mode 100644 index 0000000..0d6c199 --- /dev/null +++ b/runtime/casper/src/weights/pallet_treasury.rs @@ -0,0 +1,61 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_treasury` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_treasury +// --extrinsic=void_spend +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_treasury.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_treasury`. +pub struct WeightInfo(PhantomData); +impl pallet_treasury::WeightInfo for WeightInfo { + /// Storage: `Treasury::Spends` (r:1 w:1) + /// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`) + fn void_spend() -> Weight { + // Proof Size summary in bytes: + // Measured: `124` + // Estimated: `3534` + // Minimum execution time: 77_449_000 picoseconds. + Weight::from_parts(88_782_000, 0) + .saturating_add(Weight::from_parts(0, 3534)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/casper/src/weights/pallet_utility.rs b/runtime/casper/src/weights/pallet_utility.rs new file mode 100644 index 0000000..38e2ec8 --- /dev/null +++ b/runtime/casper/src/weights/pallet_utility.rs @@ -0,0 +1,98 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_utility` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_utility +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_utility.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_utility`. +pub struct WeightInfo(PhantomData); +impl pallet_utility::WeightInfo for WeightInfo { + /// The range of component `c` is `[0, 1000]`. + fn batch(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 20_509_000 picoseconds. + Weight::from_parts(27_625_885, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 7_840 + .saturating_add(Weight::from_parts(11_994_055, 0).saturating_mul(c.into())) + } + fn as_derivative() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 20_665_000 picoseconds. + Weight::from_parts(21_060_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// The range of component `c` is `[0, 1000]`. + fn batch_all(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 20_675_000 picoseconds. + Weight::from_parts(33_788_704, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 3_192 + .saturating_add(Weight::from_parts(13_004_420, 0).saturating_mul(c.into())) + } + fn dispatch_as() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 28_291_000 picoseconds. + Weight::from_parts(28_769_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// The range of component `c` is `[0, 1000]`. + fn force_batch(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 20_069_000 picoseconds. + Weight::from_parts(36_269_385, 0) + .saturating_add(Weight::from_parts(0, 0)) + // Standard Error: 3_338 + .saturating_add(Weight::from_parts(12_004_193, 0).saturating_mul(c.into())) + } +} diff --git a/runtime/casper/src/weights/pallet_vesting.rs b/runtime/casper/src/weights/pallet_vesting.rs new file mode 100644 index 0000000..69d2e60 --- /dev/null +++ b/runtime/casper/src/weights/pallet_vesting.rs @@ -0,0 +1,261 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_vesting` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_vesting +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_vesting.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_vesting`. +pub struct WeightInfo(PhantomData); +impl pallet_vesting::WeightInfo for WeightInfo { + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_locked(l: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `277 + l * (25 ±0) + s * (36 ±0)` + // Estimated: `4764` + // Minimum execution time: 122_639_000 picoseconds. + Weight::from_parts(119_788_111, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 3_103 + .saturating_add(Weight::from_parts(89_720, 0).saturating_mul(l.into())) + // Standard Error: 5_521 + .saturating_add(Weight::from_parts(208_023, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_unlocked(l: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `277 + l * (25 ±0) + s * (36 ±0)` + // Estimated: `4764` + // Minimum execution time: 129_566_000 picoseconds. + Weight::from_parts(127_309_060, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 1_988 + .saturating_add(Weight::from_parts(82_863, 0).saturating_mul(l.into())) + // Standard Error: 3_537 + .saturating_add(Weight::from_parts(162_912, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_other_locked(l: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `380 + l * (25 ±0) + s * (36 ±0)` + // Estimated: `4764` + // Minimum execution time: 130_629_000 picoseconds. + Weight::from_parts(129_291_209, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 3_291 + .saturating_add(Weight::from_parts(62_654, 0).saturating_mul(l.into())) + // Standard Error: 5_855 + .saturating_add(Weight::from_parts(199_735, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[1, 28]`. + fn vest_other_unlocked(l: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `380 + l * (25 ±0) + s * (36 ±0)` + // Estimated: `4764` + // Minimum execution time: 136_735_000 picoseconds. + Weight::from_parts(134_928_366, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 4_220 + .saturating_add(Weight::from_parts(76_876, 0).saturating_mul(l.into())) + // Standard Error: 7_508 + .saturating_add(Weight::from_parts(178_775, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. + fn vested_transfer(l: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `451 + l * (25 ±0) + s * (36 ±0)` + // Estimated: `4764` + // Minimum execution time: 268_393_000 picoseconds. + Weight::from_parts(269_136_230, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 5_783 + .saturating_add(Weight::from_parts(97_611, 0).saturating_mul(l.into())) + // Standard Error: 10_290 + .saturating_add(Weight::from_parts(223_818, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[0, 27]`. + fn force_vested_transfer(l: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `591 + l * (25 ±0) + s * (36 ±0)` + // Estimated: `6196` + // Minimum execution time: 277_724_000 picoseconds. + Weight::from_parts(278_570_646, 0) + .saturating_add(Weight::from_parts(0, 6196)) + // Standard Error: 3_331 + .saturating_add(Weight::from_parts(101_462, 0).saturating_mul(l.into())) + // Standard Error: 5_926 + .saturating_add(Weight::from_parts(237_946, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(4)) + } + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. + fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `378 + l * (25 ±0) + s * (36 ±0)` + // Estimated: `4764` + // Minimum execution time: 133_075_000 picoseconds. + Weight::from_parts(131_689_481, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 3_832 + .saturating_add(Weight::from_parts(73_049, 0).saturating_mul(l.into())) + // Standard Error: 7_078 + .saturating_add(Weight::from_parts(186_150, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. + fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `378 + l * (25 ±0) + s * (36 ±0)` + // Estimated: `4764` + // Minimum execution time: 141_395_000 picoseconds. + Weight::from_parts(139_649_819, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 3_605 + .saturating_add(Weight::from_parts(82_146, 0).saturating_mul(l.into())) + // Standard Error: 6_658 + .saturating_add(Weight::from_parts(186_309, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(67), added: 2542, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 49]`. + /// The range of component `s` is `[2, 28]`. + fn force_remove_vesting_schedule(l: u32, s: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `451 + l * (25 ±0) + s * (36 ±0)` + // Estimated: `4764` + // Minimum execution time: 147_292_000 picoseconds. + Weight::from_parts(145_632_661, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 4_503 + .saturating_add(Weight::from_parts(83_213, 0).saturating_mul(l.into())) + // Standard Error: 8_316 + .saturating_add(Weight::from_parts(199_717, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/runtime/casper/src/weights/pallet_whitelist.rs b/runtime/casper/src/weights/pallet_whitelist.rs new file mode 100644 index 0000000..22ced45 --- /dev/null +++ b/runtime/casper/src/weights/pallet_whitelist.rs @@ -0,0 +1,122 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated weights for `pallet_whitelist` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/ghost +// benchmark +// pallet +// --chain=casper-dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_whitelist +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./file_header.txt +// --output=./runtime/casper/src/weights/pallet_whitelist.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_whitelist`. +pub struct WeightInfo(PhantomData); +impl pallet_whitelist::WeightInfo for WeightInfo { + /// Storage: `Whitelist::WhitelistedCall` (r:1 w:1) + /// Proof: `Whitelist::WhitelistedCall` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn whitelist_call() -> Weight { + // Proof Size summary in bytes: + // Measured: `185` + // Estimated: `3556` + // Minimum execution time: 73_478_000 picoseconds. + Weight::from_parts(75_014_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Whitelist::WhitelistedCall` (r:1 w:1) + /// Proof: `Whitelist::WhitelistedCall` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + fn remove_whitelisted_call() -> Weight { + // Proof Size summary in bytes: + // Measured: `314` + // Estimated: `3556` + // Minimum execution time: 70_728_000 picoseconds. + Weight::from_parts(71_250_000, 0) + .saturating_add(Weight::from_parts(0, 3556)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Whitelist::WhitelistedCall` (r:1 w:1) + /// Proof: `Whitelist::WhitelistedCall` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Preimage::PreimageFor` (r:1 w:1) + /// Proof: `Preimage::PreimageFor` (`max_values`: None, `max_size`: Some(4194344), added: 4196819, mode: `Measured`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 4194294]`. + fn dispatch_whitelisted_call(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `390 + n * (1 ±0)` + // Estimated: `3854 + n * (1 ±0)` + // Minimum execution time: 111_739_000 picoseconds. + Weight::from_parts(112_792_000, 0) + .saturating_add(Weight::from_parts(0, 3854)) + // Standard Error: 23 + .saturating_add(Weight::from_parts(3_436, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) + } + /// Storage: `Whitelist::WhitelistedCall` (r:1 w:1) + /// Proof: `Whitelist::WhitelistedCall` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`) + /// Storage: `Preimage::StatusFor` (r:1 w:0) + /// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// Storage: `Preimage::RequestStatusFor` (r:1 w:1) + /// Proof: `Preimage::RequestStatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`) + /// The range of component `n` is `[1, 10000]`. + fn dispatch_whitelisted_call_with_preimage(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `314` + // Estimated: `3556` + // Minimum execution time: 87_333_000 picoseconds. + Weight::from_parts(88_510_679, 0) + .saturating_add(Weight::from_parts(0, 3556)) + // Standard Error: 10 + .saturating_add(Weight::from_parts(4_580, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } +} diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml new file mode 100755 index 0000000..a58e2d9 --- /dev/null +++ b/runtime/common/Cargo.toml @@ -0,0 +1,73 @@ +[package] +name = "ghost-runtime-common" +version = "0.4.2" +authors.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true + +[dependencies] +static_assertions = { workspace = true } + +sp-std = { workspace = true } +sp-io = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true, features = ["serde"] } +sp-staking = { workspace = true, features = ["serde"] } + +frame-support = { workspace = true } +frame-system = { workspace = true } +pallet-authorship = { workspace = true } +pallet-balances = { workspace = true } +pallet-staking = { workspace = true } +pallet-staking-reward-fn = { workspace = true } +pallet-timestamp = { workspace = true } +pallet-transaction-payment = { workspace = true } +pallet-treasury = { workspace = true } +pallet-election-provider-multi-phase = { workspace = true } +primitives = { workspace = true } + +[features] +default = ["std"] +no_std = [] +std = [ + "sp-core/std", + "sp-std/std", + "sp-io/std", + "sp-runtime/std", + "sp-staking/std", + "frame-support/std", + "frame-system/std", + "pallet-authorship/std", + "pallet-balances/std", + "pallet-staking/std", + "pallet-staking-reward-fn/std", + "pallet-timestamp/std", + "pallet-transaction-payment/std", + "pallet-treasury/std", + "pallet-election-provider-multi-phase/std", + "primitives/std", +] +runtime-benchmarks = [ + "sp-runtime/runtime-benchmarks", + "sp-staking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-staking/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-treasury/runtime-benchmarks", + "pallet-election-provider-multi-phase/runtime-benchmarks", +] +try-runtime = [ + "sp-runtime/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-authorship/try-runtime", + "pallet-balances/try-runtime", + "pallet-staking/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-treasury/try-runtime", + "pallet-election-provider-multi-phase/try-runtime", +] diff --git a/runtime/common/src/benchmarking.rs b/runtime/common/src/benchmarking.rs new file mode 100644 index 0000000..c3dc46e --- /dev/null +++ b/runtime/common/src/benchmarking.rs @@ -0,0 +1,26 @@ +use primitives::{AccountId, Balance}; +use pallet_treasury::ArgumentsFactory; +use sp_core::crypto::FromEntropy; +use frame_support::traits::tokens::{Pay, PaymentStatus}; + +pub struct BenchmarkTreasuryHelper; +impl ArgumentsFactory<(), AccountId> for BenchmarkTreasuryHelper { + fn create_asset_kind(_seed: u32) -> () { () } + fn create_beneficiary(seed: [u8; 32]) -> AccountId { + AccountId::from_entropy(&mut seed.as_slice()).unwrap() + } +} + +pub struct BenchmarkTreasuryPaymaster; +impl Pay for BenchmarkTreasuryPaymaster { + type Beneficiary = AccountId; + type Balance = Balance; + type Id = (); + type AssetKind = (); + type Error = (); + + fn pay(_: &Self::Beneficiary, _: Self::AssetKind, _: Self::Balance) -> Result { Ok(()) } + fn check_payment(_: Self::Id) -> PaymentStatus { PaymentStatus::Success } + fn ensure_successful(_: &Self::Beneficiary, _: Self::AssetKind, _: Self::Balance) {} + fn ensure_concluded(_: Self::Id) {} +} diff --git a/runtime/common/src/elections.rs b/runtime/common/src/elections.rs new file mode 100644 index 0000000..980bd4c --- /dev/null +++ b/runtime/common/src/elections.rs @@ -0,0 +1,42 @@ +#[macro_export] +macro_rules! impl_elections_weights { + ($runtime:ident) => { + parameter_types! { + /// A limit for off-chain phragmen unsigned solution submission. + /// + /// We want to keep it as high as possible, but can't risk having + /// it reject, so we always substract the base block execution weight. + pub OffchainSolutionWeightLimit: Weight = BlockWeights::get() + .get(DispatchClass::Normal) + .max_extrinsic + .expect("Normal extrinsic have weight limit configured by default; qed") + .saturating_sub($runtime::weights::BlockExecutionWeight::get()); + + /// A limit for off-chain phragmen unsigned solution length. + /// + /// We allow up to 90% of the block's size to be consumed by the solution. + pub OffchainSolutionLengthLimit: u32 = Perbill::from_rational(90u32, 100u32) * + *BlockLength::get() + .max + .get(DispatchClass::Normal); + } + }; +} + +/// The number configured here could always be more than the maximum limits of +/// staking pallet to ensure election snapshot will not run out of memory. For +/// now, we set them to smaller values since the staking is bounded and the weight +/// pipeline takes for this single pallet. +pub struct BenchmarkConfig; +impl pallet_election_provider_multi_phase::BenchmarkingConfig for BenchmarkConfig { + const VOTERS: [u32; 2] = [1000, 2000]; + const TARGETS: [u32; 2] = [500, 1000]; + const ACTIVE_VOTERS: [u32; 2] = [500, 800]; + const DESIRED_TARGETS: [u32; 2] = [200, 400]; + const SNAPSHOT_MAXIMUM_VOTERS: u32 = 1000; + const MINER_MAXIMUM_VOTERS: u32 = 1000; + const MAXIMUM_TARGETS: u32 = 300; +} + +/// The accuracy type used for genesis election provider. +pub type OnChainAccuracy = sp_runtime::Perbill; diff --git a/runtime/common/src/impls.rs b/runtime/common/src/impls.rs new file mode 100755 index 0000000..271c5ba --- /dev/null +++ b/runtime/common/src/impls.rs @@ -0,0 +1,253 @@ +use frame_support::traits::{ + fungible::{Balanced, Credit}, + tokens::imbalance::ResolveTo, + Imbalance, OnUnbalanced, +}; +use pallet_treasury::TreasuryAccountId; + +/// The logic for the author to get a portion of fees. +pub struct ToAuthor(sp_std::marker::PhantomData); +impl OnUnbalanced>> for ToAuthor +where + R: pallet_balances::Config + pallet_authorship::Config, + ::AccountId: From, + ::AccountId: Into, +{ + fn on_nonzero_unbalanced( + amount: Credit<::AccountId, pallet_balances::Pallet>, + ) { + if let Some(author) = >::author() { + let _ = >::resolve(&author, amount); + } + } +} + +pub struct DealWithFees(sp_std::marker::PhantomData); +impl OnUnbalanced>> for DealWithFees +where + R: pallet_balances::Config + pallet_treasury::Config + pallet_authorship::Config, + ::AccountId: From, + ::AccountId: Into, +{ + // this seems to be called for substrate-based transactions + fn on_unbalanceds( + mut fees_then_tips: impl Iterator>>, + ) { + if let Some(fees) = fees_then_tips.next() { + // for fees, 80% to treasury, 20% to author + let mut split = fees.ration(80, 20); + if let Some(tips) = fees_then_tips.next() { + // for tips, if any, 100% to author + tips.merge_into(&mut split.1); + } + ResolveTo::, pallet_balances::Pallet>::on_unbalanced(split.0); + as OnUnbalanced<_>>::on_unbalanced(split.1); + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use frame_support::{ + derive_impl, + dispatch::DispatchClass, + parameter_types, + traits::{ + tokens::{PayFromAccount, UnityAssetBalanceConversion}, + ConstU32, FindAuthor + }, + weights::Weight, + PalletId, + }; + use frame_system::limits; + use primitives::AccountId; + use sp_core::{ConstU64, H256}; + use sp_runtime::{ + traits::{BlakeTwo256, IdentityLookup}, + Perbill, BuildStorage, + }; + + type Block = frame_system::mocking::MockingBlock; + const TEST_ACCOUNT: AccountId = AccountId::new([1; 32]); + + frame_support::construct_runtime!( + pub enum Test + { + System: frame_system, + Authorship: pallet_authorship, + Balances: pallet_balances, + Treasury: pallet_treasury, + } + ); + + parameter_types! { + pub BlockWeights: limits::BlockWeights = limits::BlockWeights::builder() + .base_block(Weight::from_parts(10, 0)) + .for_class(DispatchClass::all(), |weight| { + weight.base_extrinsic = Weight::from_parts(100, 0); + }) + .for_class(DispathcClass::non_mandatory(), |weight| { + weight.max_total = Some(Weight::from_parts(1024, u64::MAX)); + }) + .build_or_panic(); + pub BlockLength: limits::BlockLength = limits::BlockLength::max(2 * 1024); + pub const AvailableBlockRatio: Perbill = Perbill::one(); + } + + #[derive_impl(frame_system::config_preludes::TestDefaultConfig)] + impl frame_system::Config for Test { + type BaseCallFilter = frame_support::traits::Everything; + type RuntimeOrigin = RuntimeOrigin; + type Nonce = u64; + type RuntimeCall = RuntimeCall; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = AccountId; + type Lookup = IdentityLookup; + type Block = Block; + type RuntimeEvent = RuntimeEvent; + type BlockLength = BlockLength; + type BlockWeights = BlockWeghts; + type DbWeight = (); + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; + } + + impl pallet_balances::Config for Runtime { + type Balance = u64; + type RuntimeEvent = RuntimeEvent; + type DustRemoval = (); + type ExistentialDeposit = ConstU64<1>; + type AccountStore = System; + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type WeightInfo = (); + type RuntimeHoldReason = RuntimeHoldReason; + type RuntimeFreezeReason = RuntimeFreezeReason; + type FreezeIdentifier = (); + type MaxFreezes = ConstU32<1>; + } + + parameter_types! { + pub const TreasuryPalletId: PalletId = PalletId(*b"g/trsry"); + pub const MaxApprovals: u32 = 100; + pub TreasuryAccount: AccountId = Treasury::account_id(); + } + + impl pallet_treasury::Config for Runtime { + type Currency = pallet_balances::Pallet; + type ApproveOrigin = frame_system::EnsureRoot; + type RejectOrigin = frame_system::EnsureRoot; + type RuntimeEvent = RuntimeEvent; + type OnSlash = (); + type ProposalBond = (); + type ProposalBondMaximum = (); + type ProposalBondMinimum = (); + type SpendPeriod = (); + type Burn = (); + type BurnDestination = (); + type PalletId = TreasuryPalletId; + type SpendFunds = (); + type MaxApprovals = MaxApprovals; + type WeightInfo = (); + type SpendOrigin = frame_support::traits::NeverEnsureOrigin; + type AssetKind = (); + type Beneficiary = Self::AccountId; + type BeneficiaryLookup = IdentityLookup; + type Paymaster = PayFromAccount; + type BalanceConverter = UnityAssetBalanceConversion; + type PayoutPeriod = ConstU64<0>; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkHelper = (); + } + + pub struct OneAuthor; + impl FindAuthor for OneAuthor { + fn find_author<'a, I>(_: I) -> Option where I: 'a { + Some(TEST_ACCOUNT) + } + } + + impl pallet_authorship::Config for Runtime { + type FindAuthor = OneAuthor; + type UncleGenerations = (); + type FilterUncle = (); + type EventHandler = (); + } + + pub fn new_test_ext() -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + // We use default for brevity, but you can configure as desired if needed. + pallet_balances::GenesisConfig::::default() + .assimilate_storage(&mut t) + .unwrap(); + t.into() + } + + #[test] + fn test_fees_and_tips_split() { + new_test_ext().execute_with(|| { + let fee = as frame_support::traits::fungible::Balanced>::issue(10); + let tip = as frame_support::traits::fungible::Balanced>::issue(20); + + assert_eq!(Balances::free_balance(Treasury::account_id()), 0); + assert_eq!(Balances::free_balance(TEST_ACCOUNT), 0); + + DealWithFees::on_unbalanced(vec![fee, tip].into_iter()); + + // Author gets 100% of tip and 20% of fee = 22 + assert_eq!(Balances::free_balance(TEST_ACCOUNT), 22); + // Treasury get 80% of fee + assert_eq!(Balances::free_balance(Treasury::account_id()), 8); + }); + } + + #[test] + fn compute_inflation_should_give_sensible_results() { + assert_eq!( + pallet_staking_reward_fn::compute_inflation( + Perquintill::from_percent(75), + Perquintill::from_percent(75), + Perquintill::from_percent(5), + ), + Perquintill::one() + ); + assert_eq!( + pallet_staking_reward_fn::compute_inflation( + Perquintill::from_percent(50), + Perquintill::from_percent(75), + Perquintill::from_percent(5), + ), + Perquintill::from_rational(2u64, 3u64) + ); + assert_eq!( + pallet_staking_reward_fn::compute_inflation( + Perquintill::from_percent(80), + Perquintill::from_percent(75), + Perquintill::from_percent(5), + ), + Perquintill::fram_rational(1u64, 2u64) + ); + } + + #[test] + fn era_payout_should_give_sensible_results() { + assert_eq!( + era_payout(75, 100, Perquintill::from_percent(10), Perquintill::one(), 0, ), + (10, 0) + ); + assert_eq!( + era_payout(80, 100, Perquintill::from_percent(10), Perquintill::one(), 0, ), + (6, 4) + ); + } +} diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs new file mode 100755 index 0000000..71e6340 --- /dev/null +++ b/runtime/common/src/lib.rs @@ -0,0 +1,186 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +pub mod impls; +pub mod elections; + +#[cfg(feature = "try-runtime")] +pub mod elections; + +#[cfg(feature = "runtime-benchmarks")] +pub mod benchmarking; + +use frame_support::{ + parameter_types, traits::ConstU32, + weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}, +}; +use frame_system::limits; +use primitives::{Balance, BlockNumber}; +use sp_runtime::{FixedPointNumber, Perbill, Perquintill}; +use static_assertions::const_assert; + +pub use pallet_balances::Call as BalancesCall; +#[cfg(feature = "std")] +pub use pallet_staking::StakerStatus; +pub use pallet_timestamp::{Call as TimestampCall}; +use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment}; +pub use sp_runtime::traits::Bounded; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; + +pub use impls::ToAuthor; + +/// We assume that an on-initialize consumes 1% of the weight on average, hence +/// a single extrinsic will not be allowed to consume more than +/// `AvailableBlockRatio - 1%`. +pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(1); + +/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can +/// be used by `Operational` extrinsics. +pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); + +/// We allow for 2 seconds of compute with a 6 seconds average block time. +/// The storage proof size is not limited so far. +pub const MAXIMUM_BLOCK_WEIGHT: Weight = + Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), u64::MAX); + +const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct()); + +// Common constants used in all runtimes. +parameter_types! { + /// Maximum amount of block to be stored in ledger. + pub const BlockHashCount: BlockNumber = 4096; + + /// The portion of the `NORMAL_DISPATCH_RATIO` that we adjust the fees + /// with. Blocks filled less than will decrease the weight and more will + /// increase. + pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25); + + /// The adjustment variable of the runtime. Higher values will cause + /// `TargetBlockFullness` to change the fees more rapidly. + pub AdjustmentVariable: Multiplier = Multiplier::saturating_from_rational(75, 1_000_000); + + /// Minimum amount of the multiplier. This value cannot be too low. A test + /// case should ensure that combined with `AdjustmentVariable`, we can + /// recover from the minimum. + pub MinimumMultiplier: Multiplier = Multiplier::saturating_from_rational(1, 10u128); + + /// The maximum amount of the multiplier. + pub MaximumMultiplier: Multiplier = Bounded::max_value(); + + /// Maximum length of block. Up to 5MB. + pub BlockLength: limits::BlockLength = + limits::BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); +} + +/// Parametrized slow adjusting fee. +pub type SlowAdjustingFeeUpdate = TargetedFeeAdjustment< + R, + TargetBlockFullness, + AdjustmentVariable, + MinimumMultiplier, + MaximumMultiplier, +>; + +/// Implements the weight types for a runtime. +/// It expects the passed runtime constants to contain a `weights` module. +/// The generated weight types were formerly part of the common +/// runtime but are now runtime dependant. +#[macro_export] +macro_rules! impl_runtime_weights { + ($runtime:ident) => { + use frame_support::{dispatch::DispatchClass, weights::Weight}; + use frame_system::limits; + use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment}; + pub use runtime_common::{ + impl_elections_weights, AVERAGE_ON_INITIALIZE_RATIO, + MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, + }; + use sp_runtime::{FixedPointNumber, Perquintill}; + + impl_elections_weights!($runtime); + + // Expose the weight from the runtime constants module. + pub use $runtime::weights::{ + BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, + ParityDbWeight, + }; + + parameter_types! { + /// Block weights base values and limits. + pub BlockWeights: limits::BlockWeights = limits::BlockWeights::builder() + .base_block($runtime::weights::BlockExecutionWeight::get()) + .for_class(DispatchClass::all(), |weights| { + weights.base_extrinsic = $runtime::weights::ExtrinsicBaseWeight::get(); + }) + .for_class(DispatchClass::Normal, |weights| { + weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); + }) + .for_class(DispatchClass::Operational, |weights| { + weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT); + // Operational transactions have an extra reserved space, so that they + // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`. + weights.reserved = Some( + MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT, + ); + }) + .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) + .build_or_panic(); + } + }; +} + + +/// The type used for currency conversion. +/// +/// This must be only be used as long as the balance type is `u128`. +pub type CurrencyToVote = sp_staking::currency_to_vote::U128CurrencyToVote; +static_assertions::assert_eq_size!(primitives::Balance, u128); + +/// A reasonable benchmarking config for staking pallet. +pub struct StakingBenchmarkingConfig; +impl pallet_staking::BenchmarkingConfig for StakingBenchmarkingConfig { + type MaxValidators = ConstU32<1000>; + type MaxNominators = ConstU32<1000>; +} + +/// Convert a balance to an unsigned 256-bit number, use in nomination pools. +pub struct BalanceToU256; +impl sp_runtime::traits::Convert for BalanceToU256 { + fn convert(n: Balance) -> sp_core::U256 { + n.into() + } +} + +/// Convert an unsigned 256-bit number to balance, use in nomination pools. +pub struct U256ToBalance; +impl sp_runtime::traits::Convert for U256ToBalance { + fn convert(n: sp_core::U256) -> Balance { + use frame_support::traits::Defensive; + n.try_into().defensive_unwrap_or(Balance::MAX) + } +} + +/// Macro to set a value (e.g. when using the `parameter_types` macro) to +/// either a production value or to an environment variable or testing value +/// ( in case the `fast-runtime` feature is selected). +/// Note that the environment varable is evaluated _at compile time_. +#[macro_export] +macro_rules! prod_or_fast { + ($prod:expr, $test:expr) => { + if cfg!(feature = "fast-runtime") { + $test + } else { + $prod + } + }; + ($prod:expr, $test:expr, $env:expr) => { + if cfg!(feature == "fast-runtime") { + core::option_env!($env) + .map(|s| s.parse().ok()) + .flatten() + .unwrap_or($test) + } else { + $prod + } + }; +} diff --git a/runtime/common/src/try_runtime.rs b/runtime/common/src/try_runtime.rs new file mode 100644 index 0000000..7652b92 --- /dev/null +++ b/runtime/common/src/try_runtime.rs @@ -0,0 +1,96 @@ +use frame_support::{ + dispatch::RawOrigin, + traits::{Get, Hooks}, +}; +use pallet_fast_unstake::{Pallet as FastUnstake, *}; +use pallet_staking::*; +use sp_std::{collections::btree_set::BTreeSet, prelude:*}; + +/// Register all inactive nominators for fast unstake, and progress until they +/// have all benn processed. +pub fn migrate_all_inactive_nominators() +where + ::RuntimeEvent: TryInto>, +{ + let mut unstaked_ok = 0; + let mut unstaked_err = 0; + let mut unstaked_slashed = 0; + + let all_stakers = Ledger::::iter().map(|(ctrl, l)| (ctrl, l.stash)).collect::>(); + let mut all_exposed = BTreeSet::new(); + ErasStakers::::iter().for_each(|(_, val, expo)| { + all_exposed.insert(val); + all_exposed.extend(expo.others.iter().map(|ie| ie.who.clone())) + }); + + let eligible = all_stakers + .iter() + .filter_map(|(ctrl, stash)| all_exposed.contains(stash).then_some(ctrl)) + .collect::>(); + + log::info!( + target: "runtime::test", + "registering {} out of {} stakers for fast-unstake", + eligible.len(), + all_stakers.len(), + ); + + for ctrl in eligible { + if let Err(why) = + FastUnstake::::register_fast_unstake(RawOrigin::Signed(ctrl.clone()).into()) + { + low::warn!(target: "runtime::test", "failed to register {:?} due to {:?}", ctrl, why); + } + } + + log::info!( + target: "runtime::test", + "registered {} successfully, starting at {:?}.", + Queue::::count(), + frame_system::Pallet::::block_number(), + ); + + while Queue::::count() != 0 || Head::::get().is_some() { + let not = frame_system::Pallet::::block_number(); + let weight = ::BlockWeights::get().max_block; + let consumed = FastUnstake::::on_idle(now, weight); + log::debug!( + target: "runtime::test", + "consumed {:?} ({})", + consumed, + consumed.ref_time() as f32 / weight.ref_time() as f32, + ); + + frame_system::Pallet::::read_events_on_consensus() + .into_iter() + .map(|r| r.event) + .filter_map(|e| { + let maybe_fast_unstake_event: Option> = + e.try_into().ok(); + maybe_fast_unstake_event + }) + .for_each(|e: pallet_fast_unstake::Event| match e { + pallet_fast_unstake::Event::Unstaked { result, .. } => + if result.is_ok() { + unstaked_ok += 1; + } else { + unstaked_err += 1; + }, + pallet_fast_unstake::Event::::Slashed { .. } => unstaked_slashed += 1, + pallet_fast_unstake::Event::::InternalError { .. } => unreachable!(), + _ => {}, + }); + + if now % 100u32.into() == sp_runtime::traits::Zero::zero() { + log::info!( + target: "runtime::test", + "status: ok {}, err {}, slash {}", + unstaked_ok, + unstaked_err, + unstaked_slashed, + ); + } + + frame_system::Pallet::::reset_events(); + } +} diff --git a/runtime/common/src/weights/block_weights.rs b/runtime/common/src/weights/block_weights.rs new file mode 100755 index 0000000..efbd024 --- /dev/null +++ b/runtime/common/src/weights/block_weights.rs @@ -0,0 +1,27 @@ +use sp_core::parameter_types; +use sp_weights::{constants::WEIGHT_PER_TIME_PER_NANOS, Weight}; + +parameter_types! { + pub const BlockExecutionWeight: Weight = + Weight::from_ref_time(WEIGHT_PER_TIME_PER_NANOS.saturating_mul(7_955_558)); +} + +#[cfg(test)] +mod test_weights { + use sp_weights::constants; + + #[test] + fn sane() { + let w = super::BlockExecutionWeight::get(); + + assert!( + w.ref_time() >= 100u64 * constants::WEIGHT_PER_TIME_PER_MICROS, + "Weight should be at least 100 µs." + ); + + assert!( + w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS, + "Weight should be at most 50 ms." + ); + } +} diff --git a/runtime/common/src/weights/extrinsic.rs b/runtime/common/src/weights/extrinsic.rs new file mode 100755 index 0000000..bcfb82a --- /dev/null +++ b/runtime/common/src/weights/extrinsic.rs @@ -0,0 +1,27 @@ +use sp_core::parameter_types; +use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight}; + +parameter_types! { + pub const ExtrinsicBaseWeight: Weight = + Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(94_914)); +} + +#[cfg(test)] +mod test_weights { + use sp_weights::constants; + + #[test] + fn sane() { + let w = super::ExtrinsicBaseWeight::get(); + + assert!( + w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS, + "Weight should be at least 10 µs." + ); + + assert!( + w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, + "Weight should be at most 1 ms." + ); + } +} diff --git a/runtime/common/src/weights/mod.rs b/runtime/common/src/weights/mod.rs new file mode 100755 index 0000000..34966c6 --- /dev/null +++ b/runtime/common/src/weights/mod.rs @@ -0,0 +1,5 @@ +pub mod block_weights; +pub mod extrinsic_weight; + +pub use block_weights::BlockExecutionWeight; +pub use extrinsic_weights::ExtrinsicBaseWeight; diff --git a/scripts/bags-generator.sh b/scripts/bags-generator.sh new file mode 100755 index 0000000..3ceecd0 --- /dev/null +++ b/scripts/bags-generator.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +set -e + +runtime="casper" +bags=200 + +while getopts r:b:t:e: flag +do + case "${flag}" in + r) runtime=${OPTARG};; + b) bags=${OPTARG};; + t) total=${OPTARG};; + e) existential=${OPTARG};; + esac +done + +if [[ -z "$total" ]]; then + echo "### ERROR: -t flag (total supply) should be set." + exit +fi + +if [[ -z "$existential" ]]; then + echo "### ERROR: -e flag (existential deposit) should be set." + exit +fi + +echo -e "### ${runtime} runtime will be used with ${bags} bags" +echo -e "### while total issuance is ${total} and existential deposit ${existential}" +read -p "### Do you want to regenerate 'bags_thresholds.rs' file? (Y/n)? " answer + +if [ $answer != ${answer#[Yy]} ]; then + cargo run --package ghost-voter-bags -- \ + --n-bags=${bags} \ + --runtime=${runtime} \ + --output=$PWD/runtime/${runtime}/src/bag_thresholds.rs \ + --total-issuance=${total} \ + --minimum-balance=${existential} + echo "### Bags generated succefully" +else + exit +fi diff --git a/scripts/build-only-wasm.sh b/scripts/build-only-wasm.sh new file mode 100755 index 0000000..98bee31 --- /dev/null +++ b/scripts/build-only-wasm.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env sh + +# Script for building only WASM binary of the given project. + +set -e + +PROJECT_ROOT=`git rev-parse -show-toplevel` + +if [ "$#" -lt 1 ]; then + echo "You need to pass the name of the crate you want to compile!" + exit 1 +fi + +WASM_BUILDER_RUNNER="$PROJECT_ROOT/target/release/wbuild-runner/$1" + +if [ -z "$2" ]; then + export WASM_TARGET_DIRECTORY=$(pwd) +else + export WASM_TARGET_DIRECTORY=$2 +fi + +if [ -d $WASM_BUILDER_RUNNER ]; then + export DEBUG=false + export OUT_DIR="$PROJECT_ROOT/target/release/build" + cargo run --release --manifest-path="$WASM_BUILDER_RUNNER/Cargo.toml" \ + | grep -vE "cargo:rerun-if-|Executing build command" +else + cargo build --release -p $1 +fi diff --git a/scripts/common.sh b/scripts/common.sh new file mode 100755 index 0000000..e126134 --- /dev/null +++ b/scripts/common.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +ROOT=`dirname "$0"` + +# A list of directories which contain wasm projects. +SRCS=( + "runtime/wasm" +) + +# Make pushd/popd silent. + +pushd () { + command pushd "$@" > /dev/null +} + +popd () { + command popd "$@" > /dev/null +} diff --git a/scripts/header-prefixer.sh b/scripts/header-prefixer.sh new file mode 100755 index 0000000..26fd61c --- /dev/null +++ b/scripts/header-prefixer.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +ROOT_PATH="${1:-}" +FILES=$(find ./"$ROOT_PATH" -type f -name '*.rs') + +for f in $FILES; do + if (grep License $f); then + echo "[-] Already prefixed $f" + else + printf "\n" | cat file_header.txt - $f > $f.new + mv $f.new $f + echo "[+] License header copied to $f" + fi +done + +echo "[+] All files have been processed" diff --git a/scripts/prepare-test-net.sh b/scripts/prepare-test-net.sh new file mode 100755 index 0000000..3cf2fc3 --- /dev/null +++ b/scripts/prepare-test-net.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +set -e + +if [ "$#" -ne 1 ]; then + echo "Please provide the number of initial validators!" + exit 1 +fi + +generate_account_id() { + ./target/release/ghostkey inspect ${3:-} ${4:-} "$SECRET//$1//$2" | grep "Account ID" | awk '{ print $3 }' +} + +generate_address() { + ./target/release/ghostkey inspect ${3:-} ${4:-} "$SECRET//$1//$2" | grep "SS58 Address" | awk '{ print $3 }' +} + +generate_public_key() { + ./target/release/ghostkey inspect ${3:-} ${4:-} "$SECRET//$1//$2" | grep "Public key (hex)" | awk '{ print $4 }' +} + +generate_address_and_account_id() { + ACCOUNT=$(generate_account_id $1 $2 $3) + ADDRESS=$(generate_address $1 $2 $3) + if ${4:-false}; then + INTO="unchecked_into" + else + INTO="into" + fi + + printf "//$ADDRESS\nhex![\"${ACCOUNT#'0x'}\"].$INTO()," +} + +V_NUM=$1 + +AUTHORITIES="" + +for i in $(seq 1 $V_NUM); do + AUTHORITIES+="(\n" + AUTHORITIES+="$(generate_address_and_account_id $i stash)\n" + AUTHORITIES+="$(generate_address_and_account_id $i controller)\n" + AUTHORITIES+="$(generate_address_and_account_id $i babe '--scheme sr25519' true)\n" + AUTHORITIES+="$(generate_address_and_account_id $i grandpa '--scheme ed25519' true)\n" + AUTHORITIES+="$(generate_address_and_account_id $i authority_discovery '--scheme sr25519' true)\n" + AUTHORITIES+="$(generate_address_and_account_id $i slow_clap '--scheme sr25519' true)\n" + AUTHORITIES+="),\n" +done + +printf "$AUTHORITIES" diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..005d963 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,29 @@ +#!/use/bin/env bash + +set -e + +# This script is to be run when we are happy with release candidate. +# It accepts a single argument: version, in the format 'v1.2.3' + +version="$1" +if [ -z "$version" ]; then + echo "No version specified, cannot continue" + exit 1 +fi + +if [[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Version should be in the format v1.2.3" + exit 1 +fi + +echo '[+] Checking out the release branch' +git checkout release +echo '[+] Pulling latest version of the release branch from github' +git pull +echo '[+] Attempting to merge the release-candidate branch to the release branch' +git merge "$version" +echo '[+] Tagging the release' +git tag -s -m "$version" "$version" +echo '[+] Pushing the release branch and tag to github. A new release will be created shortly' +git push origin release +git push origin "refs/tags/$version" diff --git a/scripts/run-all-benches.sh b/scripts/run-all-benches.sh new file mode 100755 index 0000000..bfb5ad2 --- /dev/null +++ b/scripts/run-all-benches.sh @@ -0,0 +1,169 @@ +#!/bin/bash + +# This script has three parts which all use the Substrate runtime: +# - Pallet benchmarking to update the pallet weights +# - Overhead benchmarking for the Extrinsic and Block weight +# - Machine benchmarking + +while getopts 'bfp:v' flag; do + case "${flag}" in + b) + # skip build + skip_build='true';; + f) + # fail in any sub-command in a pipe fails + set -o pipefail + # fail of undeclared variables + set -u + #fail if any sub-command fails + set -e + # fail on traps + set -E + ;; + p) + # start at pallet + start_pallet="${OPTARG}" + ;; + v) + # echo all executed commands + set -x + ;; + *) + # exit early + echo "Bad options. Chech script" + exit 1 + ;; + esac +done + +if [ "$skip_build" != true ] +then + echo "[+] Compiling Node with 'runtime-benchmarks' features" + cargo build --release --locked --features=runtime-benchmarks +fi + +EXECUTABLE=./target/release/ghost +RUNTIME="casper" + +EXCLUDED_PALLETS=( + # helper pallets + "pallet_election_provider_support_benchmarking" + # pallets without automatic benchmarking + # "pallet_babe" + # "pallet_grandpa" + "pallet_bags_list" + "frame_system" + "pallet_staking" + "pallet_offences" +) + +# Load all pallet names in an array +ALL_PALLETS=($( + $EXECUTABLE benchmark pallet --list=pallets --no-csv-header --chain=${RUNTIME}-dev +)) + +# Filter out the excluded pallets by concatenating the arrays and discarding duplicates +PALLETS=($({ printf '%s\n' "${ALL_PALLETS[@]}" "${EXCLUDED_PALLETS[@]}"; } | sort | uniq -u)) + +echo "[+] Benchmarking ${#PALLETS[@]} pallets by excluding ${#EXCLUDED_PALLETS[@]} from ${#ALL_PALLETS[@]}" + +# Define the error file +ERR_FILE="benchmarking_errors.txt" +# Delete the error file before each one +rm -f $ERR_FILE + +for PALLET in "${PALLETS[@]}"; do + # If `-p` is used, skip benchmark until the start pallet. + if [ ! -z "$start_pallet" ] && [ "$start_pallet" != "$PALLET" ] + then + echo "[+] Skipping ${PALLET}..." + continue + else + unset start_pallet + fi + + FOLDER="$(echo "${PALLET#*_}" | tr '_' '-')"; + WEIGHT_FILE="./runtime/${RUNTIME}/src/weights/${PALLET}.rs" + echo "[+] Benchmarking $PALLET for $RUNTIME with weight file $WEIGHT_FILE"; + + OUTPUT=$( + $EXECUTABLE benchmark pallet \ + --chain="${RUNTIME}-dev" \ + --steps=50 \ + --repeat=20 \ + --pallet="$PALLET" \ + --extrinsic="*" \ + --wasm-execution=compiled \ + --heap-pages=4096 \ + --header=./file_header.txt \ + --output=${WEIGHT_FILE} 2>&1 + ) + + if [ $? -ne 0 ]; then + echo "$OUTPUT" >> "$ERR_FILE" + echo "[-] Failed to benchmark $PALLET. Error written to #ERR_FILE; continuing..." + fi +done + +# # Update the block and extrinsic overhead weights +# echo "[+] Benchmarking block and extrinsic overheads..." +# OUTPUT=$( +# $EXECUTABLE benchmark overhead \ +# --chain="${RUNTIME}-dev" \ +# --wasm-execution=compiled \ +# --weight-path="./runtime/${RUNTIME}/constants/src/weights/" \ +# --header=./file_header.txt \ +# --warmup=10 \ +# --repeat=100 2>&1 +# ) +# if [ $? -ne 0 ]; then +# echo "$OUTPUT" >> "$ERR_FILE" +# echo "[-] Failed to benchmark the block and extrinsic weight. Error written to #ERR_FILE; continuing..." +# fi +# +# echo "[+] Benchmarking the machine..." +# OUTPUT=$( +# $EXECUTABLE benchmark machine --chain=${RUNTIME}-dev 2>&1 +# ) +# if [ $? -ne 0 ]; then +# # Do not write the error file since it is not a benchmarking error +# echo "[-] Failed the machine benchmark:\n$OUTPUT" +# fi +# +# echo "[+] Benchmarking the RocksDb storage..." +# OUTPUT=$( +# $EXECUTABLE benchmark storage \ +# --chain="${RUNTIME}-dev" \ +# --state-version=0 \ +# --mul=1.1 \ +# --weight-path="./runtime/${RUNTIME}/constants/src/weights/" \ +# --header=./file_header.txt 2>&1 +# ) +# if [ $? -ne 0 ]; then +# echo "$OUTPUT" >> "$ERR_FILE" +# echo "[-] Failed to benchmark the RocksDb storage. Error written to $ERR_FILE; continuing..." +# fi +# +# echo "[+] Benchmarking the ParityDb storage..." +# OUTPUT=$( +# $EXECUTABLE benchmark storage \ +# --chain="${RUNTIME}-dev" \ +# --state-version=0 \ +# --mul=1.1 \ +# --database=paritydb \ +# --weight-path="./runtime/${RUNTIME}/constants/src/weights/" \ +# --header=./file_header.txt 2>&1 +# ) +# if [ $? -ne 0 ]; then +# echo "$OUTPUT" >> "$ERR_FILE" +# echo "[-] Failed to benchmark the ParityDb storage. Error written to $ERR_FILE; continuing..." +# fi + +# Check if the error file exists +if [ -f "$ERR_FILE" ]; then + echo "[-] Some benchmarks failed. See: $ERR_FILE" + exit 1 +else + echo "[+] All benchmarks passed" + exit 0 +fi diff --git a/scripts/run-local-network.sh b/scripts/run-local-network.sh new file mode 100755 index 0000000..33fae00 --- /dev/null +++ b/scripts/run-local-network.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +OFFSET="$2" +PORT=$((30333+OFFSET)) +RPC_PORT=$((9933+OFFSET)) +KEY=$((OFFSET+1)) +NODE_KEY="000000000000000000000000000000000000000000000000000000000000000${KEY}" + +./target/release/ghost \ + --chain "casper-local" \ + --tmp \ + --port=${PORT} \ + --rpc-port=${RPC_PORT} \ + --rpc-cors all \ + --node-key=${NODE_KEY} \ + --"$1" diff --git a/scripts/two-node-local-net.sh b/scripts/two-node-local-net.sh new file mode 100755 index 0000000..f753f9e --- /dev/null +++ b/scripts/two-node-local-net.sh @@ -0,0 +1,122 @@ +#!/usr/bin/env bash + +# Run two node local net. +# Unlike the docker-compose script in the /docker folder, this version builds +# the nodes based on the current state of the code, instead of depending in a +# published version. + +set -e + +# chainspec defaults to ghost-local if no arguments are passed to this script; +# if arguments are passed in, the first is the chainspec +chainspec="${1:-ghost-local}" + +# PROJECT_ROOT=$(git rev-parse --show-toplevel) +source "$(dirname "$0")"/common.sh + +# cd "$PROJECT_ROOT" + +last_modified_rust_file=$( + find . -path ./target -prune -o -type f -name '*.rs' -printf '%T@ %p\n' | + sort -nr | + head -1 | + cut -d' ' -f2- +) + +ghost="target/release/ghost" + +# ensure the ghost binary exists and is up to date +if [ ! -x "$ghost" ] || [ "$ghost" -ot "$last_modified_rust_file" ]; then + # cargo build --release + echo "[+] Build needed" +fi + +# setup variables +node_offset=0 +declare -a node_pids +declare -a node_pipes + +# create a sed expression which injects the node name and stream type into +# each line +function make_sed_expr() { + name="$1" + type="$2" + + printf "s/^/%8s %s: /" "$name" "$type" +} + +# turn a string into a flag +function flagify() { + printf -- '--%s' "$(tr '[:upper:]' '[:lower:]' <<< "$1")" +} + +# start a node and label its output +# +# this function takes a single argument, the node name. +# the name must be one of those which can be passed to the ghost binary, in +# un-flagged form, one of: +# alice, bob, charlie, dave, eve, ferdie, one, two +function run_node() { + name="$1" + # create a named pipe so we can get the node's PID while also sedding + # its output + local stdout + local stderr + stdout=$(mktemp --dry-run --tmpdir) + stderr=$(mktemp --dry-run --tmpdir) + mkfifo "$stdout" + mkfifo "$stderr" + node_pipes+=("$stdout") + node_pipes+=("$stderr") + + # compute ports from offset + local port=$((30333+node_offset)) + local rpc_port=$((9933+node_offset)) + local ws_port=$((9944+node_offset)) + node_offset=$((node_offset+1)) + + echo "$(flagify "$name")" + echo "--node-key 000000000000000000000000000000000000000000000000000000000000000${node_offset}" + + # start the node + # "$ghost" \ + # --chain "$chainspec" \ + # --tmp \ + # --port "$port" \ + # --rpc-port "$rpc_port" \ + # --rpc-cors all \ + # --node-key 0000000000000000000000000000000000000000000000000000000000000001 \ + # "$(flagify "$name")" \ + # > "$stdout" \ + # 2> "$stderr" \ + # & + # local pid=$! + # node_pids+=("$pid") + # + # # send output from the stdout pipe to stdout, prepending the node name + # sed -e "$(make_sed_expr "$name" "OUT")" "$stdout" >&1 & + # # send output from the stderr pipe to stderr, prepending the none name + # sed -e "$(make_sed_expr "$name" "ERR")" "$stderr" >&2 & +} + +# clean up the nodes when the script exits +function finish { + for node_pid in "${node_pids[@]}"; do + kill -9 "$node_pid" + done + + for node_pipe in "${node_pipes[@]}"; do + rm "$node_pipe" + done +} +trap finish EXIT + +# start the nodes +run_node Alice +run_node Bob + +# now wait; this will exit on its own only if both subprocess exit +# the practical implication, as both subprocesses are supposed to run +# forever, is that this script will also run forever, until killed, ath which +# point the exit trap should kill the subprocesses +wait diff --git a/service/Cargo.toml b/service/Cargo.toml new file mode 100755 index 0000000..fa63b4f --- /dev/null +++ b/service/Cargo.toml @@ -0,0 +1,134 @@ +[package] +name = "ghost-service" +description = "Utils to tie different Ghost components together and allow instantiation of a node." +license.workspace = true +authors.workspace = true +version.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true + +[dependencies] +sc-authority-discovery = { workspace = true, default-features = true } +babe = { workspace = true, default-features = true } +grandpa = { workspace = true, default-features = true } +sc-block-builder = { workspace = true, default-features = true } +sc-chain-spec = { workspace = true, default-features = true } +sc-client-api = { workspace = true, default-features = true } +sc-client-db = { workspace = true, default-features = true } +sc-consensus = { workspace = true, default-features = true } +sc-consensus-slots = { workspace = true, default-features = true } +sc-executor = { workspace = true, default-features = true } +sc-network = { workspace = true, default-features = true } +sc-network-common = { workspace = true, default-features = true } +sc-network-sync = { workspace = true, default-features = true } +sc-transaction-pool = { workspace = true, default-features = true } +sc-sync-state-rpc = { workspace = true, default-features = true } +sc-keystore = { workspace = true, default-features = true } +sc-basic-authorship = { workspace = true, default-features = true } +sc-offchain = { workspace = true, default-features = true } +sc-sysinfo = { workspace = true, default-features = true } +sc-service = { workspace = true } +telemetry = { workspace = true, default-features = true } +tx-pool-api = { workspace = true, default-features = true } + +# Substrate Primitives +authority-discovery-primitives = { workspace = true, default-features = true } +consensus-common = { workspace = true, default-features = true } +grandpa-primitives = { workspace = true, default-features = true } +inherents = { workspace = true, default-features = true } +keyring = { workspace = true, default-features = true } +sp-api = { workspace = true, default-features = true } +block-builder-api = { workspace = true, default-features = true } +sp-blockchain = { workspace = true, default-features = true } +sp-core = { workspace = true, default-features = true } +sp-io = { workspace = true, default-features = true } +sp-keystore = { workspace = true, default-features = true } +offchain-primitives = { workspace = true, default-features = true } +sp-runtime = { workspace = true, default-features = true } +sp-session = { workspace = true, default-features = true } +sp-storage = { workspace = true, default-features = true } +babe-primitives = { workspace = true, default-features = true } +sp-state-machine = { workspace = true, default-features = true } +sp-weights = { workspace = true, default-features = true } +sp-version = { workspace = true, default-features = true } +sp-timestamp = { workspace = true, default-features = true } + +# Substrate Pallets +pallet-babe = { workspace = true, default-features = true } +pallet-staking = { workspace = true, default-features = true } +pallet-transaction-payment = { workspace = true, default-features = true } +pallet-transaction-payment-rpc-runtime-api = { workspace = true, default-features = true } +frame-system = { workspace = true, default-features = true } + +# Substrate Other +frame-system-rpc-runtime-api = { workspace = true, default-features = true } +prometheus-endpoint = { workspace = true, default-features = true } +frame-support = { workspace = true, default-features = true } +frame-benchmarking-cli = { workspace = true, default-features = true } +frame-benchmarking = { workspace = true, default-features = true } + +# External crates +async-trait = { workspace = true, default-features = true } +futures = { workspace = true, default-features = true } +hex-literal = { workspace = true, default-features = true } +is_executable = { workspace = true, default-features = true } +log = { workspace = true, default-features = true } +schnellru = { workspace = true, default-features = true } +serde = { workspace = true, default-features = true, features = ["derive"] } +serde_json = { workspace = true, default-features = true } +thiserror = { workspace = true, default-features = true } +kvdb = { workspace = true, default-features = true } +kvdb-rocksdb = { workspace = true, default-features = true, optional = true } +parity-db = { workspace = true, default-features = true, optional = true } +codec = { workspace = true, default-features = true } +parking_lot = { workspace = true, default-features = true } +bitvec = { workspace = true, default-features = true, optional = true } + +# Ghost inner +primitives = { workspace = true } +ghost-networks = { workspace = true } +ghost-slow-clap = { workspace = true } +ghost-rpc = { workspace = true } +ghost-machine-primitives = { workspace = true } + +# Ghost Runtimes +casper-runtime = { workspace = true, default-features = true, optional = true } +casper-runtime-constants = { workspace = true, default-features = true, optional = true } + +[dev-dependencies] +env_logger = { workspace = true } +assert_matches = { workspace = true } +serial_test = { workspace = true } +tempfile = { workspace = true } + +[features] +default = ["db", "full-node"] +db = ["sc-service/rocksdb"] +full-node = ["kvdb-rocksdb", "parity-db"] +runtime-benchmarks = [ + "frame-benchmarking-cli/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-babe/runtime-benchmarks", + "pallet-staking/runtime-benchmarks", + "casper-runtime?/runtime-benchmarks", + "sc-client-db/runtime-benchmarks", + "sc-service/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "pallet-babe/try-runtime", + "pallet-staking/try-runtime", + "pallet-transaction-payment/try-runtime", + "casper-runtime?/try-runtime", + "sp-runtime/try-runtime", +] +fast-runtime = ["casper-runtime?/fast-runtime"] + +# Configure the native runtimes to use. +casper-native = ["casper-runtime", "casper-runtime-constants", "bitvec"] +ghost-native = [] diff --git a/service/chain-specs/casper.json b/service/chain-specs/casper.json new file mode 100644 index 0000000..e69de29 diff --git a/service/src/benchmarking.rs b/service/src/benchmarking.rs new file mode 100644 index 0000000..729cb18 --- /dev/null +++ b/service/src/benchmarking.rs @@ -0,0 +1,204 @@ +use primitives::AccountId; +use sc_client_api::UsageProvider; +use sp_runtime::OpaqueExtrinsic; +use keyring::Sr25519Keyring; + +use crate::*; + +macro_rules! identify_chain { + ( + $chain:expr, + $nonce:ident, + $current_block:ident, + $period:ident, + $genesis:ident, + $signer:ident, + $generic_code:expr $(,)* + ) => { + match $chain { + Chain::Ghost => { + #[cfg(feature = "ghost-native")] + { + use ghost_runtime as runtime; + let call = $generic_code; + Ok(ghost_sign_call(call, $nonce, $current_block, $period, $genesis, $signer)) + } + + #[cfg(not(feature = "ghost-native"))] + { + Err("`ghost-native` feature not enabled") + } + }, + Chain::Casper => { + #[cfg(feature = "casper-native")] + { + use casper_runtime as runtime; + let call = $generic_code; + Ok(casper_sign_call(call, $nonce, $current_block, $period, $genesis, $signer)) + } + + #[cfg(not(feature = "casper-native"))] + { + Err("`casper-native` feature not enabled") + } + }, + Chain::Unknown => { + let _ = $nonce; + let _ = $current_block; + let _ = $period; + let _ = $genesis; + let _ = $signer; + + Err("Unknown chain") + }, + } + }; +} + +pub struct RemarkBuilder { + client: Arc, + chain: Chain, +} + +impl RemarkBuilder { + pub fn new(client: Arc, chain: Chain) -> Self { + Self { client, chain } + } +} + +impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder { + fn pallet(&self) -> &str { + "system" + } + + fn extrinsic(&self) -> &str { + "remark" + } + + fn build(&self, nonce: u32) -> std::result::Result { + let period = 128; + let genesis = self.client.usage_info().chain.best_hash; + let signer = Sr25519Keyring::Bob.pair(); + let current_block = 0; + + identify_chain! { + self.chain, + nonce, + current_block, + period, + genesis, + signer, + { + runtime::RuntimeCall::System( + runtime::SystemCall::remark { remark: vec![] } + ) + }, + } + } +} + +pub struct TransferKeepAliveBuilder { + client: Arc, + dest: AccountId, + chain: Chain, +} + +impl TransferKeepAliveBuilder { + pub fn new(client: Arc, dest: AccountId, chain: Chain) -> Self { + Self { client, dest, chain } + } +} + +impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder { + fn pallet(&self) -> &str { + "balances" + } + + fn extrinsic(&self) -> &str { + "transfer_keep_alive" + } + + fn build(&self, nonce: u32) -> std::result::Result { + let signer = Sr25519Keyring::Bob.pair(); + let period = 128; + let genesis = self.client.usage_info().chain.best_hash; + let current_block = 0; + let _dest = self.dest.clone(); + + identify_chain! { + self.chain, + nonce, + current_block, + period, + genesis, + signer, + { + runtime::RuntimeCall::Balances(runtime::BalancesCall::transfer_keep_alive { + dest: _dest.into(), + value: runtime::ExistentialDeposit::get(), + }) + }, + } + } +} + +#[cfg(feature = "casper-native")] +fn casper_sign_call( + call: casper_runtime::RuntimeCall, + nonce: u32, + current_block: u64, + period: u64, + genesis: sp_core::H256, + acc: sp_core::sr25519::Pair, +) -> OpaqueExtrinsic { + use codec::Encode; + use sp_core::Pair; + + let extra: casper_runtime::SignedExtra = ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckMortality::::from(sp_runtime::generic::Era::mortal( + period, + current_block, + )), + frame_system::CheckNonce::::from(nonce), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(0), + ); + + let payload = casper_runtime::SignedPayload::from_raw( + call.clone(), + extra.clone(), + ( + (), + casper_runtime::VERSION.spec_version, + casper_runtime::VERSION.transaction_version, + genesis, + genesis, + (), + (), + (), + ), + ); + + let signature = payload.using_encoded(|p| acc.sign(p)); + casper_runtime::UncheckedExtrinsic::new_signed( + call, + sp_runtime::AccountId32::from(acc.public()).into(), + primitives::Signature::Sr25519(signature), + extra, + ).into() +} + +pub fn benchmark_inherent_data() -> std::result::Result { + use inherents::InherentDataProvider; + let mut inherent_data = inherents::InherentData::new(); + + let d = std::time::Duration::from_millis(0); + let timestamp = sp_timestamp::InherentDataProvider::new(d.into()); + futures::executor::block_on(timestamp.provide_inherent_data(&mut inherent_data))?; + + Ok(inherent_data) +} diff --git a/service/src/chain_spec.rs b/service/src/chain_spec.rs new file mode 100755 index 0000000..8ba5981 --- /dev/null +++ b/service/src/chain_spec.rs @@ -0,0 +1,513 @@ +//! Ghost chain configuration. + +use codec::Encode; + +use ghost_slow_clap::sr25519::AuthorityId as SlowClapId; +use primitives::{AccountId, AccountPublic}; +use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId; +use grandpa_primitives::AuthorityId as GrandpaId; +use babe_primitives::AuthorityId as BabeId; +#[cfg(feature = "casper-native")] +use pallet_staking::Forcing; + +#[cfg(feature = "casper-native")] +use casper_runtime as casper; +#[cfg(feature = "casper-native")] +use casper_runtime_constants::currency::CSPR; +use sc_chain_spec::ChainSpecExtension; +#[cfg(feature = "casper-native")] +use sc_chain_spec::ChainType; +use serde::{Deserialize, Serialize}; +use sp_core::{sr25519, Pair, Public}; +use sp_runtime::traits::IdentifyAccount; +#[cfg(feature = "casper-native")] +use sp_runtime::Perbill; +#[cfg(feature = "casper-native")] +use telemetry::TelemetryEndpoints; + +#[cfg(feature = "casper-native")] +const CASPER_TELEMETRY_URL: &str = "wss://telemetry.ghostchain.io/submit/"; + +#[cfg(feature = "casper-native")] +const DEFAULT_PROTOCOL_ID: &str = "cspr"; + +/// Node `ChainSpec` extensions. +/// +/// Additional parameters for some substrate core modules, +/// customizable from the chain spec. +#[derive(Default, Clone, Serialize, Deserialize, ChainSpecExtension)] +#[serde(rename_all = "camelCase")] +pub struct Extensions { + /// Block number with known hashes. + pub fork_blocks: sc_client_api::ForkBlocks, + /// Known bad block hashes. + pub bad_blocks: sc_client_api::BadBlocks, + /// The light sync state. + /// This value will be set by the `sync-state rpc` implementation. + pub light_sync_state: sc_sync_state_rpc::LightSyncStateExtension, +} + +// Generic chain spec, in case when we don't have the native runtime. +pub type GenericChainSpec = sc_service::GenericChainSpec<(), Extensions>; + +/// The `ChainSpec` parametrized for the ghost runtime. +#[cfg(feature = "casper-native")] +pub type CasperChainSpec = sc_service::GenericChainSpec<(), Extensions>; + +#[cfg(not(feature = "casper-native"))] +pub type CasperChainSpec = GenericChainSpec; + +pub fn casper_config() -> Result { + CasperChainSpec::from_json_bytes(&include_bytes!("../chain-specs/casper.json")[..]) +} + +// #[derive(Encode, Clone)] +// struct PreparedNetworkData { +// chain_name: Vec, +// default_endpoint: Vec, +// finality_delay: Option, +// release_delay: Option, +// network_type: u8, +// gatekeeper: Vec, +// topic_name: Vec, +// incoming_fee: u32, +// outgoing_fee: u32, +// } + +#[cfg(feature = "casper-native")] +fn casper_session_keys( + babe: BabeId, + grandpa: GrandpaId, + authority_discovery: AuthorityDiscoveryId, + slow_clap: SlowClapId, +) -> casper::opaque::SessionKeys { + casper::opaque::SessionKeys { + babe, + grandpa, + authority_discovery, + slow_clap, + } +} + + +pub fn casper_chain_spec_properties() -> serde_json::map::Map { + serde_json::json!({ + "ss58Format": 1996, + "tokenDecimals": 18, + "tokenSymbol": "CSPR", + }) + .as_object() + .expect("Map given; qed") + .clone() +} + +/// Helper function to generate a crypto pair from seed. +pub fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +/// Helper function to generate account ID from seed. +pub fn get_account_id_from_seed(seed: &str) -> AccountId +where + AccountPublic: From<::Public>, +{ + AccountPublic::from(get_from_seed::(seed)).into_account() +} + +/// Helper function to generate stash, controller and session key from seed +pub fn generate_authority_keys_from_seed( + seed: &str, +) -> ( + AccountId, + AccountId, + BabeId, + GrandpaId, + AuthorityDiscoveryId, + SlowClapId, +) { + let keys = get_authority_keys_from_seed(seed); + (keys.0, keys.1, keys.2, keys.3, keys.4, keys.5) +} + +/// Helper function to generate stash, controller and session key from seed +pub fn get_authority_keys_from_seed( + seed: &str, +) -> ( + AccountId, + AccountId, + BabeId, + GrandpaId, + AuthorityDiscoveryId, + SlowClapId, +) { + ( + get_account_id_from_seed::(&format!("{}//stash", seed)), + get_account_id_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + ) +} + +#[cfg(feature = "casper-native")] +fn casper_testnet_accounts() -> Vec { + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Feride"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Feride//stash"), + ] +} + +#[cfg(feature = "casper-native")] +fn casper_testnet_evm_accounts() -> Vec<(AccountId, u128, u8)> { + vec![ + // 01c928771aea942a1e7ac06adf2b73dfbc9a25d9eaa516e3673116af7f345198 + (get_account_id_from_seed::("1A69d2D5568D1878023EeB121a73d33B9116A760"), 1337 * CSPR, 1), + // b19a435901872f817185f7234a1484eae837613f9d10cf21927a23c2d8cb9139 + (get_account_id_from_seed::("2f86cfBED3fbc1eCf2989B9aE5fc019a837A9C12"), 1337 * CSPR, 2), + // d3baf57b74d65719b2dc33f5a464176022d0cc5edbca002234229f3e733875fc + (get_account_id_from_seed::("e83f67361Ac74D42A48E2DAfb6706eb047D8218D"), 69 * CSPR, 3), + // c4683d566436af6b58b4a59c8f501319226e85b21869bf93d5eeb4596d4791d4 + (get_account_id_from_seed::("827ee4ad9b259b6fa1390ed60921508c78befd63"), 69 * CSPR, 4), + ] +} + +#[cfg(feature = "casper-native")] +fn casper_testnet_evm_networks() -> Vec<(u32, Vec)> { + vec![ + (1, ghost_networks::NetworkData { + chain_name: "ethereum-mainnet".into(), + default_endpoint: "https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/".into(), + finality_delay: Some(40u64), + release_delay: Some(80u64), + network_type: ghost_networks::NetworkType::Evm, + gatekeeper: "0x4d224452801aced8b2f0aebe155379bb5d594381".into(), + topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(), + incoming_fee: 0u32, + outgoing_fee: 0u32, + }.encode()), + (56, ghost_networks::NetworkData { + chain_name: "bnb-mainnet".into(), + default_endpoint: "https://bsc-mainnet.core.chainstack.com/35848e183f3e3303c8cfeacbea831cab/".into(), + finality_delay: Some(20u64), + release_delay: Some(40u64), + network_type: ghost_networks::NetworkType::Evm, + gatekeeper: "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82".into(), + topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(), + incoming_fee: 0u32, + outgoing_fee: 0u32, + }.encode()) + ] +} + +/// Helper function to create casper `GenesisConfig` for testing +#[cfg(feature = "casper-native")] +pub fn testnet_config_genesis( + initial_authorities: Vec<( + AccountId, + AccountId, + BabeId, + GrandpaId, + AuthorityDiscoveryId, + SlowClapId, + )>, + endowed_accounts: Option>, + ghost_accounts: Option>, + evm_networks: Option)>>, +) -> serde_json::Value { + let endowed_accounts: Vec = endowed_accounts + .unwrap_or_else(casper_testnet_accounts); + + let ghost_accounts: Vec<(AccountId, u128, u8)> = ghost_accounts + .unwrap_or_default(); + + let evm_networks: Vec<(u32, Vec)> = evm_networks + .unwrap_or_default(); + + const ENDOWMENT: u128 = 1_000 * CSPR; + const STASH: u128 = 500 * CSPR; + + serde_json::json!({ + "balances": { + "balances": endowed_accounts + .iter() + .map(|k| (k.clone(), ENDOWMENT)) + .chain(ghost_accounts + .iter() + .map(|k| (k.0.clone(), k.1.clone()))) + .collect::>(), + }, + "session": { + "keys": initial_authorities + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + casper_session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + ), + ) + }) + .collect::>(), + }, + "staking": { + "validatorCount": initial_authorities.len() as u32, + "minimumValidatorCount": 1, + "invulnerables": initial_authorities + .iter() + .map(|x| x.0.clone()) + .collect::>(), + "forceEra": Forcing::NotForcing, + "slashRewardFraction": Perbill::from_percent(10), + "stakers": initial_authorities + .iter() + .map(|x| (x.0.clone(), x.0.clone(), STASH, casper::StakerStatus::::Validator)) + .collect::>(), + }, + "babe": { + "epochConfig": Some(casper::BABE_GENESIS_EPOCH_CONFIG), + }, + "ghostNetworks": { + "networks": evm_networks, + }, + "ghostClaims": { + "total": ghost_accounts.iter().fold(0, |acc, k| acc + k.1), + "membersAndRanks": ghost_accounts + .iter() + .map(|k| (k.0.clone(), k.2.clone())) + .collect::>(), + }, + }) +} + +#[cfg(feature = "casper-native")] +fn casper_staging_config_genesis() -> serde_json::Value { + use hex_literal::hex; + use sp_core::crypto::UncheckedInto; + + // Following keys are used in genesis config for development chains. + // DO NOT use them in production chains as the secret seed is public. + // + // SECRET_SEED="fall cargo frown step audit cover various urge urge six pattern leisure" + // ghostkey inspect -n casper "$SECRET_SEED" + let endowed_accounts = vec![ + // sfFmPT1hi3iySSwEdLpNRMJWo5pvFAKpfgjhDYAgL2i2qyEWx + hex!["5afaf4bba29ed7557a0112d9664c6c3d4acd96440f1b43f3bddeffdc2b3bc800"].into(), + ]; + + // SECRET=$SECRET_SEED ./scripts/prepare-test-net.sh 4 + let initial_authorities: Vec<( + AccountId, + AccountId, + BabeId, + GrandpaId, + AuthorityDiscoveryId, + SlowClapId, + )> = vec![ + ( + //sfEdnhKt7YcjUP8iuvxNqTqUu7YpbARBeqFjAPRMH6yFuuPco + hex!["28f303d3b1f821edda19bf6c97ee886edd85d7dc80e2500ab5f4888a19e40a50"].into(), + //sfJxZKUmPStRqKF1sq5dpdgeCSCx5zRVa53c4q6d8SgfUUf7W + hex!["e83494e12531b122043315d780c4b5b1153c52b7a94c42b5d61cd91b1f188e31"].into(), + //sfFJMwRUaHrHPFL48SqQbvr39HFYvhgX4YKRmrN61i5vqmxnJ + hex!["465e3f1220c774ba014defd7273c3a6e57336eb87c2bea9f04419c2eb6ee895c"].unchecked_into(), + //sfEpnU74Gr7bRfTBR7pEKZdxx6SRXmw55atd9x4uJSWRJMGby + hex!["3155f271b9ca868a2eb980e35f17ee13525cb59e90848c1b0cc2ff306956c916"].unchecked_into(), + //sfEM1Bj59N9gnscE7t6fqBF1xvR4wvhmrxfviCQYDfrTY9dvJ + hex!["1c25e311eade248d63ff2103d3a0bd8909ad618e5878b423c99bd043b47fd535"].unchecked_into(), + //sfFyrauZLXLR44mBB58i73ZTnsgSHBjbgGxtXwoDTH751LaHE + hex!["647d3fc5c00e3dd975838a92a72e06edc6d060c2e79e23672425da61812a8011"].unchecked_into(), + ), + ( + //sfJEs3nDW3aemaCWeSjeuFtiGR3Zx5nD3uMAPvLoRkATdUicY + hex!["c867f4f1417b0aa0c1cf9805866ea3e75d810a47a1ee8d302477768d95306542"].into(), + //sfHf6BwnPaRkMqLivmsTrHGWPQ1DsPM5pVzaeodUvpUGDEuhT + hex!["aea5d94e3837022ddd3b006d77d38b70b87ebaa5423b358b871a3e05d9157e77"].into(), + //sfDzomQME6PRxB5LTEJsLYz7wxJUNNAnMop88Uj4E3wWVyu9x + hex!["0cbe89b4ea4fd1d618f9d0db15522f2ca335893abb806a638c3e9bc43f022c78"].unchecked_into(), + //sfK6CJTmSa5cGk51KFibhvbm1di6EPBnefGeCzXcprUQVokeV + hex!["ee07cb1fd2fbc6b079ec3abb6c4866a35a3f1a25aef0bd5e50d8c188a98148c9"].unchecked_into(), + //sfK9Kq2pXUW5JZBMYSFRwKCWZoMEzqkq8wRVTtpo6zxdDENqG + hex!["f06ade37706f898adce54b09f7e973e718b20fbec06eebf34e6d23046aa51d63"].unchecked_into(), + //sfEBQtB12x7xi5RPGXJiLWugdwAdDBsYePwssMLFBtr43dZiC + hex!["14d534940143dc260894c7ebfd013a0d5c65c2cd85ae89decb32d663a2628e66"].unchecked_into(), + ), + ( + //sfF4sfGLNyVtYMYZbte6A6kcncFi4hG65vPpbftQZxcBVbavS + hex!["3c14dca7697cd193184708b00abf3c148c2d78eae6d8c102b84683ec6936123b"].into(), + //sfJUHCESTjHwXKmHbzhApCDRgzUTcP5kcUUCATeBaTUwtyx8X + hex!["d2a36dc75ef7933c2934b0855e2568a85c11347a48f0a1bfbcf1fc3757db1a07"].into(), + //sfGS5ypMSqG3VSWyhKghZzCxSUdp4JC3Qaw3eu2oe8iaSy1TM + hex!["787eb8a2780f422382474cfa7e44493fffd86824963a0da22d0f0c82f9d39860"].unchecked_into(), + //sfFH1EKd6KCqCJ9HPPW5oBr5gigsEKBkHtFT4GoBqu5iUdYzZ + hex!["45554a1b748fed1f2f51f06970c8cd764edbdefd82d697993ddfe7f97290918c"].unchecked_into(), + //sfG28QRqEgkAgvpjZc3N86xDTebiwKiSvKYfg1NdwW2GNDbP6 + hex!["6638fe19b4331656dacf3be9d6a81506fa71db1fbe4bd9db0ab8c9cc0e364f1b"].unchecked_into(), + //sfFUfGqByAJGfe3e4vxiDJv5A1v1dp2piSNGpR8Kz5U9dFvMp + hex!["4e390dd2dad59ff8709e0cb714bfccdbadde8b4e91d5931cb98ba6e6eb48a93b"].unchecked_into(), + ), + ( + //sfG7zdnf5t6JHbi9tBfkKesz13x7B9mSiYwDJfnDQ1LQwXwAi + hex!["6ab24f598a38e1d91004487faedadc8c338a7cb2a07e29899eccc7d106a2195e"].into(), + //sfDu1voz5vmiKXeiCHutmCp96C6LqLogsWE4rkaUZeZyhdt1B + hex!["085401d14ff3c620c76347a9e9a7e020fd3575d081c8352728db56ea6cc52677"].into(), + //sfH9hH4P98SohVs3Aj4cBoDXZvgYbF8dPXi3NfyEng5eMry9G + hex!["983a9aa148f94a54f313aca8537fb00f3c3353f70fafa8c14d4de22b44366f3c"].unchecked_into(), + //sfJQChmUKaDDQgzsAyZvuRNQZxV4CQ2qmxzmZk27tdWczKtRa + hex!["cf875474e8dfe94f4e9e0e2a4743e02c18cebf87b2c763710c9630f3fc94c9c4"].unchecked_into(), + //sfEMDH3w5xvZCwhXaMKYV7hsSL36evqHhqianntoiNDEtewLT + hex!["1c4e97776053b47b5b48035bab5f5f4afb3e6e13b15d1964195502cf40124c2a"].unchecked_into(), + //sfEPb5wWLKAHZH8k8KXpBtfnbBQPBBTkyv2ZQ1YP3GRKKpP1w + hex!["1e1e7f0781828178bd1237d9a8c2e057bbb15f2f46d1fc5fb316ebd9f5d1ad04"].unchecked_into(), + ), + ]; + + let ghost_accounts: Vec<(AccountId, u128, u8)> = casper_testnet_evm_accounts(); + let evm_networks = casper_testnet_evm_networks(); + + const ENDOWMENT: u128 = 5_000 * CSPR; + const STASH: u128 = 500 * CSPR; + + serde_json::json!({ + "balances": { + "balances": endowed_accounts + .iter() + .map(|k: &AccountId| (k.clone(), ENDOWMENT)) + .chain(initial_authorities.iter().map(|x| (x.0.clone(), STASH))) + .collect::>(), + }, + "session": { + "keys": initial_authorities + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + casper_session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + ), + ) + }) + .collect::>(), + }, + "staking": { + "validatorCount": 50, + "minimumValidatorCount": 4, + "stakers": initial_authorities + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + STASH, + casper::StakerStatus::::Validator, + ) + }) + .collect::>(), + "invulnerables": initial_authorities.iter().map(|x| x.0.clone()).collect::>(), + "forceEra": Forcing::ForceNone, + "slashRewardFraction": Perbill::from_percent(10) + }, + "babe": { + "epochConfig": Some(casper::BABE_GENESIS_EPOCH_CONFIG), + }, + "ghostNetworks": { + "networks": evm_networks, + }, + "ghostClaims": { + "total": ghost_accounts + .iter() + .fold(0, |acc, k| acc + k.1), + "membersAndRanks": ghost_accounts + .iter() + .map(|k| (k.0.clone(), k.2.clone())) + .collect::>(), + }, + }) +} + +#[cfg(feature = "casper-native")] +fn casper_development_config_genesis() -> serde_json::Value { + testnet_config_genesis( + vec![get_authority_keys_from_seed("Alice")], + None, None, None, + ) +} + +#[cfg(feature = "casper-native")] +fn casper_local_config_genesis() -> serde_json::Value { + testnet_config_genesis( + vec![ + get_authority_keys_from_seed("Alice"), + get_authority_keys_from_seed("Bob"), + ], + Some(casper_testnet_accounts()), + Some(casper_testnet_evm_accounts()), + Some(casper_testnet_evm_networks()), + ) +} + +#[cfg(feature = "casper-native")] +pub fn casper_development_config() -> Result { + Ok(CasperChainSpec::builder( + casper::WASM_BINARY.ok_or("Casper development wasm not available")?, + Default::default(), + ) + .with_name("Development") + .with_id("casper_dev") + .with_chain_type(ChainType::Development) + .with_genesis_config_patch(casper_development_config_genesis()) + .with_protocol_id(DEFAULT_PROTOCOL_ID) + .build()) +} + +#[cfg(feature = "casper-native")] +pub fn casper_local_testnet_config() -> Result { + Ok(CasperChainSpec::builder( + casper::WASM_BINARY.ok_or("Casper local testnet wasm not available")?, + Default::default(), + ) + .with_name("Casper Local Testnet") + .with_id("casper_local_testnet") + .with_chain_type(ChainType::Local) + .with_genesis_config_patch(casper_local_config_genesis()) + .with_protocol_id(DEFAULT_PROTOCOL_ID) + .build()) +} + +#[cfg(feature = "casper-native")] +pub fn casper_staging_testnet_config() -> Result { + Ok(CasperChainSpec::builder( + casper::WASM_BINARY.ok_or("Casper staging testnet wasm not available")?, + Default::default(), + ) + .with_name("Casper Staging Testnet") + .with_id("casper_staging_testnet") + .with_chain_type(ChainType::Live) + .with_genesis_config_patch(casper_staging_config_genesis()) + .with_telemetry_endpoints( + TelemetryEndpoints::new(vec![(CASPER_TELEMETRY_URL.to_string(), 0)]) + .expect("Casper Staging telemetry url is valid; qed"), + ) + .with_protocol_id(DEFAULT_PROTOCOL_ID) + .build()) +} diff --git a/service/src/lib.rs b/service/src/lib.rs new file mode 100755 index 0000000..9f16b3a --- /dev/null +++ b/service/src/lib.rs @@ -0,0 +1,760 @@ +#![deny(unused_results)] + +pub mod benchmarking; +pub mod chain_spec; + +#[cfg(feature = "full-node")] +use { + grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider}, + sc_client_api::BlockBackend, + tx_pool_api::OffchainTransactionPoolFactory, + sp_blockchain::HeaderBackend, + sc_service::{KeystoreContainer, RpcHandlers}, + telemetry::{Telemetry, TelemetryWorkerHandle}, +}; + +use std::{sync::Arc, time::Duration}; +use telemetry::TelemetryWorker; +use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY}; + +pub use chain_spec::GenericChainSpec; +pub use consensus_common::{Proposal, SelectChain}; +pub use primitives::{Block, BlockId, BlockNumber, Hash}; +pub use sc_client_api::{Backend, CallExecutor}; +pub use sc_consensus::BlockImport; +pub use sc_executor::NativeExecutionDispatch; +pub use sp_api::{ApiRef, ConstructRuntimeApi, Core as CoreApi, ProvideRuntimeApi}; +pub use sc_service::{ + config::{DatabaseSource, PrometheusConfig}, + ChainSpec, Configuration, Error as SubstrateServiceError, PruningMode, Role, + RuntimeGenesis, TFullBackend, TFullCallExecutor, TFullClient, TaskManager, + TransactionPoolOptions, +}; +pub use sp_runtime::{ + generic, + traits::{ + self as runtime_traits, BlakeTwo256, Block as BlockT, Header as HeaderT, + NumberFor, + }, +}; + +#[cfg(feature = "casper-native")] +pub use chain_spec::CasperChainSpec; +#[cfg(feature = "casper-native")] +pub use {casper_runtime, casper_runtime_constants}; +#[cfg(feature = "casper-native")] +use casper_runtime::RuntimeApi; + +#[cfg(feature = "full-node")] +pub type FullBackend = sc_service::TFullBackend; + +#[cfg(feature = "full-node")] +pub type FullClient = sc_service::TFullClient< + Block, + RuntimeApi, + WasmExecutor<( + sp_io::SubstrateHostFunctions, + frame_benchmarking::benchmarking::HostFunctions, + )>, +>; + +const GRANDPA_JUSTIFICATION_PERIOD: u32 = 512; + +pub trait HeaderProvider: Send + Sync + 'static +where + Block: BlockT, + Error: std::fmt::Debug + Send + Sync + 'static, +{ + fn header( + &self, + hash: ::Hash, + ) -> Result::Header>, Error>; + + fn number( + &self, + hash: ::Hash, + ) -> Result::Header as HeaderT>::Number>, Error>; +} + +impl HeaderProvider for T +where + Block: BlockT, + T: sp_blockchain::HeaderBackend + 'static, +{ + fn header( + &self, + hash: Block::Hash, + ) -> sp_blockchain::Result::Header>> { + >::header(self, hash) + } + + fn number( + &self, + hash: Block::Hash, + ) -> sp_blockchain::Result::Header as HeaderT>::Number>> { + >::number(self, hash) + } +} + +pub trait HeaderProviderProvider: Send + Sync + 'static +where + Block: BlockT, +{ + type Provider: HeaderProvider + 'static; + + fn header_provider(&self) -> &Self::Provider; +} + +impl HeaderProviderProvider for T +where + Block: BlockT, + T: sc_client_api::Backend + 'static, +{ + type Provider = >::Blockchain; + + fn header_provider(&self) -> &Self::Provider { + self.blockchain() + } +} + +#[derive(thiserror::Error, Debug)] +pub enum Error { + #[error(transparent)] + Io(#[from] std::io::Error), + + #[error(transparent)] + AddrFormatInvalid(#[from] std::net::AddrParseError), + + #[error(transparent)] + Sub(#[from] SubstrateServiceError), + + #[error(transparent)] + Blockchain(#[from] sp_blockchain::Error), + + #[error(transparent)] + Consensus(#[from] consensus_common::Error), + + #[error(transparent)] + Prometheus(#[from] prometheus_endpoint::PrometheusError), + + #[error(transparent)] + Telemetry(#[from] telemetry::Error), + + #[cfg(feature = "full-node")] + #[error("Creating a custom database is required for validators")] + DatabasePathRequired, + + #[cfg(feature = "full-node")] + #[error("Expected at least one of ghost or casper runtime feature")] + NoRuntime, +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum Chain { + Ghost, + Casper, + Unknown, +} + +pub trait IdentifyVariant { + fn is_ghost(&self) -> bool; + fn is_casper(&self) -> bool; + fn is_dev(&self) -> bool; + fn identify_chain(&self) -> Chain; +} + +impl IdentifyVariant for Box { + fn is_ghost(&self) -> bool { + self.id().starts_with("ghost") + } + + fn is_casper(&self) -> bool { + self.id().starts_with("casper") + } + + fn is_dev(&self) -> bool { + self.id().ends_with("dev") + } + + fn identify_chain(&self) -> Chain { + if self.is_ghost() { Chain::Ghost } + else if self.is_casper() { Chain::Casper } + else { Chain::Unknown } + } +} + +#[cfg(feature = "full-node")] +type FullSelectChain = sc_consensus::LongestChain; +#[cfg(feature = "full-node")] +type FullGrandpaBlockImport = + grandpa::GrandpaBlockImport; + +#[cfg(feature = "full-node")] +struct Basics { + task_manager: TaskManager, + client: Arc, + backend: Arc, + keystore_container: KeystoreContainer, + telemetry: Option, +} + +#[cfg(feature = "full-node")] +fn new_partial_basics( + config: &mut Configuration, + telemetry_worker_handle: Option, +) -> Result { + let telemetry = config + .telemetry_endpoints + .clone() + .filter(|x| !x.is_empty()) + .map(move |endpoints| -> Result<_, telemetry::Error> { + let (worker, mut worker_handle) = if let Some(worker_handle) = telemetry_worker_handle { + (None, worker_handle) + } else { + let worker = TelemetryWorker::new(16)?; + let worker_handle = worker.handle(); + (Some(worker), worker_handle) + }; + let telemetry = worker_handle.new_telemetry(endpoints); + Ok((worker, telemetry)) + }) + .transpose()?; + + let heap_pages = config + .default_heap_pages + .map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static { extra_pages: h as _ }); + + let executor = WasmExecutor::builder() + .with_execution_method(config.wasm_method) + .with_onchain_heap_alloc_strategy(heap_pages) + .with_offchain_heap_alloc_strategy(heap_pages) + .with_max_runtime_instances(config.max_runtime_instances) + .with_runtime_cache_size(config.runtime_cache_size) + .build(); + + let (client, backend, keystore_container, task_manager) = + sc_service::new_full_parts::( + &config, + telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), + executor, + )?; + let client = Arc::new(client); + + let telemetry = telemetry.map(|(worker, telemetry)| { + if let Some(worker) = worker { + task_manager.spawn_handle().spawn( + "telemetry", + Some("telemetry"), + Box::pin(worker.run()), + ); + } + telemetry + }); + + Ok(Basics { task_manager, client, backend, keystore_container, telemetry }) +} + +#[cfg(feature = "full-node")] +fn new_partial( + config: &mut Configuration, + Basics { task_manager, backend, client, keystore_container, telemetry }: Basics, + select_chain: ChainSelection, +) -> Result< + sc_service::PartialComponents< + FullClient, + FullBackend, + ChainSelection, + sc_consensus::DefaultImportQueue, + sc_transaction_pool::FullPool, + ( + impl Fn( + ghost_rpc::DenyUnsafe, + ghost_rpc::SubscriptionTaskExecutor, + ) -> Result, + ( + babe::BabeBlockImport< + Block, + FullClient, + FullGrandpaBlockImport, + >, + grandpa::LinkHalf, + babe::BabeLink, + ), + grandpa::SharedVoterState, + Option, + ), + >, + Error, +> +where + ChainSelection: 'static + SelectChain, +{ + let transaction_pool = sc_transaction_pool::BasicPool::new_full( + config.transaction_pool.clone(), + config.role.is_authority().into(), + config.prometheus_registry(), + task_manager.spawn_essential_handle(), + client.clone(), + ); + + let (grandpa_block_import, grandpa_link) = + grandpa::block_import( + client.clone(), + GRANDPA_JUSTIFICATION_PERIOD, + &(client.clone() as Arc<_>), + select_chain.clone(), + telemetry.as_ref().map(|x| x.handle()), + )?; + let justification_import = grandpa_block_import.clone(); + + let babe_config = babe::configuration(&*client)?; + let (block_import, babe_link) = + babe::block_import(babe_config.clone(), grandpa_block_import, client.clone())?; + + let slot_duration = babe_link.config().slot_duration(); + let (import_queue, babe_worker_handle) = + babe::import_queue(babe::ImportQueueParams { + link: babe_link.clone(), + block_import: block_import.clone(), + justification_import: Some(Box::new(justification_import)), + client: client.clone(), + select_chain: select_chain.clone(), + create_inherent_data_providers: move |_, ()| async move { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + let slot = + babe_primitives::inherents::InherentDataProvider::from_timestamp_and_slot_duration( + *timestamp, + slot_duration, + ); + Ok((slot, timestamp)) + }, + spawner: &task_manager.spawn_essential_handle(), + registry: config.prometheus_registry(), + telemetry: telemetry.as_ref().map(|x| x.handle()), + offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(transaction_pool.clone()), + })?; + + let justification_stream = grandpa_link.justification_stream(); + let shared_authority_set = grandpa_link.shared_authority_set().clone(); + let shared_voter_state = grandpa::SharedVoterState::empty(); + let finality_proof_provider = GrandpaFinalityProofProvider::new_for_service( + backend.clone(), + Some(shared_authority_set.clone()), + ); + + let import_setup = (block_import, grandpa_link, babe_link); + let rpc_setup = shared_voter_state.clone(); + + let rpc_extensions_builder = { + let client = client.clone(); + let keystore = keystore_container.keystore(); + let transaction_pool = transaction_pool.clone(); + let select_chain = select_chain.clone(); + let chain_spec = config.chain_spec.cloned_box(); + let backend = backend.clone(); + + move | + deny_unsafe, + subscription_executor: ghost_rpc::SubscriptionTaskExecutor, + | -> Result { + let deps = ghost_rpc::FullDeps { + client: client.clone(), + pool: transaction_pool.clone(), + select_chain: select_chain.clone(), + chain_spec: chain_spec.cloned_box(), + deny_unsafe, + babe: ghost_rpc::BabeDeps { + babe_worker_handle: babe_worker_handle.clone(), + keystore: keystore.clone(), + }, + grandpa: ghost_rpc::GrandpaDeps { + shared_voter_state: shared_voter_state.clone(), + shared_authority_set: shared_authority_set.clone(), + justification_stream: justification_stream.clone(), + subscription_executor: subscription_executor.clone(), + finality_provider: finality_proof_provider.clone(), + }, + backend: backend.clone(), + }; + + ghost_rpc::create_full_rpc(deps).map_err(Into::into) + } + }; + + Ok(sc_service::PartialComponents { + client, + backend, + task_manager, + keystore_container, + select_chain, + import_queue, + transaction_pool, + other: (rpc_extensions_builder, import_setup, rpc_setup, telemetry), + }) +} + +#[cfg(feature = "full-node")] +pub struct NewFullParams { + /// Whether to enable the block authoring backoff on production networks + /// where it isn't enabled by default. + pub force_authoring_backoff: bool, + pub telemetry_worker_handle: Option, + pub hwbench: Option, +} + +#[cfg(feature = "full-node")] +pub struct NewFull { + pub task_manager: TaskManager, + pub client: Arc, + pub network: Arc, + pub sync_service: Arc>, + pub rpc_handlers: RpcHandlers, + pub backend: Arc, +} + +#[cfg(feature = "full-node")] +pub fn new_full::Hash>>( + mut config: Configuration, + NewFullParams { + force_authoring_backoff, + telemetry_worker_handle, + hwbench, + }: NewFullParams, +) -> Result { + use sc_network_sync::WarpSyncParams; + + let role = config.role.clone(); + let force_authoring = config.force_authoring; + let backoff_authoring_blocks = if !force_authoring_backoff { + None + } else { + let mut backoff = + sc_consensus_slots::BackoffAuthoringOnFinalizedHeadLagging::default(); + + if config.chain_spec.is_dev() { + backoff.max_interval = 10; + } + + Some(backoff) + }; + + let disable_grandpa = config.disable_grandpa; + let name = config.network.node_name.clone(); + + let basics = new_partial_basics(&mut config, telemetry_worker_handle)?; + + let prometheus_registry = config.prometheus_registry().cloned(); + let select_chain = sc_consensus::LongestChain::new(basics.backend.clone()); + + let sc_service::PartialComponents::<_, _, sc_consensus::LongestChain, _, _, _,> { + client, + backend, + mut task_manager, + keystore_container, + select_chain, + import_queue, + transaction_pool, + other: ( + rpc_extensions_builder, + import_setup, + rpc_setup, + mut telemetry, + ), + } = new_partial::>( + &mut config, + basics, + select_chain, + )?; + + let metrics = Network::register_notification_metrics( + config.prometheus_config.as_ref().map(|cfg| &cfg.registry), + ); + let shared_voter_state = rpc_setup; + let auth_disc_publish_non_global_ips = config.network.allow_non_globals_in_dht; + let auth_disc_public_addresses = config.network.public_addresses.clone(); + + let mut net_config = + sc_network::config::FullNetworkConfiguration::<_, _, Network>::new(&config.network); + + let genesis_hash = client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"); + let peer_store_handle = net_config.peer_store_handle(); + + let grandpa_protocol_name = grandpa::protocol_standard_name(&genesis_hash, &config.chain_spec); + let (grandpa_protocol_config, grandpa_notification_service) = + grandpa::grandpa_peers_set_config::<_, Network>( + grandpa_protocol_name.clone(), + metrics.clone(), + Arc::clone(&peer_store_handle), + ); + net_config.add_notification_protocol(grandpa_protocol_config); + + let warp_sync = Arc::new(grandpa::warp_proof::NetworkProvider::new( + backend.clone(), + import_setup.1.shared_authority_set().clone(), + Vec::new(), + )); + + let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) = + sc_service::build_network(sc_service::BuildNetworkParams { + config: &config, + net_config, + client: client.clone(), + transaction_pool: transaction_pool.clone(), + spawn_handle: task_manager.spawn_handle(), + import_queue, + block_announce_validator_builder: None, + warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)), + block_relay: None, + metrics, + })?; + + if config.offchain_worker.enabled { + use futures::FutureExt; + + task_manager.spawn_handle().spawn( + "offchain-workers-runner", + "offchain-worker", + sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions { + runtime_api_provider: client.clone(), + keystore: Some(keystore_container.keystore()), + offchain_db: backend.offchain_storage(), + transaction_pool: Some(OffchainTransactionPoolFactory::new( + transaction_pool.clone(), + )), + network_provider: Arc::new(network.clone()), + is_validator: role.is_authority(), + enable_http_requests: true, + custom_extensions: move |_| vec![], + }) + .run(client.clone(), task_manager.spawn_handle()) + .boxed(), + ); + } + + let rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams { + config, + backend: backend.clone(), + client: client.clone(), + keystore: keystore_container.keystore(), + network: network.clone(), + sync_service: sync_service.clone(), + rpc_builder: Box::new(rpc_extensions_builder), + transaction_pool: transaction_pool.clone(), + task_manager: &mut task_manager, + system_rpc_tx, + tx_handler_controller, + telemetry: telemetry.as_mut(), + })?; + + if let Some(hwbench) = hwbench { + sc_sysinfo::print_hwbench(&hwbench); + match ghost_machine_primitives::GHOST_NODE_REFERENCE_HARDWARE.check_hardware(&hwbench) { + Err(err) if role.is_authority() => { + log::warn!( + "⚠️ The hardware does not meet the minimal requirements {} for role 'Authority'", + err + ); + }, + _ => {}, + } + + if let Some(ref mut telemetry) = telemetry { + let telemetry_handle = telemetry.handle(); + task_manager.spawn_handle().spawn( + "telemetry_hwbench", + None, + sc_sysinfo::initialize_hwbench_telemetry( + telemetry_handle, + hwbench, + ), + ); + } + } + + let (block_import, link_half, babe_link) = import_setup; + + if role.is_authority() { + use futures::StreamExt; + use sc_network::{Event, NetworkEventStream}; + + let authority_discovery_role = + sc_authority_discovery::Role::PublishAndDiscover(keystore_container.keystore()); + let dht_event_stream = + network.event_stream("authority-discovery").filter_map(|e| async move { + match e { + Event::Dht(e) => Some(e), + _ => None, + } + }); + let (worker, _service) = sc_authority_discovery::new_worker_and_service_with_config( + sc_authority_discovery::WorkerConfig { + publish_non_global_ips: auth_disc_publish_non_global_ips, + public_addresses: auth_disc_public_addresses, + strict_record_validation: true, + ..Default::default() + }, + client.clone(), + Arc::new(network.clone()), + Box::pin(dht_event_stream), + authority_discovery_role, + prometheus_registry.clone() + ); + + task_manager.spawn_handle().spawn( + "authority-discovery-worker", + Some("authority-discovery"), + Box::pin(worker.run()), + ); + } + + if role.is_authority() { + let proposer = sc_basic_authorship::ProposerFactory::new( + task_manager.spawn_handle(), + client.clone(), + transaction_pool.clone(), + prometheus_registry.as_ref(), + telemetry.as_ref().map(|x| x.handle()), + ); + + let slot_duration = babe_link.config().slot_duration(); + let babe_config = babe::BabeParams { + keystore: keystore_container.keystore(), + client: client.clone(), + select_chain, + block_import, + env: proposer, + sync_oracle: sync_service.clone(), + justification_sync_link: sync_service.clone(), + create_inherent_data_providers: move |_, ()| { + async move { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + let slot = + babe_primitives::inherents::InherentDataProvider::from_timestamp_and_slot_duration( + *timestamp, + slot_duration, + ); + Ok((slot, timestamp)) + } + }, + force_authoring, + backoff_authoring_blocks, + babe_link, + block_proposal_slot_portion: babe::SlotProportion::new(2f32 / 3f32), + max_block_proposal_slot_portion: None, + telemetry: telemetry.as_ref().map(|x| x.handle()), + }; + + let babe = babe::start_babe(babe_config)?; + + task_manager.spawn_essential_handle().spawn_blocking("babe", None, babe); + } + + let keystore_opt = if role.is_authority() { + Some(keystore_container.keystore()) + } else { + None + }; + + let config = grandpa::Config { + gossip_duration: Duration::from_millis(1000), + justification_generation_period: GRANDPA_JUSTIFICATION_PERIOD, + name: Some(name), + observer_enabled: false, + keystore: keystore_opt, + local_role: role, + telemetry: telemetry.as_ref().map(|x| x.handle()), + protocol_name: grandpa_protocol_name, + }; + + let enable_grandpa = !disable_grandpa; + if enable_grandpa { + let voting_rules_builder = grandpa::VotingRulesBuilder::default(); + + let granpda_config = grandpa::GrandpaParams { + config, + link: link_half, + network: network.clone(), + sync: sync_service.clone(), + voting_rule: voting_rules_builder.build(), + prometheus_registry: prometheus_registry.clone(), + shared_voter_state, + telemetry: telemetry.as_ref().map(|x| x.handle()), + notification_service: grandpa_notification_service, + offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(transaction_pool.clone()), + }; + + task_manager.spawn_essential_handle().spawn_blocking( + "granpda-voter", + None, + grandpa::run_grandpa_voter(granpda_config)?, + ); + } + + network_starter.start_network(); + + Ok(NewFull { + task_manager, + client, + network, + sync_service, + rpc_handlers, + backend, + }) +} + +#[cfg(feature = "full-node")] +macro_rules! chain_ops { + ($config:expr, $telemetry_worker_handle:expr) => {{ + let telemetry_worker_handle = $telemetry_worker_handle; + let mut config = $config; + let basics = new_partial_basics(config, telemetry_worker_handle)?; + + let chain_selection = sc_consensus::LongestChain::new(basics.backend.clone()); + + let sc_service::PartialComponents { client, backend, import_queue, task_manager, .. } = + new_partial::>(&mut config, basics, chain_selection)?; + Ok((client, backend, import_queue, task_manager)) + }}; +} + +#[cfg(feature = "full-node")] +pub fn new_chain_ops( + config: &mut Configuration, +) -> Result<(Arc, Arc, sc_consensus::BasicQueue, TaskManager), Error> +{ + config.keystore = sc_service::config::KeystoreConfig::InMemory; + chain_ops!(config, None) +} + +#[cfg(feature = "full-node")] +pub fn build_full( + config: Configuration, + params: NewFullParams, +) -> Result { + match config.network.network_backend { + sc_network::config::NetworkBackendType::Libp2p => + new_full::>(config, params), + sc_network::config::NetworkBackendType::Litep2p => + new_full::(config, params), + } +} + +#[cfg(feature = "full-node")] +pub fn revert_backend( + client: Arc, + backend: Arc, + blocks: BlockNumber, +) -> Result<(), Error> { + let best_number = client.info().best_number; + let finalized = client.info().finalized_number; + let revertible = blocks.min(best_number - finalized); + + if revertible == 0 { + return Ok(()) + } + + babe::revert(client.clone(), backend, blocks)?; + grandpa::revert(client, blocks)?; + + Ok(()) +} diff --git a/src/main.rs b/src/main.rs new file mode 100755 index 0000000..746be14 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,17 @@ +//! Ghost CLI + +#![warn(missing_docs)] + +use color_eyre::eyre; + +/// Global allocator. Changing it to another allocator will require changing +/// `memory_stats::MemoryAllicationTracker`. +#[cfg(any(target_os = "linux", feature = "jemalloc-allocator"))] +#[global_allocator] +pub static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; + +fn main() -> eyre::Result<()> { + color_eyre::install()?; + ghost_cli::run()?; + Ok(()) +} diff --git a/tests/benchmark_block.rs b/tests/benchmark_block.rs new file mode 100755 index 0000000..3476f7e --- /dev/null +++ b/tests/benchmark_block.rs @@ -0,0 +1,84 @@ +#![cfg(unix)] + +use assert_cmd::cargo::cargo_bin; +use nix::{ + sys::signal::{kill, Signal::SIGINT}, + unistd::Pid, +}; +use std::{ + path::Path, + process::{self, Command}, + result::Result, + time::Duration, +}; +use tempfile::tempdir; + +pub mod common; + +static RUNTIMES: [&str; 2] = ["ghost, casper"]; + +/// `benchmark_block` works for all dev runtimes using wasm executor. +#[tokio::test] +async fn benchmark_block_works() { + for runtime in RUNTIMES { + let tmp_dir = tempdir().expect("could not create a temp dir"); + let base_path = tmp_dir.path(); + let runtime = format!("{}-dev", runtime); + + // Build a chain with a single block. + build_chain(&runtime, base_path).await.unwrap(); + // Benchmark the one block. + benchmark_block(&runtime, base_path, 1).unwrap(); + } +} + +/// Builds a chain with one block for the given runtime and base path. +async fn build_chain( + runtime: &str, + base_path: &Path, +) -> Result<(), String> { + let mut cmd = Command::new(cargo_bin("ghost")) + .stdout(process::Stdio::piped()) + .stderr(process::Stderr::piped()) + .args(["--chain", runtime, "--force-authoring", "--alice"]) + .arg("-d") + .arg(base_path) + .arg("--no-hardware-benchmarks") + .spawn() + .unwrap(); + + let (ws_url, _) = common::find_ws_url_from_output(cmd.stderr.take().unwrap()); + + // Wait for the chain to produce block. + let ok = common::wait_n_finalized_blocks(1, Duration::from_secs(60), &ws_url).await; + // Send SIGINT to node. + kill(Pid::from_raw(cmd.id().try_into().unwrap()), SIGINT).unwrap(); + // Wait for the node to handle it and exit. + assert!(common::wait_for(&mut cmd, 30).map(|x| x.success()).unwrap_or_default()); + + ok.map_err(|e| format!("Node dod not build the chain: {:?}", e)) +} + +/// Benchmarks the given block with the wasm executor. +fn benchmark_block( + runtime: &str, + base_path: &Path, + block: u32, +) -> Result<(), String> { + // Invoke `benhcmark block` with all options to make sure that they are valid. + let status = Command::new(carg_bin("ghost")) + .args(["benchmark", "block", "--chain", runtime]) + .arg("-d") + .arg(base_path) + .args(["--from", &block.to_string(), "--to", &block.to_string()]) + .args(["--repeat", "1"]) + .args(["--execution", "wasm", "--wasm-execution", "compiled"]) + .status() + .map_err(|e| format!("command failed: {:?}", e))?; + + if !status.success() { + return Err("Command failed".into()) + } + + Ok(()) +} diff --git a/tests/benchmark_extrinsic.rs b/tests/benchmark_extrinsic.rs new file mode 100755 index 0000000..fef4328 --- /dev/null +++ b/tests/benchmark_extrinsic.rs @@ -0,0 +1,47 @@ +use assert_cmd::cargo::cargo_bin; +use std::{process::Command, result::Result}; + +static RUNTIMES: [&str; 2] = ["ghost", "casper"]; + +static EXTRINSIC: [(&str, &str); 2] = [ + ("system", "remark"), + ("balances", "transfer_keep_alive"), +]; + +/// `becnhamrk extrinsic` works for all dev runtimes and some extrinsics. +#[test] +fn benchmark_extrinsic_works() { + for runtime in RUNTIMES { + for (pallet, extrinsic) in EXTRINSICS { + let runtime = format!("{}-dev", runtime); + assert!(benchmark_extrinsic(&runtime, pallet, extrinsic).is_ok()); + } + } +} + +/// `benchmark extrinsic` rejects all non-dev runtimes. +#[test] +fn benchmark_extrinsic_rejects_non_dev_runtimes() { + for runtime in RUNTIMES { + assert!(benchmark_extrinsic(runtime, "system", "remark").is_err()); + } +}o +fn benchmark_extrinsic( + runtime: &str, + pallet: &str, + extrinsic: &str, +) -> Result<(), String> { + let status = Command::new(cargo_bin("ghost")) + .args(["benchmark", "extrinsic", "--chain", runtime)] + .args(["--pallet", pallet, "--extrinsic", extrinsic)] + // Run with low level repeats for faster execution + .args(["--repeat=1", "--warmup=1", "--max-ext-per-block=1"]) + .status() + .map_err(|e| format!("command failed: {:?}", e))?; + + if !status.success() { + return Err("Command failed".into()) + } + + Ok(()) +} diff --git a/tests/benchmark_overhead.rs b/tests/benchmark_overhead.rs new file mode 100755 index 0000000..54e419f --- /dev/null +++ b/tests/benchmark_overhead.rs @@ -0,0 +1,50 @@ +use assert_cmd::cargo::cargo_bin; +use std::{process::Command, result::Result}; +use tempfile::tempdir; + +static RUNTIMES: [&str; 2] = ["ghost", "casper"]; + +/// `benchmark overhead` works for all dev runtimes. +#[test] +fn benchmark_overhead_works() { + for runtime in RUNTIMES { + let runtime = format!("{}-dev", runtime); + assert!(benchmark_overhead(runtime).is_ok()); + } +} + +/// `becnhmark overhead` rejects all non-dev runtimes. +#[test] +fn benchmark_overhead_rejects_non_dev_runtimes() { + for runtime in RUNTIMES { + assert!(benchmark_overhead(runtime.into()).is_err()); + } +} + +fn becnhamrk_overhead(runtime: String) -> Result<(), String> { + let tmp_dir = tempdir().expect("could not create a temp dir"); + let pase_path = tmp_dir.path(); + + let status = Command::new(carg_bin("ghost")) + .args(["benchmark", "overhead", "--chain", &runtime]) + .arg("-d") + .arg(base_path) + .arg("--weight-path") + .arg(base_path) + .args(["--warmup", "5", "--repeat", "5"]) + .args(["--add", "100", "--mul", "1.2", "--metric", "p75"]) + // Only put 5 extrinsics into the block otherwise it takes forever + // to build it, especially for a non-release builds. + .args(["--max-ext-per-block", "5"]) + .status() + .map_err(|e| format!("command failed: {:?}", e))?; + + if !status.success() { + return Err("Command failed".into()) + } + + // Weight files have been created. + assert!(base_path.join("block_weights.rs").exists()); + assert!(base_path.join("extrinsic_weights.rs").exists()); + Ok(()) +} diff --git a/tests/benchmark_storage_works.rs b/tests/benchmark_storage_works.rs new file mode 100755 index 0000000..4e91625 --- /dev/null +++ b/tests/benchmark_storage_works.rs @@ -0,0 +1,32 @@ +use assert_cmd::carg::carg_bin; +use std::{ + path::Path, + process::{Command, ExitStatus}, +}; +use tempfile::tempdir; + +/// The `benchmark storage` command works for the dev runtime. +#[test] +fn benchmark_storage_works() { + let tmp_dir = tempdir().expect("could not create a temp dir"); + let base_path = tmp_dir.path(); + + // Benchamrking the storage works and creates the weight file. + assert!(becnhark_storage("rocksdb", base_path).success()); + assert!(base_path.join("rocksdb_weights.rs").exists()); +} + +/// Invoke the `becnhamrk storage` sub-command. +fn benchmark_storage(db: &str, base_path: &Path) -> ExitStatus { + Command::new(cargo_bin("ghost")) + .args(["benhcmark", "storage", "--dev"]) + .arg("--db") + .arg(db) + .arg("--weight-path") + .arg(base_path) + .args(["--state-version", "0"]) + .args(["--warmups", "0"]) + .args(["--add", "100", "--mul", "1.2", "--metric", "p75"]) + .status() + .unwrap() +} diff --git a/tests/common.rs b/tests/common.rs new file mode 100755 index 0000000..3885ee4 --- /dev/null +++ b/tests/common.rs @@ -0,0 +1,87 @@ +use ghost_core_primitives::{Block, Hash, Header}; +use std::{ + io::{BufRead, BufReader, Read}, + process::{Child, ExitStatus}, + thread, + time::Duration, +}; +use substrate_rpc_client::{ws_client, ChainApi}; +use tokio::time::timeout; + +/// Wait for the given `child` the given amount of `secs`. +/// +/// Returns the `Some(exit status)` or `None` of the process did not finish +/// in the given time. +pub fn wait_for(child: &mut Child, secs: usize) -> Option { + for _ in 0..secs { + match child.try_wait().unwrap() { + Some(status) => return Some(status), + None => thread::sleep(Duration::from_secs(1)), + } + } + eprintln!("Took too long to exit. Killing..."); + let _ = child.kill(); + child.wait().unwrap(); + + None +} + +/// Wait for at least `n` blocks to be finalzied within the specified time. +pub async fn wait_n_finalized_blocks( + n: usize, + timeout_duration: Duration, + url: &str, +) -> Result<(), tokio::time::error::Elapsed> { + timeout(timeout_duration, wait_n_finalized_blocks_from(n, url)).await +} + +/// Wait for at least `n` blocks to be finalized from a specified node. +async fn wait_n_finalized_blocks_from(n: usize, url: &str) { + let mut built_blocks = std::collections::HashSet::new(); + let mut interval = tokio::time::interval(Duration::from_secs(6)); + + loop { + let rpc = match ws_client(url).await { + Ok(rpc_service) => rpc_service, + Err(_) => continue, + }; + + if let Ok(blocks) = ChainApi::<(), Hash, Header, Block>::finalized_head(&rpc).await { + build_blocks.insert(block); + if (build_blocks.len() > n { + break + } + }; + interval.tick().await; + } +} + +/// Read the WS address from the output. +/// +/// This is hack to get the actual binded socketaddr because ghost assigns a +/// random port if the specified port was already binded. +pub fn find_ws_url_from_output(read: impl Read + Send) -> (String, String) { + let mut data = String::new(); + + let ws_url = BufReader::new(read) + .lines() + .find_map(|line| { + let line = line.expect("failed to obtain next line from stdout for port discovery"); + + data.push_str(&line); + + // does the line contain our port (we expect this specific output + // from substrate. + let sock_addr = match line.split_once("Running JSON-RPC WS server: addr=") { + Some((_, after)) => after.split_once(",").unwrap().0, + None => return None, + }; + + Some(format!("ws://{}", sock_addr)) + }) + .unwrap_or_else(|| { + panic!("Could not find WebSocket address in process output:\n{}", &data) + }); + + (ws_url, data) +} diff --git a/tests/invalid_order_arguments.rs b/tests/invalid_order_arguments.rs new file mode 100755 index 0000000..4b9244d --- /dev/null +++ b/tests/invalid_order_arguments.rs @@ -0,0 +1,18 @@ +use assert_cmd::cargo::cargo_bin; +use std::process::Command; +use temfile::tempdir; + +#[test] +#[cfg(unix)] +fn invalid_order_arguments() { + let tmpdir = tempdir().expect("could not create temp dir"); + + let status = Command::new(cargo_bin("ghost")) + .args(["--dev", "invalid_order_arguments", "-d"]) + .arg(tmpdir.path()) + .arg("-y") + .status() + .unwrap(); + + assert!(!status.success); +} diff --git a/tests/purge_chain_works.rs b/tests/purge_chain_works.rs new file mode 100755 index 0000000..c9afab9 --- /dev/null +++ b/tests/purge_chain_works.rs @@ -0,0 +1,58 @@ +use assert_cmd::cargo::cargo_bin; +use std::{ + process::{self, Command}, + time::Duration, +}; +use temfile::tempdir; + +pub mod common; + +#[tokio::test] +#[cfg(unix)] +async fn purge_chain_rocksdb_works() { + use nix::{ + sys::signal::{kill, Singal::SIGINT}, + unistd::Pid, + }; + + let tmpdir = tempdir().expect("could not create temp dir"); + + let mut cmd = Command::new(cargo_bin("ghost")) + .stdout(process::Stdio::piped()) + .stderr(process::Stdio::piped()) + .args(["--dev", "-d"]) + .arg(tmpdir.path) + .arg("--port") + .arg("33034") + .arg("--no-hardware-benchmarks") + .spawn() + .unwrap(); + + let (ws_url, _) = common::find_ws_url_from_output(cmd.stderr.take().unwrap()); + + // Let it produce 1 block. + common::wait_n_finalized_blocks(1, Duration::from_secs(60), &ws_url) + .await + .unwrap(); + + // Send SIGINT to node + kill(Pid::from_raw(cmd.id().try_into().unwrap()), SIGINT).unwrap(); + // Wait for the node to handle it and exit. + assert!(common::wait_for(&mut cmd, 30).map(|x| x.success()).unwrap_or_default()); + assert!(tmpdir.path().join("chains/dev").exists()); + assert!(tmpdir.path().join("chains/dev/db/full").exists()); + + // Purge chain + let status = Command::new(cargo_bin("ghost")) + .args(["purge-chain", "--dev", "-d"]) + .arg(tmpdir.path()) + .arg("-y") + .status() + .unwrap(); + + assert!(status.success()); + + // Make sure that the chain folder exists, but `db/full` is deleted. + assert!(tmpdir.path().join("chains/dev").exists()); + assert!(!tmpdir.path().join("chains/dev/db/full").exists()); +} diff --git a/tests/running_the_node_and_interrupt.rs b/tests/running_the_node_and_interrupt.rs new file mode 100755 index 0000000..3ab22ba --- /dev/null +++ b/tests/running_the_node_and_interrupt.rs @@ -0,0 +1,52 @@ +use assert_cmd::cargo::cargo_bin; +use std::{ + process::{self, Command}, + time::Duration, +}; +use tempfile::tempdir; + +pub mod common; + +#[tokio::test] +#[cfg(unix)] +async fn running_the_node_works_and_can_be_interrupted() { + use nix::{ + sys::signal::{ + kill, + Signal::{self, SIGINT, SIGTERM,}, + }, + unistd::Pid, + }; + + async fn run_command_and_kill(signal: Signal) { + let tmpdir = tempdir().expect("could not create temp dir"); + + let mut cmd = Command::new(cargo_bin("ghost")) + .stdout(process::Stdio::piped()) + .stderr(process::Stdio::piped()) + .args(["--dev", "-d"]) + .arg(tmpdir.path()) + .arg("--no-hardware-benchmark") + .spawn() + .unwrap(); + + let (ws_url, _) = common::find_ws_url_from_output(cmd.stderr.take().unwrap()); + + // Let produce three blocks. + common::wait_n_finalized_blocks(3, from_secs(60)), &ws_url) + .await + .unwrap(); + + assert!(cmd.try_wait().unwrap().is_none(), "the process should still be running"); + kill(Pid::from_raw(cmd.id().try_into().unwrap()), signal).unwrap(); + assert_eq!( + common::wait_for(&mut cmd, 30).map(|x| x.success()), + Some(true), + "the process must exit gracefully after signal {}", + signal, + ); + } + + run_command_and_kill(SIGINT).await; + run_command_and_kill(SIGTERM).await; +} diff --git a/utils/bags-list/Cargo.toml b/utils/bags-list/Cargo.toml new file mode 100644 index 0000000..8f57887 --- /dev/null +++ b/utils/bags-list/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "ghost-remote-ext-tests-bags-list" +version = "1.0.0" +description = "Integration test that use state from live chains via remote externalities." +license.workspace = true +authors.workspace = true +edition.workspace = true +repository.workspace = true +homepage.workspace = true + +[dependencies] +casper-runtime = { path = "../../runtime/casper" } +casper-runtime-constants = { path = "../../runtime/casper/constants" } + +pallet-bags-list-remote-tests = { workspace = true } +sp-tracing = { workspace = true, features = ["std"] } +sp-core = { workspace = true, features = ["std"] } +frame-system = { workspace = true, features = ["std"] } + +clap = { workspace = true } +log = { workspace = true } +tokio = { workspace = true, features = ["macros"] } diff --git a/utils/bags-list/src/main.rs b/utils/bags-list/src/main.rs new file mode 100644 index 0000000..d51a85c --- /dev/null +++ b/utils/bags-list/src/main.rs @@ -0,0 +1,84 @@ +use clap::{Parser, ValueEnum}; + +#[derive(Clone, Debug, ValueEnum)] +#[value(rename_all = "PascalCase")] +enum Command { + CheckMigration, + SanityCheck, + Snapshot, +} + +#[derive(Clone, Derive, ValueEnum)] +#[value(rename_all = "PascalCase")] +enum Runtime { + Casper, +} + +#[derive(Debug)] +struct Cli { + #[arg(long, short, default_value = "wss://127.0.0.1::443")] + uri: String, + + #[arg(long, short, ignore_case = true, value_enum, default_value_t = Runtime::Casper)] + runtime: String, + + #[arg(long, short, ignore_case = true, value_enum, default_value_t = Command::SanityCheck)] + command: Command, + + #[arg(long, short)] + snapshot_limit: Option, +} + +#[tokio::main] +async fn main() { + let options = Cli::parse(); + sp_tracing::try_init_simple(); + + log::info!( + target: "remote-ext-tests", + "using runtime {:?} / command: {:?}", + options.runtime, + options.command, + ); + + use pallet_bags_list_remote_tests::*; + match options.runtime { + Runtime::Casper => sp_core::crypto::set_default_ss58_version( + ::SS58Prefix::get() + .try_into() + .unwrap(), + ), + }; + + match options.runtime { + Runtime::Casper => { + use casper_runtime::{Block, Runtime}; + use casper_runtime_constants::currency::CSPR; + + match options.command { + (Command::CheckMigration) => { + migration::execute::( + CSPR as u64, + "CSPR", + options.uri.clone(), + ).await; + }, + (Command::SanityCheck) => { + try_state::execute::( + CSPR as u64, + "CSPR", + options.uri.clone(), + ).await; + }, + (Command::Snapshot) => { + snapshot::execute::( + options.snapshot_limit + CSPR.try_into().unwrap(), + options.uri.clone(), + ).await; + }, + } + }, + _ => Err("Wrong runtime was used"), + } +} diff --git a/utils/chain-spec-builder/Cargo.toml b/utils/chain-spec-builder/Cargo.toml new file mode 100644 index 0000000..3e30929 --- /dev/null +++ b/utils/chain-spec-builder/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "ghost-staging-chain-spec-builder" +description = "Utility for building chain-specification files for Ghost and Casper runtimes on `sp-genesis-builder`" +version = "1.6.1" +build = "build.rs" +authors.workspace = true +edition.workspace = true +repository.workspace = true +license.workspace = true +homepage.workspace = true + +[[bin]] +path = "bin/main.rs" +name = "chain-spec-builder" + +[dependencies] +clap = { workspace = true, features = ["derive"] } +log = { workspace = true } +serde_json = { workspace = true } +sc-chain-spec = { workspace = true } +sp-tracing = { workspace = true, features = ["std"] } diff --git a/utils/chain-spec-builder/bin/main.rs b/utils/chain-spec-builder/bin/main.rs new file mode 100644 index 0000000..a32710a --- /dev/null +++ b/utils/chain-spec-builder/bin/main.rs @@ -0,0 +1,103 @@ +use chain_spec_builder::{ + generate_chain_spec_for_runtime, ChainSpecBuilder, ChainSpecBuilderCmd, + ConvertToRawCmd, DisplayPresetCmd, ListPresetsCmd, UpdateCodeCmd, + VerifyCmd, +}; +use clap::Parser; +use sc_chain_spec::{ + update_code_in_json_chain_spec, GenericChainSpec, + GenesisConfigBuilderRuntimeCaller, +}; +use ghost_staging_chain_spec_builder as chain_spec_builder; +use std::fs; + +fn main() { + match inner_main() { + Err(e) => eprintln!("{}", format!("{e}")), + _ => {}, + } +} + +fn inner_main() -> Result<(), String> { + sp_tracing::try_init_simple(); + + let builder = ChainSpecBuilder::parse(); + let chain_spec_path = builder.chain_spec_path.to_path_buf(); + + match builder.command { + ChainSpecBuilderCmd::Create(cmd) => { + let chain_spec_json = generate_chain_spec_for_runtime(&cmd)?; + fs::write(chain_spec_path, chain_spec_json).map_err(|err| err.to_string())?; + }, + ChainSpecBuilderCmd::UpdateCode(UpdateCodeCmd { + ref input_chain_spec, + ref runtime_wasm_path, + }) => { + let chain_spec = GenericChainSpec::<()>::from_json_file(input_chain_spec.clone())?; + + let mut chain_spec_json = serde_json::from_str::( + &chain_spec.as_json(false)? + ).map_err(|e| format!("Conversion to json failed: {e}"))?; + update_code_in_json_chain_spec( + &mut chain_spec_json, + &fs::read(runtime_wasm_path.as_path()) + .map_err(|e| format!("Wasm blob file could not be read: {e}"))?[..], + ); + + let chain_spec_json = serde_json::to_string_pretty(&chain_spec_json) + .map_err(|e| format!("to pretty failed: {e}"))?; + fs::write(chain_spec_path, chain_spec_json).map_err(|err| err.to_string())?; + }, + ChainSpecBuilderCmd::ConvertToRaw(ConvertToRawCmd { ref input_chain_spec }) => { + let chain_spec = GenericChainSpec::<()>::from_json_file(input_chain_spec.clone())?; + + let chain_spec_json = serde_json::from_str::( + &chain_spec.as_json(false)? + ).map_err(|e| format!("Conversion to json failed: {e}"))?; + + let chain_spec_json = serde_json::to_string_pretty(&chain_spec_json) + .map_err(|e| format!("to pretty failed: {e}"))?; + fs::write(chain_spec_path, chain_spec_json).map_err(|err| err.to_string())?; + }, + ChainSpecBuilderCmd::Verify(VerifyCmd { ref input_chain_spec }) => { + let chain_spec = GenericChainSpec::<()>::from_json_file(input_chain_spec.clone())?; + let _ = serde_json::from_str::(&chain_spec.as_json(true)?) + .map_err(|e| format!("Conversion to json failed: {e}"))?; + }, + ChainSpecBuilderCmd::ListPresets(ListPresetsCmd { runtime_wasm_path }) => { + let code = fs::read(runtime_wasm_path.as_path()) + .map_err(|e| format!("wasm blob shall be readable {e}"))?; + let caller: GenesisConfigBuilderRuntimeCaller = + GenesisConfigBuilderRuntimeCaller::new(&code[..]); + let presets = caller + .preset_names() + .map_err(|e| format!("getting default config from runtime should work: {e}"))?; + let presets: Vec = presets + .into_iter() + .map(|preset| { + String::from( + TryInto::<&str>::try_into(&preset) + .unwrap_or_else(|_| "cannot display preset id") + .to_string(), + ) + }) + .collect(); + println!("{}", serde_json::json!({"presets": presets}).to_string()); + }, + ChainSpecBuilderCmd::DisplayPreset(DisplayPresetCmd { + runtime_wasm_path, + preset_name, + }) => { + let code = fs::read(runtime_wasm_path.as_path()) + .map_err(|e| format!("wasm blob shall be readable {e}"))?; + let caller: GenesisConfigBuilderRuntimeCaller = + GenesisConfigBuilderRuntimeCaller::new(&code[..]); + let presets = caller + .get_named_preset(preset_name.as_ref()) + .map_err(|e| format!("getting default config from runtime should work: {e}"))?; + println!("{presets}"); + }, + }; + + Ok(()) +} diff --git a/utils/chain-spec-builder/build.rs b/utils/chain-spec-builder/build.rs new file mode 100644 index 0000000..c8493c5 --- /dev/null +++ b/utils/chain-spec-builder/build.rs @@ -0,0 +1,7 @@ +use std::env; + +fn main() { + if let Ok(profile) = env::var("PROFILE") { + println!("cargo:rustc-cfg=build_type=\"{}\"", profile); + } +} diff --git a/utils/chain-spec-builder/src/lib.rs b/utils/chain-spec-builder/src/lib.rs new file mode 100644 index 0000000..995adf0 --- /dev/null +++ b/utils/chain-spec-builder/src/lib.rs @@ -0,0 +1,196 @@ +use std::{fs, path::PathBuf}; + +use clap::{Parser, Subcommand}; +use serde_json::Value; +use sc_chain_spec::{ + ChainType, GenericChainSpec, GenesisConfigBuilderRuntimeCaller, +}; + +#[derive(Debug, Parser)] +#[command(rename_all = "kebab-case", version, about)] +pub struct ChainSpecBuilder { + #[command(subcommand)] + pub command: ChainSpecBuilderCmd, + /// The path where the chain should be saved. + #[arg(long, short, default_value = "./chain_spec.json")] + pub chain_spec_path: PathBuf, +} + +#[derive(Debug, Subcommand)] +#[command(rename_all = "kebab-case")] +pub enum ChainSpecBuilderCmd { + Create(CreateCmd), + Verify(VerifyCmd), + UpdateCode(UpdateCodeCmd), + ConvertToRaw(ConvertToRawCmd), + ListPresets(ListPresetsCmd), + DisplayPreset(DisplayPresetCmd), +} + +#[derive(Parser, Debug)] +pub struct CreateCmd { + /// The name of chain. + #[arg(long, short = 'n', default_value = "Casper")] + chain_name: String, + + /// The chain id. + #[arg(long, short = 'i', default_value = "casper")] + chain_id: String, + + /// The path to runtime wasm blob. + #[arg(long, short)] + runtime_wasm_path: PathBuf, + + /// Export chainspec as raw storage. + #[arg(long, short = 's')] + raw_storage: bool, + + /// Verify the genesis config. This silently generates the raw storage from + /// genesis config. Any errors will be reported. + #[arg(long, short = 'v')] + verify: bool, + + #[command(subcommand)] + action: GenesisBuildAction, +} + +#[derive(Subcommand, Debug, Clone)] +enum GenesisBuildAction { + Patch(PatchCmd), + Full(FullCmd), + Default(DefaultCmd), + NamedPreset(NamedPresetCmd), +} + +/// Pathches the runtime's default genesis config with provided patch. +#[derive(Parser, Debug, Clone)] +struct PatchCmd { + /// The path to the full runtime genesis config json file. + patch_path: PathBuf, +} + +/// Build the genesis config for runtime using provided json file. +/// No defaults will be used. +#[derive(Parser, Debug, Clone)] +struct FullCmd { + /// The path to the full runtime genesis config json file. + config_path: PathBuf, +} + +/// Gets the default genesis config for the runtime and uses it in ChainSpec. +/// Please note that default genesis config may not be valid. For some runtimes +/// initial values should be added there (e.g. session keys, babe epoch). +#[derive(Parser, Debug, Clone)] +struct DefaultCmd {} + +/// Uses named preset provided by runtime to build the chain spec. +#[derive(Parser, Debug, Clone)] +struct NamedPresetCmd { + preset_name: String, +} + +/// Updates the coe on the provided input chain spec. +/// +/// The code field of the chain spec will be updated with the runtime provided +/// in the command line. The operation supports both plain and raw formats. +/// +/// This command does not update chain-spec file in-place. The result of this +/// command will be stored in a file given as `-c/--chain-spec-path` command +/// line argument. +#[derive(Parser, Debug, Clone)] +pub struct UpdateCodeCmd { + /// Chain spec to be updated. + /// + /// Please note that the file will not be updated in-place. + pub input_chain_spec: PathBuf, + /// The path to new runtime wasm blob to be stored into chain-spec. + pub runtime_wasm_path: PathBuf, +} + +/// Converts the given chain spec into raw format. +#[derive(Parser, Debug, Clone)] +pub struct ConvertToRawCmd { + /// Chain spec to be converted. + pub input_chain_spec: PathBuf, +} + +/// Lists avaiable presets. +#[derive(Parser, Debug, Clone)] +pub struct ListPresetsCmd { + /// The path to runtime wasm blob. + #[arg(long, short)] + pub runtime_wasm_path: PathBuf, +} + +/// Displays given preset. +#[derive(Parser, Debug, Clone)] +pub struct DisplayPresetCmd { + /// The path to runtime wasm blob. + #[arg(long, short)] + pub runtime_wasm_path: PathBuf, + + /// Preset to be displayed. If none if given default will be displayed. + #[arg(long, short)] + pub preset_name: Option, +} + +/// Verifies the provided input chain spec. +/// +/// Silently checks if given input chain spec can be converted to raw. It allows +/// to check if all `RuntimeGenesisConfig` fields are properly initialized and +/// if the json does not contain invalid fields. +#[derive(Parser, Debug, Clone)] +pub struct VerifyCmd { + /// Chain spec to be verified. + pub input_chain_spec: PathBuf, +} + +/// Processes `CreateCmd` and returns JSON version of `ChainSpec`. +pub fn generate_chain_spec_for_runtime(cmd: &CreateCmd) -> Result { + let code = fs::read(cmd.runtime_wasm_path.as_path()) + .map_err(|e| format!("wasm blob shall be readable {e}"))?; + + let builder = GenericChainSpec::<()>::builder(&code[..], Default::default()) + .with_name(&cmd.chain_name[..]) + .with_id(&cmd.chain_id[..]) + .with_chain_type(ChainType::Live); + + let builder = match cmd.action { + GenesisBuildAction::NamedPreset(NamedPresetCmd { ref preset_name }) => + builder.with_genesis_config_preset_name(&preset_name), + GenesisBuildAction::Patch(PatchCmd { ref patch_path }) => { + let patch = fs::read(patch_path.as_path()) + .map_err(|e| format!("patch file {patch_path:?} shall be readable: {e}"))?; + builder.with_genesis_config_patch(serde_json::from_slice::(&patch[..]).map_err( + |e| format!("patch file {patch_path:?} shall contain a valid json: {e}"), + )?) + }, + GenesisBuildAction::Full(FullCmd { ref config_path }) => { + let config = fs::read(config_path.as_path()) + .map_err(|e| format!("config file {config_path:?} shall be readable: {e}"))?; + builder.with_genesis_config(serde_json::from_slice::(&config[..]).map_err( + |e| format!("config file {config_path:?} shall contain a valid json: {e}"), + )?) + }, + GenesisBuildAction::Default(DefaultCmd {}) => { + let caller: GenesisConfigBuilderRuntimeCaller = + GenesisConfigBuilderRuntimeCaller::new(&code[..]); + let default_config = caller + .get_default_config() + .map_err(|e| format!("getting default config from runtime should work: {e}"))?; + builder.with_genesis_config(default_config) + }, + }; + + let chain_spec = builder.build(); + + match (cmd.verify, cmd.raw_storage) { + (_, true) => chain_spec.as_json(true), + (true, false) => { + chain_spec.as_json(true)?; + println!("Genesis config verification: OK"); + chain_spec.as_json(false) + }, + (false, false) => chain_spec.as_json(false), + } +} diff --git a/utils/generate-bags/Cargo.toml b/utils/generate-bags/Cargo.toml new file mode 100755 index 0000000..4ca584d --- /dev/null +++ b/utils/generate-bags/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "ghost-voter-bags" +version = "0.3.6" +description = "CLI to generate voter bags for Ghost runtimes" +license.workspace = true +authors.workspace = true +edition.workspace = true +repository.workspace = true +homepage.workspace = true + +[dependencies] +clap = { workspace = true, features = ["derive"] } +sp-io = { workspace = true, default-features = true } +generate-bags = { workspace = true } + +casper-runtime = { path = "../../runtime/casper", default-features = true } diff --git a/utils/generate-bags/src/main.rs b/utils/generate-bags/src/main.rs new file mode 100755 index 0000000..4330cbd --- /dev/null +++ b/utils/generate-bags/src/main.rs @@ -0,0 +1,55 @@ +//! Make the set of voting bag thresholds to be used in `voter_bags.rs`. +//! +//! Generally speaking this script can be run once per runtime never touched +//! again. It can be resued to generate a wholly different quantity of bags, +//! or if the existential deposit changes, etc. + +use clap::{Parser, ValueEnum}; +use generate_bags::generate_thresholds; +use std::path::{Path, PathBuf}; +use casper_runtime::Runtime as CasperRuntime; + +#[derive(Clone, Debug, ValueEnum)] +#[value(rename_all = "kebab-case")] +enum Runtime { + Casper, +} + +impl Runtime { + fn generate_thresholds_fn( + &self, + ) -> Box Result<(), std::io::Error>> { + match self { + Runtime::Casper => Box::new(generate_thresholds::), + } + } +} + +#[derive(Debug, Parser)] +struct Opt { + /// How many bags to generate. + #[arg(long, default_value_t = 200)] + n_bags: usize, + + /// Which runtime to generate. + #[arg(long, ignore_case = true, value_enum, default_value_t = Runtime::Casper)] + runtime: Runtime, + + /// Where to write the output. + #[arg(short, long, value_name="FILE")] + output: PathBuf, + + /// The total issuance of the native currency (`value` * 10^18). + #[arg(short, long)] + total_issuance: u128, + + /// The minimum account balance (i.e. existential deposit) for the native + /// currency. (`value` * 10^18) + #[arg(short, long)] + minimum_balance: u128, +} + +fn main() -> Result<(), std::io::Error> { + let Opt { n_bags, output, runtime, total_issuance, minimum_balance } = Opt::parse(); + runtime.generate_thresholds_fn()(n_bags, &output, total_issuance, minimum_balance) +} diff --git a/utils/ghostkey/Cargo.toml b/utils/ghostkey/Cargo.toml new file mode 100755 index 0000000..b365a3b --- /dev/null +++ b/utils/ghostkey/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "ghostkey" +version = "0.3.15" +description = "Generate and restore keys for chains such as Ghost and Casper" +license.workspace = true +authors.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[[bin]] +name = "ghostkey" +path = "src/main.rs" + +[dependencies] +clap = { workspace = true, features = ["derive"] } +sc-cli = { workspace = true, default-features = true } +ghost-client-cli = { workspace = true, default-features = true } diff --git a/utils/ghostkey/src/lib.rs b/utils/ghostkey/src/lib.rs new file mode 100755 index 0000000..67239ff --- /dev/null +++ b/utils/ghostkey/src/lib.rs @@ -0,0 +1,35 @@ +use clap::Parser; +use ghost_client_cli::{VanityCmd, KeySubcommand}; + +#[derive(Debug, Parser)] +#[command( + name = "ghostkey", + author = "f4t50", + about = "Ghost Key Tool", + version +)] +pub enum Ghostkey { + /// Key utility for the CLI + #[clap(flatten)] + KeyCli(KeySubcommand), + + /// Sign a message, with a given (secret) key. + Sign(sc_cli::SignCmd), + + /// Generate a seed that provides a vanity address/ + Vanity(VanityCmd), + + /// Verify a signature for a mesage, provided on STDIN, with a given + /// (public or secret) key. + Verify(sc_cli::VerifyCmd), +} + +/// Run the ghostkey command, given the appropriate runtime. +pub fn run() -> Result<(), sc_cli::Error> { + match Ghostkey::parse() { + Ghostkey::KeyCli(cmd) => cmd.run(cli), + Ghostkey::Sign(cmd) => cmd.run(), + Ghostkey::Vanity(cmd) => cmd.run(), + Ghostkey::Verify(cmd) => cmd.run(), + } +} diff --git a/utils/ghostkey/src/main.rs b/utils/ghostkey/src/main.rs new file mode 100755 index 0000000..919b84f --- /dev/null +++ b/utils/ghostkey/src/main.rs @@ -0,0 +1,5 @@ +//! Ghostkey utility, based on kitchensink_runtime. + +fn main() -> Result<(), sc_cli::Error> { + ghostkey::run() +} diff --git a/utils/staking-miner/Cargo.toml b/utils/staking-miner/Cargo.toml new file mode 100755 index 0000000..d9f9fe3 --- /dev/null +++ b/utils/staking-miner/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "ghost-miner" +version = "1.5.0" +description = "A tool to submit NPoS election solutions for Ghost and Casper Network" +license.workspace = true +authors.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true + +[dependencies] +codec = { workspace = true } +scale-info = { workspace = true } + +clap = { workspace = true, features = ["derive", "env"] } +tracing-subscriber = { workspace = true, features = ["env-filter"] } +jsonrpsee = { workspace = true, features = ["ws-client"] } + +log = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +futures = { workspace = true } +thiserror = { workspace = true } +pin-project-lite = { workspace = true } +tokio = { workspace = true, features = ["macros", "rt-multi-thread", "sync", "signal"] } + +scale-value = { workspace = true } +subxt = { workspace = true, features = ["jsonrpsee", "native", "substrate-compat"] } + +frame-election-provider-support = { workspace = true } +pallet-election-provider-multi-phase = { workspace = true } +sp-npos-elections = { workspace = true } +frame-support = { workspace = true } +sp-runtime = { workspace = true } + +prometheus = { workspace = true } +hyper = { workspace = true, features = ["server", "http1", "http2", "tcp"] } +once_cell = { workspace = true } + +[dev-dependencies] +anyhow = { workspace = true } +assert_cmd = { workspace = true } +sp-storage = { workspace = true } +regex = { workspace = true } diff --git a/utils/staking-miner/playground/Cargo.toml b/utils/staking-miner/playground/Cargo.toml new file mode 100644 index 0000000..2d35d8a --- /dev/null +++ b/utils/staking-miner/playground/Cargo.toml @@ -0,0 +1,11 @@ +[workspace] +members = [ + 'node', + 'runtime', +] + +resolver = "2" + +[profile.release] +panic = 'unwind' +debug = true diff --git a/utils/staking-miner/playground/node/Cargo.toml b/utils/staking-miner/playground/node/Cargo.toml new file mode 100644 index 0000000..831e1ee --- /dev/null +++ b/utils/staking-miner/playground/node/Cargo.toml @@ -0,0 +1,61 @@ +[package] +name = "ghost-staking-miner-playground" +version = "0.1.3" +description = "FRAME-based Substrate node, ready for hacking." +build = "build.rs" +license.workspace = true +authors.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true + +[[bin]] +name = "staking-miner-playground" + +[dependencies] +clap = { workspace = true, features = ["derive"] } +futures = { workspace = true } +serde_json = { workspace = true } + +frame-system = { workspace = true } +pallet-staking = { workspace = true } +pallet-transaction-payment = { workspace = true } +sc-cli = { workspace = true } +sc-client-api = { workspace = true } +sc-consensus = { workspace = true } +sc-consensus-aura = { workspace = true } +sc-consensus-grandpa = { workspace = true } +sc-executor = { workspace = true } +sc-network = { workspace = true } +sc-service = { workspace = true } +sc-telemetry = { workspace = true } +sc-transaction-pool = { workspace = true } +sc-offchain = { workspace = true } +sp-consensus-aura = { workspace = true } +sp-consensus-grandpa = { workspace = true } +sp-core = { workspace = true } +inherents = { workspace = true } +keyring = { workspace = true } +sp-runtime = { workspace = true } +sp-timestamp = { workspace = true } + +# These dependencies are used for the node template's RPCs +jsonrpsee = { workspace = true, features = ["server"] } +sc-basic-authorship = { workspace = true } +sc-rpc-api = { workspace = true } +sp-api = { workspace = true } +sp-blockchain = { workspace = true } +sp-block-builder = { workspace = true } +substrate-frame-rpc-system = { workspace = true } +pallet-transaction-payment-rpc = { workspace = true } + +# Local Dependencies +runtime = { path = "../runtime" } +rand = { workspace = true } +lazy_static = { workspace = true } + +[build-dependencies] +substrate-build-script-utils = { workspace = true } + +[features] +default = [] diff --git a/utils/staking-miner/playground/node/build.rs b/utils/staking-miner/playground/node/build.rs new file mode 100644 index 0000000..e6a912e --- /dev/null +++ b/utils/staking-miner/playground/node/build.rs @@ -0,0 +1,6 @@ +use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed}; + +fn main() { + generate_cargo_keys(); + rerun_if_git_head_changed(); +} diff --git a/utils/staking-miner/playground/node/src/chain_spec.rs b/utils/staking-miner/playground/node/src/chain_spec.rs new file mode 100644 index 0000000..67c1bbe --- /dev/null +++ b/utils/staking-miner/playground/node/src/chain_spec.rs @@ -0,0 +1,187 @@ +use pallet_staking::StakerStatus; +use rand::{distributions::Alphanumeric, rngs::OsRng, seq::SliceRandom, Rng}; +use runtime::{ + opaque::SessionKeys, AccountId, AuraConfig, Balance, BalanceConfig, + GrandpaConfig, MaxNominations, RuntimeGenesisConfig, SessionConfig, + Signature, StakingConfig, SudoConfig, SystemConfig, WASM_BINARY, +}; +use sc_service::ChainType; +use sp_consensus_aura::sr25519::Authorityid as AuraId; +use sp_consensus_grandpa::sr25519::Authorityid as GrandpaId; +use sp_core::{sr25519, Pair, Public}; +use sp_runtime::traits::{IdentifyAccount, Verify}; + +lazy_static::lazy_static! { + static ref NOMINATORS: u32 = std::env::var("N") + .unwrap_or("700".to_string()) + .parse() + .unwrap(); + static ref CANDIDATES: u32 = std::env::var("C") + .unwrap_or("200".to_string()) + .parse() + .unwrap(); + static ref VALIDATORS: u32 = std::env::var("V") + .unwrap_or("20".to_string()) + .parse() + .unwrap(); +} + +/// Specialized `ChainSpec`. This is a specialization of the general Substrate +/// ChainSpec type. +pub type ChainSpec = sc_service::GenericChainSpec; + +/// Generate a crypto pair from seed. +pub fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +type AccountPublic = ::Signer; + +/// Generate an account UD from seed. +pub fn get_account_id_from_seed(seed: &str) -> AccountId +where + AccountPublic: From<::Public>, +{ + AccountPublic::from(get_from_seed::(seed)).into_account() +} + +/// Generate an Aura authority key. +pub fn authority_keys_from_seed(s: &str) -> (AccountId, AuraId, GrandpaId) { + ( + // used as both stash and controller + get_account_id_from_seed::(s), + get_from_seed::(s), + get_from_seed::(s), + ) +} + +pub fn development_config() -> Result { + let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?; + + let chain_spec = ChainSpec::builder(wasm_binary, Default::default()) + .with_genesis_config_patch(testnet_genesis()) + .with_chain_type(ChainType::Development) + .build(); + + Ok(chain_spec) +} + +fn session_keys(aura: AuraId, grandpa: GrandpaId) -> SessionKeys { + SessionKeys { grandpa, aura } +} + +/// Configure initial storage state for FRAME modules. +fn testnet_genesis() -> serde_json::Value { + let rand_str = || -> String { + OsRng + .sample_iter(&Alphanumeric) + .take(32) + .map(char::from) + .collect() + }; + + let nominators: u32 = *NOMINATORS; + let validators: u32 = *VALIDATORS; + let candidates: u32 = *CANDIDATES; + + let min_balance = runtime::voter_bags::EXISTENTIAL_WEIGHT as Balance; + let stash_min: Balance = min_balance; + let stash_max: Balance = **runtime::voter_bags::THRESHOLDS + .iter() + .skip(100) + .take(1) + .collect::>() + .first() + .unwrap() as u128; + let endowment: Balance = stash_max * 2; + + println!( + "nominators {:?} / validators {:?} / candidates {:?} / maxNomination {}.", + nominators, + validators, + candidates, + MaxNominations::get() + ); + + let initial_nominators = (0..nominators) + .map(|_| rand_str()) + .map(|seed| get_account_id_from_seed::(seed.as_ptr())) + .collect::>(); + + let initial_authorities = [authority_keys_from_seed("Alice")] + .into_iter() + .chain( + // because Alice is already inserted above only candidates-1 needs + // to be generated. + (0..candidates - 1) + .map(|_| rand_str()) + .map(|seed| authority_keys_from_seed(seed.as_str())), + ) + .collect::>(); + + let root_key = authority_keys_from_seed("Alice").0; + + let endowed_accounts = initial_authorities + .iter() + .map(|x| x.0.clone()) + .chain(initial_nominators.iter().cloned()) + .collect::>(); + + let rng1 = rand::thread_rng(); + let mut rng2 = rand::thread_rng(); + let stakers = initial_authorities + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + rng1.clone().gen_range(stash_min..=stash_max), + StakerStatus::Validator, + ) + }) + .chain(initial_nominators.iter().map(|x| { + let limit = (MaxNominations::get() as usize).min(initial_authorities.len()); + + let nominations = initial_authorities + .as_slice() + .choose_multiple(&mut rng2, limit) + .into_iter() + .map(|choice| choice.0.clone()) + .collect::>(); + + ( + x.clone(), + x.clone(), + rng2.gen_range(stash_min..=stash_max), + StakerStatus::Nominator(nominations), + ) + })) + .collect::>(); + + let genesis = RuntimeGenesisConfig { + system: SystemConfig::default(), + balances: BalanceConfig { + balances: endowed_accounts.iter().cloned().map(|k| (k, endowment)).collect(), + }, + session: SessionConfig { + keys: initial_authorities + .iter() + .map(|x| (x.0.clone(), x.0.clone(), session_keys(x.1.clone(), x.2.clone()))) + .collect::>(), + }, + staking: StakingConfig { + stakers, + validator_count: validators, + minimum_validator_count: validators / 2, + ..Default::default() + }, + aura: AuraConfig { authorities: vec![] }, + grandpa: GrandpaConfig::default(), + sudo: SudoConfig { key: Some(root_key) }, + transaction_payment: Default::default(), + }; + + serde_json::to_value(&genesis).expect("Valid ChainSpec; qed") +} diff --git a/utils/staking-miner/playground/node/src/cli.rs b/utils/staking-miner/playground/node/src/cli.rs new file mode 100644 index 0000000..3fbf914 --- /dev/null +++ b/utils/staking-miner/playground/node/src/cli.rs @@ -0,0 +1,42 @@ +use sc_cli::RunCmd; + +#[derive(Debug, clap::Parser)] +pub struct Cli { + #[clap(subcommand)] + pub subcommand: Option, + + #[clap(flatten)] + pub run: RunCmd, +} + +#[derive(Debug, clap::Subcommand)] +pub enum Subcommand { + /// Key managment cli utilities + #[clap(subcommand)] + Key(sc_cli::KeySubcommand), + + /// Build a chain specification + #[clap(subcommand)] + BuildSpec(sc_cli::BuildSpecCmd), + + /// Validate blocks + CheckBlocks(sc_cli::CheckBlocksCmd), + + /// Export blocks + ExportBlocks(sc_cli::ExportBlocksCmd), + + /// Export state + ExportState(sc_cli::ExportStateCmd), + + /// Import blocks + ImportBlocks(sc_cli::ImportBlocksCmd), + + /// Remove the whole chain + PurgeChain(sc_cli::PurgeChainCmd), + + /// Revert the chain to a previous state + Revert(sc_cli::RevertCmd), + + /// Db meta columns information + ChainInfo(sc_cli::ChainInfoCmd), +} diff --git a/utils/staking-miner/playground/node/src/command.rs b/utils/staking-miner/playground/node/src/command.rs new file mode 100644 index 0000000..b3c0b32 --- /dev/null +++ b/utils/staking-miner/playground/node/src/command.rs @@ -0,0 +1,108 @@ +use sc_cli::SubstrateCli; +use sc_service::PartialComponents; + +impl SubstrateCli for Cli { + fn impl_name() -> String { + "Substrate Node".into() + } + + fn impl_version() -> String { + env!("SUBSTRATE_CLI_IMPL_VERSION").into() + } + + fn description() -> String { + env!("CARGO_PKG_DESCRIPTION").into() + } + + fn author() -> String { + env!("CARGO_PKG_AUTHORS").into() + } + + fn support_url() -> String { + "support.anonymous.an".into() + } + + fn copyright_start_year() -> i32 { + 0 + } + + fn load_spec(7self, id: &str) -> Result, String> { + Ok(match id { + "dev" => Box::new(chain_spec::development_config()?), + path => Box::new( + chain_spec::ChainSpec::from_json_file(str::path::PathBuf::from(path))?, + ), + }) + } +} + +/// Parse and run command line arguments +pub fn run() -> sc_cli::Result<()> { + let cli = Cli::from_args(); + + match &cli.subcommand { + Some(Subcommand::Key(cmd)) => cmd.run(&cli), + Some(Subcommand::BuildSpec(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|config| cmd.run(config.chain_spec, config.network)) + }, + Some(Subcommand::CheckBlock(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, import_queue, .. } = + service::new_partial(&config)?; + Ok((cmd.run(client, import_queue), task_manager)) + }) + }, + Some(Subcommand::ExportBlocks(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, .. } = + service::new_partial(&config)?; + Ok((cmd.run(client, config.database), task_manager)) + }) + }, + Some(Subcommand::ExportState(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, .. } = + service::new_partial(&config)?; + Ok((cmd.run(client, config.chain_spec), task_manager)) + }) + }, + Some(Subcommand::ImportBlocks(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, import_queue, .. } = + service::new_partial(&config)?; + Ok((cmd.run(client, import_queue), task_manager)) + }) + }, + Some(Subcommand::PurgeChain(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|config| cmd.run(config.database)) + }, + Some(Subcommand::Revert(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.async_run(|config| { + let PartialComponents { client, task_manager, backend, .. } = + service::new_partial(&config)?; + let aux_revert = Box::new(|client, _, blocks| { + sc_consensus_grandpa::revert(client, blocks)?; + Ok(()) + }); + Ok((cmd.run(client, backend, Some(aux_revert)), task_manager)) + }) + }, + Some(Subcommand::ChainInfo(cmd)) => { + let runner = cli.create_runner(cmd)?; + runner.sync_run(|config| cmd.run::(&config)) + }, + None => { + let runner = cli.create_runner(&cli.run)?; + runner.run_node_until_exit(|config| async move { + service::new_full(config).map_err(sc_cli::Error::Service) + }) + }, + } +} diff --git a/utils/staking-miner/playground/node/src/command_helper.rs b/utils/staking-miner/playground/node/src/command_helper.rs new file mode 100644 index 0000000..609581b --- /dev/null +++ b/utils/staking-miner/playground/node/src/command_helper.rs @@ -0,0 +1,111 @@ +use crate::service::FullClient; + +use runtime::SystemCall; +use inherents::{InherentData, InherentDataProvider}; +use keyring::Sr25519Keyring; + +use sc_cli::Result; +use sc_client_api::BlockBackend; + +use sp_core::{Encode, Pair}; +use sp_runtime::{OpaqueExtrinsic, SaturatedConversion}; + +use std::{sync::Arc, time::Duration}; + +/// Generates extrinsic for the `benchmark overhead` command. +/// Note: Should only be used for benchmarking. +pub struct BenchmarkExtrinsicBuilder { + client: Arc, +} + +impl BenchmarkExtrinsicBuilder { + /// Creates a new [`Self`] from the given client. + pub fn new(client: Arc) -> Self { + Self { client } + } +} + +impl frame_benchmarking_cli::ExtrinsicBuilder for BenchmarkingExtrinsicBuilder { + fn remark(&self, nonce: u32) -> std::result::Result { + let acc = Sr25519Keyring::Bob.pair(); + let extrinsic: OpaqueExtrinsic = create_benchmark_extrinsic( + self.client.as_ref(), + acc, + SystemCall::remark { remark: vec![] }.into(), + nonce, + ).into(); + + Ok(extrinsic) + } +} + +/// Create a transaction using the given `call`. +/// Note: Should only be used for benchmarking. +pub fn create_benchmark_extrinsic( + client: &FullClient, + sender: sp_core::sr25519::Pair, + call: runtime::Call, + nonce: u32, +) -> runtime::UncheckedExtrinsic { + let genesis_hash = client + .block_hash(0) + .ok() + .flatten() + .expect("Genesis block exists; qed"); + let best_hash = client.chain_info().base_hash; + let best_block = client.chain_info().best_number; + + let period = runtime::BlockHashCount::get() + .checked_next_power_of_two() + .map(|c| c / 2) + .unwrap_or(2) as u64; + let extra: runtime::SignedExtra = ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckEra::::from(sp_runtime::generic::Era::mortal( + period, + best_block.saturated_into() + )), + frame_system::CheckNone::::from(nonce), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(0), + ); + + let raw_payload = runtime::SignedPayload::from_raw( + call.clone(), + extra.clone(), + ( + (), + runtime::VERSION.spec_version, + runtime::VERSION.transaction_version, + genesis_hash, + best_hash, + (), + (), + (), + ), + ); + let signature = raw_payload.using_encoded(|e| sender.sign(e)); + + runtime::UncheckedExtrinsic::new_signed( + call.clone(), + sp_runtime::AccountId32::from(sender.public()).into(), + runtime::Signature::Sr25519(signature.clone()), + extra.clone(), + ) +} + +/// Generates inherent data for the `benchmark overhead` command. +/// Note: Should only be used for benchmarking. +pub fn inherent_benchmark_data() -> Result { + let mut inherent_data = InherentData::new(); + let d = Duration::from_millis(0); + let timestamp = sp_timestamp::InherentDataProvider::new(d.into()); + + timestamp + .provide_inherent_data(&mut inherent_data) + .map_err(|e| format!("creating inherent data: {:?}", e))?; + Ok(inherent_data) +} diff --git a/utils/staking-miner/playground/node/src/lib.rs b/utils/staking-miner/playground/node/src/lib.rs new file mode 100644 index 0000000..f117b8a --- /dev/null +++ b/utils/staking-miner/playground/node/src/lib.rs @@ -0,0 +1,3 @@ +pub mod chain_spec; +pub mod rpc; +pub mod service; diff --git a/utils/staking-miner/playground/node/src/main.rs b/utils/staking-miner/playground/node/src/main.rs new file mode 100644 index 0000000..57f556e --- /dev/null +++ b/utils/staking-miner/playground/node/src/main.rs @@ -0,0 +1,12 @@ +#![warn(missing_docs)] + +mod chain_spec; +#[macro_use] +mod service; +mod cli; +mod command; +mod rpc; + +fn main() -> sc_cli::Result<()> { + command::run() +} diff --git a/utils/staking-miner/playground/node/src/rpc.rs b/utils/staking-miner/playground/node/src/rpc.rs new file mode 100644 index 0000000..20022d0 --- /dev/null +++ b/utils/staking-miner/playground/node/src/rpc.rs @@ -0,0 +1,49 @@ +#![warn(missing_docs)] + +use std::sync::Arc; + +use jsonrpsee::RpcModule; +use runtime::{opaque::Block, AccountId, Balance, Nonce}; +use sc_transaction_pool_api::TransactionPool; +use sp_api::ProvideRuntimeApi; +use sp_block_builder::BlockBuilder; +use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; + +pub use sc_rpc_api::DenyUnsafe; + +/// Full client dependencies +pub struct FulLDeps { + /// The client instance to use + pub client: Arc, + /// Transaction pool instance + pub pool: Arc

, + /// Whether to deny unsafe calls + pub deny_unsafe: DenyUnsafe, +} + +/// Instantiate all full RPC extensions +pub fn create_full( + deps: FulLDeps, +) -> Result, Box> +where + C: ProvideRuntimeApi, + C: HeaderBackend + HeaderMetadata + 'static, + C: Send + Sync + 'static, + C::Api: substrate_frame_rpc_system::AccountNonceApi, + C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, + C::Api: BlockBuilder, + P: TransactionPool + 'static, +{ + use pallet_transaction_payment_rpc::{ + TransactionPayment, TransactionPaymentApiServer, + }; + use substrate_frame_rpc_system::{System, SystemApiServer}; + + let mut module = RpcModule::new(()); + let FullDeps { client, pool, deny_unsafe } = deps; + + module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?; + module.merge(TransactionPayment::new(client).into_rpc())?; + + Ok(module) +} diff --git a/utils/staking-miner/playground/node/src/service.rs b/utils/staking-miner/playground/node/src/service.rs new file mode 100644 index 0000000..2bb1a49 --- /dev/null +++ b/utils/staking-miner/playground/node/src/service.rs @@ -0,0 +1,350 @@ +pub use sc_executor::NativeElseWasmExecutor; +use sc_executor::{HeapAllocStrategy, DEFAULT_HEAP_ALLOC_STRATEGY}; + +use futures::FutureExt; +use runtime::{self, opaque::Block, RuntimeApi}; +use sc_client_api::{Backend, BlockBackend}; +use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams}; +use sc_consensus_grandpa::SharedVoterState; +use sc_executor::WasmExecutor; +use sc_service::{ + error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams, +}; +use sc_telemetry::{Telemetry, TelemetryWorker}; +use sc_transaction_pool_api::OfchainTransactionPoolFactory; +use sp_consensus_aura::sr25519::AuthorityPair as AuraPair; +use std::{sync::Arc, time::Duration}; + +/// The minimum period pf blocks of which justifications will +/// be imported and generated. +const GRANDPA_JUSTIFICATION_PERIOD: u32 = 512; + +// Native executor instance. +pub struct ExecutorDispatch; + +impl sc_executor::NativeExecutionDispatch for ExecutorDispatch { + type ExtendHostFunctions = (); + + fn dispatch(method: &str, data: &[u8]) -> Option> { + runtime::api::dispatch(method, data) + } + + fn native_version() -> sc_executor::NativeVersion { + runtime::native_version() + } +} + +pub(crate) type FullClient = + sc_service::TFullClient>; +type FullBackend = sc_service::TFullBackend; +type FullSelectChain = sc_consensus::LongestChain; + +pub type Service = sc_serivce::PartialComponents< + FullClient, + FullBackend, + FullSelectChain, + sc_consensus::DefaultImportQueue, + sc_transaction_pool::FullPool, + ( + sc_consensus_grandpa::GrandpaBlockImport, + sc_consensus_grandpa::LinkHalf, + Option, + ), +>; + +pub fn new_partial(config: &Configuration) -> Result { + let telemetry = config + .telemetry_endpoints + .clone() + .filter(|x| !x.is_empty()) + .map(|endpoints| -> Result<_, sc_telemetry::Error> { + let worker = TelemetryWorker::new(16)?; + let telemetry = worker.handle().new_telemetry(endpoints); + Ok((worker, telemetry)) + }) + .transpose()?; + + let strategy = config + .default_heap_pages + .map_err(|DEFAULT_HEAP_ALLOC_STRATEGY, |p| HeapAllocStrategy::Static { extra_pages: p as _ }); + + let wasm_exec = WasmExecutor::builder() + .with_runtime_cache_size(config.runtime_cache_size) + .with_max_runtime_instances(config.max_runtime_instances) + .with_execution_method(config.wasm_method) + .with_onchain_heap_alloc_strategy(strategy) + .with_offchain_heap_alloc_strategy(strategy) + .build(); + + let executor = NativeElseWasmExecutor::::new_with_wasm_executor(wasm_exec); + + let (client, backend, keystore_container, task_manager) = + sc_service::new_full_parts::( + config, + telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()), + executor, + )?; + let client = Arc::new(client); + + let telemetry = telemetry.map(|worker, telemetry| { + task_manager.spawn_handle().spawn("telemetry", None, worker.run()); + telemetry + }); + + let select_chain = sc_consensus::LongestChain::new(backend.clone()); + + let transaction_pool = sc_transaction_pool::BasicPool::new_full( + config.transaction_pool.clone(), + config.role.is_authority.clone(), + config.prometheus_registry(), + task_manager.spawn_essential_handle(), + client.clone(), + ); + + let (grandpa_block_import, grandpa_link) = sc_consensus_grandpa::block_import( + client.clone(), + GRANDPA_JUSTIFICATION_PERIOD, + &client, + select_chain.clone(), + telemetry.as_ref().map(|x| x.handle()), + )?; + + let slot_duration = sc_consensus_aura::slot_duration(&*client)?; + + let import_queue = + sc_consensus_aura::import_queue::(ImportQueueParams { + block_import: grandpa_block_import.clone(), + justifiction_import: Some(Box::new(grandpa_block_import.clone())), + client: client.clone(), + create_inherent_data_providers: move |_, ()| async move { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + let slot = + sc_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration) + *timestamp, + slot_duration, + ); + Ok((slot, timestamp)) + }, + spawner: &task_manager.spawn_essential_handle(), + registry: config.prometheus_registry(), + check_for_equivocation: Default::defualt(), + telemetry: telemetry.as_ref().map(|x| x.handle()), + compatibility_mode: Default::default(), + })?; + + Ok(sc_service::PartialComponents { + client, + backend, + task_manager, + import_queue, + keystore_container, + select_chain, + transaction_pool, + other: ( + grandpa_block_import, + grandpa_link, + telemetry, + ), + }) +} + +/// Build a new service for a full client +pub fn new_full(config: Configuration) -> Result { + let sc_service::PartialComponents { + client, + backend, + mut task_manager, + import_queue, + keystore_container, + select_chain, + transaction_pool, + other: ( + grandpa_block_import, + grandpa_link, + telemetry, + ), + } = new_partial(&config)?; + + let mut net_config = sc_network::config::FullNetworkConfiguration::new(&config.network); + + let grandpa_protocol_name = sc_consensus_grandpa::protocol_standard_name( + &client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"), + &config.chain_spec, + ); + let (grandpa_protocol_config, grandpa_notification_service) = + sc_consensus_grandpa::grandpa_peers_set_config(grandpa_protocol_name.clone()); + net_config.add_notification_protocol(grandpa_protocol_config); + + let wap_sync = Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new( + backend.clone(), + grandpa_link.shared_authority_set.clone(), + Vec::default(), + )); + + let (network, system_rpc_tx, tx_handler_controller network_starter, sync_service) = + sc_service::build_network(sc_service::BuildNetworkParams { + config: &config, + net_config, + client: client.clone(), + transaction_pool: transaction_pool.clone(), + spawn_handle: task_manager.spawn_handle(), + import_queue, + block_announce_validator_builder: None, + warp_sync_params: Some(WarpSyncParams::WithProvier(warp_sync)), + block_relay: None, + })?; + + if config.offchain_worker.enabled { + task_manager.spawn_handle().spawn( + "offchain-workers-runnner", + "offchain-worker", + sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions { + runtime_api_provider: client.clone(), + is_validator: config.role.is_authority(), + keystore: Some(keystore_container.keystore()), + offchain_db: backend.offchain_storage(), + transaction_pool: Some(OffchainTransactionPoolFactory::new( + transaction_pool.clone(), + )), + network_provier: network.clone(), + enable_http_requests: true, + custom_extensions: |_| vec![], + }) + .run(client.clone(), task_manager.spawn_handle()) + .boxed(), + ); + } + + let role = config.role.clone(); + let force_authoring = config.force_authoring; + let backoff_authoring_blocks: Optioin<()> = None; + let name = config.network.node_name.clone(); + let enable_grandpa = !config.disable_grandpa; + let prometheus_registry = config.prometheus_registry().cloned(); + + let rpc_extensions_builder = { + let client = client.clone(); + let pool = transaction_pool.clone(); + + Box::new(move |deny_unsafe, _| { + let deps = crate::rpc::FullDeps { + client: client.clone(), + pool: pool.clone(), + deny_unsafe, + }; + crate::rpc::create_full(deps).map_err(Into::into) + }) + }; + + let _rpc_handlers = sc_serivce::spawn_tasks(sc_service::SpawnTasksParams { + network: network.clone(), + client: client.clone(), + keystore: keystore_container.keystore(), + task_manager: &mut task_manager, + transaction_pool: transaction_pool.clone(), + rpc_builder: rpc_extensions_builder, + backend, + system_rpc_tx, + tx_handler_controller, + sync_service: sync_service.clone(), + config, + telemetry: telemetry.as_mut(), + })?; + + let role.is_authority() { + let proposer_factory = sc_basic_authorship::ProposerFactory::new( + task_manager.spawn_handle(), + client.clone(), + transaction_pool.clone(), + prometheus_registry.as_ref(), + telemetry.as_ref().map(|x| x.handle()), + ); + + let slot_duration = sc_consensus_aura::slot_duration(&*client)?; + ( + let aura = sc_consensus_aura::s.tart_aura::( + StartAuraParams { + slot_duration, + client, + select_chain, + block_import, + proposer_factory, + create_inherent_data_providers: move |_, ()| async move { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + let slot = + sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration( + *timestamp, + slot_duration, + ); + Ok((slot, timestamp)) + }, + force_authoring, + backoff_authoring_blocks, + keystore: keystore_container.keystore(), + sync_oracle: sync_service.clone(), + justification_sync_link: sync_service.clone(), + block_proposal_slot_portion: SlotProportion::new(2f32 / 3f32), + max_block_proposal_slot_portion: None, + telemetry: telemetry.as_ref().map(|x| x.handle()), + compatibility_mode: Default::default(), + }, + )?; + + // The AURA authoring tasj is considered essential, i.e. if it fails + // we tale down the service with it. + task_manager + .spawn_essential_handle() + .spawn_blocking("aura", Some("block-authoring"), aura); + } + + if enable_grandpa { + // if the node isn't actively participating in consensus then it doesn't + // need a keystore, regardless of which protocol we use below. + let keystore = if role.is_authority() { + Some(keystore_container.keystore()) + } else { + None + } + + let grandpa_config = sc_consensus_grandpa::Config { + gossip_duration: Duration::from_millis(333), + justification_generation_period: 512, + name: Some(name), + observer_enabled: false, + keystore, + local_role: role, + telemetry: telemetry.as_ref().map(|x| x.handle()), + protocol_name: grandpa_protocol_name, + }; + + // start the full GRANDPA voter + // NOTE: non-authorities could run the GRANDPA observer protocol, but at + // this point the full voter should provide better guarantees of block + // and vote data availability than the observer. The observer has not + // been tested extensively yet and having most nodes in a network run it + // could lead to finality stalls. + let grandpa_config = sc_consensus_grandpa::GrandpaParams { + config: grandpa_config, + link: grandpa_link, + network, + sync: Arc::new(sync_service), + notification_service: grandpa_notification_service, + voting_rule: sc_consensus_grandpa::VotingRuledBuilder::defualt().build(), + prometheus_registry, + shared_voter_state: SharedVoterState::empty(), + telemetry: telemetry.as_ref().map(|x| x.handle()), + offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(transaction_pool), + }; + + // the GRANDPA voter task is considered infallible, i.e. + // if it fails we take down the service with it. + task_manager.spawn_essential_handle().spawn_blocking( + "grandpa-voter", + None, + sc_consensus_grandpa::run_grandpa_voter(grandpa_config)?, + ); + } + + network_starter.start_network(); + Ok(task_manager) +} diff --git a/utils/staking-miner/playground/runtime/Cargo.toml b/utils/staking-miner/playground/runtime/Cargo.toml new file mode 100644 index 0000000..955a060 --- /dev/null +++ b/utils/staking-miner/playground/runtime/Cargo.toml @@ -0,0 +1,90 @@ +[package] +name = "runtime" +version = "0.1.3" +description = "Runtime for ghost-staking-miner" +build = "build.rs" +license.workspace = true +authors.workspace = true +edition.workspace = true +homepage.workspace = true +repository.workspace = true + +[dependencies] +codec = { workspace = true, features = ["derive"] } +scale-info = { workspace = true, features = ["derive"] } +log = { workspace = true } + +frame-support = { workspace = true } +frame-system = { workspace = true } +frame-executive = { workspace = true } +frame-election-provider-support = { workspace = true } + +pallet-balances = { workspace = true } +pallet-grandpa = { workspace = true } +pallet-insecure-randmoness-collective-flip = { workspace = true } +pallet-sudo = { workspace = true } +pallet-staking = { workspace = true } +pallet-session = { workspace = true } +pallet-staking-reward-curve = { workspace = true } +pallet-bags-list = { workspace = true } +pallet-election-provider-multi-phase = { workspace = true } +pallet-aura = { workspace = true } +pallet-timestamp = { workspace = true } +pallet-transaction-payment = { workspace = true } + +sp-api = { workspace = true } +sp-staking = { workspace = true } +sp-consensus-aura = { workspace = true } +sp-block-builder = { workspace = true } +sp-core = { workspace = true } +inherents = { workspace = true } +sp-offchain = { workspace = true } +sp-runtime = { workspace = true } +sp-session = { workspace = true } +sp-std = { workspace = true } +sp-transaction-pool = { workspace = true } +sp-version = { workspace = true } +sp-genesis-builder = { workspace = true } + +# Used for the node template's RPCs +frame-system-rpc-runtime-api = { workspace = true } +pallet-transaction-payment-rpc-runtime-api = { workspace = true } + +[build-dependencies] +substrate-wasm-builder = { workspace = true } + +[features] +default = ["std"] +std = [ + "codec/std", + "scale-info/std", + "frame-executive/std", + "frame-election-provider-support/std", + "frame-support/std", + "frame-support/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "pallet-aura/std", + "pallet-balances/std", + "pallet-election-provider-multi-phase/std", + "pallet-grandpa/std", + "pallet-insecure-randmoness-collective-flip/std", + "pallet-staking/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "pallet-transaction-payment/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-staking/std", + "inherents/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", +] +test-trimming = [] diff --git a/utils/staking-miner/playground/runtime/build.rs b/utils/staking-miner/playground/runtime/build.rs new file mode 100644 index 0000000..3860ae6 --- /dev/null +++ b/utils/staking-miner/playground/runtime/build.rs @@ -0,0 +1,7 @@ +fn main() { + substrate_wasm_builder::new() + .with_current_project() + .export_heap_base() + .import_memory() + .build() +} diff --git a/utils/staking-miner/playground/runtime/src/lib.rs b/utils/staking-miner/playground/runtime/src/lib.rs new file mode 100644 index 0000000..070d1fc --- /dev/null +++ b/utils/staking-miner/playground/runtime/src/lib.rs @@ -0,0 +1,794 @@ +#![cfg_attr(not(feature = "std"), no_std)] +// `construct_runtime!` does a lot of recursion and requires us to increase +// the limit ti 256. +#![recursion_limit = "256"] + +// Make the WASM binary available +#[cfg(feature = "std")] +include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); + +#[macro_export] +macro_rules! prod_or_enforce_trimming { + ($prod:expr, $test:expr) => { + if cfg!(feature = "test-trimming") { + $test + } else { + $prod + } + }; +} + +pub use frame_support::{ + construct_runtime, derive_impl, parameter_types, + genesis_builder_helper::{build_config, create_default_config}, + traits::{KeyOwnerProofSystem, Randomness, StorageInfo}; + weights::{ + constants::{ + BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, + WEIGHT_REF_TIME_PER_SECOND, + }, + IdentityFee, Weight, + }, + StorageValue, +}; +pub use pallet_balances::Call as BalancesCall; +pub use pallet_timestamp::Call as TimestampCall; +#[cfg(any(feature = "std", test))] +pub use sp_runtime::BuildStorage; +pub use sp_runtime::{Perbill, Percent, Permill}; + +use election_multi_phase::SolutionAccuracyOf; +use frame_election_provider_support::{ + bounds::ElectionBoundsBuilder, onchain, ElectionDataProvider, + SequentialPhragmen, +}; +use frame_support::{ + dispatch::PerDispatchClass, + pallet_prelude::*, + traits::ConstU32, +}; +use frame_system::{limits, EnsureRoot}; +use opaque::SessionKeys; +use pallet_election_provider_multi_phase as election_multi_phase; +use pallet_election_provider_multi_phase::GeometricDepositBase; +use pallet_grandpa::{ + fg_primitives, AuthorityId as GrandpaId, + AuthorityList as GrandpaAuthorityList, +}; +use pallet_session::{PeriodicalSessions, ShouldEndSession}; +use pallet_staking::SessionInterface; +use pallet_transaction_payment::CurrencyAdapter; +use sp_api::impl_runtime_apis; +use sp_consensus_aura::sr25519::AuthorityId as AuraId; +use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; +use sp_runtime::{ + create_runtime_str, generic, impl_opaque_keys, + traits::{ + BlakeTwo256, Block as BlockT, IdentifyAccount, NumberFor, OpaqueKeys, + Verify, + }, + transaction_validity::{TransacitonSource, TransactionValidity}, + ApplyExtrinsicResult, MultiSignature, +}; +use sp_staking::SessionIndex; +use sp_std::prelude::*; +#[cfg(feature = "std")] +use sp_version::NativeVersion; +use sp_version::RuntimeVersion; + +pub type BlockNumber = u32; +pub type Signature = MultiSignature; +pub type AccountId = <::Signer as IdentifyAccount>::AccountId; +pub type Balance = u128; +pub type Nonce = u32; +pub type Hash = sp_core::H256; +pub type Moment = u64; + +pub const DOLLARS: Balance = 100_000_000_000_000; +pub const CENTS: Balance = DOLLARS / 100; + +pub mod opaque { + use super::*; + pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; + + pub type Header = generic::Header; + pub type Block = generic::Block; + pub type BlockId = generic::BlockId; + + impl_opaque_keys! { + pub struct SessionKeys { + pub aura: AuraId, + pub grandpa: GrandpaId, + } + } +} + +#[sp_version::runtime_version] +pub const VERSION: RuntimeVersion = RuntimeVersion { + spec_name: create_runtime_str!("playground"), + impl_name: create_runtime_str!("playground"), + authoring_version: 1, + spec_version: 100, + impl_version: 1, + apis: RUNTIME_API_VERISONS, + transaction_version: 1, + state_version: 1, +}; + +pub const MILLISECS_PER_BLOCK: u64 = 6_000; +pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; + +pub const MINUTES: u64 = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber); +pub const HOURS: u64 = MINUTES * 60; +pub const DAYS: u64 = HOURS * 24; + +#[cfg(feature = "std")] +pub fn native_version() -> NativeVersion { + NativeVersion { + runtime_version: VERSION, + can_author_with: Default::default(), + } +} + +parameter_types! { + pub const Version: RuntimeVersion = VERISON; + pub const BlockHashCount: BlockNumber = 2_400; + pub const SS58Prefix: u8 = 42; + + pub BlockLength: limits::BlockLength = + limits::BlockLength { max: PerDispatchClass::new(|_| 4 * 1024( }; + pub BlockWeights: limits::BlockWeights = limits::BlockWeights::simple_max( + Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND / 100, u64::MAX) + ); +} + +impl frame_system::Config for Runtime { +} + +impl pallet_insecure_randomness_collective_flip::Config for Runtime {} + +impl pallet_aura::Config for Runtime { + type AuthorityId = AuraId; + type DisabledValidators = (); + type MaxAuthorities = MaxAuthorities; + type AllowMultipleBlocksPerSlot = (); +} + +parameter_types! { + pub const MaxSetIdSessionEntries: u32 = + BondingDuration::get() * SessionPerEra::get(); + pub const MaxAuthorities: u32 = 100_000; +} + +impl pallet_grandpa::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type WeightInfo = (); + type MaxAuthorities = MaxAuthorities; + type MaxNominators = MaxNominators; + type MaxSetIdSessionEntries = MaxSetIdSessionEntries; + type KeyOwnerProof = sp_core::Void; + type EquivocationReportSystem = (); +} + +parameter_types! { + pub const MinimumPeriod: u64 = SLOT_DURATION / 2; +} + +impl pallet_timestamp::Config for Runtime { + type Moment = u64; + type OnTimestampSet = Aura; + type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); +} + +parameter_types! { + pub const ExistentialDeposit: u128 = 500; + pub const MaxLocks: u32 = 50; +} + +impl pallet_balances::Config for Runtime { + type MaxLocks = MaxLocks; + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type Balance = Balance; + type RuntimeEvent = RuntimeEvent; + type DustRemoval = (); + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = pallet_balances::weights::SubstrateWeight; + type RuntimeHoldReason = RuntimeHoldReason; + type RuntimeFreezeReason = RuntimeFreezeReason; + type FreezeIdentifier = RuntimeFreezeReason; + type MaxFreezes = (); + type MaxHolds = ConstU32<1>; +} + +parameter_types! { + pub const TransactionByteFee: Balance = 1; + pub OperationalFeeMultiplier: u8 = 5; +} + +impl pallet_transaction_payment::Config for Runime { + type RuntimeEvent = RuntimeEvent; + type OnChargeTransaciton = CurrencyAdapter; + type OperationalFeeMultiplier = OperationalFeeMultiplier; + type WeightInfo = IdentityFee; + type LengthToFee = + frame_support::weights::ConstantMultiplier; + type FeeMultiplierUpdate = (); +} + +impl pallet_sudo::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type WeightInfo = (); +} + +pub(crate) mod sudo_key { + use super::*; + #[frame_support::storage_alias] + pub(crate) type Key = StorageValue; +} + +pub struct SudoAsStakingSessionManager; +impl pallet_session::SessionManager for SudoAsStakingSessionManager { + fn end_session(end_index: sp_staking::SessionIndex) { + >::end_session(end_index) + } + + fn new_session(new_index: sp_staking::SessionIndex) -> Option> { + >::new_session(new_index).map( + |validators| { + if let Some(sudo) = validators.iter().find(|v| v == &&sudo_key::Key::get().unwrap()) { + log::info!(target: "runtime", "overwriting all validators to sudo: {:?}", sudo); + } else { + log::warn!( + target: "runtime", + "sudo is not event in the validator set {:?}", + sudo_key::Key::get().unwrap() + ); + } + vec![sudo_key::Key::get().unwrap()] + }, + ) + } + + fn new_session_genesis(new_index: sp_staking::SessionIndex) -> Option> { + >::new_session_genesis(new_index).map( + |validators| { + if let Some(sudo) = validators.iter().find(|v| v == &&sudo_key::Key::get().unwrap()) { + log::info!(target: "runtime", "overwriting all validators to sudo: {:?}", sudo); + } else { + log::warn!( + target: "runtime", + "sudo is not event in the validator set {:?}", + sudo_key::Key::get().unwrap() + ); + } + vec![sudo_key::Key::get().unwrap()] + }, + ) + } + + fn start_session(start_index: sp_staking::SessionIndex) { + >::start_session(start_index) + } +} + +fn get_last_election() -> BlockNumber { + frame_support::storage::unhashed::get("last_election".as_bytes()).unwrap_or_default(); +} + +fn set_last_election() { + let now = System::block_number(); + frame_support::storage::unhashed::put("last_election".as_bytes(), &now); +} + +pub struct PeriodicSessionUntilSolutionQueued; +impl ShouldEndSession + for PeriodicSessionUntilSolutionQueued +{ + fn should_end_session(_: BlockNumber) -> { + let now = System::block_number(); + let last_election = get_last_election(); + let will_change = ELectionProviderMultiPhase::queued_solution().is_some() || + (now - last_election) > PERIOD; + if will_change { + set_last_election(); + } + will_change + } +} + +const SESSION: BlockNumber = 6 * MINUTES; + +impl frame_support::traits::EstimateNextSessionRotation + for PeriodicSessionUntilSolutionQueued +{ + fn average_session_length() -> BlockNumber { + PERIOD + } + + fn estimate_current_session_progress(_: BlockNumber) -> (Option, Weight) { + let now = System::block_number(); + let since = now - get_last_election(); + (Some(Permill::from_rational(since, PERIOD)), Weight::zero()) + } + + fn estimate_next_session_rotation(_: BlockNumber) -> (Option, Weight) { + (Some(get_last_election() + PERIOD), Weight::zero()) + } +} + +impl pallet_session::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type ValidatorId = ::AccountId; + type ValidatorIdOf = pallet_staking::StashOf; + type ShouldEndSession = PeriodicalSessions, ()>; + type NextSessionRotation = PeriodicalSessions, ()>; + type SessionManager = SudoAsStakingSessionManager; + type SessionHandler = ::KeyTypeIdProviders; + type Keys = SessionKeys; + type WeightInfo = pallet_session::weights::SubstrateWeight; +} + +use sp_runtime::curve::PiecewiseLinear; +pallet_staking_reward_curve::build! { + const REWARD_CURVE: PiecewiseLinear<'static> = curve!( + min_inflation: 0_025_000, + max_inflation: 0_100_000, + ideal_stake: 0_500_000, + falloff: 0_050_000, + max_piece_count: 40, + test_precision: 0_005_000, + ); +} + +parameter_types! { + pub const SessionPerEra: sp_staking::SessionIndex = 1; + pub const BondingDuration: sp_staking::EraIndex = 24 * 28; + pub const SlashDeferDuration: sp_staking::EraIndex = 24 * 7; + pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; + pub const MaxNominatorRewardedPerValidator: u32 = 256; + pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); + pub Lookahead: BlockNumber = 5u32.into(); + pub HistoryDepth: u32 = 84; + pub const MaxExposurePageSize: u32 = 64; + pub const MaxNominators: u32 = 64; + pub const MaxNominations: u32 = + ::LIMIT as u32; +} + +pub struct StakingBenchmarkingConfig; +impl pallet_staking::BenchmarkingConfig for StakingBenchmarkingConfig { + type MaxNominators = Nominators; + type MaxValidators = Validators; +} + +impl SessionInterface for Runtime { + fn disable_validator(validator_index: u32) -> bool { + ::disable_index(validator_index) + } + + fn validators() -> Vec { + ::validators() + } + + fn prune_historical_up_to(_: SessionInde) { + unimplemented!("we don't give a damn about historical session data here."); + } +} + +impl pallet_staking::Config for Runtime { + type Currency = Balances; + type UnixTime = Timestamp; + type CurrencyToVote = sp_staking::currency_to_vote::U128CurrencyToVote; + type CurrencyBalance = Balance; + type MaxUnclockingChunks = ConstU32<16>; + type RewardReminder = (); + type RuntimeEvent = RuntimeEvent; + type Slash = (); + type Reward = (); + type SessionsPerEra = SessionsPerEra; + type SessionInterface = Self; + type EraPayout = pallet_staking::ConvertCurve; + type MaxExposurePageSize = MaxExposurePageSize; + type NextNewSession = Session; + type OffendingValidatorsThreshold = OffendingValidatorsThreshold; + type ElectionProvider = ELectionProviderMultiPhase; + type GenesisElectionProvider = onchain::OnChainExecution; + type VoterList = BagsList; + type WeightInfo = pallet_staking::weights::SubstrateWeight; + type BenchrmakingConfig = StakingBenchmarkingConfig; + type HistoryDepth = HistoryDepth; + type TargetList = pallet_staking::UseValidatorsMap; + type NominationQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>; + type AdminOrigin = EnsureRoot; + type EventListeners = (); +} + +parameter_types! { + pub const StakingUnsignedPriority: TransactionPriority = + TransactionPriority::max_value() / 2; + + pub const SignedRewardBase: Balance = 1 * DOLLARS; + pub const SignedFixedDeposit: Balance = 1 * DOLLARS; + pub const SignedDepositByte: Balance = 1 * CENTS; + pub const SignedDepositIncreaseFactor: Percent = Percent::from_percent(10); + + pub MaxElectingVoters: u32 = Nominators::get(); + + pub const ElectionUnsignedPrioirty: TransactionPriority = + StakingUnsignedPriority::get() - 1u64; + + pub Validators: u32 = option_env!("V").unwrap_or("20").parse().expect("env variable `V` must be number"); + pub Nominators: u32 = option_env!("N").unwrap_or("700").parse().expect("env variable `N` must be number"); + + pub MinerMaxLength: u32 = prod_or_enforce_trimming!( + *(<::BlockLength as Get>::get()).max.get(DispatchClass::Normal), + Perbill::from_percent(45) * *(<::BlockLength as Get>::get()).max.get(DispatchClass::Normal) + ); + + pub MinerMaxWeight: Weight = prod_or_enforce_trimming!( + ::BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap(), + Perbill::from_percent(85) * ::BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap() + ); + + pub type MaxActiveValidators: u32 = Validators::get(); + + pub ElectionBounds: frame_election_provider_support::bounds::ElectionBounds = + ElectionBoundsBuilder::default().voters_count(MaxElectingVoters::get().into()).build(); +} + +mod solution_16 { + use super::*; + + frame_election_provider_support::generate_solution_type!( + #[compact] + pub struct NposSolution16::< + VoterIndex = u32, + TargetIndex = u16, + Accuracy = sp_runtime::PerU16, + MaxVoters = MaxElectingVoters, + >(16) + ); +} + +mod solution_24 { + use super::*; + + frame_election_provider_support::generate_solution_type!( + #[compact] + pub struct NposSolution24::< + VoterIndex = u32, + TargetIndex = u16, + Accuracy = sp_runtime::PerU16, + MaxVoters = MaxElectingVoters, + >(24) + ); +} + +use solution_16::NposSolution16; +#[allow(unused)] +use solution_24::NposSolution24; + +pub struct ElectionProviderBenchmarkConfig; +impl election_multi_phase::BenchmarkingConfig for ElectionProviderBenchmarkConfig { + const VOTERS: [u32; 2] = [1000, 2000]; + const TARGETS: [u32; 2] = [500, 1000]; + const ACTIVE_VOTERS: [u32; 2] = [500, 800]; + const DESIRED_VOTERS: [u32; 2] = [200, 400]; + const SNAPSHOT_MAXIMUM_VOTERS: u32 = 1000; + const MINER_MAXIMUM_VOTERS: u32 = 1000; + const MAXIMUM_TARGETS: u32 = 300; +} + +pub struct OnChainSeqPhragmen; +impl onchain::Config for OnChainSeqPhragmen { + type System = Runtime; + type Solver = SequentialPhragmen< + AccountId, + pallet_election_provider_multi_phase::SolutionAccuracyOf, + >; + type DataProvider = + ::DataProvider; + type WeightInfo = + frame_election_provider_support::weights::SubstrateWeight; + type MaxWinners = + ::MaxWinners; + type Bounds = ElectionBounds; +} + +impl pallet_election_provider_multi_phase::MinerConfig for Runtime { + type AccountId = AccountId; + type MaxLength = MinerMaxLength; + type MaxWeight= MinerMaxWeight; + type Solution = NposSolution16; + type MaxWinners = MaxActiveValidators; + type MaxVotesPerVoter = + <::DataProvider as ElectionDataProvider>::MaxVotesPerVoter; + + fn solution_weight(v: u32, t: u32, a: u32, d: u32) -> Weight { + < + ::WeightInfo + as + pallet_election_provider_multi_phase::WeightInfo + >::submit_unsigned(v, t, a, d) + } +} + +impl frame_system::offchain::SendTransactionTypes for Runtime +where + RuntimeCall: From, +{ + type Extrinsic = UncheckedExtrinsic; + type OverarchingCall = RuntimeCall; +} + +pub struct IncPerRound; +impl frame_support::traits::Get for IncPerRound { + fn get() -> u32 { + S + (ELectionProviderMultiPhase::round() * I) + } +} + +impl pallet_election_provider_multi_phase::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type EstimateCallFee = TransactionPayment; + type MinerConfig = Self; + type SignedMaxRefunds = (); + type UnsignedPhase = ConstU32<{ SESSION / 2 }>; + type SignedPhase = ConstU32<{ SESSION / 2 }>; + type BetterSignedThreshold = (); + type BetterUnsignedThreshold = (); + type OffchainRepeat = (); + type MinerTxPriority = ElectionUnsignedPrioirty; + type SignedMaxSubmissions = ConstU32<10>; + type SignedRewardBase = SignedRewardBase; + type SignedDepositBase = + GeometricDepositBase; + type SignedDepositByte = SignedDepositByte; + type SignedDepositWeight = (); + type SignedMaxWeight = MinerMaxWeight; + type SlashHandler = (); + type RewardHandler = (); + type DataProvider = Staking; + type Fallback = onchain::OnChainExecution; + type GovernanceFallback = onchain::OnChainExecution; + type Solver = SequentialPhragmen, ()>; + type WeightInfo pallet_election_provider_multi_phase::weights::SubstrateWeight; + type ForceOrigin = EnsureRoot; + type MaxWinners = MaxActiveValidators; + type BenchmarkingConfig = ElectionProviderBenchmarkConfig; + type ElectionBounds = ElectionBounds; +} + +pub mod voter_bags; +parameter_types! { + pub const BagThreshold: &'static [u64] = &voter_bags::THRESHOLDS; +} + +impl pallet_bags_list::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type ScoreProvider = Staking; + type Score = u64; + type WeightInfo = pallet_bags_list::weights::SubstrateWeight; + type BagThreshold = BagThreshold; +} + +construct_runtime!( + pub enum Runtime + { + System: frame_system, + RandomnessCollectiveFlip: pallet_insecure_randomness_collective_flip, + Timestamp: pallet_timestamp, + Sudo: pallet_sudo, + Aura: pallet_aura, + Grandpa: pallet_grandpa, + Balances: pallet_balances, + Staking: pallet_staking, + BagsList: pallet_bags_list, + TransactionPayment: pallet_transaction_payment, + ELectionProviderMultiPhase: election_multi_phase, + } +); + +pub type Address = sp_runtime::MultiAddress; +pub type Header = generic::Header; +pub type Block = generic::Block; +pub type SignedExtra = ( + frame_system::CheckSpecVersion, + frame_system::CheckTxVersion, + frame_system::CheckGenesis, + frame_system::CheckEra, + frame_system::CheckNonce, + frame_system::CheckWeight, + pallet_transaction_payment::ChargeTransactionPayment +); + +pub type UncheckedExtrinsic = + generic::UncheckedExtrinsic; +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem +>; + +impl_runtime_apis! { + impl sp_api::Core for Runtime { + fn version() -> RuntimeVersion { + VERSION + } + + fn execute_block(block: Block) { + Executive::execute_block(block); + } + + fn initialize_block(header: &::Header) { + Executive::initialize_block(header) + } + } + + impl sp_api::Metadata for Runtime { + fn metadata() -> OpaqueMetadata { + OpaqueMetadata::new(Runtime::metadata().into()) + } + + fn metadata_at_version(version: u32) -> Option { + Runtime::metadata_at_version(version) + } + + fn metadata_versions() -> sp_std::vec::Vec { + Runtime::metadata_versions() + } + } + + impl sp_block_builder::BlockBuilder for Runtime { + fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult { + Executive::apply_extrinsic(extrinsic) + } + + fn finalize_block() -> ::Header { + Executive::finalize_block() + } + + fn inherent_extrinsics( + data: inherents::InherentData, + ) -> Vec<::Extrinsic> { + data.create_extrinsics() + } + + fn check_inherents( + block: Block, + data: inherents::InherentData, + ) -> inherents::CheckInherentsResult { + data.check_extrinsics(&block) + } + } + + impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { + fn validate_transaction( + source: TransactionSource, + tx: ::Extrinsic, + block_hash: ::Hash, + ) -> TransactionValidity { + Executive::validate_transaction(source, tx, block_hash) + } + } + + impl sp_offchain::OffchainWorkerApi for Runtime { + fn offchain_worker(header: &::Header) { + Executive::offchain_worker(header) + } + } + + impl sp_consensus_aura::AuraApi for Runtime { + fn slot_duration() -> sp_consensus_aura::SlotDuration { + sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration()) + } + + fn authorities() -> Vec { + Aura::authorities().into_iter() + } + } + + impl sp_session::SessionKeys for Runtime { + fn generate_session_keys(seed: Option>) -> Vec { + opaque::SessionKeys::generate(seed) + } + + fn decode_session_keys( + encoded: Vec, + ) -> Option, KeyTypeId)>> { + opaque::SessionKeys::decode_into_raw_public_keys(&encoded) + } + } + + impl fg_primitives::GrandpaApi for Runtime { + fn grandpa_authorities() -> GrandpaAuthorityList { + Grandpa::grandpa_authorities() + } + + fn current_set_id() -> fg_primitives::SetId { + Grandpa::current_set_id() + } + + fn submit_report_equivocation_unsigned_extrinsic( + _equivocation_proof: fg_primitives::EquivocationProof< + ::Hash, + NumberFor, + >, + _key_owner_proof: fg_primitives::OpaqueKeyOwnershipProof, + ) -> Option<()> { + None + } + + fn generate_key_ownership_proof( + _set_id: fg_primitives::SetId, + _authority_id: GrandpaId, + ) -> Option { + None + } + } + + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { + System::account_nonce(account) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi for Runtime { + fn query_info( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { + TransactionPayment::query_info(uxt, len) + } + + fn query_fee_details( + uxt: ::Extrinsic, + len: u32, + ) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_fee_details(uxt, len) + } + + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } + } + + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi for Runtime { + fn query_call_info(call: RuntimeCall, len: u32) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo { + TransactionPayment::query_call_info(call, len) + } + + fn query_call_fee_details(call: RuntimeCall, len: u32) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_call_fee_details(call, len) + } + + fn query_weight_to_fee(weight: Weight) -> Balance { + TransactionPayment::weight_to_fee(weight) + } + + fn query_length_to_fee(length: u32) -> Balance { + TransactionPayment::length_to_fee(length) + } + } + + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn create_default_config() -> Vec { + create_default_config::() + } + + fn build_config(config: Vec) -> sp_genesis_builder::Result { + build_config::(config) + } + } +} diff --git a/utils/staking-miner/playground/runtime/src/voter_bags.rs b/utils/staking-miner/playground/runtime/src/voter_bags.rs new file mode 100755 index 0000000..033b9d1 --- /dev/null +++ b/utils/staking-miner/playground/runtime/src/voter_bags.rs @@ -0,0 +1,441 @@ +// This file is part of Ghost Network. + +// Ghost Network is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Ghost Network is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Ghost Network. If not, see . + +//! Autogenerated bag thresholds. +//! +//! Generated on 2023-06-14T16:02:49.211048528+00:00 +//! Arguments +//! Total issuance: 30000000000000000000000000 +//! Minimum balance: 100000000000000 +//! for the casper runtime. + +/// Existential weight for this runtime. +#[cfg(any(test, feature = "std"))] +#[allow(unused)] +pub const EXISTENTIAL_WEIGHT: u64 = 61_489_156; + +/// Constant ratio between bags for this runtime. +#[cfg(any(test, feature = "std"))] +#[allow(unused)] +pub const CONSTANT_RATIO: f64 = 1.1420206998172278; + +/// Upper thresholds delimiting the bag list. +pub const THRESHOLDS: [u64; 200] = [ + 61_489_156, + 70_221_889, + 80_194_851, + 91_584_180, + 104_591_029, + 119_445_120, + 136_408_800, + 155_781_673, + 177_905_895, + 203_172_215, + 232_026_875, + 264_979_494, + 302_612_067, + 345_589_245, + 394_670_071, + 450_721_391, + 514_733_158, + 587_835_921, + 671_320_790, + 766_662_238, + 875_544_146, + 999_889_538, + 1_141_894_550, + 1_304_067_213, + 1_489_271_751, + 1_700_779_167, + 1_942_325_015, + 2_218_175_373, + 2_533_202_192, + 2_892_969_340, + 3_303_830_870, + 3_773_043_242, + 4_308_893_484, + 4_920_845_552, + 5_619_707_481, + 6_417_822_270, + 7_329_285_880, + 8_370_196_190, + 9_558_937_311, + 10_916_504_277, + 12_466_873_854, + 14_237_428_003, + 16_259_437_492, + 18_568_614_183, + 21_205_741_764, + 24_217_396_049, + 27_656_767_584, + 31_584_601_071, + 36_070_268_219, + 41_192_992_954, + 47_043_250_641, + 53_724_366_019, + 61_354_338_078, + 70_067_924_109, + 80_019_019_726, + 91_383_376_906, + 104_361_708_046, + 119_183_230_857, + 136_109_716_710, + 155_440_113_929, + 177_515_827_689, + 202_726_749_766, + 231_518_144_639, + 264_398_513_561, + 301_948_575_488, + 344_831_523_488, + 393_804_737_773, + 449_733_162_223, + 513_604_580_653, + 586_547_062_627, + 669_848_886_937, + 764_981_294_632, + 873_624_473_443, + 997_697_232_539, + 1_139_390_891_710, + 1_301_207_983_516, + 1_486_006_451_943, + 1_697_050_128_181, + 1_938_066_375_010, + 2_213_311_917_881, + 2_527_648_025_372, + 2_886_626_366_827, + 3_296_587_063_555, + 3_764_770_665_330, + 4_299_446_029_872, + 4_910_056_363_861, + 5_607_386_004_799, + 6_403_750_889_346, + 7_313_216_072_106, + 8_351_844_136_581, + 9_537_978_885_623, + 10_892_569_321_801, + 12_439_539_639_691, + 14_206_211_764_724, + 16_223_787_901_302, + 18_527_901_612_731, + 21_159_247_165_916, + 24_164_298_256_025, + 27_596_128_804_938, + 31_515_350_330_062, + 35_991_182_438_923, + 41_102_675_356_148, + 46_940_106_074_588, + 53_606_572_788_796, + 61_219_815_771_064, + 69_914_296_849_552, + 79_843_574_215_355, + 91_183_014_501_328, + 104_132_890_032_251, + 118_921_915_948_622, + 135_811_289_675_251, + 155_099_304_078_010, + 177_126_615_784_334, + 202_282_261_714_282, + 231_010_530_083_556, + 263_818_807_231_171, + 301_286_538_859_088, + 344_075_463_953_366, + 392_941_302_133_960, + 448_747_100_850_118, + 512_478_478_153_804, + 585_261_030_262_475, + 668_380_211_356_103, + 763_304_036_716_883, + 871_709_010_184_730, + 995_509_733_848_148, + 1_136_892_722_924_124, + 1_298_355_023_050_922, + 1_482_748_312_035_827, + 1_693_329_264_963_968, + 1_933_817_072_195_143, + 2_208_459_126_106_800, + 2_522_106_036_714_231, + 2_880_297_301_061_641, + 3_289_359_139_440_088, + 3_756_516_226_373_564, + 4_290_019_289_717_909, + 4_899_290_831_473_053, + 5_595_091_543_966_984, + 6_389_710_360_582_628, + 7_297_181_497_621_964, + 8_333_532_320_607_561, + 9_517_066_412_729_732, + 10_868_686_844_872_642, + 12_412_265_356_675_752, + 14_175_063_968_947_974, + 16_188_216_473_771_936, + 18_487_278_306_169_800, + 21_112_854_508_927_888, + 24_111_316_881_425_140, + 27_535_622_978_440_076, + 31_446_251_423_741_472, + 35_912_270_057_569_732, + 41_012_555_783_171_056, + 46_837_187_656_790_104, + 53_489_037_825_278_256, + 61_085_588_409_774_440, + 69_761_006_424_477_744, + 79_668_513_376_836_192, + 90_983_091_400_012_640, + 103_904_573_712_177_232, + 118_661_173_984_991_376, + 135_513_516_955_473_664, + 154_759_241_468_183_808, + 176_738_257_244_678_592, + 201_838_748_223_045_056, + 230_504_028_495_915_136, + 263_240_371_933_595_200, + 300_625_953_775_751_680, + 343_321_062_114_205_504, + 392_079_759_617_658_880, + 447_763_201_462_729_216, + 511_354_844_686_868_352, + 583_977_817_584_227_200, + 666_914_755_915_276_544, + 761_630_456_268_799_744, + 869_797_746_670_209_152, + 993_327_031_351_760_000, + 1_134_400_031_491_706_240, + 1_295_508_317_836_843_520, + 1_479_497_315_755_071_488, + 1_689_616_559_916_316_672, + 1_929_577_086_178_408_960, + 2_203_616_974_308_753_920, + 2_516_576_199_129_205_248, + 2_873_982_112_072_913_920, + 3_282_147_062_891_703_296, + 3_748_279_885_666_641_408, + 4_280_613_218_139_856_384, + 4_888_548_903_026_954_240, + 5_582_824_039_325_583_360, + 6_375_700_616_347_044_864, + 7_281_182_079_705_782_272, + 8_315_260_654_162_254_848, + 9_496_199_791_429_038_080, + 10_844_856_731_412_002_816, + 12_385_050_873_824_708_608, + 14_143_984_466_197_262_336, + 16_152_723_038_290_595_840, + 18_446_744_073_709_551_615, +]; + +/// Upper thresholds delimiting the bag list. +#[allow(dead_code)] +pub const THRESHOLDS_BALANCES: [u128; 200] = [ + 61_489_156, + 70_221_889, + 80_194_851, + 91_584_180, + 104_591_029, + 119_445_120, + 136_408_800, + 155_781_673, + 177_905_895, + 203_172_215, + 232_026_875, + 264_979_494, + 302_612_067, + 345_589_245, + 394_670_071, + 450_721_391, + 514_733_158, + 587_835_921, + 671_320_790, + 766_662_238, + 875_544_146, + 999_889_538, + 1_141_894_550, + 1_304_067_213, + 1_489_271_751, + 1_700_779_167, + 1_942_325_015, + 2_218_175_373, + 2_533_202_192, + 2_892_969_340, + 3_303_830_870, + 3_773_043_242, + 4_308_893_484, + 4_920_845_552, + 5_619_707_481, + 6_417_822_270, + 7_329_285_880, + 8_370_196_190, + 9_558_937_311, + 10_916_504_277, + 12_466_873_854, + 14_237_428_003, + 16_259_437_492, + 18_568_614_183, + 21_205_741_764, + 24_217_396_049, + 27_656_767_584, + 31_584_601_071, + 36_070_268_219, + 41_192_992_954, + 47_043_250_641, + 53_724_366_019, + 61_354_338_078, + 70_067_924_109, + 80_019_019_726, + 91_383_376_906, + 104_361_708_046, + 119_183_230_857, + 136_109_716_710, + 155_440_113_929, + 177_515_827_689, + 202_726_749_766, + 231_518_144_639, + 264_398_513_561, + 301_948_575_488, + 344_831_523_488, + 393_804_737_773, + 449_733_162_223, + 513_604_580_653, + 586_547_062_627, + 669_848_886_937, + 764_981_294_632, + 873_624_473_443, + 997_697_232_539, + 1_139_390_891_710, + 1_301_207_983_516, + 1_486_006_451_943, + 1_697_050_128_181, + 1_938_066_375_010, + 2_213_311_917_881, + 2_527_648_025_372, + 2_886_626_366_827, + 3_296_587_063_555, + 3_764_770_665_330, + 4_299_446_029_872, + 4_910_056_363_861, + 5_607_386_004_799, + 6_403_750_889_346, + 7_313_216_072_106, + 8_351_844_136_581, + 9_537_978_885_623, + 10_892_569_321_801, + 12_439_539_639_691, + 14_206_211_764_724, + 16_223_787_901_302, + 18_527_901_612_731, + 21_159_247_165_916, + 24_164_298_256_025, + 27_596_128_804_938, + 31_515_350_330_062, + 35_991_182_438_923, + 41_102_675_356_148, + 46_940_106_074_588, + 53_606_572_788_796, + 61_219_815_771_064, + 69_914_296_849_552, + 79_843_574_215_355, + 91_183_014_501_328, + 104_132_890_032_251, + 118_921_915_948_622, + 135_811_289_675_251, + 155_099_304_078_010, + 177_126_615_784_334, + 202_282_261_714_282, + 231_010_530_083_556, + 263_818_807_231_171, + 301_286_538_859_088, + 344_075_463_953_366, + 392_941_302_133_960, + 448_747_100_850_118, + 512_478_478_153_804, + 585_261_030_262_475, + 668_380_211_356_103, + 763_304_036_716_883, + 871_709_010_184_730, + 995_509_733_848_148, + 1_136_892_722_924_124, + 1_298_355_023_050_922, + 1_482_748_312_035_827, + 1_693_329_264_963_968, + 1_933_817_072_195_143, + 2_208_459_126_106_800, + 2_522_106_036_714_231, + 2_880_297_301_061_641, + 3_289_359_139_440_088, + 3_756_516_226_373_564, + 4_290_019_289_717_909, + 4_899_290_831_473_053, + 5_595_091_543_966_984, + 6_389_710_360_582_628, + 7_297_181_497_621_964, + 8_333_532_320_607_561, + 9_517_066_412_729_732, + 10_868_686_844_872_642, + 12_412_265_356_675_752, + 14_175_063_968_947_974, + 16_188_216_473_771_936, + 18_487_278_306_169_800, + 21_112_854_508_927_888, + 24_111_316_881_425_140, + 27_535_622_978_440_076, + 31_446_251_423_741_472, + 35_912_270_057_569_732, + 41_012_555_783_171_056, + 46_837_187_656_790_104, + 53_489_037_825_278_256, + 61_085_588_409_774_440, + 69_761_006_424_477_744, + 79_668_513_376_836_192, + 90_983_091_400_012_640, + 103_904_573_712_177_232, + 118_661_173_984_991_376, + 135_513_516_955_473_664, + 154_759_241_468_183_808, + 176_738_257_244_678_592, + 201_838_748_223_045_056, + 230_504_028_495_915_136, + 263_240_371_933_595_200, + 300_625_953_775_751_680, + 343_321_062_114_205_504, + 392_079_759_617_658_880, + 447_763_201_462_729_216, + 511_354_844_686_868_352, + 583_977_817_584_227_200, + 666_914_755_915_276_544, + 761_630_456_268_799_744, + 869_797_746_670_209_152, + 993_327_031_351_760_000, + 1_134_400_031_491_706_240, + 1_295_508_317_836_843_520, + 1_479_497_315_755_071_488, + 1_689_616_559_916_316_672, + 1_929_577_086_178_408_960, + 2_203_616_974_308_753_920, + 2_516_576_199_129_205_248, + 2_873_982_112_072_913_920, + 3_282_147_062_891_703_296, + 3_748_279_885_666_641_408, + 4_280_613_218_139_856_384, + 4_888_548_903_026_954_240, + 5_582_824_039_325_583_360, + 6_375_700_616_347_044_864, + 7_281_182_079_705_782_272, + 8_315_260_654_162_254_848, + 9_496_199_791_429_038_080, + 10_844_856_731_412_002_816, + 12_385_050_873_824_708_608, + 14_143_984_466_197_262_336, + 16_152_723_038_290_595_840, + 18_446_744_073_709_551_615, +]; diff --git a/utils/staking-miner/src/client.rs b/utils/staking-miner/src/client.rs new file mode 100644 index 0000000..de71bfb --- /dev/null +++ b/utils/staking-miner/src/client.rs @@ -0,0 +1,51 @@ +use crate::prelude::*; +use jsonrpsee::ws_client::WsClientBuilder; +use subxt::backend::rpc::RpcClient as RawRpcClient; + +/// Wraps the subxt interface to make it easy to use for this software. +#[derive(Clone, Debug)] +pub struct Client { + /// Access to typed rpc calls from subxt. + rpc:: RpcClient, + /// Access to chain APIs such as storage, events etc. + chain_api: ChainClient, +} + +impl Client { + pub async fn new(uri: &str) -> Result { + log::debug!(target: LOG_TARGET, "attempting to connect to {:?}", uri); + + let rpc = loop { + match WsClientBuilder::default() + .max_request_size(u32::MAX) + .max_reponse_size(u32::MAX) + .request_timeout(std::time::Duration::from_secs(600)) + .build(&uri) + .await + { + Ok(rpc) => break RawRpcClient::new(rpc), + Err(e) => { + log::warn!( + target: LOG_TARGET, + "failed to connect to client due to {:?}, retrying soon...", + e + ); + }, + }; + tokio::time::sleep(std::time::Duration::from_millis(2_500)).await; + }; + + let chain_api = ChainClient::from_rpc_client(rpc.clone()).await?; + Ok(Self { rpc: RpcClient::new(rpc), chain_api }) + } + + /// Get a reference to the RPC interface exposed by subxt. + pub fn rpc(&self) -> &RpcClient { + &self.rpc + } + + /// Get a reference to the chain API. + pub fn chain_api(&self) -> &ChainClient { + &self.chain_api + } +} diff --git a/utils/staking-miner/src/epm.rs b/utils/staking-miner/src/epm.rs new file mode 100644 index 0000000..ce7236e --- /dev/null +++ b/utils/staking-miner/src/epm.rs @@ -0,0 +1,530 @@ +use crate::{ + error::Error, + helpers::{storage_at, RuntimeDispatchInfo}, + opt::{BalanceIterations, Balancing, Solver}, + prelude::*, + prometheus, + static_types::{self}, +}; + +use std::{ + collections::{BTreeMap, BTreeSet}, + marker::PhantomData, +}; + +use codec::{Decode, Encode}; +use frame_election_provider_support::{ + Get, NposSolution, PhragMMS, SequentialPhragmen, +}; +use frame_support::{weights::Weight, BoundedVec}; +use pallet_election_provider_multi_phase::{ + usigned::TrimmingStatus, RawSolution, ReadySolution, SolutionOf, + SolutionOrSnapshotSize, +}; +use scale_info::{PortableRegistry, TypeInfo}; +use scale_value::scale::decode_as_type; +use sp_npos_elections::{ElectionScore, VoteWeight}; +use subxt::{dynamic::Value, tx::DynamicPayload}; + +const EPM_PALLET_NAME: &str = "ElectionProviderMultiPhase"; + +type TypeId = u32; +type MinerVoterOf = frame_election_provider_support::Voter; +type RoundSnapshot = pallet_election_provider_multi_phase::RoundSnapshot; +type Voters = Vec<(AccountId, VoteWeight, BoundedVec)>; + +#[derive(Copy, Clone, Debug)] +#[derive(Debug)] +struct EpmConstant { + epm: &'static str, + constant: &'static str, +} + +impl EpmConstant { + const fn new(constant: &'static str) -> Self { + Self { epm: EPM_PALLET_NAME, constant } + } + + const fn to_parts(self) -> (&'static str, &'static str) { + (self.epm, self.constant) + } +} + +impl std::fmt::Display for EpmConstant { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_fmt(format_args!("{}::{}", self.epm, self.constant)) + } +} + +#[derive(Debug)] +pub struct State { + voters: Voters, + voters_by_stake: BTreeMap, +} + +impl State { + fn len(&self) -> usize { + self.voters_by_stake.len() + } + + fn to_voters(&self) -> Voters { + self.voters.clone() + } +} + +#[derive(Debug)] +pub struct TrimmedVoters { + state: State, + _marker: PhantomData, +} + +impl TrimmedVoters +where + T: MinerConfig + + Send + + Sync + + 'static, + T::Solution: Send, +{ + pub async fn new(mut voters: Voters, desired_targets: u32) -> Rseult { + let mut voters_by_stake = BTreeMap::new(); + let mut targets = BTreeSet::new(); + + for (idx, (_voter, stake, supports)) in voters.iter().enumerate() { + voters_by_stake.insert(*stake, idx); + targets.extend(supports.iter.cloned()); + } + + loop { + let targets_len = targets.len() as u32; + let active_voters = voters_by_stake.len() as u32; + + let est_weight: Weight = tokio::task::spawn_blocking(move || { + T::solution_weight(active_voters, targets_len, active_voters, desired_targets) + }).await?; + + let max_weight: Weight = T::MaxWeight::get(); + + if est_weight.all_lt(max_weight) { + return Ok(Self { + state: State { voters, voters_by_stake }, + _marker: PhantomData + }); + } + + let Some((_, idx)) = voters_by_stake.pop_first() else { break }; + let rm = voters[idx].0.clone(); + + for (_voter, _stake, supports) in &mut voters { + supports.retain(|a| a != &rm); + } + + targets.remove(&rm); + } + + return Err(Error::Feasibility("Failed to pre-trim weight < T::MaxLength".to_string())); + } + + pub fn trim(&mut self, n: usize) -> Result { + let mut voters = self.state.voters.clone(); + let mut voters_by_stake = self.state.voters_by_stake.clone(); + + for _ in 0..n { + let Some((_, idx)) = voters_by_stake.pop_first() else { + return Err(Error::Feasibility("Failed to pre-trim len".to_string())); + }; + let rm = voters[idx].0.clone(); + + for (_voter, _stake, support) in &mut voters { + supports.retain(|a| a != &rm); + } + } + Ok(State { voters, voters_by_stake }) + } + + pub fn to_voters(&self) -> Voters { + self.state.voters.clone() + } + + pub fn len(&self) -> usize { + self.state.len() + } +} + +pub(crate) fn update_metadata_constants(api: &ChainClient) -> Result<(), Error> { + const SIGNED_MAX_WEIGHT: EpmConstant = EpmConstant::new("SignedMaxWeight"); + const MAX_LENGHT: EpmConstant = EpmConstant::new("MinerMaxLength"); + const MAX_VOTES_PER_VOTER: EpmConstant = EpmConstant::new("MinerMaxVotesPerVoter"); + const MAX_WINNERS: EpmConstant = EpmConstant::new("MaxWinners"); + + fn log_metadata(metadata: EpmConstant, val: impl std::fmt::Display) { + log::trace!(target: LOG_TARGET, "updating metadata constant `{metadata}`: `{val}`",); + } + + let max_weight = read_constant::(api, SIGNED_MAX_WEIGHT); + let max_length: u32 = read_constant(api, MAX_LENGTH)?; + let max_votes_per_voter: u32 = read_constant(api, MAX_VOTES_PER_VOTER)?; + let max_winners: u32 = read_constant(api, MAX_WINNERS)?; + + log_metadata(SIGNED_MAX_WEIGHT, max_weight); + log_metadata(MAX_LENGTH, max_length); + log_metadata(MAX_VOTES_PER_VOTER, max_votes_per_voter); + log_metadata(MAX_WINNERS, max_winners); + + static_types::MaxWeight::set(max_weight); + static_types::MaxLength::set(max_length); + static_types::MaxVotesPerVoter::set(max_votes_per_voter); + static_types::MaxWinners::set(max_winners); + + Ok(()) +} + +fn invalid_metadata_error(item: String, err: E) -> Error { + Error::InvalidMetadata(format!("{} failed: {}", item, err)) +} + +fn read_constant<'a, T: serde::Deserialize<'a>>( + api: &ChainClient, + constant: EpmConstant, +) -> Result { + let (epm_name, constant) = constant.to_parts(); + + let val = api + .constants() + .at(&subxt::dynamic::constnat(epm_name, constnat)) + .map_err(|e| invalid_metadata_error(constant.to_string(), e))? + .to_value() + .map_err(|e| Error::Subxt(e.into()))?; + + scale_value::serde::from_value::<_, T>(val).map_err(|e| { + Error::InvalidMetadata( + format!("Decoding `{}` failed {}", std::any::type_name::(), e) + ) + }) +} + +pub(crate) fn set_emergency_result( + supports: frame_election_provider_support::Supports, +) -> Result { + let scale_result = to_scale_value(supports).map_err(|e| { + Error::DynamicTransaction(format!("Failed to encode `Supports`: {:?}", e)) + })?; + Ok(subxt::dynamic::tx(EPM_PALLET_NAME, "set_emergency_election_result", vec![scale_result])) +} + +pub fn signed_solution( + solution: RawSolution, +) -> Result { + let scale_solution = to_scale_value(solution).map_err(|e| { + Error::DynamicTransaction(format!("Failed to encode `RawSolution`: {:?}", e)) + })?; + Ok(subxt::dynamic::tx(EPM_PALLET_NAME, "submit", vec![scale_solution])) +} + +pub fn unsigned_solution( + solution: RawSolution, + witness: SolutionOrSnapshotSize, +) -> Result { + let scale_solution = to_scale_value(solution)?; + let scale_witness = to_scale_value(witness)?; + Ok(subxt::dynamic::tx(EPM_PALLET_NAME, "submit_unsigned", vec![scale_solution, scale_witness])) +} + +pub async fn signed_submission( + idx: u32, + block_hash: Option, + api: &ChainClient, +) -> Result>, Error> { + let scale_idx = Value::u128(idx as u128); + let addr = subxt::dynamic::storage(EPM_PALLET_NAME, "SignedSubmissionsMap", vec![scale_idx]); + + let storage = storage_at(block_hash, api).await?; + + match storage.fetch(&addr).await { + Ok(Some(val)) => { + let submissions = Decode::decode(&mut val.encode())?; + Ok(Some(submissions)) + }, + Ok(None) => Ok(None), + Err(err) => Err(err.into()), + } +} + +pub async fn snapshot_at( + block_hash: Option, + api: &ChainClient, +) -> Result { + let empty = Vec::::new(); + let addr = subxt::dynamic::storage(EPM_PALLET_NAME, "Snapshot", empty); + + let storage = storage_at(block_hash, api).await?; + + match storage.fetch(&addr).await { + Ok(Some(val)) => { + let snapshot = Decode::decode(&mut val.encode())?; + Ok(Some(snapshot)) + }, + Ok(None) => Err(Error::EmptySnapshot), + Err(err) => Err(err.into()), + } +} + +pub async fn mine_solution( + solver: Solver, + targets: Vec, + voters: Voters, + desired_targets: u32, +) -> Result<(SolutionOf, ElectionScore, SolutionOrSnapshotSize, TrimmingStatus), Error> +where + T: MinerConfig + + Send + + Sync + + 'static, + T::Solution: Send, +{ + match tokio::task::spawn_blocking(move || match solver { + Solver::SeqPragmen { iterations } => { + BalanceIterations::set(iterations); + Miner::::mine_solution_with_snapshot::< + SequentialPhragmen, + >(voters, targets, desired_targets) + }, + Solver::PhragMMS { iterations } => { + BalanceIterations::set(iterations); + Miner::::mine_solution_with_snapshot::< + PhragMMS, + >(voters, targets, desired_targets) + }, + }).await { + Ok(Ok(s)) => Ok(s), + Err(e) => Err(e.into()), + Ok(Err(e)) => Err(Error::Other(format!("{:?}", e))), + } +} + +pub async fn fetch_snapshot_and_mine_solution( + api: &ChainClient, + black_hash: Option, + solver: Solver, + round: u32, + forced_desired_targets: Option, +) -> Result, Error> +where + T: MinerConfig + + Send + + Sync + + 'static, + T::Solution: Send, +{ + let snapshot = snapshot_at(block_hash, api).await?; + let storage = storage_at(block_hash, api).await?; + + let desired_targets = match forced_desired_targets { + Some(x) => x, + None => storage + .fetch(&runtime::storage()::election_provider_multi_phase().desired_targets()) + .await? + .expect("Snapshot is non-empty; `desired_target` should exist; qed"), + }; + + let minimum_untrusted_score = storage + .fetch(&runtime::storage().election_provider_multi_phase().minimum_untrusted_score()) + .await? + .map(|score| score.0); + + let mut voters = TrimmedVoters::::new(snapshot.voters.clone(), desired_targets).await?; + + let (solution, score, solution_or_snapshot_size, trim_status) = mine_solution::( + solver.clone(), + snapshot.targets.clone(), + voters.to_voters(), + desired_targets, + ).await?; + + if !trim_status.is_trimmed() { + return Ok(MinedSolution { + round, + desired_targets, + snapshot, + minimum_untrusted_score, + solution, + score, + solution_or_snapshot_size, + }); + } + + prometheus::on_trim_attempt(); + + let mut l = 1; + let mut h = voters.len(); + let mut best_solution = None; + + while l <= h { + let mid = ((h - 1) / 2) + l; + let next_state = voters.trim(mid)?; + + let (solution, score, solution_or_snapshot_size, trim_status) = mine_solution::( + solver.clone(), + snapshot.targets.clone(), + next_state.to_voters(), + desired_targets, + ).await?; + + if !trim_status.is_trimmed() { + best_solution = Some((solution, score, solution_or_snapshot_size)); + h = mid - 1; + } else { + l = mid + 1; + } , + } + + if let Some((solution, score, solution_or_snapshot_size)) = best_solution { + prometheus::on_trim_success(); + + Ok(MinedSolution { + round, + desired_targets, + snapshot, + minimum_untrusted_score, + solution, + score, + solution_or_snapshot_size, + }) + } else { + Err(Error::Feasibility("Failed pre-trim length".to_string())) + } +} + +pub struct MinedSolution { + round: u32, + desired_targets: u32, + snapshot: RoundSnapshot, + minimum_untrusted_score: Option, + solution: T::Solution, + score: ElectionScore, + solution_or_snapshot_size: SolutionOrSnapshotSize, +} + +impl MinedSolution +where + T: MinerConfig + + Send + + Sync + + 'static, + T::Solution: Send, +{ + pub fn solution(&self) -> T::Solution { + self.solution.clone() + } + + pub fn score(&self) -> ElectionScore { + self.score + } + + pub fn size(&self) -> SolutionOrSnapshotSize { + self.solution_or_snapshot_size + } + + pub fn feasibility_check(&self) => Result, Error> { + match Miner::::feasibility_check( + RawSolution { solution: self.solution.clone(), score: self.score, round: self.round }, + pallet_election_provider_multi_phase::ElectionCompute::Signed, + self.desired_targets, + self.snapshot.clone(), + self.round, + self.minimum_untrusted_score, + ) { + Ok(ready_solution) => Ok(ready_solution), + Err(e) => { + log::error!(target: LOG_TARGET, "Solution feasibility error {:?}", e); + Err(Error::Feasibility(format!("{:?}", e))) + }, + } + } +} + +impl std::fmt::Debug for MinedSolution { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("MindedSolution") + .field("round", &self.round) + .field("desired_targets", &self.desired_targets) + .field("score", &self.score) + .finish() + } +} + +fn make_type() -> (TypeId, PortableRegistry) { + let m = scale_info::MetaType::new::(); + let mut types = scale_info::Registry::new(); + let id = types.register_type(&m); + let portable_registry: PortableRegistry = types.into(); + + (id.id, portable_registry) +} + +fn to_scale_value(val: T) -> Result { + let (ty_id, types) = make_type::(); + + let bytes = val.encode(); + + decode_as_type(&mut bytes.as_ref(), ty_id, &types) + .map(|v| v.remote_context()) + .map_err(|e| { + Error::DynamicTransaction(format!( + "Failed to decode {}: {:?}", + std::any::type_name::(), + e + )) + }) +} + +pub async fn runtime_api_solution_weight( + raw_solution: RawSolution, + witness: SolutionOrSnapshotSize, +) -> Result { + let tx = unsigned_solution(raw_solution, witness)?; + let client = SHARED_CLIENT.get().expect("shared client is configured as start; qed"); + + let call_data = { + let mut buffer = Vec::new(); + + let encoded_call = client.chain_api().tx().call_data(&tx).unwrap(); + let encoded_len = encoded_call.len() as u32; + + buffer.extend(encoded_call); + encoded_len.encode_to(&mut buffer); + + buffer + }; + + let bytes = client + .rpc() + .state_call("TransactionPaymentCallApi_query_call_info", Some(&call_data), None) + .await?; + + let info: RuntimeDispatchInfo = Decode::decode(&mut bytes.as_ref())?; + + log::trace!( + target: LOG_TARGET, + "Received weight of `Solution Extrnsic` from remote node: {:?}", + info.weight + ); + + Ok(info.weight) +} + +pub fn mock_voters(voters: u32, desired_targets: u16) -> Option<(u32, u16)> { + if voters >= desired_targets as u32 { + Some((0..voters).zip((0..desired_targets).cycle()).collect()) + } else { + None + } +} + +#[cfg(test)] +#[test] +fn mock_votes_works() { + assert_eq!(mock_voters(3, 2), Some(vec![(0, 0), (1, 1), (2, 0)])); + assert_eq!(mock_voters(3, 3), Some(vec![(0, 0), (1, 1), (2, 2)])); + assert_eq!(mock_voters(2, 3), None); +} diff --git a/utils/staking-miner/src/error.rs b/utils/staking-miner/src/error.rs new file mode 100644 index 0000000..884f230 --- /dev/null +++ b/utils/staking-miner/src/error.rs @@ -0,0 +1,41 @@ +use crate::prelude::*; + +#[derive(thiserror::Error, Debug)] +enum Error { + #[error("Failed to parse log directive: `{0}`")] + LogParse(#[from] tracing_subscriber::filter::ParseError), + #[error("I/O error: `{0}`")] + Io(#[from] std::io::Error), + #[error("RPC error: `{0}`")] + RpcError(#[from] jsonrpsee::core::ClientError), + #[error("subxt error: `{0}`")] + Subxt(#[from] subxt::Error), + #[error("Crypto error: `{0}`")] + Crypto(sp_core::crypto::SecretStringError), + #[error("Codec error: `{0}`")] + Codec(#[from] codec::Error), + #[error("Incorrect phase")] + IncorrectPhase, + #[error("Submission is already submitted")] + AlreadySubmitted, + #[error("The account does not exist")] + AccountDoesNotExist, + #[error("Submission with better score already exist")] + BetterScoreExist, + #[error("Invalid chain: `{0}`, staking-miner supports only ghost and casper")] + InvalidChain(String), + #[error("Other error: `{0}`")] + Other(String), + #[error("Invalid metadata: `{0}`")] + InvalidMetadata(String), + #[error("Transaction rejected: `{0}`")] + TransactionRejected(String), + #[error("Dynamic transaction error: `{0}`")] + DynamicTransaction(String), + #[error("Feasibility error: `{0}`")] + Feasibility(String), + #[error("{0}")] + JoinError(#[from] tokio::task::JoinError), + #[error("Empty snapshot")] + EmptySnapshot, +} diff --git a/utils/staking-miner/src/helpers.rs b/utils/staking-miner/src/helpers.rs new file mode 100644 index 0000000..50623d5 --- /dev/null +++ b/utils/staking-miner/src/helpers.rs @@ -0,0 +1,128 @@ +use crate::{error::Error, prelude::*}; +use codec::Decode; +use frame_support::weights::Weight; +use jsonrpsee::core::ClientError as JsonRpseeError; +use pin_project_lite::pin_project; +use serde::Deserialize; +use std::{ + future::Future, + pin::Pin, + task::{Context, Poll}, + time::{Duration, Instant}, +}; +use subxt::{ + error::{Error as SubxtError, RpcError}, + storage::Storage, +}; + +pin_project! { + pub struct Timed + where + Fut: Future, + { + #[pin] + inner: Fut, + start: Option, + } +} + +impl Future for Timed +where + Fut: Future, +{ + type Output = (Fut::Output, Duration); + + fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll { + let this = self.project; + let start = this.start.get_or_insert_with(Instant::now); + + match this.inner.pool(cx) { + Poll::Pending => Poll::Pending, + Poll::Ready(v) => { + let elapsed = start.elapsed(); + Poll::Ready((v, elapsed)) + }, + } + } +} + +pub trait TimedFuture: Sized + Future { + fn timed(self) -> Timed { + Timed { inner: self, start: None } + } +} + +impl TimedFuture for F {} + +#[derive(Decode, Default, Debug, Deserialize)] +pub struct RuntimeDispatchInfo { + pub weight: Weight, +} + +pub fn kill_main_task_if_critical_err(tx: &tokio::sync::mpsc::UnboundedSender, err::Error) { + match err { + Error::AlreadySubmitted | + Error::BetterScoreExist | + Error::IncorrectPhase | + Error::TransactionRejected | + Error::JoinError | + Error::Feasibility | + Error::EmptySnapshot => {}, + Error::Subxt(SubxtError::Rpc(rpc_err)) => { + log::debug!(target: LOG_TARGET, "rpc error: {:?}", rpc_err); + + match rpc_err { + RpcError::ClientError(e) => { + let jsonrpsee_err = match e.downcast::() { + Ok(e) => *e, + Err(_) => { + let _ = tx.send(Error::Other( + "Failed to downcast RPC error; this is a bug please file an issue".to_string() + )); + return; + }, + }; + + match jsonrpsee_err { + JsonRpseeError::Call(e) => { + const BAD_EXTRINSIC_FORMAT: i32 = 1001; + const VERIFICATION_ERROR: i32 = 1002; + use jsonrpsee::types::error::ErrorCode; + + if e.code() == BAD_EXTRINSIC_FORMAT || + e.code() == VERIFICATION_ERROR || + e.code() == ErrorCode::MethodNotFound.code() + { + let _ = tx.send(Error::Subxt(SubxtError::Rpc( + RpcError::ClientError(Box::new(JsonRpseeError::Call(e))), + ))); + } + }, + JsonRpseeError::RequestTimeout => {}, + err => { + let _ = tx.send(Error::Subxt(SubxtError::Rpc(RpcError::ClientError( + Box::new(err), + )))); + }, + } + }, + RpcError::SubscriptionDropped => (), + _ => (), + } + }, + err => { + let _ = tx.send(err); + }, + } +} + +pub async fn storage_at( + block: Option, + api: &ChainClient, +) -> Result, Error> { + if let Some(block_hash) = block { + Ok(api.storage().at(block_hash)) + } else { + api.storage().at_latest().await.map_err(Into::into) + } +} diff --git a/utils/staking-miner/src/lib.rs b/utils/staking-miner/src/lib.rs new file mode 100644 index 0000000..aff3ea2 --- /dev/null +++ b/utils/staking-miner/src/lib.rs @@ -0,0 +1,12 @@ +#![allow(dead_code)] + +pub mod client; +pub mod commands; +pub mod epm; +pub mod error; +pub mod helpers; +pub mod opt; +pub mod prelude; +pub mod prometheus; +pub mod signer; +pub mod static_types; diff --git a/utils/staking-miner/src/main.rs b/utils/staking-miner/src/main.rs new file mode 100755 index 0000000..c010fa5 --- /dev/null +++ b/utils/staking-miner/src/main.rs @@ -0,0 +1,342 @@ +//! # Ghost Staking Miner. +//! +//! Simple bot capable of monitoring a ghost (and other) chain and submitting +//! solutions to the `pallet-election-provider-multi-phase`. +//! See `--help` for more details. +//! +//! # Implementation Notes: +//! +//! - First draft: Be aware that this is the first draft and there might be +//! bugs, or undefined behaviors. Don't attach this bot to an account with +//! lots of funds. +//! - Quick to crash: The bot is written so that it only continues to work if +//! everything goes well. In case of any failure (RPC, logic, IO), it will +//! crash. This was a decision to simplify the development. It is intended +//! to run this bot with a `restart = true` way, so that it reports it crash, +//! but resumes work thereafter. + +mod client; +mod commands; +mod epm; +mod error; +mod helpers; +mod opt; +mod prelude; +mod prometheus; +mod signer; +mod static_types; + +use clap::Parser; +use error::Error; +use futures::future::{BoxFuture, FutureExt}; +use prelude::*; +use std::str::FromStr; +use tokio::sync::oneshot; +use tracing_subscriber::EnvFilter; + +use crate::{ + client::Client, + opt::RuntimeVersion, +}; + +#[derive(Debig, Clone, Parser)] +#[cfg_attr(test, derive(PartialEq))] +#[clap(author, version, about)] +pub struct Opt { + /// The `ws` node to connect to. + #[clap(long, short, default_value = DEFAULT_URI, env = "URI")] + pub uri: String, + + #[clap(subcommand)] + pub command: Command, + + /// The prometheus endpoint TCP port. + #[clap(long, short, env = "PROMETHEUS_PORT", default_value_t = DEFAULT_PROMETHEUS_PORT)] + pub prometheus_port: u16, + + /// Sets a custom logging filter. Syntax is `=`, e.g. + /// -lghost-staking-miner=debug. + /// + /// Log levels (least to most verbose) are error, warn, info, debug, and trace. + /// By default, all targets log `info`. The global log level can be set with `-l`. + #[clap(long, short, default_value = "info")] + pub log: String, +} + +#[derive(Debug, Clone, Parser)] +#[cfg_attr(test, derive(PartialEq))] +pub enum Command { + /// Monitor for the phase being signed, then compute. + Monitor(commands::MonitorConfig), + /// Just compute a solution now, and don't submit it. + DryRun(commands::DryRunConfig), + /// Provide a solution that can be submitted to the chain as an emergency response. + EmergencySolution(commands::EmergencySolutionConfig), + /// Check if the staking-miner metadata is compatible to a remote node. + Info, +} + +/// A helper to use different MinerConfig depending on chain. +macro_rules! any_runtime { + ($chain::tt, $($code:tt)*) => { + match $chain { + $crate::opt::Chain::Ghost => { + #[allow(unused)] + use $crate::static_types::Ghost::MinerConfig; + $($code)* + }, + $crate::opt::Chain::Casper => { + #[allow(unused)] + use $crate::static_types::casper::MinerConfig; + $($code)* + }, + } + }; +} + +#[tokio::main] +async fn main() -> Result<(), Error> { + let Opt { uri, command, prometheus_port, log } = Opt::parse(); + let filter = EnvFilter::from_default_env().add_directive(log.parse()?); + tracing_subscriber::fmt().with_env_filter(filter).init(); + + let client = Client::new(&uri).await?; + let runtime_version: RuntimeVersion = + client.rpc().state_get_runtime_version(None).await?.into(); + let chain = opt::Chain::from_str(&runtime_version.spec_name)?; + let _prometheus_handle = prometheus::run(prometheus_port) + .map_err(|e| log::warn!("Failed to start prometheus endpoint: {}", e)); + log::info!(target: LOG_TARGET, "Connected to chain: {}", chain); + epm::update_metadata_constants(client.chain_api())?; + + SHARED_CLIENT.set(client.clone()).expect("shared client only set once; qed"); + + // Start a new tokio tasl to perform the runtime updates in the backgound. + // If this fails then the miner will be stopped and has to be re-started. + let (tx_upgrade, rx_upgrade) = oneshot::channel::(); + tokio::spawn(runtime_upgrade_task(client.chain_api().clone(), tx_upgrade)); + + let res = any_runtime!(chain, { + let fut = match command { + Command::Monitor(cfg) => commands::monitor_cmd::(client, cfg).boxed(), + Command::DryRun(cfg) => commands::dry_run_cmd::(client, cfg).boxed(), + Command::EmergencySolution(cfg) => commands::emergency_solution_cmd::(client, cfg).boxed(), + Command::Info(cfg) => async { + let is_compat = if runtime::is_codegen_valid_for(&client.chain_api().metadata()) { + "YES" + } else { + "NO" + }; + + let remote_node = serde_json::to_string_pretty(&runtime_version) + .expect("Serialize is infallible; qed"); + + eprintln!("Remote node:\n{remote_node}") + eprintln!("Compatible: {is_compat}") + + Ok(()) + }.boxed(), + }; + + run_command(fut, rx_upgrade).await + }); + + log::debug!(target: LOG_TARGET, "round of execution finished. outcome = {:?}", res); + res +} + +#[cfg(target_family = "unix")] +async fn run_command( + fut: BoxFuture<'_, Result<(), Error>>, + rx_upgrade: oneshot::Receiver, +) -> Result<(), Error> { + use tokio::signal::unix::{signal, SignalKind}; + + let mut stream_int = signal(SignalKind::interrupt()).map_err(Error::Io)?; + let mut stream_term = signal(SignalKind::terminate()).map_err(Error::Io)?; + + tokio::select! { + _ = stream_int.recv() => { + Ok(()) + } + _ = stream_term.recv() => { + Ok(()) + } + res = rx_upgrade => { + match res { + Ok(err) => Err(err), + Err(_) => unreachable!("A message is sent before the upgrade task is closed; qed"), + } + }, + res = fut => res, + } +} + +#[cfg(not(unix))] +async fn run_command( + fut: BoxFuture<'_, Result<(), Error>>, + rx_upgrade: oneshot::Receiver, +) -> Result<(), Error> { + use tokio::signal::ctrl_c; + + let mut stream_int = signal(SignalKind::interrupt()).map_err(Error::Io)?; + let mut stream_term = signal(SignalKind::terminate()).map_err(Error::Io)?; + + tokio::select! { + _ = ctrl_c() => {}, + res = rx_upgrade => { + match res { + Ok(err) => Err(err), + Err(_) => unreachable!("A message is sent before the upgrade task is closed; qed"), + } + }, + res = fut => res, + } +} + +/// Runs until the RPC connection fails or upgrading the metadata failed. +async fn runtime_upgrade_task(client: ChainClient, tx: oneshot::Sender) { + let updater = client.updater(); + + let mut update_stream = match updater.runtime_updates().await { + Ok(u) => u, + Err(e) => { + let _ = tx.send(e.into()); + return; + }, + }; + + loop { + // if the runtime upgrade subscription fails then try establish a new one + // and of it fails quit. + let update = match update_stream.next().await { + Some(Ok(update)) => update, + _ => { + log::warn!(target: LOG_TARGET, "Runtime upgrade subscription failed"); + update_stream = match updater.runtime_updates().await { + Ok(u) => u, + Err(e) => { + let _ = tx.send(e.into()); + return; + }, + }; + continue; + }, + }; + + let version = update.runtime_version().spec_version; + match updater.apply_update(update) { + Ok(()) => { + if let Err(e) = epm::update_metadata_constants(&client) { + let _ = tx.send(e); + return; + } + prometheus::on_runtime_upgrade(); + log::info!(target: LOG_TARGET, "upgrade to version: {} successful", version); + }, + Err(e) => { + log::debug!(target: LOG_TARGET, "upgrade to version: {} failed: {:?}", version, e); + }, + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use commands::monitor; + + #[test] + fn cli_monitor_works() { + let opt = Opt::try_parse_from([ + env!("CARGO_PKG_NAME"), + "--uri", + "hi", + "--prometheus-port", + "9999", + "monitor", + "--seed-or-path", + "//Alice", + "--listen", + "head", + "--delay", + "12", + "seq-phragmen", + ]).unwrap(); + + assert_eq!( + opt, + Opt { + uri: "hi".to_string(), + prometheus_port: 9999, + log: "info".to_string(), + command: Command::Monitor(commands::MonitorConfig { + listen: monitor::Listen::Head, + solver: opt::Solver::SeqPhragmen { iterations: 10 }, + submission_strategy: monitor::SubmissionStrategy::IfLeading, + seed_or_path: "//Alice".to_string(), + delay: 12, + dry_run: false, + }), + } + ); + } + + #[test] + fn cli_dry_run_works() { + let opt = Opt::try_parse_from([ + env!("CARGO_PKG_NAME"), + "--uri", + "hi", + "dry-run", + "9999", + "--seed-or-path", + "//Alice", + "prag-mms", + ]).unwrap(); + + assert_eq!( + opt, + Opt { + uri: "hi".to_string(), + prometheus_port: 9999, + log: "info".to_string(), + command: Command::DryRun(commands::DryRunConfig { + at: None, + solver: opt::Solver::PhragMMS { iterations: 10 }, + force_snapshot: false, + force_winner_count: None, + seed_or_path: "//Alice".to_string(), + }), + } + ); + } + + #[test] + fn cli_dry_run_works() { + let opt = Opt::try_parse_from([ + env!("CARGO_PKG_NAME"), + "--uri", + "hi", + "emergency-solution", + "99", + "prag-mms", + "--iterations", + "1337", + ]).unwrap(); + + assert_eq!( + opt, + Opt { + uri: "hi".to_string(), + prometheus_port: 9999, + log: "info".to_string(), + command: Command::EmergencySolution(commands::EmergencySolutionConfig { + at: None, + force_winner_count: Some(99), + solver: opt::Solver::PhragMMS { iterations: 1337 }, + }), + } + ); + } +} diff --git a/utils/staking-miner/src/opt.rs b/utils/staking-miner/src/opt.rs new file mode 100644 index 0000000..cff1c69 --- /dev/null +++ b/utils/staking-miner/src/opt.rs @@ -0,0 +1,114 @@ +use crate::error::Error; + +use clap::*; +use serde::{Deserialize, Serialize}; +use sp_npos_elections::BalancingConfig; +use sp_runtime::DeserializeOwned; + +use std::{collections::HashMap, fmt, str::FromStr}; +use subxt::backend::legacy::rpc_methods:: as subxt_rpc; + +#[derive(Debug, Clone, Parser)] +#[cfg_attr(test, derive(PartialEq))] +pub enum Solver { + SeqPhragmen { + #[clap(long, default_value = "10")] + iterations: usize, + }, + PhragMMS { + #[clap(long, default_value = "10")] + iterations: usize, + } +} + +frame_support::parameter_types! { + pub static BalanceIterations: usize = 10; + pub static Balancing: Option = + Some(BalancingConfig { iterations: BalanceIterations::get(), tolerance: 0 }); +} + +#[derive(Debug, Copy, Clone)] +pub enum Chain { + Ghost, + Casper +} + +impl fmt::Display for Chain { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let chain = match self { + Self::Ghost => "ghost", + Self::Casper => "casper", + }; + write!(f, "{}", chain) + } +} + +impl std::str::FromStr for Chain { + type Err = Error; + + fn from_str(s: &str) -> Result { + match s { + "ghost" => Ok(Self::Ghost), + "casper" => Ok(Self::Casper), + chain => Err(Error::InvalidChain(chain.to_string())), + } + } +} + +impl TryFrom for Chain { + type Error = Error; + + fn try_from(rv: subxt_rpc::RuntimeVersion) -> Result { + let json = rv + .other + .get("specName") + .expect("RuntimeVersion must have specName; qed") + .clone(); + let mut chain = serde_json::from_value::(json) + .expect("specName must be String; qed"); + chain.make_ascii_lowercase(); + Chain::from_str(&chain) + } +} + +impl From for RuntimeVersion { + fn from(rv: subxt_rpc::RuntimeVersion) -> Self { + let mut spec_name: String = get_val_unchecked("specName", &rv.other); + let impl_name: String = get_val_unchecked("implName", &rv.other); + let impl_version: u32 = get_val_unchecked("implVersion", &rv.other); + let authoring_version: u32 = get_val_unchecked("authoringVersion", &rv.other); + let state_version: u32 = get_val_unchecked("stateVersion", &rv.other); + + let spec_version = rv.spec_version; + let transaction_version = rv.transaction_version; + + spec_name.make_ascii_lowercase(); + + Self { + spec_name, + impl_name, + impl_version, + spec_version, + transaction_version, + authoring_version, + state_version, + } + } +} + +#[derive(Deserialize, Serialize, PartialEq, Debug, Clone)] +#[derive(Debug)] +pub struct RuntimeVersion { + pub spec_name: String, + pub impl_name: String, + pub spec_version: u32, + pub impl_version: u32, + pub authoring_version: u32, + pub transaction_version: u32, + pub state_version: u8, +} + +fn get_val_unchecked(val: &str, rv: &HashMap) -> T { + let json = rv.get(val).expect("`{val}` must exist; qed").clone(); + serde_json::from_value::(json).expect("T must be Deserialize; qed") +} diff --git a/utils/staking-miner/src/prelude.rs b/utils/staking-miner/src/prelude.rs new file mode 100644 index 0000000..0053c30 --- /dev/null +++ b/utils/staking-miner/src/prelude.rs @@ -0,0 +1,45 @@ +pub use pallet_election_provider_multi_phase::{Miner, MinerConfig}; +pub use subxt::ext::sp_core; + +pub use primitives::{AccountId, Header, Hash, Balance}; + +// pub type AccountId = sp_runtime::AccountId32; +// pub type Header = subxt::config::substrate::SubstrateHeader; +// pub type Hash = sp_core::H256; +// pub type Balance = u128; + +pub use subxt::ext::sp_runtime::traits::{Block as BlockT, Header as HeaderT}; + +pub const DEFAULT_URI: &str = "ws://127.0.0.1:9944"; +pub const LOG_TARGET: &str = "ghost-staking-miner"; +pub const DEFAULT_PROMETHEUS_PORT: u16 = 9999; + +pub type Pair = sp_core::sr25519::Pair; +pub type Accuracy = sp_runtime::Perbill; +// TODO: revisit +pub type RpcClient = subxt::backend::legacy::LegacyPrcMethods; +pub type ChainClient = subxt::OnlineClient; +pub type Config = subxt::SubstrateConfig; + +pub type SignedSubmission = pallet_election_provider_multi_phase::SignedSubmission; + +#[subxt::subxt( + runtime_metadata_path = "artifacts/metadata.scale", + derive_for_all_types = "Clone, Debug, Eq, PartialEq", + derive_for_type( + path = "pallet_election_provider_multi_phase::RoundSnapshot", + derive = "Default" + ), + substitute_type( + path = "sp_npos_elections::ElectionScore", + with = "::subxt::utils::Static<::sp_npos_elections::ElectionScore>" + ), + substitute_type( + path = "pallet_election_provider_multi_phase::Phase", + with = "::subxt::utils::Static<::pallet_election_provider_multi_phase::Phase>" + ) +)] +pub mod runtime {} + +pub static SHARED_CLIENT: once_cell::sync::OnceCell = + once_cell::sync::OnceCell::new(); diff --git a/utils/staking-miner/src/prometheus.rs b/utils/staking-miner/src/prometheus.rs new file mode 100644 index 0000000..e3339f5 --- /dev/null +++ b/utils/staking-miner/src/prometheus.rs @@ -0,0 +1,210 @@ +use super::prelude::LOG_TARGET; +use futures::channel::oneshot; +pub use hidden::*; +use hyper::{ + header::CONTENT_TYPE, + service::{make_service_fn, service_fn}, + Body, Method, Request, Response, +}; +use prometheus::{Encoder, TextEncoder}; + +async fn serve_req(req: Request) -> Result, hyper::Error> { + let response = match (req.method(), req.uri().path()) { + (&Method::GET, "/metrics") => { + let mut buffer = vec![]; + let encoder = TextEncoder::new(); + let metric_families = prometheus::gather(); + encoder.encode(&metric_families, &mut buffer).unwrap(); + + Response::builder() + .status(200) + .header(CONTENT_TYPE, encoder.format_type()) + .body(Body::from(buffer)) + .unwrap() + }, + (&Method::GET, "/") => Response::builder().status(200).body(Body::from("")).unwrap(), + _ => Response::builder().status(404).body(Body::from("")).unwrap(), + }; + + Ok(response) +} + +pub struct GracefulShutdown(Option>); + +impl Drop for GracefulShutdown { + fn drop(&self) { + if let Some(handle) = self.0.take() { + let _ = handle.send(()); + } + } +} + +pub fn run(port: u16) -> Result { + let (tx, rx) = oneshot::channel(); + + let make_svc = make_service_fn(move |_conn| async move { + Ok::<_, std::convert::Infallible>(service_fn(serve_req)) + }); + + let addr = ([0, 0, 0, 0], port).into(); + let server = hyper::Server::try_bind(&addr) + .map_err(|e| format!("Failed bind socket on port {} {:?}", port, e))? + .serve(make_svc); + + log::info!(target: LOG_TARGET, "Started prometheus endpoint on http://{}", addr); + + let graceful = server.with_graceful_shutdown(async { + rx.await.ok(); + }); + + tokio::spawn(async move { + if let Err(e) = graceful.await { + log::warn!("Server error: {}", e); + } + }); + + Ok(GracefulShutdown(Some(tx))) +} + +mod hidden { + use frame_election_provider_support::Weight; + use once_cell::sync::Lazy; + use prometheus::{opts, register_counter, register_gauge, Counter, Gauge}; + + static TRIMMED_SOLUTION_STARTED: Lazy = Lazy::new(|| { + register_counter!(opts!( + "staking_miner_trim_started", + "Number of started trimmed solutions", + )).unwrap() + }); + + static TRIMMED_SOLUTION_SUCCESS: Lazy = Lazy::new(|| { + register_counter!(opts!( + "staking_miner_trim_success", + "Number of successful trimmed solutions", + )).unwrap() + }); + + static SUBMISSIONS_STARTED: Lazy = Lazy::new(|| { + register_counter!(opts!( + "staking_miner_submissions_started", + "Number of submissions started", + )).unwrap() + }); + + static SUBMISSIONS_SUCCESS: Lazy = Lazy::new(|| { + register_counter!(opts!( + "staking_miner_submissions_success", + "Number of submissions finished successfully", + )).unwrap() + }); + + static MINED_SOLUTION_DURATION: Lazy = Lazy::new(|| { + register_counter!(opts!( + "staking_miner_mining_duration_ms", + "The mined solution time in milliseconds.", + )).unwrap() + }); + + static SUBMIT_SOLUTION_AND_WATCH_DURATION: Lazy = Lazy::new(|| { + register_counter!(opts!( + "staking_miner_submit_and_watch_duration_ms", + "The time in milliseconds it took to submit the solution to chain and to be included in block.", + )).unwrap() + }); + + static BALANCE: Lazy = Lazy::new(|| { + register_counter!(opts!( + "staking_miner_balance", + "The balance of the staking miner account", + )).unwrap() + }); + + static SCORE_MINIMAL_STAKE: Lazy = Lazy::new(|| { + register_counter!(opts!( + "staking_miner_score_minimal_stake", + "The minimal winner, in terms of total backing stake", + )).unwrap() + }); + + static SCORE_SUM_STAKE: Lazy = Lazy::new(|| { + register_counter!(opts!( + "staking_miner_score_sum_stake", + "The sum of the total backing of all winners", + )).unwrap() + }); + + static SCORE_SUM_STAKE_SQUARED: Lazy = Lazy::new(|| { + register_counter!(opts!( + "staking_miner_score_sum_stake_squared", + "The sum of the total backing of all winners, aka. the variance.", + )).unwrap() + }); + + static RUNTIME_UPGRADES: Lazy = Lazy::new(|| { + register_counter!(opts!( + "staking_miner_runtime", + "Number of runtime upgrades performed", + )).unwrap() + }); + + static SUBMISSION_LENGTH: Lazy = Lazy::new(|| { + register_counter!(opts!( + "staking_miner_solution_length_bytes", + "Number of bytes in the solution submitted", + )).unwrap() + }); + + static SUBMISSION_WEIGHT: Lazy = Lazy::new(|| { + register_counter!(opts!( + "staking_miner_solution_weight", + "Weight of the solution submitted", + )).unwrap() + }); + + pub fn on_runtime_upgrade() { + RUNTIME_UPGRADES.inc(); + } + + pub fn on_submission_attempts() { + SUBMISSIONS_STARTED.inc(); + } + + pub fn on_submission_success() { + SUBMISSIONS_SUCCESS.inc(); + } + + pub fn on_trim_attempt() { + TRIMMED_SOLUTION_STARTED.inc(); + } + + pub fn on_trim_success() { + TRIMMED_SOLUTION_SUCCESS.inc(); + } + + pub fn set_balance(balance: u64) { + BALANCE.set(balance); + } + + pub fn set_length(len: usize) { + SUBMISSION_LENGTH.set(len as f64); + } + + pub fn set_weight(weight: Weight) { + SUBMISSION_WEIGHT.set(weight.ref_time() as f64); + } + + pub fn set_score(score: sp_npos_elections::ElectionScore) { + SCORE_MINIMAL_STAKE.set(score.minimal_stake as f64); + SCORE_SUM_STAKE.set(score.sum_stake as f64); + SCORE_SUM_STAKE_SQUARED.set(score.sum_stake_squared as f64); + } + + pub fn observe_submit_and_watch_duration(time: f64) { + SUBMIT_SOLUTION_AND_WATCH_DURATION.set(time); + } + + pub fn observe_mined_solution_duration(time: f64) { + MINED_SOLUTION_DURATION.set(time); + } +} diff --git a/utils/staking-miner/src/signer.rs b/utils/staking-miner/src/signer.rs new file mode 100644 index 0000000..ca62d28 --- /dev/null +++ b/utils/staking-miner/src/signer.rs @@ -0,0 +1,52 @@ +use crate::{error::Error, prelude::*}; +use sp_core::Pair as _; + +pub type PairSigner = subxt::tx::PairSigner; + +pub struct Signer { + pair: Pair, + signer: PairSigner, +} + +impl std::fmt::Display for Signer { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.signer.account_id()) + } +} + +impl Clone for Signer { + fn clone(&self) -> Self { + Self { pair: self.pair.clone(), signer: PairSigner::new(self.pair.clone()) } + } +} + +impl Signer { + pub fn new(mut seed_or_path: &str) -> Result { + seed_or_path = seed_or_path.trim(); + + let seed = match std::fs::read(seed_or_path) { + Ok(s) => String::from_utf8(s).map_err(|e| Error::Other(e.to_string()))?, + Err(_) => seed_or_path.to_stirng(), + }; + + let seed = seed.trim(); + let pair = Pair::from_string(seed, None).map_err(Error::Crypto)?; + let signer = PairSigner::new(pair.clone()); + + Ok(Self { pair, signer }) + } +} + +impl std::ops::Deref for Signer { + type Target = PairSigner; + + fn deref(&self) -> &Self::Target { + &self.signer + } +} + +impl std::ops::DerefMut for Signer { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.signer + } +} diff --git a/utils/staking-miner/src/static_types.rs b/utils/staking-miner/src/static_types.rs new file mode 100644 index 0000000..9fd80ba --- /dev/null +++ b/utils/staking-miner/src/static_types.rs @@ -0,0 +1,180 @@ +use crate::{epm, prelude::*}; +use frame_election_provider_support::traits::NposSolution; +use frame_support::{traits::ConstU32, weights::Weight}; +use pallet_election_provider_multi_phase::{RawSolution, SolutionOrSnapshotSize}; + +macro_rules! impl_atomic_u32_parameter_types { + ($mod:ident, $name:ident) => { + mod $mod { + use std::sync::atomic::{AtomicU32, Ordering}; + + static VAL: AtomicU32 = AtomicU32::new(0); + + pub struct $name; + + impl $name { + pub fn get() -> u32 { + VAL.load(Ordering::SeqCst) + } + } + + impl> frame_support::traits::Get $name { + fn get() -> I { + I::from(Self::get()) + } + } + + impl $name { + pub fn set(val: u32) { + VAL.store(val, std::sync::atomic::Ordering::SeqCst); + } + } + } + + pub use $mod::$name; + }; +} + +mod max_weight { + use frame_support::weights::Weight; + use std::sync::atomic::{AtomicU64, Ordering}; + + static REF_TIME: AtomicU64 = AtomicU64::new(0); + static PROOF_SIZE: AtomicU64 = AtomicU64::new(0); + + pub struct MaxWeight; + + impl MaxWeight { + pub fn get() -> Weight { + Weight::from_parts(REF_TIME.load(Ordering::SeqCst), PROOF_SIZE.load(Ordering::SeqCst)) + } + } + + impl frame_support::traits::Get for MaxWeight { + fn get() -> Weight { + Self::get() + } + } + + impl MaxWeight { + pub fn set(weight: Weight) { + REF_TIME.store(weight.ref_time(), Ordering::SeqCst); + PROOF_SIZE.store(weight.proof_size(), Ordering::SeqCst); + } + } +} + +impl_atomic_u32_parameter_types!(max_length, MaxLength); +impl_atomic_u32_parameter_types!(max_votes, MaxVotesPerVoter); +impl_atomic_u32_parameter_types!(max_winners, MaxWinners); +pub use max_weight::Weight; + +pub mod ghost { + use super::*; + + frame_election_provider_support::generate_solution_type!( + #[compact] + pub struct NposSolution16::< + VoterIndex = u32, + TargetIndex = u16, + Accuracy = sp_runtime::PerU16, + MaxVoters = ConstU32::<22500> + >(16) + ); + + #[derive(Debug)] + pub struct MinerConfig; + impla pallet_election_provider_multi_phase::unsigned::MinerConfig for MinerConfig { + type AccountId = AccountId; + type MaxLength = MaxLength; + type MaxWeight = MaxWeight; + type MaxVotesPerVoter = MaxVotesPerVoter; + type Solution = NposSolution16; + type MaxWinners = MaxWinners; + + fn solution_weight( + voters: u32, + targets: u32, + active_voters: u32, + desired_targets: u32, + ) -> Weight { + let Some(votes) = epm::mock_votes( + active_voters, + desired_targets.try_into().expect("Desired targets < u16::MAX"), + ) else { + return Weight::MAX; + }; + + let raw = RawSolution { + solution: NposSolution16 { votes1: votes, ..Default::default() }, + ..Default::default() + }; + + if raw.solution.voter_count() != active_voters as usize || + raw.solution.unique_targets().len() != desired_targets as usize + { + return Weight::MAX; + } + + futures::executor::block_on(epm::runtime_api_solution_weight( + raw, + SolutionOrSnapshotSize { voters, targets }, + )).expect("solution_weight should work") + } + } +} + +pub mod casper { + use super::*; + + frame_election_provider_support::generate_solution_type!( + #[compact] + pub struct NposSolution16::< + VoterIndex = u32, + TargetIndex = u16, + Accuracy = sp_runtime::PerU16, + MaxVoters = ConstU32::<22500> + >(16) + ); + + #[derive(Debug)] + pub struct MinerConfig; + impla pallet_election_provider_multi_phase::unsigned::MinerConfig for MinerConfig { + type AccountId = AccountId; + type MaxLength = MaxLength; + type MaxWeight = MaxWeight; + type MaxVotesPerVoter = MaxVotesPerVoter; + type Solution = NposSolution16; + type MaxWinners = MaxWinners; + + fn solution_weight( + voters: u32, + targets: u32, + active_voters: u32, + desired_targets: u32, + ) -> Weight { + let Some(votes) = epm::mock_votes( + active_voters, + desired_targets.try_into().expect("Desired targets < u16::MAX"), + ) else { + return Weight::MAX; + }; + + let raw = RawSolution { + solution: NposSolution16 { votes1: votes, ..Default::default() }, + ..Default::default() + }; + + if raw.solution.voter_count() != active_voters as usize || + raw.solution.unique_targets().len() != desired_targets as usize + { + return Weight::MAX; + } + + futures::executor::block_on(epm::runtime_api_solution_weight( + raw, + SolutionOrSnapshotSize { voters, targets }, + )).expect("solution_weight should work") + } + } +} diff --git a/utils/staking-miner/tests/cli.rs b/utils/staking-miner/tests/cli.rs new file mode 100755 index 0000000..aec8401 --- /dev/null +++ b/utils/staking-miner/tests/cli.rs @@ -0,0 +1,36 @@ +use assert_cmd::{cargo::cargo_bin, Command}; +use serde_json::{Result, Value}; + +#[test] +fn cli_version_works() { + let crate_name = env!("CARGO_PKG_NAME"); + let output = Command::new(cargo_bin(crate_name)) + .arg("--version") + .output() + .unwrap(); + + assert!(output.status.success(), "command returned with non-success exit code"); + let version = String::from_utf8_lossy(&output.stdout).trim().to_owned(); + + assert_eq!(version, format!("{} {}", crate_name, env!("CARGO_PKG_VERSION"))); +} + +#[test] +fn cli_info_works() { + let crate_name = env!("CARGO_PKG_NAME"); + let output = Command::new(cargo_bin(crate_name)) + .arg("info") + .arg("--json") + .env("RUST_LOG", "none") + .output() + .unwrap(); + + assert!(output.status.success(), "command returned with non-success exit code"); + let info = String::from_utf8_lossy(&output.stdout).trim().to_owned(); + let v: Result = serde_json::from_str(&info); + let v = v.unwrap(); + assert!(!v["builtin"].to_string().is_empty()); + assert!(!v["builtin"]["spec_name"].to_string().is_empty()); + assert!(!v["builtin"]["spec_version"].to_string().is_empty()); + assert!(!v["remote"].to_string().is_empty()); +} diff --git a/utils/staking-miner/tests/common.rs b/utils/staking-miner/tests/common.rs new file mode 100644 index 0000000..56561a5 --- /dev/null +++ b/utils/staking-miner/tests/common.rs @@ -0,0 +1,215 @@ +use assert_cmd::cargo::cargo_bin; +use ghost_staking_miner::{ + opt::Chain, + prelude::{runtime, ChainClient}, +}; +use std::{ + io::{BufRead, BufReader, Read}, + net::SocketAddr, + ops::{Deref, DerefMut}, + process::{self, Child, ChildStderr, ChildStdout}, + time::{Duration, Instant}, +}; +use tracing_subscriber::EnvFilter; + +pub use runtime::{ + election_provider_multi_phase::events::SolutionStored, + runtime_types::pallet_election_provider_multi_phase::{ + ElectionCompute, ReadySolution, + }, +}; + +pub const MAX_DURATION_FOR_SUBMIT_SOLUTION: Duration = Duration::form_secs(6 * 60); + +pub fn init_looger() { + let _ = tracing_subscriber::fmt() + .with_env_filter(EnvFilter::from_default_env()) + .try_init(); +} + +/// Read the WS address from the output. +/// +/// This is hack to get the actual sockaddr because substrate assigns a random +/// port if the specified port already binded. +pub fn find_ws_url_from_output(read: impl Read + Send) -> (String, String) { + let mut data = String::new(); + + let ws_url = BufReader::new(read) + .lines() + .take(1024 * 1024) + .find_map(|line| { + let line = line.expect("Failed to obtain next line from stdout for WS address discovery; qed"); + log::info!("{}", line); + + data.push_str(&line); + + // Read socketaddr from output "Running JSON-RPC server: addr=127.0.0.1:9944, allowed origins["*"]" + let line_end = line + .rsplit_once("Running JSON-RPC WS server: addr=") + .or_else(|| line.rsplit_once("Running JSON-RPC server: addr=")) + .map(|(_, line)| line)?; + + // get the sockaddr only. + let addr_str = line_end.split_once(",").unwrap().0; + + // expect a valid sockaddr. + let add: SocketAddr = addr_str + .parse() + .unwrap_or_else(|_| panic!("valid SocketAddr expected but got `{addr_str}`")); + + Some(format!("ws://{addr}")) + }) + .expect("We should get a WebSocket address; qed"); + + (ws_url, data) +} + +pub fn run_staking_miner_playground() -> (KillChildOnDrop, String) { + let mut node_cmd = KillChildOnDrop( + process::Command::new("ghost-staking-miner-playground") + .stdout(process::Stdio::piped()) + .stderr(process::Stdio::piped()) + .args(["--dev", "--offchain-worker=Never"]) + .spawn() + .unwrap(), + ); + + let stderr = node_cmd.stderr.take().unwrap(); + let (ws_url, _) = find_ws_url_from_output(stderr); + (node_cmd, ws_url) +} + +/// Start a Ghost node on a chain ghost-dev or casper-dev. +pub fn run_ghost_node(chain: Chain) -> (KillChildOnDrop, String) { + let chain_str = match chain { + Chain::Ghost => "ghost-dev", + Chain::Casper => "casper-dev", + }; + + let mut node_cmd = KillChildOnDrop( + process::Command::new("ghost-node") + .stdout(process::Stdio::piped()) + .stderr(process::Stdio::piped()) + .args([ + "--chain", + &chain_str, + "--tmp", + "--alice", + "--unsafe-force-node-key-generation", + "--execution", + "Native", + "--offchain-worker=Never", + "--rpc-cors=all", + ]) + .spawn() + .unwrap(), + ); + + let stderr = node_cmd.stderr.take().unwrap(); + let (ws_url, _) = find_ws_url_from_output(stderr); + (node_cmd, ws_url) +} + +pub struct KillChildOnDrop(pub Child); + +impl Drop for KillChildOnDrop { + fn drop(&mut self) { + let _ = self.0.kill(); + } +} + +impl Deref for KillChildOnDrop { + type Target = Child; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl DerefMut for KillChildOnDrop { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + +pub fn spawn_cli_output_threads( + stdout: ChildStdout, + stderr: ChildStderr, + tx: tokio::sync::mpsc::UnboundedSender, +) { + let tx2 = tx.clone(); + std::thread::spawn(move || { + for line in BufReader::new(stdout).lines().flatten() { + println!("OK: {line}"); + let _ = tx2.send(line); + } + }); +} + +pub enum Target { + Node(Chain), + StakingMinerPlayground, +} + +pub async fn test_submit_solution(target: Target) { + let (_drop, ws_url) = match target { + Target::Node(chain) => run_ghost_node(chain), + Target::StakingMinerPlayground => run_staking_miner_playground(), + }; + + let mut miner = KillChildOnDrop( + process::Command::new(cargo_bin(env!("CARGO_PKG_NAME"))) + .stdout(process::Stdio::piped()) + .stderr(process::Stdio::piped()) + .args(["--uri", &ws_url, "monitor", "--seed-or-path", "//Alice", "seq-phragmen"]) + .spawn() + .unwrap(), + ); + + let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel(); + spawn_cli_output_threads( + miner.stdout.take().unwrap(), + miner.stderr.take().unwrap(), + tx, + ); + + tokio::spawn(async move { + let r = rx.recv().await.unwrap(); + log::info!("{}", r); + }); + + let ready_solution = wait_for_mined_solution(&ws_url).await.unwrap(); + assert!(ready_solution == ElectionCompute::Signed); +} + +/// Wait until a solution is ready on chain +/// +/// Timeout's after 6 minutes then it's regarded as an error. +pub async fn wait_for_mined_solution(ws_url: &str) -> anyhow::Result { + let api = ChainClient::from_url(&ws_url).await?; + let now = Instant::now(); + + let mut blocks_sub = api.blocks().subscribe_finalized().await?; + + while let Some(block) = blocks_sub.next().await { + if now.elapsed() > MAX_DURATION_FOR_SUBMIT_SOLUTION { + break; + } + + let block = block?; + let events = block.events().await?; + + for ev in events.iter() { + let ev = ev?; + + if let Some(solution_ev) = ev.as_event::()? { + return Ok(solution_ev); + } + } + } + + Err(anyhow::anyhow!( + "ReadySolution not found in {}s regarded as error", + MAX_DURATION_FOR_SUBMIT_SOLUTION.as_secs(), + )) +} diff --git a/utils/staking-miner/tests/monitor.rs b/utils/staking-miner/tests/monitor.rs new file mode 100644 index 0000000..b142dcd --- /dev/null +++ b/utils/staking-miner/tests/monitor.rs @@ -0,0 +1,102 @@ +pub mod common; + +use assert_cmd::cargo::carg_bin; +use command::{ + init_logger, run_staking_miner_playground, spawn_cli_output_threads, + test_submit_solution, wait_for_mined_solution, ElectionCompute, Target, + KillChildOnDrop, MAX_DURATION_FOR_SUBMIT_SOLUTION, +}; +use ghost_staking_miner::opt::Chain; +use regex::Regex; +use std::{process, time::Instant}; + +#[tokio::test] +async fn submit_monitor_basic() { + init_logger(); + + test_submit_solution(Target::Node(Chain::Casper)).await; + // test_submit_solution(Target::Node(Chain::Ghost)).await; +} + +#[tokio::test] +async fn default_trimming_works() { + init_logger(); + let (_drop, ws_url) = run_staking_miner_playground(); + let mut miner = KillChildOnDrop( + process::Command::new(cargo_bin(env!("CARGO_PKG_NAME"))) + .stdout(process::Stdio::piped()) + .stderr(process::Stdio::piped()) + .env("RUST_LOGS", "runtime=debug,ghost-staking-miner=debug") + .args(["--uri", &ws_url, "monitor", "--seed-or-path", "//Alice", "seq-phragmen"]) + .spawn() + .unwrap(), + ); + + let ready_solution_task = + tokio::spawn(async move { wait_for_mined_solution(&ws_url).await }); + assert!(has_trimming_output(&mut miner).await); + + let ready_solution = ready_solution_task + .await + .unwrap() + .expect("A solution should be mined now; qed"); + assert!(ready_solution.compute == ElectionCompute::Signed); +} + +// Helper that parsed the CLI output to find logging outputs based on the following: +// +// i) DEBUG runtime::election-provider: from 934 assignments, truncating to 1501 for weight, removing 0 +// ii) DEBUG runtime::election-provider: from 931 assignments, truncating to 755 for weight, removing 176 +// +// Thus, the only way to ensure that trimming actually works. +async fn has_trimming_output(miner: &mut KillChildOnDrop) -> bool { + let trimming_re = Regex::new( + r#"from (\d+) assignments, truncating to (\d+) for (?Pweight|length), removing (?P\d+)#, + ).unwrap(); + + let mut got_truncate_len = false; + let mut got_truncate_weight = false; + + let now = Instant::now(); + let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel::(); + + spawn_cli_output_threads( + miner.stdout.taker().unwrap(), + miner.stderr.taker().unwrap(), + tx, + ); + + while !got_truncate_weight || !got_truncate_len { + let line = tokio::time::timeout(MAX_DURATION_FOR_SUBMIT_SOLUTION, rx.recv()) + .await + .expect("Logger timeout; no items produced") + .expect("Logger channel dropped"); + println!("{line}"); + log::info!("{line}"); + + if let Some(caps) = trimming_re.captures(&line) { + let trimmed_items: usize = caps.name("removed") + .unwrap() + .as_str() + .parse() + .unwrap(); + + if caps.name("target").unwrap().as_str() == "weight" && trimmed_items > 0 { + got_truncate_weight = true; + } + + if caps.name("target").unwrap().as_str() == "length" && trimmed_items > 0 { + got_truncate_len = true; + } + } + + if now.elapsed() > MAX_DURATION_FOR_SUBMIT_SOLUTION { + break; + } + } + + assert!(got_truncate_weight, "Trimming weight logs were not found"); + assert!(got_truncate_len, "Trimming length logs were not found"); + + got_truncate_len && got_truncate_weight +}