inital commit, which is clearly not initial
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
commit
66719626bb
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
debug/
|
||||
target/
|
||||
|
||||
.env*
|
||||
.idea
|
||||
.local
|
||||
|
||||
|
||||
**/*rs.bk
|
||||
|
||||
*.pdb
|
14095
Cargo.lock
generated
Normal file
14095
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
379
Cargo.toml
Normal file
379
Cargo.toml
Normal file
@ -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]
|
1
LICENSE.md
Executable file
1
LICENSE.md
Executable file
@ -0,0 +1 @@
|
||||
TODO
|
81
cli/Cargo.toml
Executable file
81
cli/Cargo.toml
Executable file
@ -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"]
|
7
cli/build.rs
Executable file
7
cli/build.rs
Executable file
@ -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();
|
||||
}
|
112
cli/src/cli.rs
Executable file
112
cli/src/cli.rs
Executable file
@ -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<C: sc_cli::SubstrateCli>(&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<String>,
|
||||
}
|
||||
|
||||
/// An overarching CLI command definition
|
||||
#[derive(Debug, clap::Parser)]
|
||||
pub struct Cli {
|
||||
/// Possible subcommands with parameters.
|
||||
#[clap(subcommand)]
|
||||
pub subcommand: Option<Subcommand>,
|
||||
|
||||
/// Base command line.
|
||||
#[clap(flatten)]
|
||||
pub run: RunCmd,
|
||||
|
||||
/// Parameters used to create the storage monitor.
|
||||
#[clap(flatten)]
|
||||
pub storage_monitor: sc_storage_monitor::StorageMonitorParams,
|
||||
}
|
369
cli/src/command.rs
Executable file
369
cli/src/command.rs
Executable file
@ -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<T> = std::result::Result<T, Error>;
|
||||
|
||||
fn get_exec_name() -> Option<String> {
|
||||
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<Box<dyn sc_service::ChainSpec>, 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<dyn service::ChainSpec>;
|
||||
|
||||
if chain_spec.is_casper() {
|
||||
Box::new(service::CasperChainSpec::from_json_file(path)?)
|
||||
} else {
|
||||
chain_spec
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn set_ss58_version(spec: &Box<dyn service::ChainSpec>) {
|
||||
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<F>(
|
||||
cli: Cli,
|
||||
logger_hook: F,
|
||||
) -> Result<()>
|
||||
where
|
||||
F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration),
|
||||
{
|
||||
let runner = cli
|
||||
.create_runner_with_logger_hook::<sc_cli::RunCmd, F>(&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::<sp_runtime::traits::HashingFor<service::Block>, ()>(
|
||||
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::<service::Block>(&config))?)
|
||||
},
|
||||
}?;
|
||||
|
||||
#[cfg(feature = "pyroscope")]
|
||||
if let Some(pyroscope_agent) = pyroscope_agent_maybe.take() {
|
||||
let agent = pyroscope_agent.stop()?;
|
||||
agent.shutdown();
|
||||
}
|
||||
Ok(())
|
||||
}
|
46
cli/src/error.rs
Executable file
46
cli/src/error.rs
Executable file
@ -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<String> for Error {
|
||||
fn from(s: String) -> Self {
|
||||
Self::Other(s)
|
||||
}
|
||||
}
|
19
cli/src/lib.rs
Executable file
19
cli/src/lib.rs
Executable file
@ -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};
|
29
client/cli/Cargo.toml
Normal file
29
client/cli/Cargo.toml
Normal file
@ -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",
|
||||
]
|
74
client/cli/src/commands/generate.rs
Executable file
74
client/cli/src/commands/generate.rs
Executable file
@ -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<usize>,
|
||||
|
||||
#[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())
|
||||
}
|
||||
}
|
253
client/cli/src/commands/inspect_key.rs
Executable file
253
client/cli/src/commands/inspect_key.rs
Executable file
@ -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<String>,
|
||||
|
||||
/// 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<String>,
|
||||
}
|
||||
|
||||
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<Pair: sp_core::Pair>(
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
40
client/cli/src/commands/key.rs
Executable file
40
client/cli/src/commands/key.rs
Executable file
@ -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<C: SubstrateCli>(&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(),
|
||||
}
|
||||
}
|
||||
}
|
11
client/cli/src/commands/mod.rs
Executable file
11
client/cli/src/commands/mod.rs
Executable file
@ -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},
|
||||
};
|
220
client/cli/src/commands/utils.rs
Executable file
220
client/cli/src/commands/utils.rs
Executable file
@ -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<Pair>(
|
||||
uri: &str,
|
||||
password: Option<SecretString>,
|
||||
network_override: Option<Ss58AddressFormat>,
|
||||
output: OutputType,
|
||||
) where
|
||||
Pair: sp_core::Pair,
|
||||
Pair::Public: Into<MultiSigner>,
|
||||
{
|
||||
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::<Pair>(seed),
|
||||
"publicKey": format_public_key::<Pair>(public_key.clone()),
|
||||
"ss58PublicKey": public_key.to_ss58check_with_version(network_override),
|
||||
"accountId": format_account_id::<Pair>(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::<Pair>(seed),
|
||||
format_public_key::<Pair>(public_key.clone()),
|
||||
format_account_id::<Pair>(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::<Pair>(seed) } else { "n/a".into() },
|
||||
"publicKey": format_public_key::<Pair>(public_key.clone()),
|
||||
"ss58PublicKey": public_key.to_ss58check_with_version(network_override),
|
||||
"accountId": format_account_id::<Pair>(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::<Pair>(seed) } else { "n/a".into() },
|
||||
format_public_key::<Pair>(public_key.clone()),
|
||||
format_account_id::<Pair>(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::<Pair>(public_key.clone()),
|
||||
"accountId": format_account_id::<Pair>(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::<Pair>(public_key.clone()),
|
||||
format_account_id::<Pair>(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<Pair>(
|
||||
public_str: &str,
|
||||
network_override: Option<Ss58AddressFormat>,
|
||||
output: OutputType,
|
||||
) -> Result<(), sc_cli::Error>
|
||||
where
|
||||
Pair: sp_core::Pair,
|
||||
Pair::Public: Into<MultiSigner>,
|
||||
{
|
||||
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::<Pair>(public_key.clone()),
|
||||
"accountId": format_account_id::<Pair>(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::<Pair>(public_key.clone()),
|
||||
format_account_id::<Pair>(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<Ss58AddressFormat>) -> 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<P: sp_core::Pair>(seed: SeedFor<P>) -> String {
|
||||
format!("0x{}", HexDisplay::from(&seed.as_ref()))
|
||||
}
|
||||
|
||||
fn format_public_key<P: sp_core::Pair>(public_key: PublicFor<P>) -> String {
|
||||
format!("0x{}", HexDisplay::from(&public_key.as_ref()))
|
||||
}
|
||||
|
||||
fn format_account_id<P: sp_core::Pair>(public_key: PublicFor<P>) -> String
|
||||
where
|
||||
PublicFor<P>: Into<MultiSigner>,
|
||||
{
|
||||
format!("0x{}", HexDisplay::from(&public_key.into().into_account().as_ref()))
|
||||
}
|
214
client/cli/src/commands/vanity.rs
Executable file
214
client/cli/src/commands/vanity.rs
Executable file
@ -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<Pair>(
|
||||
desired: &str,
|
||||
network_override: Ss58AddressFormat,
|
||||
) -> Result<String, &'static str>
|
||||
where
|
||||
Pair: sp_core::Pair,
|
||||
Pair::Public: IdentifyAccount,
|
||||
<Pair::Public as 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::<Pair>(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<String, &'static str> {
|
||||
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::<sr25519::Pair>("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::<sr25519::Pair>("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
|
||||
);
|
||||
}
|
||||
}
|
5
client/cli/src/lib.rs
Normal file
5
client/cli/src/lib.rs
Normal file
@ -0,0 +1,5 @@
|
||||
pub mod params;
|
||||
pub mod commands;
|
||||
|
||||
pub use commands::KeySubcommand;
|
||||
pub use commands::VanityCmd;
|
70
client/cli/src/params/mod.rs
Normal file
70
client/cli/src/params/mod.rs
Normal file
@ -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<Self, Self::Error> {
|
||||
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<Ss58AddressFormat, String> {
|
||||
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<Ss58AddressFormat>,
|
||||
}
|
21
core-primitives/Cargo.toml
Executable file
21
core-primitives/Cargo.toml
Executable file
@ -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",
|
||||
]
|
58
core-primitives/src/lib.rs
Executable file
58
core-primitives/src/lib.rs
Executable file
@ -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 = <Signature as Verify>::Signer;
|
||||
|
||||
/// Alias to public key used for this chain, actually a `AccountId32`. This is
|
||||
/// always 32 bytes.
|
||||
pub type AccountId = <AccountPublic as IdentifyAccount>::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<BlockNumber, BlakeTwo256>;
|
||||
|
||||
/// Block type.
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
|
||||
/// Block ID.
|
||||
pub type BlockId = generic::BlockId<Block>;
|
||||
|
||||
/// Type for identifier for the named reserve.
|
||||
pub type ReserveIdentifier = [u8; 8];
|
||||
pub type FreezeIdentifier = [u8; 8];
|
14
file_header.txt
Executable file
14
file_header.txt
Executable file
@ -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 <http://www.gnu.org/licenses/>.
|
40
metrics/Cargo.toml
Normal file
40
metrics/Cargo.toml
Normal file
@ -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",
|
||||
]
|
47
metrics/src/lib.rs
Normal file
47
metrics/src/lib.rs
Normal file
@ -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<Self, prometheus::PrometheusError>;
|
||||
|
||||
fn register(
|
||||
registry: Option<&prometheus::Registry>,
|
||||
) -> Result<Self, prometheus::PrometheusError> {
|
||||
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;
|
51
metrics/src/metronome.rs
Normal file
51
metrics/src/metronome.rs
Normal file
@ -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<Option<Self::Item>> {
|
||||
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
|
||||
}
|
||||
}
|
189
metrics/src/runtime/mod.rs
Normal file
189
metrics/src/runtime/mod.rs
Normal file
@ -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<Mutex<HashMap<String, CounterVec<U64>>>>,
|
||||
counters: Arc<Mutex<HashMap<String, Counter<u64>>>>,
|
||||
histograms: Arc<Mutex<HashMap<String, Histogram>>>,
|
||||
}
|
||||
|
||||
#[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<F>(&self, do_something: F)
|
||||
where
|
||||
F: FnOnce(MutexGuard<'_, HashMap<String, Counter<U64>>>) -> Result<(), PrometheusError>,
|
||||
{
|
||||
let _ = self.1.counters.lock().map(do_something).or_else(|error| Err(error));
|
||||
}
|
||||
|
||||
fn with_counter_vecs_lock_held<F>(&self, do_something: F)
|
||||
where
|
||||
F: FnOnce(MutexGuard<'_, HashMap<String, CounterVec<U64>>>) -> Result<(), PrometheusError>,
|
||||
{
|
||||
let _ = self.1.counter_vecs.lock().map(do_something).or_else(|error| Err(error));
|
||||
}
|
||||
|
||||
fn with_histograms_lock_held<F>(&self, do_something: F)
|
||||
where
|
||||
F: FnOnce(MutexGuard<'_, HashMap<String, Histogram>>) -> 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<Vec<u8>> {
|
||||
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));
|
||||
}
|
||||
}
|
66
metrics/src/tests.rs
Normal file
66
metrics/src/tests.rs
Normal file
@ -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<String, u64> {
|
||||
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()
|
||||
}
|
74
pallets/claims/Cargo.toml
Normal file
74
pallets/claims/Cargo.toml
Normal file
@ -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",
|
||||
]
|
56
pallets/claims/src/benchmarking.rs
Normal file
56
pallets/claims/src/benchmarking.rs
Normal file
@ -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::<T, I>::minimum_balance();
|
||||
let pseudo_account: T::AccountId = Pallet::<T, I>::into_account_id(eth_address).unwrap();
|
||||
let _ = CurrencyOf::<T, I>::deposit_creating(&pseudo_account, balance);
|
||||
Total::<T, I>::put(balance);
|
||||
|
||||
let pseudo_rank = 5u16;
|
||||
let _ = Club::<T, I>::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::<T, I>(ðereum_secret_key, &user_account.encode());
|
||||
|
||||
let prev_balance = CurrencyOf::<T, I>::free_balance(&user_account);
|
||||
let prev_rank = Club::<T, I>::rank_of(&user_account);
|
||||
|
||||
#[extrinsic_call]
|
||||
claim(RawOrigin::Signed(user_account.clone()), eth_address, signature);
|
||||
|
||||
assert_eq!(CurrencyOf::<T, I>::free_balance(&user_account), prev_balance + balance);
|
||||
assert_eq!(CurrencyOf::<T, I>::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::<T, I>::rank_of(&user_account), rank);
|
||||
assert_eq!(Club::<T, I>::rank_of(&pseudo_account), None);
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Pallet,
|
||||
crate::mock::new_test_ext(),
|
||||
crate::mock::Test,
|
||||
);
|
||||
}
|
313
pallets/claims/src/lib.rs
Normal file
313
pallets/claims/src/lib.rs
Normal file
@ -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<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
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<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
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<u8> = 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<T, I> = <<T as Config<I>>::VestingSchedule as VestingSchedule<
|
||||
<T as frame_system::Config>::AccountId
|
||||
>>::Currency;
|
||||
|
||||
type BalanceOf<T, I> = <CurrencyOf<T, I> as Currency<
|
||||
<T as frame_system::Config>::AccountId>
|
||||
>::Balance;
|
||||
|
||||
type RankOf<T, I> = <pallet_ranked_collective::Pallet::<T, I> as RankedMembers>::Rank;
|
||||
type AccountIdOf<T, I> = <pallet_ranked_collective::Pallet::<T, I> as RankedMembers>::AccountId;
|
||||
|
||||
#[frame_support::pallet]
|
||||
pub mod pallet {
|
||||
use super::*;
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T, I = ()>(_);
|
||||
|
||||
#[pallet::config]
|
||||
pub trait Config<I: 'static = ()>: frame_system::Config + pallet_ranked_collective::Config<I> {
|
||||
type RuntimeEvent: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
|
||||
|
||||
type VestingSchedule: VestingSchedule<Self::AccountId, Moment = BlockNumberFor<Self>>;
|
||||
type BlockNumberProvider: BlockNumberProvider<BlockNumber = BlockNumberFor<Self>>;
|
||||
type MemberSwappedHandler: RankedMembersSwapHandler<AccountIdOf<Self, I>, RankOf<Self, I>>;
|
||||
|
||||
#[pallet::constant]
|
||||
type Prefix: Get<&'static [u8]>;
|
||||
|
||||
#[pallet::constant]
|
||||
type MaximumWithdrawAmount: Get<BalanceOf<Self, I>>;
|
||||
|
||||
#[pallet::constant]
|
||||
type VestingBlocks: Get<u32>;
|
||||
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
#[pallet::event]
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config<I>, I: 'static = ()> {
|
||||
Claimed {
|
||||
receiver: T::AccountId,
|
||||
donor: T::AccountId,
|
||||
amount: BalanceOf<T, I>,
|
||||
rank: Option<RankOf<T, I>>,
|
||||
},
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
pub enum Error<T, I = ()> {
|
||||
InvalidEthereumSignature,
|
||||
InvalidEthereumAddress,
|
||||
NoBalanceToClaim,
|
||||
AddressDecodingFailed,
|
||||
ArithmeticError,
|
||||
PotUnderflow,
|
||||
}
|
||||
|
||||
#[pallet::storage]
|
||||
pub type Total<T: Config<I>, I: 'static = ()> = StorageValue<_, BalanceOf<T, I>, ValueQuery>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
#[derive(DefaultNoBound)]
|
||||
pub struct GenesisConfig<T: Config<I>, I: 'static = ()> {
|
||||
pub total: BalanceOf<T, I>,
|
||||
pub members_and_ranks: Vec<(T::AccountId, u16)>,
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config<I>, I: 'static> BuildGenesisConfig for GenesisConfig<T, I> {
|
||||
fn build(&self) {
|
||||
let cult_accounts: Vec<_> = self
|
||||
.members_and_ranks
|
||||
.iter()
|
||||
.map(|(account_id, rank)| {
|
||||
assert!(
|
||||
pallet_ranked_collective::Pallet::<T, I>::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::<T, I>::put(self.total);
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::claim())]
|
||||
pub fn claim(
|
||||
origin: OriginFor<T>,
|
||||
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::<T, I>::InvalidEthereumSignature)?;
|
||||
|
||||
ensure!(recovered_address == ethereum_address,
|
||||
Error::<T, I>::InvalidEthereumAddress);
|
||||
|
||||
Self::do_claim(who, ethereum_address)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn to_ascii_hex(data: &[u8]) -> Vec<u8> {
|
||||
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<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
fn ethereum_signable_message(what: &[u8]) -> Vec<u8> {
|
||||
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<EthereumAddress> {
|
||||
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<T::AccountId, codec::Error> {
|
||||
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::<T, I>::AddressDecodingFailed)?;
|
||||
|
||||
let balance_due = CurrencyOf::<T, I>::free_balance(&donor);
|
||||
ensure!(balance_due >= CurrencyOf::<T, I>::minimum_balance(),
|
||||
Error::<T, I>::NoBalanceToClaim);
|
||||
|
||||
let new_total = Total::<T, I>::get()
|
||||
.checked_sub(&balance_due)
|
||||
.ok_or(Error::<T, I>::PotUnderflow)?;
|
||||
|
||||
CurrencyOf::<T, I>::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::<T, I>::ArithmeticError)?;
|
||||
|
||||
let vesting_blocks = T::VestingBlocks::get();
|
||||
let per_block_balance = vesting_balance
|
||||
.checked_div(&vesting_blocks.into())
|
||||
.ok_or(Error::<T, I>::ArithmeticError)?;
|
||||
|
||||
T::VestingSchedule::add_vesting_schedule(
|
||||
&receiver,
|
||||
vesting_balance,
|
||||
per_block_balance,
|
||||
T::BlockNumberProvider::current_block_number(),
|
||||
)?;
|
||||
}
|
||||
|
||||
let rank = if let Some(rank) = <pallet_ranked_collective::Pallet::<T, I> as RankedMembers>::rank_of(&donor) {
|
||||
pallet_ranked_collective::Pallet::<T, I>::do_remove_member_from_rank(&donor, rank)?;
|
||||
let new_rank = match <pallet_ranked_collective::Pallet::<T, I> 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::<T, I>::do_promote_member(receiver.clone(), None, false)?;
|
||||
}
|
||||
rank
|
||||
},
|
||||
_ => {
|
||||
pallet_ranked_collective::Pallet::<T, I>::do_add_member_to_rank(receiver.clone(), rank, false)?;
|
||||
rank
|
||||
},
|
||||
};
|
||||
<T as pallet::Config<I>>::MemberSwappedHandler::swapped(&donor, &receiver, new_rank);
|
||||
Some(new_rank)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Total::<T, I>::put(new_total);
|
||||
Self::deposit_event(Event::<T, I>::Claimed {
|
||||
receiver,
|
||||
donor,
|
||||
amount: balance_due,
|
||||
rank,
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
221
pallets/claims/src/mock.rs
Normal file
221
pallets/claims/src/mock.rs
Normal file
@ -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() -> <Test as frame_system::Config>::AccountId { 69 }
|
||||
pub fn bob_account_id() -> <Test as frame_system::Config>::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() -> <Test as frame_system::Config>::AccountId { crate::secp_utils::into_account_id::<Test, ()>(first_eth_public_key()) }
|
||||
pub fn second_account_id() -> <Test as frame_system::Config>::AccountId { crate::secp_utils::into_account_id::<Test, ()>(second_eth_public_key()) }
|
||||
pub fn third_account_id() -> <Test as frame_system::Config>::AccountId { crate::secp_utils::into_account_id::<Test, ()>(third_eth_public_key()) }
|
||||
pub fn fourth_account_id() -> <Test as frame_system::Config>::AccountId { crate::secp_utils::into_account_id::<Test, ()>(fourth_eth_public_key()) }
|
||||
|
||||
pub fn first_signature() -> EcdsaSignature { crate::secp_utils::sig::<Test, ()>(&first_eth_private_key(), &alice_account_id().encode()) }
|
||||
pub fn second_signature() -> EcdsaSignature { crate::secp_utils::sig::<Test, ()>(&second_eth_private_key(), &alice_account_id().encode()) }
|
||||
pub fn third_signature() -> EcdsaSignature { crate::secp_utils::sig::<Test, ()>(&third_eth_private_key(), &alice_account_id().encode()) }
|
||||
pub fn fourth_signature() -> EcdsaSignature { crate::secp_utils::sig::<Test, ()>(&fourth_eth_private_key(), &bob_account_id().encode()) }
|
||||
pub fn wrong_signature() -> EcdsaSignature { crate::secp_utils::sig::<Test, ()>(&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<u64>;
|
||||
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<Delta>(sp_std::marker::PhantomData<Delta>);
|
||||
impl<Delta: Get<Rank>> Convert<Class, Rank> for MinRankOfClass<Delta> {
|
||||
fn convert(a: Class) -> Rank {
|
||||
a.saturating_sub(Delta::get())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TestPolls;
|
||||
impl Polling<TallyOf<Test>> for TestPolls {
|
||||
type Index = u8;
|
||||
type Votes = u32;
|
||||
type Moment = u64;
|
||||
type Class = Class;
|
||||
|
||||
fn classes() -> Vec<Self::Class> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn as_ongoing(_index: u8) -> Option<(TallyOf<Test>, Self::Class)> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn access_poll<R>(
|
||||
_index: Self::Index,
|
||||
_f: impl FnOnce(PollStatus<&mut TallyOf<Test>, Self::Moment, Self::Class>) -> R,
|
||||
) -> R {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn try_access_poll<R>(
|
||||
_index: Self::Index,
|
||||
_f: impl FnOnce(
|
||||
PollStatus<&mut TallyOf<Test>, Self::Moment, Self::Class>,
|
||||
) -> Result<R, DispatchError>,
|
||||
) -> Result<R, DispatchError> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn create_ongoing(_class: Self::Class) -> Result<Self::Index, ()> {
|
||||
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<Self::AccountId, ConstU16<65535>>;
|
||||
type RemoveOrigin = EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>;
|
||||
type PromoteOrigin = EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>;
|
||||
type DemoteOrigin = EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>;
|
||||
type ExchangeOrigin = EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>;
|
||||
|
||||
type Polls = TestPolls;
|
||||
type MemberSwappedHandler = ();
|
||||
type MinRankOfClass = MinRankOfClass<MinRankOfClassDelta>;
|
||||
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<Test>;
|
||||
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::<Test>::default()
|
||||
.build_storage()
|
||||
.unwrap();
|
||||
|
||||
pallet_balances::GenesisConfig::<Test> {
|
||||
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::<Test> {
|
||||
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
|
||||
}
|
37
pallets/claims/src/secp_utils.rs
Normal file
37
pallets/claims/src/secp_utils.rs
Normal file
@ -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<T: Config<I>, I: 'static>(address: EthereumAddress) -> T::AccountId {
|
||||
super::Pallet::<T, I>::into_account_id(address).unwrap()
|
||||
}
|
||||
|
||||
pub fn sig<T: Config<I>, I: 'static>(
|
||||
secret: &libsecp256k1::SecretKey,
|
||||
what: &[u8],
|
||||
) -> EcdsaSignature {
|
||||
let msg = keccak_256(&super::Pallet::<T, I>::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)
|
||||
}
|
274
pallets/claims/src/tests.rs
Normal file
274
pallets/claims/src/tests.rs
Normal file
@ -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::<Test, ()>::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::<Test, ()>::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::<Test, ()>::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::<Test, ()>::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::<Test, ()>::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::<Test, ()>::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::<Test>::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::<Test, ()>::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::<Test>::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::<Test, ()>::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::<Test>::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::<Test, ()>::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,
|
||||
}));
|
||||
})
|
||||
}
|
9
pallets/claims/src/weights.rs
Normal file
9
pallets/claims/src/weights.rs
Normal file
@ -0,0 +1,9 @@
|
||||
use frame_support::weights::Weight;
|
||||
|
||||
pub trait WeightInfo {
|
||||
fn claim() -> Weight;
|
||||
}
|
||||
|
||||
impl WeightInfo for () {
|
||||
fn claim() -> Weight { Weight::zero() }
|
||||
}
|
49
pallets/networks/Cargo.toml
Executable file
49
pallets/networks/Cargo.toml
Executable file
@ -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",
|
||||
]
|
222
pallets/networks/src/benchmarking.rs
Executable file
222
pallets/networks/src/benchmarking.rs
Executable file
@ -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<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
|
||||
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
|
||||
}
|
||||
|
||||
fn prepare_network<T: Config>(
|
||||
n: u32, m: u32,
|
||||
) -> (<T as module::Config>::NetworkId, NetworkData) {
|
||||
let chain_id: <T as module::Config>::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<T: Config>(
|
||||
chain_id: <T as module::Config>::NetworkId,
|
||||
network: NetworkData,
|
||||
) -> Result<Option<NetworkData>, BenchmarkError> {
|
||||
let prev_network = match GhostNetworks::<T>::get(&chain_id) {
|
||||
Some(net) => net,
|
||||
None => {
|
||||
let authority = T::RegisterOrigin::try_successful_origin()
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
GhostNetworks::<T>::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::<T>(i, j);
|
||||
let authority = T::RegisterOrigin::try_successful_origin()
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
let prev_network = GhostNetworks::<T>::networks(chain_id.clone());
|
||||
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), network.clone())
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NetworkRegistered {
|
||||
chain_id: chain_id.clone(), network,
|
||||
}.into());
|
||||
assert_ne!(GhostNetworks::<T>::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::<T>(1, 1);
|
||||
let authority = T::UpdateOrigin::try_successful_origin()
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
|
||||
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), name.clone())
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NetworkNameUpdated {
|
||||
chain_id: chain_id.clone(), chain_name: name,
|
||||
}.into());
|
||||
assert_ne!(GhostNetworks::<T>::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::<T>(1, 1);
|
||||
let authority = T::UpdateOrigin::try_successful_origin()
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
|
||||
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), endpoint.clone())
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NetworkEndpointUpdated {
|
||||
chain_id: chain_id.clone(), default_endpoint: endpoint,
|
||||
}.into());
|
||||
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
|
||||
}
|
||||
|
||||
update_network_finality_delay {
|
||||
let delay = Some(1337);
|
||||
let (chain_id, network) = prepare_network::<T>(1, 1);
|
||||
let authority = T::UpdateOrigin::try_successful_origin()
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
|
||||
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), delay)
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NetworkFinalityDelayUpdated {
|
||||
chain_id: chain_id.clone(), finality_delay: delay,
|
||||
}.into());
|
||||
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
|
||||
}
|
||||
|
||||
update_network_release_delay {
|
||||
let delay = Some(1337);
|
||||
let (chain_id, network) = prepare_network::<T>(1, 1);
|
||||
let authority = T::UpdateOrigin::try_successful_origin()
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
|
||||
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), delay)
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NetworkReleaseDelayUpdated {
|
||||
chain_id: chain_id.clone(), release_delay: delay,
|
||||
}.into());
|
||||
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
|
||||
}
|
||||
|
||||
update_network_type {
|
||||
let network_type = NetworkType::Utxo;
|
||||
let (chain_id, network) = prepare_network::<T>(1, 1);
|
||||
let authority = T::UpdateOrigin::try_successful_origin()
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
|
||||
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), network_type.clone())
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NetworkTypeUpdated {
|
||||
chain_id: chain_id.clone(), network_type: network_type.clone(),
|
||||
}.into());
|
||||
assert_ne!(GhostNetworks::<T>::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::<T>(1, 1);
|
||||
let authority = T::UpdateOrigin::try_successful_origin()
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
|
||||
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), gatekeeper.clone())
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NetworkGatekeeperUpdated {
|
||||
chain_id: chain_id.clone(), gatekeeper,
|
||||
}.into());
|
||||
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
|
||||
}
|
||||
|
||||
update_network_topic_name {
|
||||
let topic_name = b"0x9876543219876543219876543219876543219876543219876543219876543219".to_vec();
|
||||
let (chain_id, network) = prepare_network::<T>(1, 1);
|
||||
let authority = T::UpdateOrigin::try_successful_origin()
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
|
||||
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), topic_name.clone())
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NetworkTopicNameUpdated {
|
||||
chain_id: chain_id.clone(), topic_name,
|
||||
}.into());
|
||||
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
|
||||
}
|
||||
|
||||
update_incoming_network_fee {
|
||||
let incoming_fee = 1337;
|
||||
let (chain_id, network) = prepare_network::<T>(1, 1);
|
||||
let authority = T::UpdateOrigin::try_successful_origin()
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
|
||||
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), incoming_fee)
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NetworkIncomingFeeUpdated {
|
||||
chain_id: chain_id.clone(), incoming_fee,
|
||||
}.into());
|
||||
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
|
||||
}
|
||||
|
||||
update_outgoing_network_fee {
|
||||
let outgoing_fee = 1337;
|
||||
let (chain_id, network) = prepare_network::<T>(1, 1);
|
||||
let authority = T::UpdateOrigin::try_successful_origin()
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
|
||||
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), outgoing_fee)
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NetworkOutgoingFeeUpdated {
|
||||
chain_id: chain_id.clone(), outgoing_fee,
|
||||
}.into());
|
||||
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
|
||||
}
|
||||
|
||||
remove_network {
|
||||
let (chain_id, network) = prepare_network::<T>(1, 1);
|
||||
let authority = T::RemoveOrigin::try_successful_origin()
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
|
||||
}: _<T::RuntimeOrigin>(authority, chain_id.clone())
|
||||
verify {
|
||||
assert_last_event::<T>(Event::NetworkRemoved {
|
||||
chain_id: chain_id.clone(),
|
||||
}.into());
|
||||
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(GhostNetworks, crate::mock::ExtBuilder::build(), crate::mock::Test);
|
||||
}
|
538
pallets/networks/src/lib.rs
Executable file
538
pallets/networks/src/lib.rs
Executable file
@ -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<u8>,
|
||||
pub default_endpoint: Vec<u8>,
|
||||
pub gatekeeper: Vec<u8>,
|
||||
pub topic_name: Vec<u8>,
|
||||
pub finality_delay: Option<u64>,
|
||||
pub release_delay: Option<u64>,
|
||||
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<Event<Self>> + IsType<<Self as frame_system::Config>::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<Self::RuntimeOrigin>;
|
||||
/// The origin required to update network information.
|
||||
type UpdateOrigin: EnsureOrigin<Self::RuntimeOrigin>;
|
||||
/// The origin required to remove network.
|
||||
type RemoveOrigin: EnsureOrigin<Self::RuntimeOrigin>;
|
||||
|
||||
/// Weight information for extrinsics in this module.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
pub enum Error<T> {
|
||||
/// 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<T: Config> {
|
||||
NetworkRegistered { chain_id: T::NetworkId, network: NetworkData },
|
||||
NetworkNameUpdated { chain_id: T::NetworkId, chain_name: Vec<u8> },
|
||||
NetworkEndpointUpdated { chain_id: T::NetworkId, default_endpoint: Vec<u8> },
|
||||
NetworkFinalityDelayUpdated { chain_id: T::NetworkId, finality_delay: Option<u64> },
|
||||
NetworkReleaseDelayUpdated { chain_id: T::NetworkId, release_delay: Option<u64> },
|
||||
NetworkTypeUpdated { chain_id: T::NetworkId, network_type: NetworkType },
|
||||
NetworkGatekeeperUpdated { chain_id: T::NetworkId, gatekeeper: Vec<u8> },
|
||||
NetworkTopicNameUpdated { chain_id: T::NetworkId, topic_name: Vec<u8> },
|
||||
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<T: Config> =
|
||||
StorageMap<_, Twox64Concat, T::NetworkId, NetworkData, OptionQuery>;
|
||||
|
||||
#[pallet::genesis_config]
|
||||
pub struct GenesisConfig<T: Config> {
|
||||
pub networks: Vec<(T::NetworkId, Vec<u8>)>,
|
||||
}
|
||||
|
||||
impl<T: Config> Default for GenesisConfig<T> {
|
||||
fn default() -> Self {
|
||||
Self { networks: vec![] }
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::genesis_build]
|
||||
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
|
||||
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::<T>::do_register_network(chain_id.clone(), network)
|
||||
.expect("Error registering network");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[pallet::pallet]
|
||||
#[pallet::without_storage_info]
|
||||
pub struct Pallet<T>(PhantomData<T>);
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[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<T>,
|
||||
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<T>,
|
||||
chain_id: T::NetworkId,
|
||||
chain_name: Vec<u8>,
|
||||
) -> 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<T>,
|
||||
chain_id: T::NetworkId,
|
||||
default_endpoint: Vec<u8>,
|
||||
) -> 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<T>,
|
||||
chain_id: T::NetworkId,
|
||||
finality_delay: Option<u64>,
|
||||
) -> 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<T>,
|
||||
chain_id: T::NetworkId,
|
||||
release_delay: Option<u64>,
|
||||
) -> 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<T>,
|
||||
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<T>,
|
||||
chain_id: T::NetworkId,
|
||||
gatekeeper: Vec<u8>,
|
||||
) -> 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<T>,
|
||||
chain_id: T::NetworkId,
|
||||
topic_name: Vec<u8>,
|
||||
) -> 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<T>,
|
||||
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<T>,
|
||||
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<T>,
|
||||
chain_id: T::NetworkId,
|
||||
) -> DispatchResult {
|
||||
T::RemoveOrigin::ensure_origin_or_root(origin)?;
|
||||
Self::do_remove_network(chain_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Register a new network.
|
||||
pub fn do_register_network(
|
||||
chain_id: T::NetworkId,
|
||||
network: NetworkData,
|
||||
) -> DispatchResult {
|
||||
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
|
||||
ensure!(maybe_network.is_none(), Error::<T>::NetworkAlreadyRegistered);
|
||||
*maybe_network = Some(network.clone());
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
Self::deposit_event(Event::<T>::NetworkRegistered { chain_id, network });
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Remove existent network.
|
||||
pub fn do_remove_network(chain_id: T::NetworkId) -> DispatchResult {
|
||||
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
|
||||
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
|
||||
*maybe_network = None;
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
Self::deposit_event(Event::<T>::NetworkRemoved { chain_id });
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Update existent network name.
|
||||
pub fn do_update_network_name(
|
||||
chain_id: T::NetworkId,
|
||||
chain_name: Vec<u8>,
|
||||
) -> DispatchResult {
|
||||
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
|
||||
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
|
||||
let net = maybe_network.as_mut().unwrap();
|
||||
net.chain_name = chain_name.clone();
|
||||
*maybe_network = Some(net.clone());
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
Self::deposit_event(Event::<T>::NetworkNameUpdated {
|
||||
chain_id,
|
||||
chain_name,
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Update existent network default endpoint.
|
||||
pub fn do_update_network_endpoint(
|
||||
chain_id: T::NetworkId,
|
||||
default_endpoint: Vec<u8>,
|
||||
) -> DispatchResult {
|
||||
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
|
||||
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
|
||||
let net = maybe_network.as_mut().unwrap();
|
||||
net.default_endpoint = default_endpoint.clone();
|
||||
*maybe_network = Some(net.clone());
|
||||
Ok(())
|
||||
})?;
|
||||
Self::deposit_event(Event::<T>::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<u64>,
|
||||
) -> DispatchResult {
|
||||
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
|
||||
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
|
||||
let net = maybe_network.as_mut().unwrap();
|
||||
net.finality_delay = finality_delay;
|
||||
*maybe_network = Some(net.clone());
|
||||
Ok(())
|
||||
})?;
|
||||
Self::deposit_event(Event::<T>::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<u64>,
|
||||
) -> DispatchResult {
|
||||
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
|
||||
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
|
||||
let net = maybe_network.as_mut().unwrap();
|
||||
net.release_delay = release_delay;
|
||||
*maybe_network = Some(net.clone());
|
||||
Ok(())
|
||||
})?;
|
||||
Self::deposit_event(Event::<T>::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::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
|
||||
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
|
||||
let net = maybe_network.as_mut().unwrap();
|
||||
net.network_type = network_type.clone();
|
||||
*maybe_network = Some(net.clone());
|
||||
Ok(())
|
||||
})?;
|
||||
Self::deposit_event(Event::<T>::NetworkTypeUpdated {
|
||||
chain_id,
|
||||
network_type,
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Update existent network gatekeeper.
|
||||
pub fn do_update_network_gatekeeper(
|
||||
chain_id: T::NetworkId,
|
||||
gatekeeper: Vec<u8>,
|
||||
) -> DispatchResult {
|
||||
ensure!(gatekeeper.len() == 42 && gatekeeper[0] == 48 && gatekeeper[1] == 120,
|
||||
Error::<T>::WrongGatekeeperAddress);
|
||||
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
|
||||
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
|
||||
let net = maybe_network.as_mut().unwrap();
|
||||
net.gatekeeper = gatekeeper.clone();
|
||||
*maybe_network = Some(net.clone());
|
||||
Ok(())
|
||||
})?;
|
||||
Self::deposit_event(Event::<T>::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<u8>,
|
||||
) -> DispatchResult {
|
||||
ensure!(topic_name.len() == 66 && topic_name[0] == 48 && topic_name[1] == 120,
|
||||
Error::<T>::WrongTopicName);
|
||||
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
|
||||
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
|
||||
let net = maybe_network.as_mut().unwrap();
|
||||
net.topic_name = topic_name.clone();
|
||||
*maybe_network = Some(net.clone());
|
||||
Ok(())
|
||||
})?;
|
||||
Self::deposit_event(Event::<T>::NetworkTopicNameUpdated {
|
||||
chain_id,
|
||||
topic_name,
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn do_update_incoming_network_fee(
|
||||
chain_id: T::NetworkId,
|
||||
incoming_fee: u32,
|
||||
) -> DispatchResult {
|
||||
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
|
||||
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
|
||||
let net = maybe_network.as_mut().unwrap();
|
||||
net.incoming_fee = incoming_fee.clone();
|
||||
*maybe_network = Some(net.clone());
|
||||
Ok(())
|
||||
})?;
|
||||
Self::deposit_event(Event::<T>::NetworkIncomingFeeUpdated {
|
||||
chain_id,
|
||||
incoming_fee,
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn do_update_outgoing_network_fee(
|
||||
chain_id: T::NetworkId,
|
||||
outgoing_fee: u32,
|
||||
) -> DispatchResult {
|
||||
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
|
||||
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
|
||||
let net = maybe_network.as_mut().unwrap();
|
||||
net.outgoing_fee = outgoing_fee.clone();
|
||||
*maybe_network = Some(net.clone());
|
||||
Ok(())
|
||||
})?;
|
||||
Self::deposit_event(Event::<T>::NetworkOutgoingFeeUpdated {
|
||||
chain_id,
|
||||
outgoing_fee,
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> NetworkDataBasicHandler for Pallet<T> {
|
||||
type NetworkId = T::NetworkId;
|
||||
}
|
||||
|
||||
impl<T: Config> NetworkDataInspectHandler<NetworkData> for Pallet<T> {
|
||||
fn get(n: &Self::NetworkId) -> Option<NetworkData> {
|
||||
Networks::<T>::get(n)
|
||||
}
|
||||
|
||||
fn iter() -> PrefixIterator<(Self::NetworkId, NetworkData)> {
|
||||
Networks::<T>::iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config> NetworkDataMutateHandler<NetworkData> for Pallet<T> {
|
||||
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)
|
||||
}
|
||||
}
|
104
pallets/networks/src/mock.rs
Executable file
104
pallets/networks/src/mock.rs
Executable file
@ -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<Self::AccountId, ()>;
|
||||
type Block = Block;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type DbWeight = ();
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
type AccountData = pallet_balances::AccountData<Balance>;
|
||||
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::<RegistererAccount, AccountId>;
|
||||
type UpdateOrigin = EnsureSignedBy::<UpdaterAccount, AccountId>;
|
||||
type RemoveOrigin = EnsureSignedBy::<RemoverAccount, AccountId>;
|
||||
type WeightInfo = crate::weights::SubstrateWeight<Test>;
|
||||
}
|
||||
|
||||
type Block = frame_system::mocking::MockBlockU32<Test>;
|
||||
|
||||
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::<Test>::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
|
||||
}
|
||||
}
|
637
pallets/networks/src/tests.rs
Executable file
637
pallets/networks/src/tests.rs
Executable file
@ -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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::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::<Test>::get(chain_id), None);
|
||||
assert_err!(GhostNetworks::update_network_name(
|
||||
RuntimeOrigin::signed(UpdaterAccount::get()),
|
||||
chain_id, "Binance".into()),
|
||||
crate::Error::<Test>::NetworkDoesNotExist);
|
||||
assert_eq!(Networks::<Test>::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::<Test>::get(chain_id), None);
|
||||
assert_err!(GhostNetworks::update_network_endpoint(
|
||||
RuntimeOrigin::signed(UpdaterAccount::get()),
|
||||
chain_id, "https:://google.com".into()),
|
||||
crate::Error::<Test>::NetworkDoesNotExist);
|
||||
assert_eq!(Networks::<Test>::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::<Test>::get(chain_id), None);
|
||||
assert_err!(GhostNetworks::update_network_finality_delay(
|
||||
RuntimeOrigin::signed(UpdaterAccount::get()),
|
||||
chain_id, Some(1337)),
|
||||
crate::Error::<Test>::NetworkDoesNotExist);
|
||||
assert_eq!(Networks::<Test>::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::<Test>::get(chain_id), None);
|
||||
assert_err!(GhostNetworks::update_network_release_delay(
|
||||
RuntimeOrigin::signed(UpdaterAccount::get()),
|
||||
chain_id, Some(1337)),
|
||||
crate::Error::<Test>::NetworkDoesNotExist);
|
||||
assert_eq!(Networks::<Test>::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::<Test>::get(chain_id), None);
|
||||
assert_err!(GhostNetworks::update_network_type(
|
||||
RuntimeOrigin::signed(UpdaterAccount::get()),
|
||||
chain_id, NetworkType::Utxo),
|
||||
crate::Error::<Test>::NetworkDoesNotExist);
|
||||
assert_eq!(Networks::<Test>::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::<Test>::get(chain_id), None);
|
||||
assert_err!(GhostNetworks::update_network_gatekeeper(
|
||||
RuntimeOrigin::signed(UpdaterAccount::get()),
|
||||
chain_id, b"0x9876543219876543219876543219876543219876".to_vec()),
|
||||
crate::Error::<Test>::NetworkDoesNotExist);
|
||||
assert_eq!(Networks::<Test>::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::<Test>::get(chain_id), None);
|
||||
assert_err!(GhostNetworks::update_network_topic_name(
|
||||
RuntimeOrigin::signed(UpdaterAccount::get()),
|
||||
chain_id, b"0x9876543219876543219876543219876543219876543219876543219876543219".to_vec()),
|
||||
crate::Error::<Test>::NetworkDoesNotExist);
|
||||
assert_eq!(Networks::<Test>::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::<Test>::get(chain_id), None);
|
||||
assert_err!(GhostNetworks::update_incoming_network_fee(
|
||||
RuntimeOrigin::signed(UpdaterAccount::get()),
|
||||
chain_id, 1337),
|
||||
crate::Error::<Test>::NetworkDoesNotExist);
|
||||
assert_eq!(Networks::<Test>::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::<Test>::get(chain_id), None);
|
||||
assert_err!(GhostNetworks::update_outgoing_network_fee(
|
||||
RuntimeOrigin::signed(UpdaterAccount::get()),
|
||||
chain_id, 1337),
|
||||
crate::Error::<Test>::NetworkDoesNotExist);
|
||||
assert_eq!(Networks::<Test>::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::<Test>::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::<Test>::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::<Test>::get(chain_id), None);
|
||||
assert_err!(GhostNetworks::remove_network(
|
||||
RuntimeOrigin::signed(RemoverAccount::get()),
|
||||
chain_id),
|
||||
crate::Error::<Test>::NetworkDoesNotExist);
|
||||
assert_eq!(Networks::<Test>::get(chain_id), None);
|
||||
});
|
||||
}
|
325
pallets/networks/src/weights.rs
Executable file
325
pallets/networks/src/weights.rs
Executable file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
71
pallets/slow-clap/Cargo.toml
Executable file
71
pallets/slow-clap/Cargo.toml
Executable file
@ -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",
|
||||
]
|
205
pallets/slow-clap/src/benchmarking.rs
Normal file
205
pallets/slow-clap/src/benchmarking.rs
Normal file
@ -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: Config>() -> 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<T: Config>(
|
||||
total: usize,
|
||||
network_id: NetworkIdOf<T>,
|
||||
user_account: T::AccountId,
|
||||
fee: H256,
|
||||
receiver: H160,
|
||||
) -> Result<CompanionId, &'static str> {
|
||||
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 = <<T as pallet::Config>::Currency>::minimum_balance();
|
||||
let balance = minimum_balance + minimum_balance;
|
||||
let companion = Companion::<NetworkIdOf::<T>, BalanceOf::<T>> {
|
||||
network_id: network_id.into(), receiver,
|
||||
fee, amount: balance,
|
||||
};
|
||||
|
||||
let _ = <<T as pallet::Config>::Currency>::mint_into(&user_account, balance);
|
||||
let companion_id = SlowClap::<T>::current_companion_id();
|
||||
let _ = SlowClap::<T>::propose_companion(
|
||||
RawOrigin::Signed(user_account.clone()).into(),
|
||||
network_id,
|
||||
companion,
|
||||
)?;
|
||||
last_companion_id = companion_id;
|
||||
}
|
||||
Ok(last_companion_id)
|
||||
}
|
||||
|
||||
pub fn create_claps<T: Config>(i: u32, j: u32) -> Result<
|
||||
(
|
||||
Vec<crate::Clap<T::AccountId, NetworkIdOf<T>, BalanceOf<T>>>,
|
||||
<T::AuthorityId as RuntimeAppPublic>::Signature,
|
||||
),
|
||||
&'static str,
|
||||
> {
|
||||
let minimum_balance = <<T as pallet::Config>::Currency>::minimum_balance();
|
||||
let amount = minimum_balance + minimum_balance;
|
||||
let total_amount = amount.saturating_mul(j.into());
|
||||
let network_id = NetworkIdOf::<T>::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::<T>::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::<T>(),
|
||||
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 = <<T as pallet::Config>::NetworkDataHandler as NetworkDataBasicHandler>::NetworkId::default();
|
||||
|
||||
let (claps, signature) = create_claps::<T>(k, j)?;
|
||||
let _ = create_companions::<T>(j as usize, network_id, user_account, fee, receiver)?;
|
||||
}: _(RawOrigin::None, claps, signature)
|
||||
verify {
|
||||
let minimum_balance = <<T as pallet::Config>::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 = <<T as pallet::Config>::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::<T>(1, network_id, user_account.clone(), fee, receiver)?;
|
||||
let companion_id = SlowClap::<T>::current_companion_id();
|
||||
let minimum_balance = <<T as pallet::Config>::Currency>::minimum_balance();
|
||||
let balance = minimum_balance + minimum_balance;
|
||||
let companion = Companion::<NetworkIdOf::<T>, BalanceOf::<T>> {
|
||||
network_id: network_id.into(), receiver,
|
||||
fee, amount: balance,
|
||||
};
|
||||
let _ = <<T as pallet::Config>::Currency>::mint_into(&user_account, balance);
|
||||
assert_eq!(SlowClap::<T>::current_companion_id(), companion_id);
|
||||
}: _(RawOrigin::Signed(user_account), network_id.into(), companion)
|
||||
verify {
|
||||
assert_eq!(SlowClap::<T>::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 = <<T as pallet::Config>::NetworkDataHandler as NetworkDataBasicHandler>::NetworkId::default();
|
||||
let companion_id = create_companions::<T>(1, network_id, user_account.clone(), fee, receiver)?;
|
||||
assert_eq!(SlowClap::<T>::release_blocks(companion_id), BlockNumberFor::<T>::default());
|
||||
}: _(RawOrigin::Signed(user_account), network_id.into(), companion_id)
|
||||
verify {
|
||||
assert_ne!(SlowClap::<T>::release_blocks(companion_id), BlockNumberFor::<T>::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 = <<T as pallet::Config>::NetworkDataHandler as NetworkDataBasicHandler>::NetworkId::default();
|
||||
let companion_id = create_companions::<T>(1, network_id, user_account.clone(), fee, receiver)?;
|
||||
SlowClap::<T>::release_companion(
|
||||
RawOrigin::Signed(user_account.clone()).into(),
|
||||
network_id,
|
||||
companion_id,
|
||||
)?;
|
||||
let block_shift =
|
||||
<<T as pallet::Config>::NetworkDataHandler as NetworkDataInspectHandler<NetworkData>>::get(&network_id)
|
||||
.unwrap()
|
||||
.release_delay
|
||||
.unwrap();
|
||||
frame_system::Pallet::<T>::set_block_number((block_shift + 1).saturated_into());
|
||||
}: _(RawOrigin::Signed(user_account), network_id.into(), companion_id)
|
||||
verify {
|
||||
assert_eq!(SlowClap::<T>::companions(network_id, companion_id), None);
|
||||
assert_eq!(SlowClap::<T>::companion_details(companion_id), None);
|
||||
assert_eq!(SlowClap::<T>::current_companion_id(), companion_id + 1);
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Pallet,
|
||||
crate::mock::new_test_ext(),
|
||||
crate::mock::Runtime,
|
||||
);
|
||||
}
|
1334
pallets/slow-clap/src/lib.rs
Executable file
1334
pallets/slow-clap/src/lib.rs
Executable file
File diff suppressed because it is too large
Load Diff
253
pallets/slow-clap/src/mock.rs
Normal file
253
pallets/slow-clap/src/mock.rs
Normal file
@ -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<Runtime>;
|
||||
|
||||
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<Vec<u64>> = Some(vec![
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
]);
|
||||
}
|
||||
|
||||
pub struct TestSessionManager;
|
||||
impl pallet_session::SessionManager<u64> for TestSessionManager {
|
||||
fn new_session(_new_index: SessionIndex) -> Option<Vec<u64>> {
|
||||
Validators::mutate(|l| l.take())
|
||||
}
|
||||
fn end_session(_: SessionIndex) {}
|
||||
fn start_session(_: SessionIndex) {}
|
||||
}
|
||||
|
||||
impl pallet_session::historical::SessionManager<u64, u64> for TestSessionManager {
|
||||
fn new_session(_new_index: SessionIndex) -> Option<Vec<(u64, u64)>> {
|
||||
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<IdentificationTuple>;
|
||||
|
||||
parameter_types! {
|
||||
pub static Offences: Vec<(Vec<u64>, Offence)> = vec![];
|
||||
}
|
||||
|
||||
pub struct OffenceHandler;
|
||||
impl ReportOffence<u64, IdentificationTuple, Offence> for OffenceHandler {
|
||||
fn report_offence(reporters: Vec<u64>, 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() -> <Runtime as frame_system::Config>::AccountId { 69 }
|
||||
pub fn eve_account_id() -> <Runtime as frame_system::Config>::AccountId { 1337 }
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut t = frame_system::GenesisConfig::<Runtime>::default()
|
||||
.build_storage()
|
||||
.unwrap();
|
||||
|
||||
pallet_balances::GenesisConfig::<Runtime> {
|
||||
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<u64>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const Period: u64 = 1;
|
||||
pub const Offset: u64 = 0;
|
||||
}
|
||||
|
||||
impl pallet_session::Config for Runtime {
|
||||
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type SessionManager =
|
||||
pallet_session::historical::NoteHistoricalRoot<Runtime, TestSessionManager>;
|
||||
type SessionHandler = (SlowClap,);
|
||||
type ValidatorId = u64;
|
||||
type ValidatorIdOf = ConvertInto;
|
||||
type Keys = UintAuthorityId;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
impl pallet_session::historical::Config for Runtime {
|
||||
type FullIdentification = u64;
|
||||
type FullIdentificationOf = ConvertInto;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub static MockCurrentSessionProgress: Option<Option<Permill>> = None;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub static MockAverageSessionLength: Option<u64> = None;
|
||||
}
|
||||
|
||||
pub struct TestNextSessionRotation;
|
||||
impl frame_support::traits::EstimateNextSessionRotation<u64> for TestNextSessionRotation {
|
||||
fn average_session_length() -> u64 {
|
||||
let mock = MockAverageSessionLength::mutate(|p| p.take());
|
||||
mock.unwrap_or(pallet_session::PeriodicSessions::<Period, Offset>::average_session_length())
|
||||
}
|
||||
|
||||
fn estimate_current_session_progress(now: u64) -> (Option<Permill>, Weight) {
|
||||
let (estimate, weight) =
|
||||
pallet_session::PeriodicSessions::<Period, Offset>::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<u64>, Weight) {
|
||||
pallet_session::PeriodicSessions::<Period, Offset>::estimate_next_session_rotation(now)
|
||||
}
|
||||
}
|
||||
|
||||
impl ghost_networks::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type NetworkId = u32;
|
||||
type RegisterOrigin = EnsureRoot<Self::AccountId>;
|
||||
type UpdateOrigin = EnsureRoot<Self::AccountId>;
|
||||
type RemoveOrigin = EnsureRoot<Self::AccountId>;
|
||||
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<RuntimeCall, ()>;
|
||||
|
||||
// impl frame_system::offchain::SigningTypes for Runtime {
|
||||
// type Public = <Signature as Verify>::Signer;
|
||||
// type Signature = Signature;
|
||||
// }
|
||||
|
||||
impl<LocalCall> frame_system::offchain::SendTransactionTypes<LocalCall> for Runtime
|
||||
where
|
||||
RuntimeCall: From<LocalCall>,
|
||||
{
|
||||
type OverarchingCall = RuntimeCall;
|
||||
type Extrinsic = Extrinsic;
|
||||
}
|
||||
|
||||
// impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime
|
||||
// where
|
||||
// RuntimeCall: From<LocalCall>,
|
||||
// {
|
||||
// fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
|
||||
// call: Self::OverarchingCall,
|
||||
// _public: Self::Public,
|
||||
// _account: Self::AccountId,
|
||||
// nonce: Self::Nonce,
|
||||
// ) -> Option<(RuntimeCall, <Extrinsic as ExtrinsicT>::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);
|
||||
// }
|
696
pallets/slow-clap/src/tests.rs
Normal file
696
pallets/slow-clap/src/tests.rs
Normal file
@ -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<NetworkIdOf<Runtime>, BalanceOf<Runtime>> {
|
||||
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::<Runtime>::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::<Runtime>::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::<Runtime>::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::<Runtime>::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::<Runtime>::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::<Runtime>::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::<Runtime>::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::<Runtime>::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::<Runtime>::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::<u8>::new(),
|
||||
Vec::<u8>::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::<u8>::new(),
|
||||
Vec::<u8>::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<u8> {
|
||||
b"https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/".to_vec()
|
||||
}
|
||||
|
||||
fn get_gatekeeper() -> Vec<u8> {
|
||||
b"0x4d224452801ACEd8B2F0aebE155379bb5D594381".to_vec()
|
||||
}
|
||||
|
||||
fn get_topic_name() -> Vec<u8> {
|
||||
b"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".to_vec()
|
||||
}
|
||||
|
||||
fn get_network_id() -> u32 {
|
||||
// let mut network_id: NetworkIdOf<Runtime> = 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<Log> {
|
||||
let byte_converter = |s: &str| -> Vec<u8> {
|
||||
(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,
|
||||
},
|
||||
]
|
||||
}
|
18
pallets/slow-clap/src/weights.rs
Normal file
18
pallets/slow-clap/src/weights.rs
Normal file
@ -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() }
|
||||
}
|
19
pallets/traits/Cargo.toml
Executable file
19
pallets/traits/Cargo.toml
Executable file
@ -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",
|
||||
]
|
3
pallets/traits/src/lib.rs
Executable file
3
pallets/traits/src/lib.rs
Executable file
@ -0,0 +1,3 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
pub mod networks;
|
29
pallets/traits/src/networks.rs
Executable file
29
pallets/traits/src/networks.rs
Executable file
@ -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<Network>: NetworkDataBasicHandler {
|
||||
fn get(n: &Self::NetworkId) -> Option<Network>;
|
||||
fn iter() -> PrefixIterator<(Self::NetworkId, Network)>;
|
||||
}
|
||||
|
||||
pub trait NetworkDataMutateHandler<Network>: NetworkDataInspectHandler<Network> {
|
||||
fn register(chain_id: Self::NetworkId, network: Network) -> DispatchResult;
|
||||
fn remove(chain_id: Self::NetworkId) -> DispatchResult;
|
||||
}
|
14
primitives/machine/Cargo.toml
Normal file
14
primitives/machine/Cargo.toml
Normal file
@ -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 }
|
22
primitives/machine/src/ghost_node_hardware.json
Normal file
22
primitives/machine/src/ghost_node_hardware.json
Normal file
@ -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
|
||||
}
|
||||
]
|
6
primitives/machine/src/lib.rs
Normal file
6
primitives/machine/src/lib.rs
Normal file
@ -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")
|
||||
};
|
||||
}
|
36
rpc/Cargo.toml
Executable file
36
rpc/Cargo.toml
Executable file
@ -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 }
|
145
rpc/src/lib.rs
Executable file
145
rpc/src/lib.rs
Executable file
@ -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<Block>,
|
||||
/// The keystore that manages the keys of the node.
|
||||
pub keystore: KeystorePtr,
|
||||
}
|
||||
|
||||
/// Extra dependencies for GRANDPA.
|
||||
pub struct GrandpaDeps<B> {
|
||||
/// Voting round info.
|
||||
pub shared_voter_state: grandpa::SharedVoterState,
|
||||
/// Authority set info.
|
||||
pub shared_authority_set: grandpa::SharedAuthoritySet<Hash, BlockNumber>,
|
||||
/// Receives notifications about justification events from GRANDPA,
|
||||
pub justification_stream: grandpa::GrandpaJustificationStream<Block>,
|
||||
/// Subscription manager to keep track of pubsub subscribers.
|
||||
pub subscription_executor: sc_rpc::SubscriptionTaskExecutor,
|
||||
/// Finality proof provider.
|
||||
pub finality_provider: Arc<FinalityProofProvider<B, Block>>,
|
||||
}
|
||||
|
||||
/// Full client dependencies
|
||||
pub struct FullDeps<C, P, SC, B> {
|
||||
/// The client instance to use.
|
||||
pub client: Arc<C>,
|
||||
/// Transaction pool instance.
|
||||
pub pool: Arc<P>,
|
||||
/// The [`SelectChain`] Strategy
|
||||
pub select_chain: SC,
|
||||
/// A copy of the chain spec.
|
||||
pub chain_spec: Box<dyn sc_chain_spec::ChainSpec>,
|
||||
/// Whether to deny unsafe calls.
|
||||
pub deny_unsafe: DenyUnsafe,
|
||||
/// BABE specific dependencies
|
||||
pub babe: BabeDeps,
|
||||
/// GRANDPA specific dependencies
|
||||
pub grandpa: GrandpaDeps<B>,
|
||||
/// Backend used by the node.
|
||||
pub backend: Arc<B>,
|
||||
}
|
||||
|
||||
pub fn create_full_rpc<C, P, SC, B>(
|
||||
FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa, backend } : FullDeps<C, P, SC, B>,
|
||||
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
|
||||
where
|
||||
C: ProvideRuntimeApi<Block>
|
||||
+ HeaderBackend<Block>
|
||||
+ AuxStore
|
||||
+ HeaderMetadata<Block, Error = BlockChainError>
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static,
|
||||
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
|
||||
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
|
||||
C::Api: BlockBuilder<Block>,
|
||||
C::Api: BabeApi<Block>,
|
||||
P: TransactionPool + Sync + Send + 'static,
|
||||
SC: SelectChain<Block> + 'static,
|
||||
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
|
||||
B::State: sc_client_api::StateBackend<sp_runtime::traits::HashingFor<Block>>,
|
||||
{
|
||||
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)
|
||||
}
|
301
runtime/casper/Cargo.toml
Executable file
301
runtime/casper/Cargo.toml
Executable file
@ -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",
|
||||
]
|
7
runtime/casper/build.rs
Executable file
7
runtime/casper/build.rs
Executable file
@ -0,0 +1,7 @@
|
||||
fn main() {
|
||||
substrate_wasm_builder::WasmBuilder::new()
|
||||
.with_current_project()
|
||||
.import_memory()
|
||||
.export_heap_base()
|
||||
.build()
|
||||
}
|
30
runtime/casper/constants/Cargo.toml
Executable file
30
runtime/casper/constants/Cargo.toml
Executable file
@ -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",
|
||||
]
|
110
runtime/casper/constants/src/lib.rs
Executable file
110
runtime/casper/constants/src/lib.rs
Executable file
@ -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<Self::Balance> {
|
||||
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);
|
||||
}
|
||||
}
|
79
runtime/casper/constants/src/weights/block_weights.rs
Normal file
79
runtime/casper/constants/src/weights/block_weights.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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."
|
||||
);
|
||||
}
|
||||
}
|
79
runtime/casper/constants/src/weights/extrinsic_weights.rs
Normal file
79
runtime/casper/constants/src/weights/extrinsic_weights.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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."
|
||||
);
|
||||
}
|
||||
}
|
9
runtime/casper/constants/src/weights/mod.rs
Normal file
9
runtime/casper/constants/src/weights/mod.rs
Normal file
@ -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;
|
83
runtime/casper/constants/src/weights/paritydb_weights.rs
Normal file
83
runtime/casper/constants/src/weights/paritydb_weights.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
82
runtime/casper/constants/src/weights/rocksdb_weights.rs
Normal file
82
runtime/casper/constants/src/weights/rocksdb_weights.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
222
runtime/casper/src/bag_thresholds.rs
Normal file
222
runtime/casper/src/bag_thresholds.rs
Normal file
@ -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,
|
||||
];
|
164
runtime/casper/src/cult/mod.rs
Executable file
164
runtime/casper/src/cult/mod.rs
Executable file
@ -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<Self::AccountId, ConstU16<65535>>,
|
||||
Skeletons,
|
||||
>;
|
||||
type DispatchWhitelistedOrigin = EitherOf<
|
||||
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
|
||||
Geniuses,
|
||||
>;
|
||||
type Preimages = Preimage;
|
||||
type WeightInfo = weights::pallet_whitelist::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
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<CultReferendaInstance> for Runtime {
|
||||
type WeightInfo = ();
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Scheduler = Scheduler;
|
||||
type Currency = Balances;
|
||||
type SubmitOrigin = EitherOf<
|
||||
pallet_ranked_collective::EnsureMember<Runtime, CultCollectiveInstance, 3>,
|
||||
MapSuccess<
|
||||
TryWithMorphedArg<
|
||||
RuntimeOrigin,
|
||||
<RuntimeOrigin as OriginTrait>::PalletsOrigin,
|
||||
ToVoice,
|
||||
EnsureOfRank<Runtime, CultCollectiveInstance>,
|
||||
(AccountId, u16),
|
||||
>,
|
||||
TakeFirst,
|
||||
>
|
||||
>;
|
||||
type CancelOrigin = Skeletons;
|
||||
type KillOrigin = Ghosts;
|
||||
type Slash = Treasury;
|
||||
type Votes = pallet_ranked_collective::Votes;
|
||||
type Tally = pallet_ranked_collective::TallyOf<Runtime, CultCollectiveInstance>;
|
||||
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<CultCollectiveInstance> for Runtime {
|
||||
type WeightInfo = weights::pallet_ranked_collective::WeightInfo<Runtime>;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
type PromoteOrigin = frame_system::EnsureNever<pallet_ranked_collective::Rank>;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type PromoteOrigin = EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>;
|
||||
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
type AddOrigin = frame_system::EnsureNever<pallet_ranked_collective::Rank>;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type AddOrigin = EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>;
|
||||
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
type RemoveOrigin = frame_system::EnsureNever<pallet_ranked_collective::Rank>;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type RemoveOrigin = EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>;
|
||||
|
||||
type DemoteOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Ghosts>;
|
||||
type ExchangeOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, 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<CultCoreInstance> for Runtime {
|
||||
type WeightInfo = weights::pallet_core_fellowship::WeightInfo<Runtime>;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Members = pallet_ranked_collective::Pallet<Runtime, CultCollectiveInstance>;
|
||||
type Balance = Balance;
|
||||
|
||||
type ParamsOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Skeletons>;
|
||||
type InductOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Zombies>;
|
||||
type ApproveOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, EnsureCanRetainAt>;
|
||||
type PromoteOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, EnsureCanPromoteTo>;
|
||||
|
||||
type EvidenceSize = ConstU32<65536>;
|
||||
}
|
||||
|
||||
pub type CultSalaryInstance = pallet_salary::Instance1;
|
||||
impl pallet_salary::Config<CultSalaryInstance> for Runtime {
|
||||
type WeightInfo = weights::pallet_salary::WeightInfo<Runtime>;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
|
||||
type Paymaster = PayFromAccount<Balances, TreasuryAccount>;
|
||||
type Members = pallet_ranked_collective::Pallet<Runtime, CultCollectiveInstance>;
|
||||
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
type Salary = pallet_core_fellowship::Pallet<Runtime, CultCoreInstance>;
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
type Salary = frame_support::traits::tokens::ConvertRank<
|
||||
crate::impls::benchmarks::RankToSalary<Balances>,
|
||||
>;
|
||||
|
||||
type RegistrationPeriod = ConstU32<{ 15 * DAYS }>;
|
||||
type PayoutPeriod = ConstU32<{ 15 * DAYS }>;
|
||||
type Budget = ConstU128<{ 100 * CSPR }>;
|
||||
}
|
168
runtime/casper/src/cult/origins.rs
Executable file
168
runtime/casper/src/cult/origins.rs
Executable file
@ -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<T>(_);
|
||||
|
||||
#[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<pallet_ranked_collective::Rank> {
|
||||
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<O> for ToVoice {
|
||||
type Outcome = pallet_ranked_collective::Rank;
|
||||
fn try_morph(o: O) -> Result<pallet_ranked_collective::Rank, ()> {
|
||||
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<O: Into<Result<Origin, O>> + From<Origin>> EnsureOrigin<O> for $name {
|
||||
type Success = $success_type;
|
||||
fn try_origin(o: O) -> Result<Self::Success, O> {
|
||||
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<O, ()> {
|
||||
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<Success = $success_type:ty> {
|
||||
$( $item:ident = $success:expr, )*
|
||||
}
|
||||
) => {
|
||||
$vis struct $name;
|
||||
impl<O: Into<Result<Origin, O>> + From<Origin>> EnsureOrigin<O> for $name {
|
||||
type Success = $success_type;
|
||||
fn try_origin(o: O) -> Result<Self::Success, O> {
|
||||
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<O, ()> {
|
||||
// By convention the more privileged origins go later,
|
||||
// so for greatest chance of success, we want the last one.
|
||||
let _result: Result<O, ()> = Err(());
|
||||
$(
|
||||
let _result: Result<O, ()> = Ok(O::from(Origin::$item));
|
||||
)*
|
||||
_result
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
decl_ensure! {
|
||||
pub type EnsureCult: EnsureOrigin<Success = Rank> {
|
||||
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<Success = Rank> {
|
||||
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<Success = Rank> {
|
||||
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<Success = Balance> {
|
||||
Geniuses = 50 * CSPR,
|
||||
Degens = 100 * CSPR,
|
||||
Zombies = 500 * CSPR,
|
||||
Skeletons = 1_000 * CSPR,
|
||||
Ghosts = 10_000 * CSPR,
|
||||
}
|
||||
}
|
||||
}
|
377
runtime/casper/src/cult/tracks.rs
Executable file
377
runtime/casper/src/cult/tracks.rs
Executable file
@ -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<TrackId, Rank> 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<Balance, BlockNumber>); 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<Balance, BlockNumber> for TracksInfo {
|
||||
type Id = TrackId;
|
||||
type RuntimeOrigin = <RuntimeOrigin as frame_support::traits::OriginTrait>::PalletsOrigin;
|
||||
|
||||
fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo<Balance, BlockNumber>)] {
|
||||
&TRACKS_DATA[..]
|
||||
}
|
||||
|
||||
fn track_for(id: &Self::RuntimeOrigin) -> Result<Self::Id, ()> {
|
||||
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);
|
237
runtime/casper/src/genesis_config_presets.rs
Normal file
237
runtime/casper/src/genesis_config_presets.rs
Normal file
@ -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<u8>,
|
||||
default_endpoint: Vec<u8>,
|
||||
finality_delay: Option<u64>,
|
||||
release_delay: Option<u64>,
|
||||
network_type: u8,
|
||||
gatekeeper: Vec<u8>,
|
||||
topic_name: Vec<u8>,
|
||||
incoming_fee: u32,
|
||||
outgoing_fee: u32,
|
||||
}
|
||||
|
||||
fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
||||
.expect("static values are valid; qed")
|
||||
.public()
|
||||
}
|
||||
|
||||
fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId
|
||||
where
|
||||
AccountPublic: From<<TPublic::Pair as Pair>::Public>,
|
||||
{
|
||||
AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()
|
||||
}
|
||||
|
||||
fn get_authority_keys_from_seed(
|
||||
seed: &str,
|
||||
) -> (
|
||||
AccountId,
|
||||
AccountId,
|
||||
BabeId,
|
||||
GrandpaId,
|
||||
AuthorityDiscoveryId,
|
||||
SlowClapId,
|
||||
) {
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", seed)),
|
||||
get_account_id_from_seed::<sr25519::Public>(seed),
|
||||
get_from_seed::<BabeId>(seed),
|
||||
get_from_seed::<GrandpaId>(seed),
|
||||
get_from_seed::<AuthorityDiscoveryId>(seed),
|
||||
get_from_seed::<SlowClapId>(seed),
|
||||
)
|
||||
}
|
||||
|
||||
fn testnet_accounts() -> Vec<AccountId> {
|
||||
Vec::from([
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Charlie"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Dave"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Eve"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Feride"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Feride//stash"),
|
||||
])
|
||||
}
|
||||
|
||||
fn testnet_evm_accounts() -> Vec<(AccountId, u128, u8)> {
|
||||
vec![
|
||||
// 01c928771aea942a1e7ac06adf2b73dfbc9a25d9eaa516e3673116af7f345198
|
||||
(get_account_id_from_seed::<sr25519::Public>("1A69d2D5568D1878023EeB121a73d33B9116A760"), 1337 * CSPR, 1),
|
||||
// b19a435901872f817185f7234a1484eae837613f9d10cf21927a23c2d8cb9139
|
||||
(get_account_id_from_seed::<sr25519::Public>("2f86cfBED3fbc1eCf2989B9aE5fc019a837A9C12"), 1337 * CSPR, 2),
|
||||
// d3baf57b74d65719b2dc33f5a464176022d0cc5edbca002234229f3e733875fc
|
||||
(get_account_id_from_seed::<sr25519::Public>("e83f67361Ac74D42A48E2DAfb6706eb047D8218D"), 69 * CSPR, 3),
|
||||
// c4683d566436af6b58b4a59c8f501319226e85b21869bf93d5eeb4596d4791d4
|
||||
(get_account_id_from_seed::<sr25519::Public>("827ee4ad9b259b6fa1390ed60921508c78befd63"), 69 * CSPR, 4),
|
||||
]
|
||||
}
|
||||
|
||||
fn testnet_evm_networks() -> Vec<(u32, Vec<u8>)> {
|
||||
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<Vec<AccountId>>,
|
||||
ghost_accounts: Option<Vec<(AccountId, u128, u8)>>,
|
||||
evm_networks: Option<Vec<(u32, Vec<u8>)>>,
|
||||
) -> serde_json::Value {
|
||||
let endowed_accounts: Vec<AccountId> =
|
||||
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<u8>)> =
|
||||
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::<Vec<_>>(),
|
||||
},
|
||||
"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::<Vec<_>>(),
|
||||
},
|
||||
"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::<Vec<_>>(),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 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<sp_std::vec::Vec<u8>> {
|
||||
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<sp_genesis_builder::PresetId> {
|
||||
Vec::from([
|
||||
sp_genesis_builder::PresetId::from("local_testnet"),
|
||||
sp_genesis_builder::PresetId::from("development"),
|
||||
])
|
||||
}
|
93
runtime/casper/src/impls.rs
Normal file
93
runtime/casper/src/impls.rs
Normal file
@ -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<T> = <T as frame_system::Config>::AccountId;
|
||||
type ProposalOf<T, I> = <T as pallet_collective::Config<I>>::Proposal;
|
||||
type HashOf<T> = <T as frame_system::Config>::Hash;
|
||||
|
||||
/// Proposal provider for alliance pallet.
|
||||
/// Adapter from collective pallet to alliance proposal provider trait.
|
||||
pub struct AllianceProposalProvider<T, I = ()>(PhantomData<(T, I)>);
|
||||
impl <T, I> ProposalProvider<AccountIdOf<T>, HashOf<T>, ProposalOf<T, I>> for AllianceProposalProvider<T, I>
|
||||
where
|
||||
T: pallet_collective::Config<I> + frame_system::Config,
|
||||
I: 'static,
|
||||
{
|
||||
fn propose_proposal(
|
||||
who: AccountIdOf<T>,
|
||||
threshold: u32,
|
||||
proposal: Box<ProposalOf<T, I>>,
|
||||
length_bound: u32,
|
||||
) -> Result<(u32, u32), DispatchError> {
|
||||
pallet_collective::Pallet::<T, I>::do_propose_proposed(who, threshold, proposal, length_bound)
|
||||
}
|
||||
|
||||
fn vote_proposal(
|
||||
who: AccountIdOf<T>,
|
||||
proposal: HashOf<T>,
|
||||
index: ProposalIndex,
|
||||
approve: bool,
|
||||
) -> Result<bool, DispatchError> {
|
||||
pallet_collective::Pallet::<T, I>::do_vote(who, proposal, index, approve)
|
||||
}
|
||||
|
||||
fn close_proposal(
|
||||
proposal_hash: HashOf<T>,
|
||||
proposal_index: ProposalIndex,
|
||||
proposal_weight_bound: Weight,
|
||||
length_bound: u32,
|
||||
) -> DispatchResultWithPostInfo {
|
||||
pallet_collective::Pallet::<T, I>::do_close(
|
||||
proposal_hash,
|
||||
proposal_index,
|
||||
proposal_weight_bound,
|
||||
length_bound,
|
||||
)
|
||||
}
|
||||
|
||||
fn proposal_of(proposal_hash: HashOf<T>) -> Option<ProposalOf<T, I>> {
|
||||
pallet_collective::ProposalOf::<T, I>::get(proposal_hash)
|
||||
}
|
||||
}
|
||||
|
||||
/// Used the compare the privilege of an origin inside the scheduler.
|
||||
pub struct EqualOrGreatestRootCmp;
|
||||
impl PrivilegeCmp<OriginCaller> for EqualOrGreatestRootCmp {
|
||||
fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option<Ordering> {
|
||||
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<Fungible>(PhantomData<Fungible>);
|
||||
impl<Fungible> Convert<Rank, Balance> for RankToSalary<Fungible>
|
||||
where
|
||||
Fungible: fungible::Inspect<AccountId, Balance = Balance>,
|
||||
{
|
||||
fn convert(r: Rank) -> Balance {
|
||||
Balance::from(r).saturating_mul(Fungible::minimum_balance())
|
||||
}
|
||||
}
|
||||
}
|
1915
runtime/casper/src/lib.rs
Executable file
1915
runtime/casper/src/lib.rs
Executable file
File diff suppressed because it is too large
Load Diff
104
runtime/casper/src/weights/frame_benchmarking_baseline.rs
Normal file
104
runtime/casper/src/weights/frame_benchmarking_baseline.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> frame_benchmarking::baseline::WeightInfo for WeightInfo<T> {
|
||||
/// 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()))
|
||||
}
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> frame_election_provider_support::WeightInfo for WeightInfo<T> {
|
||||
/// 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()))
|
||||
}
|
||||
}
|
170
runtime/casper/src/weights/frame_system.rs
Normal file
170
runtime/casper/src/weights/frame_system.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
71
runtime/casper/src/weights/ghost_claims.rs
Normal file
71
runtime/casper/src/weights/ghost_claims.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> ghost_claims::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
191
runtime/casper/src/weights/ghost_networks.rs
Normal file
191
runtime/casper/src/weights/ghost_networks.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
125
runtime/casper/src/weights/ghost_slow_clap.rs
Normal file
125
runtime/casper/src/weights/ghost_slow_clap.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> ghost_slow_clap::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
28
runtime/casper/src/weights/mod.rs
Normal file
28
runtime/casper/src/weights/mod.rs
Normal file
@ -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;
|
483
runtime/casper/src/weights/pallet_alliance.rs
Normal file
483
runtime/casper/src/weights/pallet_alliance.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
60
runtime/casper/src/weights/pallet_babe.rs
Normal file
60
runtime/casper/src/weights/pallet_babe.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_babe::WeightInfo for WeightInfo<T> {
|
||||
/// 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()))
|
||||
}
|
||||
}
|
105
runtime/casper/src/weights/pallet_bags_list.rs
Normal file
105
runtime/casper/src/weights/pallet_bags_list.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
173
runtime/casper/src/weights/pallet_balances.rs
Normal file
173
runtime/casper/src/weights/pallet_balances.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
63
runtime/casper/src/weights/pallet_bounties.rs
Normal file
63
runtime/casper/src/weights/pallet_bounties.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_bounties::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
297
runtime/casper/src/weights/pallet_collective.rs
Normal file
297
runtime/casper/src/weights/pallet_collective.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
|
||||
/// 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()))
|
||||
}
|
||||
}
|
226
runtime/casper/src/weights/pallet_core_fellowship.rs
Normal file
226
runtime/casper/src/weights/pallet_core_fellowship.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_core_fellowship::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo for WeightInfo<T> {
|
||||
/// 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()))
|
||||
}
|
||||
}
|
207
runtime/casper/src/weights/pallet_fast_unstake.rs
Normal file
207
runtime/casper/src/weights/pallet_fast_unstake.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_fast_unstake::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
71
runtime/casper/src/weights/pallet_grandpa.rs
Normal file
71
runtime/casper/src/weights/pallet_grandpa.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_grandpa::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
434
runtime/casper/src/weights/pallet_identity.rs
Normal file
434
runtime/casper/src/weights/pallet_identity.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
113
runtime/casper/src/weights/pallet_indices.rs
Normal file
113
runtime/casper/src/weights/pallet_indices.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_indices::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
161
runtime/casper/src/weights/pallet_multisig.rs
Normal file
161
runtime/casper/src/weights/pallet_multisig.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
671
runtime/casper/src/weights/pallet_nomination_pools.rs
Normal file
671
runtime/casper/src/weights/pallet_nomination_pools.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
264
runtime/casper/src/weights/pallet_preimage.rs
Normal file
264
runtime/casper/src/weights/pallet_preimage.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
|
||||
/// 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()))
|
||||
}
|
||||
}
|
222
runtime/casper/src/weights/pallet_proxy.rs
Normal file
222
runtime/casper/src/weights/pallet_proxy.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
198
runtime/casper/src/weights/pallet_ranked_collective.rs
Normal file
198
runtime/casper/src/weights/pallet_ranked_collective.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_ranked_collective::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
537
runtime/casper/src/weights/pallet_referenda.rs
Normal file
537
runtime/casper/src/weights/pallet_referenda.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_referenda::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
153
runtime/casper/src/weights/pallet_salary.rs
Normal file
153
runtime/casper/src/weights/pallet_salary.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_salary::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
286
runtime/casper/src/weights/pallet_scheduler.rs
Normal file
286
runtime/casper/src/weights/pallet_scheduler.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_scheduler::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
81
runtime/casper/src/weights/pallet_session.rs
Normal file
81
runtime/casper/src/weights/pallet_session.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_session::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
847
runtime/casper/src/weights/pallet_staking.rs
Normal file
847
runtime/casper/src/weights/pallet_staking.rs
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! 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<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
|
||||
/// 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))
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user