mirror of
https://github.com/pezkuwichain/pezkuwi-runtime-templates.git
synced 2026-04-22 02:07:55 +00:00
Transition into monorepo (#180)
* evm template integrated * workflows modified per template * workflow fixes
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Released]
|
||||
|
||||
## [1.0.0] - 2024-04-25
|
||||
|
||||
### Added
|
||||
|
||||
- Audit report (#170)
|
||||
- Upgraded from v1.7.0 to v1.10.0 (#165)
|
||||
- Upgraded docs to v1.10.0 (#166)
|
||||
|
||||
### Fixed
|
||||
|
||||
- removed `polkadot launch` (#169)
|
||||
- explanation for runtime constants (#167)
|
||||
- proxy filters (#146)
|
||||
- weights for non-XCM related pallets (#149)
|
||||
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.1.2] - 2024-02-20
|
||||
|
||||
### Added
|
||||
|
||||
- Upgraded from v1.6.0 to v1.7.0 (#114)
|
||||
- Created documentation for generic runtime template (#61)
|
||||
- Added test for detecting changes in runtime constants (#31)
|
||||
- Tested and added guidelines about connecting to relay chain (#84)
|
||||
- Integrated fuzzer (#14)
|
||||
- Added documentation for pallet assets (#106)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Filtered out anonymous proxy calls due to known bug (#12)
|
||||
- Removed 0 weights from runtime (#104)
|
||||
- Various optimizations to CI (#112), (#117), and (#120)
|
||||
|
||||
## [0.1.1] - 2024-02-01
|
||||
|
||||
### Added
|
||||
|
||||
- Upgraded `polkadot-sdk` dependencies from `polkadotv1.3.0` -> `polkadotv1.6.0` (#96)
|
||||
|
||||
## [0.1.0] - 2023-12-21
|
||||
|
||||
### Added
|
||||
|
||||
- Fork cumulus parachain template (#11)
|
||||
- Configured pallet-multisig (#13)
|
||||
- Configured pallet-proxy (#20)
|
||||
- Configured pallet-utility (#36)
|
||||
- Integration tests (#24)
|
||||
- Set up Docs (#51)
|
||||
- Docs for pallet-proxy (#57)
|
||||
- Docs for aura-ext (#59)
|
||||
- Docs for parachain-system (#63)
|
||||
- Docs for collator-selection (#63)
|
||||
- Docs for pallet-multisig (#64)
|
||||
- Docs for pallet-transaction-payment (#53)
|
||||
- Docs for pallet-message-queue (#58)
|
||||
- Docs for weights & fees (#66)
|
||||
- Docs for xcmp-queue (#73)
|
||||
- Docs for balances (#72)
|
||||
- Docs for xcm-executor (#77)
|
||||
- Docs for pallet-xcm (#76)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix runtime build (#40)
|
||||
- Add pallet index to multisig (#45)
|
||||
- Update LICENSE (#50)
|
||||
- Fix CI to verify runtime builds (#46)
|
||||
- Don't run Rust CI on Doc Changes (#54)
|
||||
Generated
+14956
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,149 @@
|
||||
[workspace]
|
||||
members = [ "node", "runtime", "template-fuzzer" ]
|
||||
resolver = "2"
|
||||
|
||||
[workspace.package]
|
||||
authors = [ "OpenZeppelin" ]
|
||||
description = "Runtime template(s) for Polkadot Para{chains, cores}"
|
||||
edition = "2021"
|
||||
license = "GPL-3.0-only"
|
||||
repository = "https://github.com/OpenZeppelin/polkadot-runtime-template"
|
||||
|
||||
[workspace.dependencies]
|
||||
clap = { version = "4.5.3", features = [ "derive" ] }
|
||||
color-print = "0.3.4"
|
||||
futures = "0.3.28"
|
||||
hex-literal = "0.4.1"
|
||||
jsonrpsee = { version = "0.22", features = [ "server" ] }
|
||||
log = { version = "0.4.20", default-features = false }
|
||||
parity-scale-codec = { version = "3.0.0", default-features = false, features = [
|
||||
"derive",
|
||||
"max-encoded-len",
|
||||
] }
|
||||
scale-info = { version = "2.10.0", default-features = false }
|
||||
serde = { version = "1.0.188", default-features = false }
|
||||
serde_json = "1.0.108"
|
||||
smallvec = "1.11.0"
|
||||
|
||||
# Substrate
|
||||
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
frame-try-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-assets = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-authorship = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-conviction-voting = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-message-queue = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-multisig = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-preimage = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-proxy = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-referenda = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-scheduler = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-session = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-treasury = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-whitelist = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-chain-spec = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-cli = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-executor = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-network = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-offchain = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-service = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-telemetry = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-tracing = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-arithmetic = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-genesis-builder = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-inherents = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.10.0" }
|
||||
sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-offchain = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-session = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-std = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
sp-version = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.10.0" }
|
||||
substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.10.0" }
|
||||
|
||||
# Polkadot
|
||||
pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", features = [
|
||||
"rococo-native",
|
||||
], tag = "polkadot-v1.10.0" }
|
||||
polkadot-parachain-primitives = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
|
||||
# Cumulus
|
||||
assets-common = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-client-consensus-proposer = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-primitives-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-primitives-utility = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
pallet-collator-selection = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
parachain-info = { package = "staging-parachain-info", git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
parachains-common = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
|
||||
|
||||
# Fuzzer
|
||||
substrate-runtime-fuzzer = { git = "https://github.com/srlabs/substrate-runtime-fuzzer.git", default-features = false }
|
||||
ziggy = { version = "0.8", default-features = false }
|
||||
|
||||
|
||||
[workspace.lints.clippy]
|
||||
large_enum_variant = "allow"
|
||||
too_many_arguments = "allow"
|
||||
type_complexity = "allow"
|
||||
|
||||
[profile.production]
|
||||
codegen-units = 1
|
||||
inherits = "release"
|
||||
lto = true
|
||||
|
||||
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
panic = "unwind"
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
allow-unwrap-in-tests = true
|
||||
@@ -0,0 +1,96 @@
|
||||
[package]
|
||||
name = "parachain-template-node"
|
||||
authors = { workspace = true }
|
||||
build = "build.rs"
|
||||
description = "Node compatible with parachain runtime template."
|
||||
edition = { workspace = true }
|
||||
license = { workspace = true }
|
||||
publish = false
|
||||
repository = { workspace = true }
|
||||
version = "1.0.0"
|
||||
|
||||
[dependencies]
|
||||
clap = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
jsonrpsee = { workspace = true, features = [ "server" ] }
|
||||
log = { workspace = true }
|
||||
parity-scale-codec = { workspace = true }
|
||||
serde = { workspace = true, features = [ "derive" ] }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
# Local
|
||||
parachain-template-runtime = { path = "../runtime" }
|
||||
|
||||
# Substrate
|
||||
frame-benchmarking = { workspace = true }
|
||||
frame-benchmarking-cli = { workspace = true }
|
||||
pallet-transaction-payment-rpc = { workspace = true }
|
||||
sc-basic-authorship = { workspace = true }
|
||||
sc-chain-spec = { workspace = true }
|
||||
sc-cli = { workspace = true }
|
||||
sc-client-api = { workspace = true }
|
||||
sc-consensus = { workspace = true }
|
||||
sc-executor = { workspace = true }
|
||||
sc-network = { workspace = true }
|
||||
sc-network-sync = { workspace = true }
|
||||
sc-offchain = { workspace = true }
|
||||
sc-rpc = { workspace = true }
|
||||
sc-service = { workspace = true }
|
||||
sc-sysinfo = { workspace = true }
|
||||
sc-telemetry = { workspace = true }
|
||||
sc-tracing = { workspace = true }
|
||||
sc-transaction-pool = { workspace = true }
|
||||
sc-transaction-pool-api = { workspace = true }
|
||||
sp-api = { workspace = true }
|
||||
sp-block-builder = { workspace = true }
|
||||
sp-blockchain = { workspace = true }
|
||||
sp-consensus-aura = { workspace = true }
|
||||
sp-core = { workspace = true }
|
||||
sp-io = { workspace = true }
|
||||
sp-keystore = { workspace = true }
|
||||
sp-runtime = { workspace = true }
|
||||
sp-timestamp = { workspace = true }
|
||||
substrate-frame-rpc-system = { workspace = true }
|
||||
substrate-prometheus-endpoint = { workspace = true }
|
||||
|
||||
# Polkadot
|
||||
polkadot-cli = { workspace = true, features = [ "rococo-native" ] }
|
||||
polkadot-primitives = { workspace = true }
|
||||
xcm = { workspace = true }
|
||||
|
||||
# Cumulus
|
||||
color-print = { workspace = true }
|
||||
cumulus-client-cli = { workspace = true }
|
||||
cumulus-client-collator = { workspace = true }
|
||||
cumulus-client-consensus-aura = { workspace = true }
|
||||
cumulus-client-consensus-common = { workspace = true }
|
||||
cumulus-client-consensus-proposer = { workspace = true }
|
||||
cumulus-client-service = { workspace = true }
|
||||
cumulus-primitives-core = { workspace = true }
|
||||
cumulus-primitives-parachain-inherent = { workspace = true }
|
||||
cumulus-relay-chain-interface = { workspace = true }
|
||||
|
||||
[build-dependencies]
|
||||
substrate-build-script-utils = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
async-backing = []
|
||||
experimental = []
|
||||
runtime-benchmarks = [
|
||||
"frame-benchmarking-cli/runtime-benchmarks",
|
||||
"frame-benchmarking/runtime-benchmarks",
|
||||
"parachain-template-runtime/runtime-benchmarks",
|
||||
"polkadot-cli/runtime-benchmarks",
|
||||
"polkadot-primitives/runtime-benchmarks",
|
||||
"sc-service/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"parachain-template-runtime/try-runtime",
|
||||
"polkadot-cli/try-runtime",
|
||||
"sp-runtime/try-runtime",
|
||||
]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -0,0 +1,7 @@
|
||||
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
|
||||
|
||||
fn main() {
|
||||
generate_cargo_keys();
|
||||
|
||||
rerun_if_git_head_changed();
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use parachain_template_runtime::{
|
||||
constants::currency::EXISTENTIAL_DEPOSIT, AccountId, AuraId, Signature,
|
||||
};
|
||||
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
|
||||
use sc_service::ChainType;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sp_core::{sr25519, Pair, Public};
|
||||
use sp_runtime::traits::{IdentifyAccount, Verify};
|
||||
|
||||
/// Specialized `ChainSpec` for the normal parachain runtime.
|
||||
pub type ChainSpec =
|
||||
sc_service::GenericChainSpec<parachain_template_runtime::RuntimeGenesisConfig, Extensions>;
|
||||
|
||||
/// The default XCM version to set in genesis config.
|
||||
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
|
||||
|
||||
/// Helper function to generate a crypto pair from seed
|
||||
pub 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()
|
||||
}
|
||||
|
||||
/// The extensions for the [`ChainSpec`].
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Extensions {
|
||||
/// The relay chain of the Parachain.
|
||||
pub relay_chain: String,
|
||||
/// The id of the Parachain.
|
||||
pub para_id: u32,
|
||||
}
|
||||
|
||||
impl Extensions {
|
||||
/// Try to get the extension from the given `ChainSpec`.
|
||||
pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> {
|
||||
sc_chain_spec::get_extension(chain_spec.extensions())
|
||||
}
|
||||
}
|
||||
|
||||
type AccountPublic = <Signature as Verify>::Signer;
|
||||
|
||||
/// Generate collator keys from seed.
|
||||
///
|
||||
/// This function's return type must always match the session keys of the chain
|
||||
/// in tuple format.
|
||||
pub fn get_collator_keys_from_seed(seed: &str) -> AuraId {
|
||||
get_from_seed::<AuraId>(seed)
|
||||
}
|
||||
|
||||
/// Helper function to generate an account ID from seed
|
||||
pub 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()
|
||||
}
|
||||
|
||||
/// Generate the session keys from individual elements.
|
||||
///
|
||||
/// The input must be a tuple of individual keys (a single arg for now since we
|
||||
/// have just one key).
|
||||
pub fn template_session_keys(keys: AuraId) -> parachain_template_runtime::SessionKeys {
|
||||
parachain_template_runtime::SessionKeys { aura: keys }
|
||||
}
|
||||
|
||||
pub fn development_config() -> ChainSpec {
|
||||
// Give your base currency a unit name and decimal places
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("tokenSymbol".into(), "UNIT".into());
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
properties.insert("ss58Format".into(), 42.into());
|
||||
|
||||
ChainSpec::builder(
|
||||
parachain_template_runtime::WASM_BINARY
|
||||
.expect("WASM binary was not built, please build it!"),
|
||||
Extensions {
|
||||
relay_chain: "rococo-local".into(),
|
||||
// You MUST set this to the correct network!
|
||||
para_id: 1000,
|
||||
},
|
||||
)
|
||||
.with_name("Development")
|
||||
.with_id("dev")
|
||||
.with_chain_type(ChainType::Development)
|
||||
.with_genesis_config_patch(testnet_genesis(
|
||||
// initial collators.
|
||||
vec![
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_collator_keys_from_seed("Alice"),
|
||||
),
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_collator_keys_from_seed("Bob"),
|
||||
),
|
||||
],
|
||||
vec![
|
||||
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>("Ferdie"),
|
||||
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>("Ferdie//stash"),
|
||||
],
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
1000.into(),
|
||||
))
|
||||
.build()
|
||||
}
|
||||
|
||||
pub fn local_testnet_config() -> ChainSpec {
|
||||
// Give your base currency a unit name and decimal places
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("tokenSymbol".into(), "UNIT".into());
|
||||
properties.insert("tokenDecimals".into(), 12.into());
|
||||
properties.insert("ss58Format".into(), 42.into());
|
||||
|
||||
#[allow(deprecated)]
|
||||
ChainSpec::builder(
|
||||
parachain_template_runtime::WASM_BINARY
|
||||
.expect("WASM binary was not built, please build it!"),
|
||||
Extensions {
|
||||
relay_chain: "rococo-local".into(),
|
||||
// You MUST set this to the correct network!
|
||||
para_id: 1000,
|
||||
},
|
||||
)
|
||||
.with_name("Local Testnet")
|
||||
.with_id("local_testnet")
|
||||
.with_chain_type(ChainType::Local)
|
||||
.with_genesis_config_patch(testnet_genesis(
|
||||
// initial collators.
|
||||
vec![
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_collator_keys_from_seed("Alice"),
|
||||
),
|
||||
(
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_collator_keys_from_seed("Bob"),
|
||||
),
|
||||
],
|
||||
vec![
|
||||
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>("Ferdie"),
|
||||
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>("Ferdie//stash"),
|
||||
],
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
1000.into(),
|
||||
))
|
||||
.with_protocol_id("template-local")
|
||||
.with_properties(properties)
|
||||
.build()
|
||||
}
|
||||
|
||||
fn testnet_genesis(
|
||||
invulnerables: Vec<(AccountId, AuraId)>,
|
||||
endowed_accounts: Vec<AccountId>,
|
||||
root: AccountId,
|
||||
id: ParaId,
|
||||
) -> serde_json::Value {
|
||||
serde_json::json!({
|
||||
"balances": {
|
||||
"balances": endowed_accounts.iter().cloned().map(|k| (k, 1u64 << 60)).collect::<Vec<_>>(),
|
||||
},
|
||||
"parachainInfo": {
|
||||
"parachainId": id,
|
||||
},
|
||||
"collatorSelection": {
|
||||
"invulnerables": invulnerables.iter().cloned().map(|(acc, _)| acc).collect::<Vec<_>>(),
|
||||
"candidacyBond": EXISTENTIAL_DEPOSIT * 16,
|
||||
},
|
||||
"session": {
|
||||
"keys": invulnerables
|
||||
.into_iter()
|
||||
.map(|(acc, aura)| {
|
||||
(
|
||||
acc.clone(), // account id
|
||||
acc, // validator id
|
||||
template_session_keys(aura), // session keys
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
},
|
||||
"treasury": {},
|
||||
"polkadotXcm": {
|
||||
"safeXcmVersion": Some(SAFE_XCM_VERSION),
|
||||
},
|
||||
"sudo": { "key": Some(root) }
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Sub-commands supported by the collator.
|
||||
#[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),
|
||||
|
||||
/// Revert the chain to a previous state.
|
||||
Revert(sc_cli::RevertCmd),
|
||||
|
||||
/// Remove the whole chain.
|
||||
PurgeChain(cumulus_client_cli::PurgeChainCmd),
|
||||
|
||||
/// Export the genesis head data of the parachain.
|
||||
///
|
||||
/// Head data is the encoded block header.
|
||||
#[command(alias = "export-genesis-state")]
|
||||
ExportGenesisHead(cumulus_client_cli::ExportGenesisHeadCommand),
|
||||
|
||||
/// Export the genesis wasm of the parachain.
|
||||
ExportGenesisWasm(cumulus_client_cli::ExportGenesisWasmCommand),
|
||||
|
||||
/// Sub-commands concerned with benchmarking.
|
||||
/// The pallet benchmarking moved to the `pallet` sub-command.
|
||||
#[command(subcommand)]
|
||||
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
||||
|
||||
/// Try-runtime has migrated to a standalone
|
||||
/// [CLI](<https://github.com/paritytech/try-runtime-cli>). The subcommand exists as a stub and
|
||||
/// deprecation notice. It will be removed entirely some time after Janurary
|
||||
/// 2024.
|
||||
TryRuntime,
|
||||
}
|
||||
|
||||
const AFTER_HELP_EXAMPLE: &str = color_print::cstr!(
|
||||
r#"<bold><underline>Examples:</></>
|
||||
<bold>parachain-template-node build-spec --disable-default-bootnode > plain-parachain-chainspec.json</>
|
||||
Export a chainspec for a local testnet in json format.
|
||||
<bold>parachain-template-node --chain plain-parachain-chainspec.json --tmp -- --chain rococo-local</>
|
||||
Launch a full node with chain specification loaded from plain-parachain-chainspec.json.
|
||||
<bold>parachain-template-node</>
|
||||
Launch a full node with default parachain <italic>local-testnet</> and relay chain <italic>rococo-local</>.
|
||||
<bold>parachain-template-node --collator</>
|
||||
Launch a collator with default parachain <italic>local-testnet</> and relay chain <italic>rococo-local</>.
|
||||
"#
|
||||
);
|
||||
#[derive(Debug, clap::Parser)]
|
||||
#[command(
|
||||
propagate_version = true,
|
||||
args_conflicts_with_subcommands = true,
|
||||
subcommand_negates_reqs = true
|
||||
)]
|
||||
#[clap(after_help = AFTER_HELP_EXAMPLE)]
|
||||
pub struct Cli {
|
||||
#[command(subcommand)]
|
||||
pub subcommand: Option<Subcommand>,
|
||||
|
||||
#[command(flatten)]
|
||||
pub run: cumulus_client_cli::RunCmd,
|
||||
|
||||
/// Disable automatic hardware benchmarks.
|
||||
///
|
||||
/// By default these benchmarks 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 sent as part of
|
||||
/// telemetry, if telemetry is enabled.
|
||||
#[arg(long)]
|
||||
pub no_hardware_benchmarks: bool,
|
||||
|
||||
/// Relay chain arguments
|
||||
#[arg(raw = true)]
|
||||
pub relay_chain_args: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RelayChainCli {
|
||||
/// The actual relay chain cli object.
|
||||
pub base: polkadot_cli::RunCmd,
|
||||
|
||||
/// Optional chain id that should be passed to the relay chain.
|
||||
pub chain_id: Option<String>,
|
||||
|
||||
/// The base path that should be used by the relay chain.
|
||||
pub base_path: Option<PathBuf>,
|
||||
}
|
||||
|
||||
impl RelayChainCli {
|
||||
/// Parse the relay chain CLI parameters using the para chain
|
||||
/// `Configuration`.
|
||||
pub fn new<'a>(
|
||||
para_config: &sc_service::Configuration,
|
||||
relay_chain_args: impl Iterator<Item = &'a String>,
|
||||
) -> Self {
|
||||
let extension = crate::chain_spec::Extensions::try_get(&*para_config.chain_spec);
|
||||
let chain_id = extension.map(|e| e.relay_chain.clone());
|
||||
let base_path = para_config.base_path.path().join("polkadot");
|
||||
Self {
|
||||
base_path: Some(base_path),
|
||||
chain_id,
|
||||
base: clap::Parser::parse_from(relay_chain_args),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,389 @@
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use cumulus_client_service::storage_proof_size::HostFunctions as ReclaimHostFunctions;
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
|
||||
use log::info;
|
||||
use parachain_template_runtime::Block;
|
||||
use sc_cli::{
|
||||
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
|
||||
NetworkParams, Result, SharedParams, SubstrateCli,
|
||||
};
|
||||
use sc_service::config::{BasePath, PrometheusConfig};
|
||||
use sp_runtime::traits::AccountIdConversion;
|
||||
|
||||
use crate::{
|
||||
chain_spec,
|
||||
cli::{Cli, RelayChainCli, Subcommand},
|
||||
service::new_partial,
|
||||
};
|
||||
|
||||
fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
Ok(match id {
|
||||
"dev" => Box::new(chain_spec::development_config()),
|
||||
"template-rococo" => Box::new(chain_spec::local_testnet_config()),
|
||||
"" | "local" => Box::new(chain_spec::local_testnet_config()),
|
||||
path => Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
|
||||
})
|
||||
}
|
||||
|
||||
impl SubstrateCli for Cli {
|
||||
fn impl_name() -> String {
|
||||
"Parachain Collator Template".into()
|
||||
}
|
||||
|
||||
fn impl_version() -> String {
|
||||
env!("SUBSTRATE_CLI_IMPL_VERSION").into()
|
||||
}
|
||||
|
||||
fn description() -> String {
|
||||
format!(
|
||||
"Parachain Collator Template\n\nThe command-line arguments provided first will be \
|
||||
passed to the parachain node, while the arguments provided after -- will be passed \
|
||||
to the relay chain node.\n\n{} <parachain-args> -- <relay-chain-args>",
|
||||
Self::executable_name()
|
||||
)
|
||||
}
|
||||
|
||||
fn author() -> String {
|
||||
env!("CARGO_PKG_AUTHORS").into()
|
||||
}
|
||||
|
||||
fn support_url() -> String {
|
||||
"https://github.com/paritytech/polkadot-sdk/issues/new".into()
|
||||
}
|
||||
|
||||
fn copyright_start_year() -> i32 {
|
||||
2020
|
||||
}
|
||||
|
||||
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
|
||||
load_spec(id)
|
||||
}
|
||||
}
|
||||
|
||||
impl SubstrateCli for RelayChainCli {
|
||||
fn impl_name() -> String {
|
||||
"Parachain Collator Template".into()
|
||||
}
|
||||
|
||||
fn impl_version() -> String {
|
||||
env!("SUBSTRATE_CLI_IMPL_VERSION").into()
|
||||
}
|
||||
|
||||
fn description() -> String {
|
||||
format!(
|
||||
"Parachain Collator Template\n\nThe command-line arguments provided first will be \
|
||||
passed to the parachain node, while the arguments provided after -- will be passed \
|
||||
to the relay chain node.\n\n{} <parachain-args> -- <relay-chain-args>",
|
||||
Self::executable_name()
|
||||
)
|
||||
}
|
||||
|
||||
fn author() -> String {
|
||||
env!("CARGO_PKG_AUTHORS").into()
|
||||
}
|
||||
|
||||
fn support_url() -> String {
|
||||
"https://github.com/paritytech/polkadot-sdk/issues/new".into()
|
||||
}
|
||||
|
||||
fn copyright_start_year() -> i32 {
|
||||
2020
|
||||
}
|
||||
|
||||
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
|
||||
polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! construct_async_run {
|
||||
(|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{
|
||||
let runner = $cli.create_runner($cmd)?;
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial(&$config)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
}}
|
||||
}
|
||||
|
||||
/// Parse command line arguments into service configuration.
|
||||
pub fn run() -> Result<()> {
|
||||
let cli = Cli::from_args();
|
||||
|
||||
match &cli.subcommand {
|
||||
Some(Subcommand::BuildSpec(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
|
||||
},
|
||||
Some(Subcommand::CheckBlock(cmd)) => {
|
||||
construct_async_run!(|components, cli, cmd, config| {
|
||||
Ok(cmd.run(components.client, components.import_queue))
|
||||
})
|
||||
},
|
||||
Some(Subcommand::ExportBlocks(cmd)) => {
|
||||
construct_async_run!(|components, cli, cmd, config| {
|
||||
Ok(cmd.run(components.client, config.database))
|
||||
})
|
||||
},
|
||||
Some(Subcommand::ExportState(cmd)) => {
|
||||
construct_async_run!(|components, cli, cmd, config| {
|
||||
Ok(cmd.run(components.client, config.chain_spec))
|
||||
})
|
||||
},
|
||||
Some(Subcommand::ImportBlocks(cmd)) => {
|
||||
construct_async_run!(|components, cli, cmd, config| {
|
||||
Ok(cmd.run(components.client, components.import_queue))
|
||||
})
|
||||
},
|
||||
Some(Subcommand::Revert(cmd)) => {
|
||||
construct_async_run!(|components, cli, cmd, config| {
|
||||
Ok(cmd.run(components.client, components.backend, None))
|
||||
})
|
||||
},
|
||||
Some(Subcommand::PurgeChain(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
|
||||
runner.sync_run(|config| {
|
||||
let polkadot_cli = RelayChainCli::new(
|
||||
&config,
|
||||
[RelayChainCli::executable_name()].iter().chain(cli.relay_chain_args.iter()),
|
||||
);
|
||||
|
||||
let polkadot_config = SubstrateCli::create_configuration(
|
||||
&polkadot_cli,
|
||||
&polkadot_cli,
|
||||
config.tokio_handle.clone(),
|
||||
)
|
||||
.map_err(|err| format!("Relay chain argument error: {}", err))?;
|
||||
|
||||
cmd.run(config, polkadot_config)
|
||||
})
|
||||
},
|
||||
Some(Subcommand::ExportGenesisHead(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.sync_run(|config| {
|
||||
let partials = new_partial(&config)?;
|
||||
|
||||
cmd.run(partials.client)
|
||||
})
|
||||
},
|
||||
Some(Subcommand::ExportGenesisWasm(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
runner.sync_run(|_config| {
|
||||
let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?;
|
||||
cmd.run(&*spec)
|
||||
})
|
||||
},
|
||||
Some(Subcommand::Benchmark(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
// Switch on the concrete benchmark sub-command-
|
||||
match cmd {
|
||||
BenchmarkCmd::Pallet(cmd) =>
|
||||
if cfg!(feature = "runtime-benchmarks") {
|
||||
runner.sync_run(|config| cmd.run::<sp_runtime::traits::HashingFor<Block>, ReclaimHostFunctions>(config))
|
||||
} else {
|
||||
Err("Benchmarking wasn't enabled when building the node. \
|
||||
You can enable it with `--features runtime-benchmarks`."
|
||||
.into())
|
||||
},
|
||||
BenchmarkCmd::Block(cmd) => runner.sync_run(|config| {
|
||||
let partials = new_partial(&config)?;
|
||||
cmd.run(partials.client)
|
||||
}),
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
BenchmarkCmd::Storage(_) =>
|
||||
Err(sc_cli::Error::Input(
|
||||
"Compile with --features=runtime-benchmarks \
|
||||
to enable storage benchmarks."
|
||||
.into(),
|
||||
)),
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {
|
||||
let partials = new_partial(&config)?;
|
||||
let db = partials.backend.expose_db();
|
||||
let storage = partials.backend.expose_storage();
|
||||
cmd.run(config, partials.client.clone(), db, storage)
|
||||
}),
|
||||
BenchmarkCmd::Machine(cmd) =>
|
||||
runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone())),
|
||||
// NOTE: this allows the Client to leniently implement
|
||||
// new benchmark commands without requiring a companion MR.
|
||||
#[allow(unreachable_patterns)]
|
||||
_ => Err("Benchmarking sub-command unsupported".into()),
|
||||
}
|
||||
},
|
||||
Some(Subcommand::TryRuntime) => Err("The `try-runtime` subcommand has been migrated to a standalone CLI (https://github.com/paritytech/try-runtime-cli). It is no longer being maintained here and will be removed entirely some time after January 2024. Please remove this subcommand from your runtime and use the standalone CLI.".into()),
|
||||
None => {
|
||||
let runner = cli.create_runner(&cli.run.normalize())?;
|
||||
let collator_options = cli.run.collator_options();
|
||||
|
||||
runner.run_node_until_exit(|config| async move {
|
||||
let hwbench = (!cli.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 para_id = chain_spec::Extensions::try_get(&*config.chain_spec)
|
||||
.map(|e| e.para_id)
|
||||
.ok_or("Could not find parachain ID in chain-spec.")?;
|
||||
|
||||
let polkadot_cli = RelayChainCli::new(
|
||||
&config,
|
||||
[RelayChainCli::executable_name()].iter().chain(cli.relay_chain_args.iter()),
|
||||
);
|
||||
|
||||
let id = ParaId::from(para_id);
|
||||
|
||||
let parachain_account =
|
||||
AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(
|
||||
&id,
|
||||
);
|
||||
|
||||
let tokio_handle = config.tokio_handle.clone();
|
||||
let polkadot_config =
|
||||
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle)
|
||||
.map_err(|err| format!("Relay chain argument error: {}", err))?;
|
||||
|
||||
info!("Parachain Account: {parachain_account}");
|
||||
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
|
||||
|
||||
crate::service::start_parachain_node(
|
||||
config,
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
id,
|
||||
hwbench,
|
||||
)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into)
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
impl DefaultConfigurationValues for RelayChainCli {
|
||||
fn p2p_listen_port() -> u16 {
|
||||
30334
|
||||
}
|
||||
|
||||
fn rpc_listen_port() -> u16 {
|
||||
9945
|
||||
}
|
||||
|
||||
fn prometheus_listen_port() -> u16 {
|
||||
9616
|
||||
}
|
||||
}
|
||||
|
||||
impl CliConfiguration<Self> for RelayChainCli {
|
||||
fn shared_params(&self) -> &SharedParams {
|
||||
self.base.base.shared_params()
|
||||
}
|
||||
|
||||
fn import_params(&self) -> Option<&ImportParams> {
|
||||
self.base.base.import_params()
|
||||
}
|
||||
|
||||
fn network_params(&self) -> Option<&NetworkParams> {
|
||||
self.base.base.network_params()
|
||||
}
|
||||
|
||||
fn keystore_params(&self) -> Option<&KeystoreParams> {
|
||||
self.base.base.keystore_params()
|
||||
}
|
||||
|
||||
fn base_path(&self) -> Result<Option<BasePath>> {
|
||||
Ok(self.shared_params().base_path()?.or_else(|| self.base_path.clone().map(Into::into)))
|
||||
}
|
||||
|
||||
fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> {
|
||||
self.base.base.rpc_addr(default_listen_port)
|
||||
}
|
||||
|
||||
fn prometheus_config(
|
||||
&self,
|
||||
default_listen_port: u16,
|
||||
chain_spec: &Box<dyn ChainSpec>,
|
||||
) -> Result<Option<PrometheusConfig>> {
|
||||
self.base.base.prometheus_config(default_listen_port, chain_spec)
|
||||
}
|
||||
|
||||
fn init<F>(
|
||||
&self,
|
||||
_support_url: &String,
|
||||
_impl_version: &String,
|
||||
_logger_hook: F,
|
||||
_config: &sc_service::Configuration,
|
||||
) -> Result<()>
|
||||
where
|
||||
F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration),
|
||||
{
|
||||
unreachable!("PolkadotCli is never initialized; qed");
|
||||
}
|
||||
|
||||
fn chain_id(&self, is_dev: bool) -> Result<String> {
|
||||
let chain_id = self.base.base.chain_id(is_dev)?;
|
||||
|
||||
Ok(if chain_id.is_empty() { self.chain_id.clone().unwrap_or_default() } else { chain_id })
|
||||
}
|
||||
|
||||
fn role(&self, is_dev: bool) -> Result<sc_service::Role> {
|
||||
self.base.base.role(is_dev)
|
||||
}
|
||||
|
||||
fn transaction_pool(&self, is_dev: bool) -> Result<sc_service::config::TransactionPoolOptions> {
|
||||
self.base.base.transaction_pool(is_dev)
|
||||
}
|
||||
|
||||
fn trie_cache_maximum_size(&self) -> Result<Option<usize>> {
|
||||
self.base.base.trie_cache_maximum_size()
|
||||
}
|
||||
|
||||
fn rpc_methods(&self) -> Result<sc_service::config::RpcMethods> {
|
||||
self.base.base.rpc_methods()
|
||||
}
|
||||
|
||||
fn rpc_max_connections(&self) -> Result<u32> {
|
||||
self.base.base.rpc_max_connections()
|
||||
}
|
||||
|
||||
fn rpc_cors(&self, is_dev: bool) -> Result<Option<Vec<String>>> {
|
||||
self.base.base.rpc_cors(is_dev)
|
||||
}
|
||||
|
||||
fn default_heap_pages(&self) -> Result<Option<u64>> {
|
||||
self.base.base.default_heap_pages()
|
||||
}
|
||||
|
||||
fn force_authoring(&self) -> Result<bool> {
|
||||
self.base.base.force_authoring()
|
||||
}
|
||||
|
||||
fn disable_grandpa(&self) -> Result<bool> {
|
||||
self.base.base.disable_grandpa()
|
||||
}
|
||||
|
||||
fn max_runtime_instances(&self) -> Result<Option<usize>> {
|
||||
self.base.base.max_runtime_instances()
|
||||
}
|
||||
|
||||
fn announce_block(&self) -> Result<bool> {
|
||||
self.base.base.announce_block()
|
||||
}
|
||||
|
||||
fn telemetry_endpoints(
|
||||
&self,
|
||||
chain_spec: &Box<dyn ChainSpec>,
|
||||
) -> Result<Option<sc_telemetry::TelemetryEndpoints>> {
|
||||
self.base.base.telemetry_endpoints(chain_spec)
|
||||
}
|
||||
|
||||
fn node_name(&self) -> Result<String> {
|
||||
self.base.base.node_name()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//! Substrate Parachain Node Template CLI
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
mod chain_spec;
|
||||
#[macro_use]
|
||||
mod service;
|
||||
mod cli;
|
||||
mod command;
|
||||
mod rpc;
|
||||
|
||||
fn main() -> sc_cli::Result<()> {
|
||||
command::run()
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
//! A collection of node-specific RPC methods.
|
||||
//! Substrate provides the `sc-rpc` crate, which defines the core RPC layer
|
||||
//! used by Substrate nodes. This file extends those RPC definitions with
|
||||
//! capabilities that are specific to this project's runtime configuration.
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use parachain_template_runtime::{opaque::Block, AccountId, Balance, Nonce};
|
||||
use sc_client_api::AuxStore;
|
||||
pub use sc_rpc::DenyUnsafe;
|
||||
use sc_transaction_pool_api::TransactionPool;
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_block_builder::BlockBuilder;
|
||||
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
|
||||
|
||||
/// A type representing all RPC extensions.
|
||||
pub type RpcExtension = jsonrpsee::RpcModule<()>;
|
||||
|
||||
/// Full client dependencies
|
||||
pub struct FullDeps<C, P> {
|
||||
/// The client instance to use.
|
||||
pub client: Arc<C>,
|
||||
/// Transaction pool instance.
|
||||
pub pool: Arc<P>,
|
||||
/// Whether to deny unsafe calls
|
||||
pub deny_unsafe: DenyUnsafe,
|
||||
}
|
||||
|
||||
/// Instantiate all RPC extensions.
|
||||
pub fn create_full<C, P>(
|
||||
deps: FullDeps<C, P>,
|
||||
) -> 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: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
|
||||
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
|
||||
C::Api: BlockBuilder<Block>,
|
||||
P: TransactionPool + Sync + Send + 'static,
|
||||
{
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
|
||||
use substrate_frame_rpc_system::{System, SystemApiServer};
|
||||
|
||||
let mut module = RpcExtension::new(());
|
||||
let FullDeps { client, pool, deny_unsafe } = deps;
|
||||
|
||||
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
|
||||
module.merge(TransactionPayment::new(client).into_rpc())?;
|
||||
Ok(module)
|
||||
}
|
||||
@@ -0,0 +1,450 @@
|
||||
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
|
||||
|
||||
// std
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
use cumulus_client_cli::CollatorOptions;
|
||||
// Cumulus Imports
|
||||
use cumulus_client_collator::service::CollatorService;
|
||||
use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport;
|
||||
use cumulus_client_consensus_proposer::Proposer;
|
||||
use cumulus_client_service::{
|
||||
build_network, build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks,
|
||||
BuildNetworkParams, CollatorSybilResistance, DARecoveryProfile, ParachainHostFunctions,
|
||||
StartRelayChainTasksParams,
|
||||
};
|
||||
#[cfg(feature = "async-backing")]
|
||||
use cumulus_primitives_core::relay_chain::ValidationCode;
|
||||
use cumulus_primitives_core::{relay_chain::CollatorPair, ParaId};
|
||||
use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};
|
||||
// Substrate Imports
|
||||
use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
|
||||
// Local Runtime Types
|
||||
use parachain_template_runtime::{
|
||||
opaque::{Block, Hash},
|
||||
RuntimeApi,
|
||||
};
|
||||
use sc_client_api::Backend;
|
||||
use sc_consensus::ImportQueue;
|
||||
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
|
||||
use sc_network::NetworkBlock;
|
||||
use sc_network_sync::SyncingService;
|
||||
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
|
||||
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
|
||||
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
|
||||
use sp_keystore::KeystorePtr;
|
||||
use substrate_prometheus_endpoint::Registry;
|
||||
|
||||
type ParachainExecutor = WasmExecutor<ParachainHostFunctions>;
|
||||
|
||||
type ParachainClient = TFullClient<Block, RuntimeApi, ParachainExecutor>;
|
||||
|
||||
type ParachainBackend = TFullBackend<Block>;
|
||||
|
||||
type ParachainBlockImport = TParachainBlockImport<Block, Arc<ParachainClient>, ParachainBackend>;
|
||||
|
||||
/// Assembly of PartialComponents (enough to run chain ops subcommands)
|
||||
pub type Service = PartialComponents<
|
||||
ParachainClient,
|
||||
ParachainBackend,
|
||||
(),
|
||||
sc_consensus::DefaultImportQueue<Block>,
|
||||
sc_transaction_pool::FullPool<Block, ParachainClient>,
|
||||
(ParachainBlockImport, Option<Telemetry>, Option<TelemetryWorkerHandle>),
|
||||
>;
|
||||
|
||||
/// Starts a `ServiceBuilder` for a full service.
|
||||
///
|
||||
/// Use this macro if you don't actually need the full service, but just the builder in order to
|
||||
/// be able to perform chain operations.
|
||||
pub fn new_partial(config: &Configuration) -> Result<Service, sc_service::Error> {
|
||||
let telemetry = config
|
||||
.telemetry_endpoints
|
||||
.clone()
|
||||
.filter(|x| !x.is_empty())
|
||||
.map(|endpoints| -> Result<_, sc_telemetry::Error> {
|
||||
let worker = TelemetryWorker::new(16)?;
|
||||
let telemetry = worker.handle().new_telemetry(endpoints);
|
||||
Ok((worker, telemetry))
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
let heap_pages = config
|
||||
.default_heap_pages
|
||||
.map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static { extra_pages: h as _ });
|
||||
|
||||
let executor = ParachainExecutor::builder()
|
||||
.with_execution_method(config.wasm_method)
|
||||
.with_onchain_heap_alloc_strategy(heap_pages)
|
||||
.with_offchain_heap_alloc_strategy(heap_pages)
|
||||
.with_max_runtime_instances(config.max_runtime_instances)
|
||||
.with_runtime_cache_size(config.runtime_cache_size)
|
||||
.build();
|
||||
|
||||
let (client, backend, keystore_container, task_manager) =
|
||||
sc_service::new_full_parts_record_import::<Block, RuntimeApi, _>(
|
||||
config,
|
||||
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
|
||||
executor,
|
||||
true,
|
||||
)?;
|
||||
let client = Arc::new(client);
|
||||
|
||||
let telemetry_worker_handle = telemetry.as_ref().map(|(worker, _)| worker.handle());
|
||||
|
||||
let telemetry = telemetry.map(|(worker, telemetry)| {
|
||||
task_manager.spawn_handle().spawn("telemetry", None, worker.run());
|
||||
telemetry
|
||||
});
|
||||
|
||||
let transaction_pool = sc_transaction_pool::BasicPool::new_full(
|
||||
config.transaction_pool.clone(),
|
||||
config.role.is_authority().into(),
|
||||
config.prometheus_registry(),
|
||||
task_manager.spawn_essential_handle(),
|
||||
client.clone(),
|
||||
);
|
||||
|
||||
let block_import = ParachainBlockImport::new(client.clone(), backend.clone());
|
||||
|
||||
let import_queue = build_import_queue(
|
||||
client.clone(),
|
||||
block_import.clone(),
|
||||
config,
|
||||
telemetry.as_ref().map(|telemetry| telemetry.handle()),
|
||||
&task_manager,
|
||||
)?;
|
||||
|
||||
Ok(PartialComponents {
|
||||
backend,
|
||||
client,
|
||||
import_queue,
|
||||
keystore_container,
|
||||
task_manager,
|
||||
transaction_pool,
|
||||
select_chain: (),
|
||||
other: (block_import, telemetry, telemetry_worker_handle),
|
||||
})
|
||||
}
|
||||
|
||||
/// Start a node with the given parachain `Configuration` and relay chain `Configuration`.
|
||||
///
|
||||
/// This is the actual implementation that is abstract over the executor and the runtime api.
|
||||
#[sc_tracing::logging::prefix_logs_with("Parachain")]
|
||||
async fn start_node_impl(
|
||||
parachain_config: Configuration,
|
||||
polkadot_config: Configuration,
|
||||
collator_options: CollatorOptions,
|
||||
para_id: ParaId,
|
||||
hwbench: Option<sc_sysinfo::HwBench>,
|
||||
) -> sc_service::error::Result<(TaskManager, Arc<ParachainClient>)> {
|
||||
let parachain_config = prepare_node_config(parachain_config);
|
||||
|
||||
let params = new_partial(¶chain_config)?;
|
||||
let (block_import, mut telemetry, telemetry_worker_handle) = params.other;
|
||||
let net_config = sc_network::config::FullNetworkConfiguration::new(¶chain_config.network);
|
||||
|
||||
let client = params.client.clone();
|
||||
let backend = params.backend.clone();
|
||||
let mut task_manager = params.task_manager;
|
||||
|
||||
let (relay_chain_interface, collator_key) = build_relay_chain_interface(
|
||||
polkadot_config,
|
||||
¶chain_config,
|
||||
telemetry_worker_handle,
|
||||
&mut task_manager,
|
||||
collator_options.clone(),
|
||||
hwbench.clone(),
|
||||
)
|
||||
.await
|
||||
.map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;
|
||||
|
||||
let validator = parachain_config.role.is_authority();
|
||||
let prometheus_registry = parachain_config.prometheus_registry().cloned();
|
||||
let transaction_pool = params.transaction_pool.clone();
|
||||
let import_queue_service = params.import_queue.service();
|
||||
|
||||
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
|
||||
build_network(BuildNetworkParams {
|
||||
parachain_config: ¶chain_config,
|
||||
net_config,
|
||||
client: client.clone(),
|
||||
transaction_pool: transaction_pool.clone(),
|
||||
para_id,
|
||||
spawn_handle: task_manager.spawn_handle(),
|
||||
relay_chain_interface: relay_chain_interface.clone(),
|
||||
import_queue: params.import_queue,
|
||||
sybil_resistance_level: CollatorSybilResistance::Resistant, // because of Aura
|
||||
})
|
||||
.await?;
|
||||
|
||||
if parachain_config.offchain_worker.enabled {
|
||||
use futures::FutureExt;
|
||||
|
||||
task_manager.spawn_handle().spawn(
|
||||
"offchain-workers-runner",
|
||||
"offchain-work",
|
||||
sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
|
||||
runtime_api_provider: client.clone(),
|
||||
keystore: Some(params.keystore_container.keystore()),
|
||||
offchain_db: backend.offchain_storage(),
|
||||
transaction_pool: Some(OffchainTransactionPoolFactory::new(
|
||||
transaction_pool.clone(),
|
||||
)),
|
||||
network_provider: network.clone(),
|
||||
is_validator: parachain_config.role.is_authority(),
|
||||
enable_http_requests: false,
|
||||
custom_extensions: move |_| vec![],
|
||||
})
|
||||
.run(client.clone(), task_manager.spawn_handle())
|
||||
.boxed(),
|
||||
);
|
||||
}
|
||||
|
||||
let rpc_builder = {
|
||||
let client = client.clone();
|
||||
let transaction_pool = transaction_pool.clone();
|
||||
|
||||
Box::new(move |deny_unsafe, _| {
|
||||
let deps = crate::rpc::FullDeps {
|
||||
client: client.clone(),
|
||||
pool: transaction_pool.clone(),
|
||||
deny_unsafe,
|
||||
};
|
||||
|
||||
crate::rpc::create_full(deps).map_err(Into::into)
|
||||
})
|
||||
};
|
||||
|
||||
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
||||
rpc_builder,
|
||||
client: client.clone(),
|
||||
transaction_pool: transaction_pool.clone(),
|
||||
task_manager: &mut task_manager,
|
||||
config: parachain_config,
|
||||
keystore: params.keystore_container.keystore(),
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
backend,
|
||||
#[cfg(feature = "async-backing")]
|
||||
backend: backend.clone(),
|
||||
network: network.clone(),
|
||||
sync_service: sync_service.clone(),
|
||||
system_rpc_tx,
|
||||
tx_handler_controller,
|
||||
telemetry: telemetry.as_mut(),
|
||||
})?;
|
||||
|
||||
if let Some(hwbench) = hwbench {
|
||||
sc_sysinfo::print_hwbench(&hwbench);
|
||||
// Here you can check whether the hardware meets your chains' requirements. Putting a link
|
||||
// in there and swapping out the requirements for your own are probably a good idea. The
|
||||
// requirements for a para-chain are dictated by its relay-chain.
|
||||
match SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) {
|
||||
Err(err) if validator => {
|
||||
log::warn!(
|
||||
"⚠️ The hardware does not meet the minimal requirements {} for role \
|
||||
'Authority'.",
|
||||
err
|
||||
);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
if let Some(ref mut telemetry) = telemetry {
|
||||
let telemetry_handle = telemetry.handle();
|
||||
task_manager.spawn_handle().spawn(
|
||||
"telemetry_hwbench",
|
||||
None,
|
||||
sc_sysinfo::initialize_hwbench_telemetry(telemetry_handle, hwbench),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let announce_block = {
|
||||
let sync_service = sync_service.clone();
|
||||
Arc::new(move |hash, data| sync_service.announce_block(hash, data))
|
||||
};
|
||||
|
||||
let relay_chain_slot_duration = Duration::from_secs(6);
|
||||
|
||||
let overseer_handle = relay_chain_interface
|
||||
.overseer_handle()
|
||||
.map_err(|e| sc_service::Error::Application(Box::new(e)))?;
|
||||
|
||||
start_relay_chain_tasks(StartRelayChainTasksParams {
|
||||
client: client.clone(),
|
||||
announce_block: announce_block.clone(),
|
||||
para_id,
|
||||
relay_chain_interface: relay_chain_interface.clone(),
|
||||
task_manager: &mut task_manager,
|
||||
da_recovery_profile: if validator {
|
||||
DARecoveryProfile::Collator
|
||||
} else {
|
||||
DARecoveryProfile::FullNode
|
||||
},
|
||||
import_queue: import_queue_service,
|
||||
relay_chain_slot_duration,
|
||||
recovery_handle: Box::new(overseer_handle.clone()),
|
||||
sync_service: sync_service.clone(),
|
||||
})?;
|
||||
|
||||
if validator {
|
||||
start_consensus(
|
||||
client.clone(),
|
||||
#[cfg(feature = "async-backing")]
|
||||
backend.clone(),
|
||||
block_import,
|
||||
prometheus_registry.as_ref(),
|
||||
telemetry.as_ref().map(|t| t.handle()),
|
||||
&task_manager,
|
||||
relay_chain_interface.clone(),
|
||||
transaction_pool,
|
||||
sync_service.clone(),
|
||||
params.keystore_container.keystore(),
|
||||
relay_chain_slot_duration,
|
||||
para_id,
|
||||
collator_key.expect("Command line arguments do not allow this. qed"),
|
||||
overseer_handle,
|
||||
announce_block,
|
||||
)?;
|
||||
}
|
||||
|
||||
start_network.start_network();
|
||||
|
||||
Ok((task_manager, client))
|
||||
}
|
||||
|
||||
/// Build the import queue for the parachain runtime.
|
||||
fn build_import_queue(
|
||||
client: Arc<ParachainClient>,
|
||||
block_import: ParachainBlockImport,
|
||||
config: &Configuration,
|
||||
telemetry: Option<TelemetryHandle>,
|
||||
task_manager: &TaskManager,
|
||||
) -> Result<sc_consensus::DefaultImportQueue<Block>, sc_service::Error> {
|
||||
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
|
||||
|
||||
Ok(cumulus_client_consensus_aura::equivocation_import_queue::fully_verifying_import_queue::<
|
||||
sp_consensus_aura::sr25519::AuthorityPair,
|
||||
_,
|
||||
_,
|
||||
_,
|
||||
_,
|
||||
>(
|
||||
client,
|
||||
block_import,
|
||||
move |_, _| async move {
|
||||
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
||||
Ok(timestamp)
|
||||
},
|
||||
slot_duration,
|
||||
&task_manager.spawn_essential_handle(),
|
||||
config.prometheus_registry(),
|
||||
telemetry,
|
||||
))
|
||||
}
|
||||
|
||||
fn start_consensus(
|
||||
client: Arc<ParachainClient>,
|
||||
#[cfg(feature = "async-backing")] backend: Arc<ParachainBackend>,
|
||||
block_import: ParachainBlockImport,
|
||||
prometheus_registry: Option<&Registry>,
|
||||
telemetry: Option<TelemetryHandle>,
|
||||
task_manager: &TaskManager,
|
||||
relay_chain_interface: Arc<dyn RelayChainInterface>,
|
||||
transaction_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient>>,
|
||||
sync_oracle: Arc<SyncingService<Block>>,
|
||||
keystore: KeystorePtr,
|
||||
relay_chain_slot_duration: Duration,
|
||||
para_id: ParaId,
|
||||
collator_key: CollatorPair,
|
||||
overseer_handle: OverseerHandle,
|
||||
announce_block: Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,
|
||||
) -> Result<(), sc_service::Error> {
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
use cumulus_client_consensus_aura::collators::basic::{self as basic_aura, Params};
|
||||
#[cfg(feature = "async-backing")]
|
||||
use cumulus_client_consensus_aura::collators::lookahead::{self as aura, Params};
|
||||
|
||||
// NOTE: because we use Aura here explicitly, we can use `CollatorSybilResistance::Resistant`
|
||||
// when starting the network.
|
||||
|
||||
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
|
||||
|
||||
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
|
||||
task_manager.spawn_handle(),
|
||||
client.clone(),
|
||||
transaction_pool,
|
||||
prometheus_registry,
|
||||
telemetry.clone(),
|
||||
);
|
||||
|
||||
let proposer = Proposer::new(proposer_factory);
|
||||
|
||||
let collator_service = CollatorService::new(
|
||||
client.clone(),
|
||||
Arc::new(task_manager.spawn_handle()),
|
||||
announce_block,
|
||||
client.clone(),
|
||||
);
|
||||
|
||||
let params = Params {
|
||||
create_inherent_data_providers: move |_, ()| async move { Ok(()) },
|
||||
block_import,
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
para_client: client,
|
||||
#[cfg(feature = "async-backing")]
|
||||
para_client: client.clone(),
|
||||
#[cfg(feature = "async-backing")]
|
||||
para_backend: backend,
|
||||
relay_client: relay_chain_interface,
|
||||
#[cfg(feature = "async-backing")]
|
||||
code_hash_provider: move |block_hash| {
|
||||
client.code_at(block_hash).ok().map(ValidationCode).map(|c| c.hash())
|
||||
},
|
||||
sync_oracle,
|
||||
keystore,
|
||||
collator_key,
|
||||
para_id,
|
||||
overseer_handle,
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
slot_duration,
|
||||
relay_chain_slot_duration,
|
||||
proposer,
|
||||
collator_service,
|
||||
// Very limited proposal time.
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
authoring_duration: Duration::from_millis(500),
|
||||
#[cfg(feature = "async-backing")]
|
||||
authoring_duration: Duration::from_millis(1500),
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
collation_request_receiver: None,
|
||||
#[cfg(feature = "async-backing")]
|
||||
reinitialize: false,
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
let fut =
|
||||
basic_aura::run::<Block, sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _, _>(
|
||||
params,
|
||||
);
|
||||
#[cfg(feature = "async-backing")]
|
||||
let fut =
|
||||
aura::run::<Block, sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _, _, _, _>(
|
||||
params,
|
||||
);
|
||||
task_manager.spawn_essential_handle().spawn("aura", None, fut);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Start a parachain node.
|
||||
pub async fn start_parachain_node(
|
||||
parachain_config: Configuration,
|
||||
polkadot_config: Configuration,
|
||||
collator_options: CollatorOptions,
|
||||
para_id: ParaId,
|
||||
hwbench: Option<sc_sysinfo::HwBench>,
|
||||
) -> sc_service::error::Result<(TaskManager, Arc<ParachainClient>)> {
|
||||
start_node_impl(parachain_config, polkadot_config, collator_options, para_id, hwbench).await
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
[package]
|
||||
name = "parachain-template-runtime"
|
||||
authors = { workspace = true }
|
||||
description = "A generic parachain runtime template"
|
||||
edition = { workspace = true }
|
||||
license = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
version = "1.0.0"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = [ "x86_64-unknown-linux-gnu" ]
|
||||
|
||||
[dependencies]
|
||||
hex-literal = { workspace = true, optional = true }
|
||||
log = { workspace = true }
|
||||
parity-scale-codec = { workspace = true, features = [ "derive" ] }
|
||||
scale-info = { workspace = true, features = [ "derive" ] }
|
||||
smallvec = { workspace = true }
|
||||
|
||||
# Substrate
|
||||
frame-benchmarking = { workspace = true, optional = true }
|
||||
frame-executive = { workspace = true }
|
||||
frame-support = { workspace = true }
|
||||
frame-system = { workspace = true }
|
||||
frame-system-benchmarking = { workspace = true, optional = true }
|
||||
frame-system-rpc-runtime-api = { workspace = true }
|
||||
frame-try-runtime = { workspace = true, optional = true }
|
||||
pallet-assets = { workspace = true }
|
||||
pallet-aura = { workspace = true }
|
||||
pallet-authorship = { workspace = true }
|
||||
pallet-balances = { workspace = true }
|
||||
pallet-conviction-voting = { workspace = true }
|
||||
pallet-message-queue = { workspace = true }
|
||||
pallet-multisig = { workspace = true }
|
||||
pallet-preimage = { workspace = true }
|
||||
pallet-proxy = { workspace = true }
|
||||
pallet-referenda = { workspace = true }
|
||||
pallet-scheduler = { workspace = true }
|
||||
pallet-session = { workspace = true }
|
||||
pallet-sudo = { 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-whitelist = { workspace = true }
|
||||
sp-api = { workspace = true }
|
||||
sp-arithmetic = { workspace = true }
|
||||
sp-block-builder = { workspace = true }
|
||||
sp-consensus-aura = { workspace = true }
|
||||
sp-core = { workspace = true }
|
||||
sp-genesis-builder = { workspace = true }
|
||||
sp-inherents = { workspace = true }
|
||||
sp-offchain = { workspace = true }
|
||||
sp-runtime = { workspace = true }
|
||||
sp-session = { workspace = true }
|
||||
sp-std = { workspace = true }
|
||||
sp-transaction-pool = { workspace = true }
|
||||
sp-version = { workspace = true }
|
||||
|
||||
# Polkadot
|
||||
pallet-xcm = { workspace = true }
|
||||
polkadot-parachain-primitives = { workspace = true }
|
||||
polkadot-runtime-common = { workspace = true }
|
||||
xcm = { workspace = true }
|
||||
xcm-builder = { workspace = true }
|
||||
xcm-executor = { workspace = true }
|
||||
|
||||
# Cumulus
|
||||
assets-common = { workspace = true }
|
||||
cumulus-pallet-aura-ext = { workspace = true }
|
||||
cumulus-pallet-parachain-system = { workspace = true, features = [
|
||||
"parameterized-consensus-hook",
|
||||
] }
|
||||
cumulus-pallet-session-benchmarking = { workspace = true }
|
||||
cumulus-pallet-xcm = { workspace = true }
|
||||
cumulus-pallet-xcmp-queue = { workspace = true }
|
||||
cumulus-primitives-aura = { workspace = true }
|
||||
cumulus-primitives-core = { workspace = true }
|
||||
cumulus-primitives-utility = { workspace = true }
|
||||
pallet-collator-selection = { workspace = true }
|
||||
parachain-info = { workspace = true }
|
||||
parachains-common = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
sp-io = { workspace = true }
|
||||
|
||||
[build-dependencies]
|
||||
substrate-wasm-builder = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = [
|
||||
"assets-common/std",
|
||||
"cumulus-pallet-aura-ext/std",
|
||||
"cumulus-pallet-parachain-system/std",
|
||||
"cumulus-pallet-session-benchmarking/std",
|
||||
"cumulus-pallet-xcm/std",
|
||||
"cumulus-pallet-xcmp-queue/std",
|
||||
"cumulus-primitives-core/std",
|
||||
"cumulus-primitives-utility/std",
|
||||
"frame-benchmarking?/std",
|
||||
"frame-executive/std",
|
||||
"frame-support/std",
|
||||
"frame-system-benchmarking?/std",
|
||||
"frame-system-rpc-runtime-api/std",
|
||||
"frame-system/std",
|
||||
"frame-try-runtime?/std",
|
||||
"log/std",
|
||||
"pallet-assets/std",
|
||||
"pallet-aura/std",
|
||||
"pallet-authorship/std",
|
||||
"pallet-balances/std",
|
||||
"pallet-collator-selection/std",
|
||||
"pallet-conviction-voting/std",
|
||||
"pallet-message-queue/std",
|
||||
"pallet-multisig/std",
|
||||
"pallet-preimage/std",
|
||||
"pallet-proxy/std",
|
||||
"pallet-referenda/std",
|
||||
"pallet-scheduler/std",
|
||||
"pallet-session/std",
|
||||
"pallet-sudo/std",
|
||||
"pallet-timestamp/std",
|
||||
"pallet-transaction-payment-rpc-runtime-api/std",
|
||||
"pallet-transaction-payment/std",
|
||||
"pallet-treasury/std",
|
||||
"pallet-utility/std",
|
||||
"pallet-whitelist/std",
|
||||
"pallet-xcm/std",
|
||||
"parachain-info/std",
|
||||
"parachains-common/std",
|
||||
"parity-scale-codec/std",
|
||||
"polkadot-parachain-primitives/std",
|
||||
"polkadot-runtime-common/std",
|
||||
"scale-info/std",
|
||||
"sp-api/std",
|
||||
"sp-arithmetic/std",
|
||||
"sp-block-builder/std",
|
||||
"sp-consensus-aura/std",
|
||||
"sp-core/std",
|
||||
"sp-genesis-builder/std",
|
||||
"sp-inherents/std",
|
||||
"sp-offchain/std",
|
||||
"sp-runtime/std",
|
||||
"sp-session/std",
|
||||
"sp-std/std",
|
||||
"sp-transaction-pool/std",
|
||||
"sp-version/std",
|
||||
"xcm-builder/std",
|
||||
"xcm-executor/std",
|
||||
"xcm/std",
|
||||
]
|
||||
async-backing = []
|
||||
|
||||
runtime-benchmarks = [
|
||||
"assets-common/runtime-benchmarks",
|
||||
"cumulus-pallet-parachain-system/runtime-benchmarks",
|
||||
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
||||
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
|
||||
"cumulus-primitives-utility/runtime-benchmarks",
|
||||
"frame-benchmarking/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"frame-system-benchmarking/runtime-benchmarks",
|
||||
"frame-system/runtime-benchmarks",
|
||||
"hex-literal",
|
||||
"pallet-assets/runtime-benchmarks",
|
||||
"pallet-balances/runtime-benchmarks",
|
||||
"pallet-collator-selection/runtime-benchmarks",
|
||||
"pallet-conviction-voting/runtime-benchmarks",
|
||||
"pallet-message-queue/runtime-benchmarks",
|
||||
"pallet-multisig/runtime-benchmarks",
|
||||
"pallet-preimage/runtime-benchmarks",
|
||||
"pallet-proxy/runtime-benchmarks",
|
||||
"pallet-referenda/runtime-benchmarks",
|
||||
"pallet-scheduler/runtime-benchmarks",
|
||||
"pallet-sudo/runtime-benchmarks",
|
||||
"pallet-timestamp/runtime-benchmarks",
|
||||
"pallet-treasury/runtime-benchmarks",
|
||||
"pallet-utility/runtime-benchmarks",
|
||||
"pallet-whitelist/runtime-benchmarks",
|
||||
"pallet-xcm/runtime-benchmarks",
|
||||
"parachains-common/runtime-benchmarks",
|
||||
"polkadot-parachain-primitives/runtime-benchmarks",
|
||||
"polkadot-runtime-common/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"xcm-builder/runtime-benchmarks",
|
||||
"xcm-executor/runtime-benchmarks",
|
||||
]
|
||||
|
||||
try-runtime = [
|
||||
"cumulus-pallet-aura-ext/try-runtime",
|
||||
"cumulus-pallet-parachain-system/try-runtime",
|
||||
"cumulus-pallet-xcm/try-runtime",
|
||||
"cumulus-pallet-xcmp-queue/try-runtime",
|
||||
"frame-executive/try-runtime",
|
||||
"frame-support/try-runtime",
|
||||
"frame-system/try-runtime",
|
||||
"frame-try-runtime/try-runtime",
|
||||
"pallet-assets/try-runtime",
|
||||
"pallet-aura/try-runtime",
|
||||
"pallet-authorship/try-runtime",
|
||||
"pallet-balances/try-runtime",
|
||||
"pallet-collator-selection/try-runtime",
|
||||
"pallet-conviction-voting/try-runtime",
|
||||
"pallet-message-queue/try-runtime",
|
||||
"pallet-multisig/try-runtime",
|
||||
"pallet-preimage/try-runtime",
|
||||
"pallet-proxy/try-runtime",
|
||||
"pallet-referenda/try-runtime",
|
||||
"pallet-scheduler/try-runtime",
|
||||
"pallet-session/try-runtime",
|
||||
"pallet-session/try-runtime",
|
||||
"pallet-sudo/try-runtime",
|
||||
"pallet-timestamp/try-runtime",
|
||||
"pallet-transaction-payment/try-runtime",
|
||||
"pallet-treasury/try-runtime",
|
||||
"pallet-utility/try-runtime",
|
||||
"pallet-whitelist/try-runtime",
|
||||
"pallet-xcm/try-runtime",
|
||||
"parachain-info/try-runtime",
|
||||
"polkadot-runtime-common/try-runtime",
|
||||
"sp-runtime/try-runtime",
|
||||
]
|
||||
|
||||
experimental = [ "pallet-aura/experimental" ]
|
||||
@@ -0,0 +1,13 @@
|
||||
#[cfg(feature = "std")]
|
||||
fn main() {
|
||||
substrate_wasm_builder::WasmBuilder::new()
|
||||
.with_current_project()
|
||||
.export_heap_base()
|
||||
.import_memory()
|
||||
.build()
|
||||
}
|
||||
|
||||
/// The wasm builder is deactivated when compiling
|
||||
/// this crate for wasm to speed up the compilation.
|
||||
#[cfg(not(feature = "std"))]
|
||||
fn main() {}
|
||||
@@ -0,0 +1,15 @@
|
||||
pub mod currency {
|
||||
use crate::Balance;
|
||||
|
||||
pub const MICROCENTS: Balance = 1_000_000;
|
||||
pub const MILLICENTS: Balance = 1_000_000_000;
|
||||
pub const CENTS: Balance = 1_000 * MILLICENTS; // assume this is worth about a cent.
|
||||
pub const DOLLARS: Balance = 100 * CENTS;
|
||||
pub const GRAND: Balance = 1_000 * DOLLARS;
|
||||
|
||||
pub const EXISTENTIAL_DEPOSIT: Balance = MILLICENTS;
|
||||
|
||||
pub const fn deposit(items: u32, bytes: u32) -> Balance {
|
||||
items as Balance * 15 * CENTS + (bytes as Balance) * 6 * CENTS
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
//! OpenGov governance config
|
||||
|
||||
pub mod origins;
|
||||
pub use origins::{
|
||||
pallet_custom_origins, ReferendumCanceller, ReferendumKiller, Spender, Treasurer,
|
||||
WhitelistedCaller,
|
||||
};
|
||||
mod tracks;
|
||||
|
||||
use frame_support::traits::EitherOf;
|
||||
use frame_system::EnsureRootWithSuccess;
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
constants::currency::{CENTS, GRAND},
|
||||
Balance,
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
pub const VoteLockingPeriod: BlockNumber = 7 * DAYS;
|
||||
}
|
||||
|
||||
impl pallet_conviction_voting::Config for Runtime {
|
||||
type Currency = Balances;
|
||||
type MaxTurnout =
|
||||
frame_support::traits::tokens::currency::ActiveIssuanceOf<Balances, Self::AccountId>;
|
||||
type MaxVotes = ConstU32<512>;
|
||||
type Polls = Referenda;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type VoteLockingPeriod = VoteLockingPeriod;
|
||||
type WeightInfo = pallet_conviction_voting::weights::SubstrateWeight<Runtime>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const MaxBalance: Balance = Balance::max_value();
|
||||
}
|
||||
pub type TreasurySpender = EitherOf<EnsureRootWithSuccess<AccountId, MaxBalance>, Spender>;
|
||||
|
||||
impl origins::pallet_custom_origins::Config for Runtime {}
|
||||
|
||||
impl pallet_whitelist::Config for Runtime {
|
||||
type DispatchWhitelistedOrigin = EitherOf<EnsureRoot<Self::AccountId>, WhitelistedCaller>;
|
||||
type Preimages = Preimage;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type WeightInfo = pallet_whitelist::weights::SubstrateWeight<Runtime>;
|
||||
type WhitelistOrigin = EnsureRoot<Self::AccountId>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const AlarmInterval: BlockNumber = 1;
|
||||
pub const SubmissionDeposit: Balance = 3 * CENTS;
|
||||
pub const UndecidingTimeout: BlockNumber = 14 * DAYS;
|
||||
}
|
||||
|
||||
impl pallet_referenda::Config for Runtime {
|
||||
type AlarmInterval = AlarmInterval;
|
||||
type CancelOrigin = EnsureRoot<AccountId>;
|
||||
type Currency = Balances;
|
||||
type KillOrigin = EnsureRoot<AccountId>;
|
||||
type MaxQueued = ConstU32<20>;
|
||||
type Preimages = Preimage;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type Scheduler = Scheduler;
|
||||
type Slash = Treasury;
|
||||
type SubmissionDeposit = SubmissionDeposit;
|
||||
type SubmitOrigin = EnsureSigned<AccountId>;
|
||||
type Tally = pallet_conviction_voting::TallyOf<Runtime>;
|
||||
type Tracks = tracks::TracksInfo;
|
||||
type UndecidingTimeout = UndecidingTimeout;
|
||||
type Votes = pallet_conviction_voting::VotesOf<Runtime>;
|
||||
type WeightInfo = pallet_referenda::weights::SubstrateWeight<Runtime>;
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
//! Custom origins for governance interventions.
|
||||
|
||||
pub use pallet_custom_origins::*;
|
||||
|
||||
#[frame_support::pallet]
|
||||
pub mod pallet_custom_origins {
|
||||
use frame_support::pallet_prelude::*;
|
||||
|
||||
use crate::governance::{Balance, CENTS, GRAND};
|
||||
|
||||
#[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 {
|
||||
/// Origin for spending (any amount of) funds.
|
||||
Treasurer,
|
||||
/// Origin able to cancel referenda.
|
||||
ReferendumCanceller,
|
||||
/// Origin able to kill referenda.
|
||||
ReferendumKiller,
|
||||
/// Origin able to spend the amount specified in Spender.
|
||||
SmallTipper,
|
||||
/// Origin able to spend the amount specified in Spender.
|
||||
BigTipper,
|
||||
/// Origin able to spend the amount specified in Spender.
|
||||
SmallSpender,
|
||||
/// Origin able to spend the amount specified in Spender.
|
||||
MediumSpender,
|
||||
/// Origin able to spend the amount specified in Spender.
|
||||
BigSpender,
|
||||
/// Origin able to dispatch a whitelisted call.
|
||||
WhitelistedCaller,
|
||||
}
|
||||
|
||||
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!(Treasurer, ReferendumCanceller, ReferendumKiller, WhitelistedCaller,);
|
||||
|
||||
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 Spender: EnsureOrigin<Success = Balance> {
|
||||
SmallTipper = 250 * 3 * CENTS,
|
||||
BigTipper = GRAND,
|
||||
SmallSpender = 10 * GRAND,
|
||||
MediumSpender = 100 * GRAND,
|
||||
BigSpender = 1_000 * GRAND,
|
||||
Treasurer = 10_000 * GRAND,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
//! Track configurations for governance.
|
||||
|
||||
use super::*;
|
||||
|
||||
const fn percent(x: i32) -> sp_arithmetic::FixedI64 {
|
||||
sp_arithmetic::FixedI64::from_rational(x as u128, 100)
|
||||
}
|
||||
use pallet_referenda::Curve;
|
||||
const APP_ROOT: Curve = Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100));
|
||||
const SUP_ROOT: Curve = Curve::make_linear(28, 28, percent(0), percent(50));
|
||||
const APP_TREASURER: Curve = Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100));
|
||||
const SUP_TREASURER: Curve = Curve::make_linear(28, 28, percent(0), percent(50));
|
||||
const APP_REFERENDUM_CANCELLER: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
|
||||
const SUP_REFERENDUM_CANCELLER: Curve =
|
||||
Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
|
||||
const APP_REFERENDUM_KILLER: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
|
||||
const SUP_REFERENDUM_KILLER: Curve =
|
||||
Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
|
||||
const APP_SMALL_TIPPER: Curve = Curve::make_linear(10, 28, percent(50), percent(100));
|
||||
const SUP_SMALL_TIPPER: Curve = Curve::make_reciprocal(1, 28, percent(4), percent(0), percent(50));
|
||||
const APP_BIG_TIPPER: Curve = Curve::make_linear(10, 28, percent(50), percent(100));
|
||||
const SUP_BIG_TIPPER: Curve = Curve::make_reciprocal(8, 28, percent(1), percent(0), percent(50));
|
||||
const APP_SMALL_SPENDER: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
|
||||
const SUP_SMALL_SPENDER: Curve =
|
||||
Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
|
||||
const APP_MEDIUM_SPENDER: Curve = Curve::make_linear(23, 28, percent(50), percent(100));
|
||||
const SUP_MEDIUM_SPENDER: Curve =
|
||||
Curve::make_reciprocal(16, 28, percent(1), percent(0), percent(50));
|
||||
const APP_BIG_SPENDER: Curve = Curve::make_linear(28, 28, percent(50), percent(100));
|
||||
const SUP_BIG_SPENDER: Curve = Curve::make_reciprocal(20, 28, percent(1), percent(0), percent(50));
|
||||
const APP_WHITELISTED_CALLER: Curve =
|
||||
Curve::make_reciprocal(16, 28 * 24, percent(96), percent(50), percent(100));
|
||||
const SUP_WHITELISTED_CALLER: Curve =
|
||||
Curve::make_reciprocal(1, 28, percent(20), percent(5), percent(50));
|
||||
|
||||
const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 10] = [
|
||||
(
|
||||
0,
|
||||
pallet_referenda::TrackInfo {
|
||||
name: "root",
|
||||
max_deciding: 1,
|
||||
decision_deposit: 100 * GRAND,
|
||||
prepare_period: 8 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 12 * MINUTES,
|
||||
min_enactment_period: 5 * MINUTES,
|
||||
min_approval: APP_ROOT,
|
||||
min_support: SUP_ROOT,
|
||||
},
|
||||
),
|
||||
(
|
||||
1,
|
||||
pallet_referenda::TrackInfo {
|
||||
name: "whitelisted_caller",
|
||||
max_deciding: 100,
|
||||
decision_deposit: 10 * GRAND,
|
||||
prepare_period: 6 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 4 * MINUTES,
|
||||
min_enactment_period: 3 * MINUTES,
|
||||
min_approval: APP_WHITELISTED_CALLER,
|
||||
min_support: SUP_WHITELISTED_CALLER,
|
||||
},
|
||||
),
|
||||
(
|
||||
11,
|
||||
pallet_referenda::TrackInfo {
|
||||
name: "treasurer",
|
||||
max_deciding: 10,
|
||||
decision_deposit: GRAND,
|
||||
prepare_period: 8 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 8 * MINUTES,
|
||||
min_enactment_period: 5 * MINUTES,
|
||||
min_approval: APP_TREASURER,
|
||||
min_support: SUP_TREASURER,
|
||||
},
|
||||
),
|
||||
(
|
||||
20,
|
||||
pallet_referenda::TrackInfo {
|
||||
name: "referendum_canceller",
|
||||
max_deciding: 1_000,
|
||||
decision_deposit: 10 * GRAND,
|
||||
prepare_period: 8 * MINUTES,
|
||||
decision_period: 14 * MINUTES,
|
||||
confirm_period: 8 * MINUTES,
|
||||
min_enactment_period: 3 * MINUTES,
|
||||
min_approval: APP_REFERENDUM_CANCELLER,
|
||||
min_support: SUP_REFERENDUM_CANCELLER,
|
||||
},
|
||||
),
|
||||
(
|
||||
21,
|
||||
pallet_referenda::TrackInfo {
|
||||
name: "referendum_killer",
|
||||
max_deciding: 1_000,
|
||||
decision_deposit: 50 * GRAND,
|
||||
prepare_period: 8 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 8 * MINUTES,
|
||||
min_enactment_period: 3 * MINUTES,
|
||||
min_approval: APP_REFERENDUM_KILLER,
|
||||
min_support: SUP_REFERENDUM_KILLER,
|
||||
},
|
||||
),
|
||||
(
|
||||
30,
|
||||
pallet_referenda::TrackInfo {
|
||||
name: "small_tipper",
|
||||
max_deciding: 200,
|
||||
decision_deposit: 3 * CENTS,
|
||||
prepare_period: MINUTES,
|
||||
decision_period: 14 * MINUTES,
|
||||
confirm_period: 4 * MINUTES,
|
||||
min_enactment_period: MINUTES,
|
||||
min_approval: APP_SMALL_TIPPER,
|
||||
min_support: SUP_SMALL_TIPPER,
|
||||
},
|
||||
),
|
||||
(
|
||||
31,
|
||||
pallet_referenda::TrackInfo {
|
||||
name: "big_tipper",
|
||||
max_deciding: 100,
|
||||
decision_deposit: 10 * 3 * CENTS,
|
||||
prepare_period: 4 * MINUTES,
|
||||
decision_period: 14 * MINUTES,
|
||||
confirm_period: 12 * MINUTES,
|
||||
min_enactment_period: 3 * MINUTES,
|
||||
min_approval: APP_BIG_TIPPER,
|
||||
min_support: SUP_BIG_TIPPER,
|
||||
},
|
||||
),
|
||||
(
|
||||
32,
|
||||
pallet_referenda::TrackInfo {
|
||||
name: "small_spender",
|
||||
max_deciding: 50,
|
||||
decision_deposit: 100 * 3 * CENTS,
|
||||
prepare_period: 10 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 10 * MINUTES,
|
||||
min_enactment_period: 5 * MINUTES,
|
||||
min_approval: APP_SMALL_SPENDER,
|
||||
min_support: SUP_SMALL_SPENDER,
|
||||
},
|
||||
),
|
||||
(
|
||||
33,
|
||||
pallet_referenda::TrackInfo {
|
||||
name: "medium_spender",
|
||||
max_deciding: 50,
|
||||
decision_deposit: 200 * 3 * CENTS,
|
||||
prepare_period: 10 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 12 * MINUTES,
|
||||
min_enactment_period: 5 * MINUTES,
|
||||
min_approval: APP_MEDIUM_SPENDER,
|
||||
min_support: SUP_MEDIUM_SPENDER,
|
||||
},
|
||||
),
|
||||
(
|
||||
34,
|
||||
pallet_referenda::TrackInfo {
|
||||
name: "big_spender",
|
||||
max_deciding: 50,
|
||||
decision_deposit: 400 * 3 * CENTS,
|
||||
prepare_period: 10 * MINUTES,
|
||||
decision_period: 20 * MINUTES,
|
||||
confirm_period: 14 * MINUTES,
|
||||
min_enactment_period: 5 * MINUTES,
|
||||
min_approval: APP_BIG_SPENDER,
|
||||
min_support: SUP_BIG_SPENDER,
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
pub struct TracksInfo;
|
||||
impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
|
||||
type Id = u16;
|
||||
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, ()> {
|
||||
if let Ok(system_origin) = frame_system::RawOrigin::try_from(id.clone()) {
|
||||
match system_origin {
|
||||
frame_system::RawOrigin::Root => Ok(0),
|
||||
_ => Err(()),
|
||||
}
|
||||
} else if let Ok(custom_origin) = origins::Origin::try_from(id.clone()) {
|
||||
match custom_origin {
|
||||
origins::Origin::WhitelistedCaller => Ok(1),
|
||||
origins::Origin::Treasurer => Ok(11),
|
||||
// Referendum admins
|
||||
origins::Origin::ReferendumCanceller => Ok(20),
|
||||
origins::Origin::ReferendumKiller => Ok(21),
|
||||
// Limited treasury spenders
|
||||
origins::Origin::SmallTipper => Ok(30),
|
||||
origins::Origin::BigTipper => Ok(31),
|
||||
origins::Origin::SmallSpender => Ok(32),
|
||||
origins::Origin::MediumSpender => Ok(33),
|
||||
origins::Origin::BigSpender => Ok(34),
|
||||
}
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
}
|
||||
pallet_referenda::impl_tracksinfo_get!(TracksInfo, Balance, BlockNumber);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,53 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, Weight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// Importing a block with 0 Extrinsics.
|
||||
pub const BlockExecutionWeight: Weight =
|
||||
Weight::from_parts(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000), 0);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use frame_support::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::constants::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."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
|
||||
//! Autogenerated weights for `cumulus_pallet_parachain_system`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/parachain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=results-cumulus_pallet_parachain_system.json
|
||||
// --pallet=cumulus_pallet_parachain_system
|
||||
// --chain=dev
|
||||
// --output=new-benchmarks/cumulus_pallet_parachain_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 `cumulus_pallet_parachain_system`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> cumulus_pallet_parachain_system::WeightInfo for WeightInfo<T> {
|
||||
/// Storage: `ParachainSystem::LastDmqMqcHead` (r:1 w:1)
|
||||
/// Proof: `ParachainSystem::LastDmqMqcHead` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
|
||||
/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`)
|
||||
/// Storage: `ParachainSystem::ProcessedDownwardMessages` (r:0 w:1)
|
||||
/// Proof: `ParachainSystem::ProcessedDownwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `MessageQueue::Pages` (r:0 w:1000)
|
||||
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`)
|
||||
/// The range of component `n` is `[0, 1000]`.
|
||||
fn enqueue_inbound_downward_messages(n: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `12`
|
||||
// Estimated: `3517`
|
||||
// Minimum execution time: 2_323_000 picoseconds.
|
||||
Weight::from_parts(2_390_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3517))
|
||||
// Standard Error: 16_951
|
||||
.saturating_add(Weight::from_parts(187_637_298, 0).saturating_mul(n.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(4))
|
||||
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
|
||||
//! Autogenerated weights for `cumulus_pallet_xcmp_queue`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/parachain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=results-cumulus_pallet_xcmp_queue.json
|
||||
// --pallet=cumulus_pallet_xcmp_queue
|
||||
// --chain=dev
|
||||
// --output=new-benchmarks/cumulus_pallet_xcmp_queue.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 `cumulus_pallet_xcmp_queue`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> cumulus_pallet_xcmp_queue::WeightInfo for WeightInfo<T> {
|
||||
/// Storage: `XcmpQueue::QueueConfig` (r:1 w:1)
|
||||
/// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn set_config_with_u32() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `76`
|
||||
// Estimated: `1561`
|
||||
// Minimum execution time: 5_689_000 picoseconds.
|
||||
Weight::from_parts(5_900_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1561))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `XcmpQueue::QueueConfig` (r:1 w:0)
|
||||
/// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
|
||||
/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`)
|
||||
/// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0)
|
||||
/// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `MessageQueue::Pages` (r:0 w:1)
|
||||
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`)
|
||||
fn enqueue_xcmp_message() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `82`
|
||||
// Estimated: `3517`
|
||||
// Minimum execution time: 17_110_000 picoseconds.
|
||||
Weight::from_parts(17_515_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3517))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1)
|
||||
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn suspend_channel() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `76`
|
||||
// Estimated: `1561`
|
||||
// Minimum execution time: 3_337_000 picoseconds.
|
||||
Weight::from_parts(3_433_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1561))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `XcmpQueue::OutboundXcmpStatus` (r:1 w:1)
|
||||
/// Proof: `XcmpQueue::OutboundXcmpStatus` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn resume_channel() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `111`
|
||||
// Estimated: `1596`
|
||||
// Minimum execution time: 4_150_000 picoseconds.
|
||||
Weight::from_parts(4_324_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1596))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
fn take_first_concatenated_xcm() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 9_245_000 picoseconds.
|
||||
Weight::from_parts(9_765_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
}
|
||||
/// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1)
|
||||
/// Proof: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1)
|
||||
/// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6bedc49980ba3aa32b0a189290fd036649` (r:1 w:1)
|
||||
/// Proof: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6bedc49980ba3aa32b0a189290fd036649` (r:1 w:1)
|
||||
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
|
||||
/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`)
|
||||
/// Storage: `XcmpQueue::QueueConfig` (r:1 w:0)
|
||||
/// Proof: `XcmpQueue::QueueConfig` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `XcmpQueue::InboundXcmpSuspended` (r:1 w:0)
|
||||
/// Proof: `XcmpQueue::InboundXcmpSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `MessageQueue::Pages` (r:0 w:1)
|
||||
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`)
|
||||
fn on_idle_good_msg() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `65711`
|
||||
// Estimated: `69176`
|
||||
// Minimum execution time: 115_317_000 picoseconds.
|
||||
Weight::from_parts(117_489_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 69176))
|
||||
.saturating_add(T::DbWeight::get().reads(6))
|
||||
.saturating_add(T::DbWeight::get().writes(5))
|
||||
}
|
||||
/// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1)
|
||||
/// Proof: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6b345d8e88afa015075c945637c07e8f20` (r:1 w:1)
|
||||
/// Storage: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6bedc49980ba3aa32b0a189290fd036649` (r:1 w:1)
|
||||
/// Proof: UNKNOWN KEY `0x7b3237373ffdfeb1cab4222e3b520d6bedc49980ba3aa32b0a189290fd036649` (r:1 w:1)
|
||||
fn on_idle_large_msg() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `65710`
|
||||
// Estimated: `69175`
|
||||
// Minimum execution time: 56_379_000 picoseconds.
|
||||
Weight::from_parts(58_187_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 69175))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, Weight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||
pub const ExtrinsicBaseWeight: Weight =
|
||||
Weight::from_parts(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000), 0);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use frame_support::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::constants::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."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Expose the auto generated weight files.
|
||||
|
||||
pub mod block_weights;
|
||||
pub mod cumulus_pallet_parachain_system;
|
||||
pub mod cumulus_pallet_xcmp_queue;
|
||||
pub mod extrinsic_weights;
|
||||
pub mod pallet_assets;
|
||||
pub mod pallet_balances;
|
||||
pub mod pallet_collator_selection;
|
||||
pub mod pallet_message_queue;
|
||||
pub mod pallet_multisig;
|
||||
pub mod pallet_proxy;
|
||||
pub mod pallet_session;
|
||||
pub mod pallet_sudo;
|
||||
pub mod pallet_timestamp;
|
||||
pub mod pallet_utility;
|
||||
pub mod pallet_xcm;
|
||||
pub mod paritydb_weights;
|
||||
pub mod rocksdb_weights;
|
||||
|
||||
pub use block_weights::constants::BlockExecutionWeight;
|
||||
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||
pub use rocksdb_weights::constants::RocksDbWeight;
|
||||
@@ -0,0 +1,503 @@
|
||||
|
||||
//! Autogenerated weights for `pallet_assets`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/parachain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=results-pallet_assets.json
|
||||
// --pallet=pallet_assets
|
||||
// --chain=dev
|
||||
// --output=new-benchmarks/pallet_assets.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_assets`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_assets::WeightInfo for WeightInfo<T> {
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
fn create() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `146`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 30_471_000 picoseconds.
|
||||
Weight::from_parts(31_044_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
fn force_create() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 11_341_000 picoseconds.
|
||||
Weight::from_parts(11_640_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
fn start_destroy() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `277`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 13_750_000 picoseconds.
|
||||
Weight::from_parts(14_126_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:1001 w:1000)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1000 w:1000)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// The range of component `c` is `[0, 1000]`.
|
||||
fn destroy_accounts(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `85 + c * (208 ±0)`
|
||||
// Estimated: `3675 + c * (2609 ±0)`
|
||||
// Minimum execution time: 18_109_000 picoseconds.
|
||||
Weight::from_parts(18_396_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
// Standard Error: 6_810
|
||||
.saturating_add(Weight::from_parts(15_041_583, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(c.into())))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(c.into())))
|
||||
.saturating_add(Weight::from_parts(0, 2609).saturating_mul(c.into()))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Approvals` (r:1001 w:1000)
|
||||
/// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
|
||||
/// The range of component `a` is `[0, 1000]`.
|
||||
fn destroy_approvals(a: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `414 + a * (86 ±0)`
|
||||
// Estimated: `3675 + a * (2623 ±0)`
|
||||
// Minimum execution time: 18_628_000 picoseconds.
|
||||
Weight::from_parts(18_901_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
// Standard Error: 4_422
|
||||
.saturating_add(Weight::from_parts(17_365_668, 0).saturating_mul(a.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(a.into())))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(a.into())))
|
||||
.saturating_add(Weight::from_parts(0, 2623).saturating_mul(a.into()))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Metadata` (r:1 w:0)
|
||||
/// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
|
||||
fn finish_destroy() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `243`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 15_092_000 picoseconds.
|
||||
Weight::from_parts(15_711_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:1 w:1)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn mint() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `243`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 27_366_000 picoseconds.
|
||||
Weight::from_parts(27_812_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:1 w:1)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn burn() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `351`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 36_696_000 picoseconds.
|
||||
Weight::from_parts(37_320_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:2 w:2)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, 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: `390`
|
||||
// Estimated: `6208`
|
||||
// Minimum execution time: 51_189_000 picoseconds.
|
||||
Weight::from_parts(52_117_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6208))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(4))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:2 w:2)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, 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_keep_alive() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `390`
|
||||
// Estimated: `6208`
|
||||
// Minimum execution time: 46_131_000 picoseconds.
|
||||
Weight::from_parts(47_137_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6208))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(4))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:2 w:2)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, 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: `390`
|
||||
// Estimated: `6208`
|
||||
// Minimum execution time: 51_431_000 picoseconds.
|
||||
Weight::from_parts(51_988_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6208))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(4))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:0)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:1 w:1)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn freeze() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `351`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 18_806_000 picoseconds.
|
||||
Weight::from_parts(19_208_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:0)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:1 w:1)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn thaw() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `351`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 18_891_000 picoseconds.
|
||||
Weight::from_parts(19_307_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
fn freeze_asset() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `277`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 13_584_000 picoseconds.
|
||||
Weight::from_parts(14_004_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
fn thaw_asset() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `277`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 13_573_000 picoseconds.
|
||||
Weight::from_parts(13_940_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Metadata` (r:1 w:0)
|
||||
/// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
|
||||
fn transfer_ownership() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `243`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 15_576_000 picoseconds.
|
||||
Weight::from_parts(16_295_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
fn set_team() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `243`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 13_374_000 picoseconds.
|
||||
Weight::from_parts(13_775_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:0)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Metadata` (r:1 w:1)
|
||||
/// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
|
||||
/// The range of component `n` is `[0, 50]`.
|
||||
/// The range of component `s` is `[0, 50]`.
|
||||
fn set_metadata(_n: u32, _s: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `243`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 32_479_000 picoseconds.
|
||||
Weight::from_parts(33_701_345, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:0)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Metadata` (r:1 w:1)
|
||||
/// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
|
||||
fn clear_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `407`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 33_293_000 picoseconds.
|
||||
Weight::from_parts(33_832_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:0)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Metadata` (r:1 w:1)
|
||||
/// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
|
||||
/// The range of component `n` is `[0, 50]`.
|
||||
/// The range of component `s` is `[0, 50]`.
|
||||
fn force_set_metadata(_n: u32, s: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `82`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 13_737_000 picoseconds.
|
||||
Weight::from_parts(14_470_503, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
// Standard Error: 318
|
||||
.saturating_add(Weight::from_parts(120, 0).saturating_mul(s.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:0)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Metadata` (r:1 w:1)
|
||||
/// Proof: `Assets::Metadata` (`max_values`: None, `max_size`: Some(140), added: 2615, mode: `MaxEncodedLen`)
|
||||
fn force_clear_metadata() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `407`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 32_485_000 picoseconds.
|
||||
Weight::from_parts(33_247_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
fn force_asset_status() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `243`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 12_881_000 picoseconds.
|
||||
Weight::from_parts(13_245_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Approvals` (r:1 w:1)
|
||||
/// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
|
||||
fn approve_transfer() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `277`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 37_242_000 picoseconds.
|
||||
Weight::from_parts(38_026_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Approvals` (r:1 w:1)
|
||||
/// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:2 w:2)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, 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_approved() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `560`
|
||||
// Estimated: `6208`
|
||||
// Minimum execution time: 75_984_000 picoseconds.
|
||||
Weight::from_parts(77_686_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6208))
|
||||
.saturating_add(T::DbWeight::get().reads(5))
|
||||
.saturating_add(T::DbWeight::get().writes(5))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Approvals` (r:1 w:1)
|
||||
/// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
|
||||
fn cancel_approval() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `447`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 39_641_000 picoseconds.
|
||||
Weight::from_parts(40_125_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Approvals` (r:1 w:1)
|
||||
/// Proof: `Assets::Approvals` (`max_values`: None, `max_size`: Some(148), added: 2623, mode: `MaxEncodedLen`)
|
||||
fn force_cancel_approval() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `447`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 39_914_000 picoseconds.
|
||||
Weight::from_parts(40_607_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
fn set_min_balance() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `243`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 14_598_000 picoseconds.
|
||||
Weight::from_parts(15_052_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Assets::Account` (r:1 w:1)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
fn touch() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `346`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 37_665_000 picoseconds.
|
||||
Weight::from_parts(38_271_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
/// Storage: `Assets::Account` (r:1 w:1)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
fn touch_other() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `243`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 36_204_000 picoseconds.
|
||||
Weight::from_parts(36_918_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `Assets::Account` (r:1 w:1)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
fn refund() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `472`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 36_693_000 picoseconds.
|
||||
Weight::from_parts(37_631_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
/// Storage: `Assets::Account` (r:1 w:1)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Asset` (r:1 w:1)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
fn refund_other() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `402`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 35_318_000 picoseconds.
|
||||
Weight::from_parts(35_970_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `Assets::Asset` (r:1 w:0)
|
||||
/// Proof: `Assets::Asset` (`max_values`: None, `max_size`: Some(210), added: 2685, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Assets::Account` (r:1 w:1)
|
||||
/// Proof: `Assets::Account` (`max_values`: None, `max_size`: Some(134), added: 2609, mode: `MaxEncodedLen`)
|
||||
fn block() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `351`
|
||||
// Estimated: `3675`
|
||||
// Minimum execution time: 18_741_000 picoseconds.
|
||||
Weight::from_parts(19_123_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3675))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
|
||||
//! Autogenerated weights for `pallet_balances`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/parachain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=results-pallet_balances.json
|
||||
// --pallet=pallet_balances
|
||||
// --chain=dev
|
||||
// --output=new-benchmarks/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: 61_845_000 picoseconds.
|
||||
Weight::from_parts(62_587_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: 49_086_000 picoseconds.
|
||||
Weight::from_parts(49_781_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: `174`
|
||||
// Estimated: `3593`
|
||||
// Minimum execution time: 18_512_000 picoseconds.
|
||||
Weight::from_parts(19_052_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: `174`
|
||||
// Estimated: `3593`
|
||||
// Minimum execution time: 25_434_000 picoseconds.
|
||||
Weight::from_parts(25_737_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: `103`
|
||||
// Estimated: `6196`
|
||||
// Minimum execution time: 64_094_000 picoseconds.
|
||||
Weight::from_parts(64_693_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: 61_075_000 picoseconds.
|
||||
Weight::from_parts(62_130_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: `174`
|
||||
// Estimated: `3593`
|
||||
// Minimum execution time: 22_123_000 picoseconds.
|
||||
Weight::from_parts(22_711_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 * (136 ±0)`
|
||||
// Estimated: `990 + u * (2603 ±0)`
|
||||
// Minimum execution time: 20_871_000 picoseconds.
|
||||
Weight::from_parts(21_121_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 990))
|
||||
// Standard Error: 11_849
|
||||
.saturating_add(Weight::from_parts(17_256_565, 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: 7_580_000 picoseconds.
|
||||
Weight::from_parts(7_896_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
|
||||
//! Autogenerated weights for `pallet_collator_selection`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/parachain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=results-pallet_collator_selection.json
|
||||
// --pallet=pallet_collator_selection
|
||||
// --chain=dev
|
||||
// --output=new-benchmarks/pallet_collator_selection.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_collator_selection`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_collator_selection::WeightInfo for WeightInfo<T> {
|
||||
/// Storage: `Session::NextKeys` (r:20 w:0)
|
||||
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `CollatorSelection::Invulnerables` (r:0 w:1)
|
||||
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
|
||||
/// The range of component `b` is `[1, 20]`.
|
||||
fn set_invulnerables(b: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `197 + b * (79 ±0)`
|
||||
// Estimated: `1188 + b * (2555 ±0)`
|
||||
// Minimum execution time: 15_121_000 picoseconds.
|
||||
Weight::from_parts(11_575_812, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1188))
|
||||
// Standard Error: 5_171
|
||||
.saturating_add(Weight::from_parts(3_863_259, 0).saturating_mul(b.into()))
|
||||
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
.saturating_add(Weight::from_parts(0, 2555).saturating_mul(b.into()))
|
||||
}
|
||||
/// Storage: `Session::NextKeys` (r:1 w:0)
|
||||
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:1)
|
||||
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
|
||||
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, 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 `b` is `[1, 19]`.
|
||||
/// The range of component `c` is `[1, 99]`.
|
||||
fn add_invulnerable(b: u32, c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `795 + b * (32 ±0) + c * (53 ±0)`
|
||||
// Estimated: `6287 + b * (37 ±0) + c * (53 ±0)`
|
||||
// Minimum execution time: 50_613_000 picoseconds.
|
||||
Weight::from_parts(51_112_923, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6287))
|
||||
// Standard Error: 8_238
|
||||
.saturating_add(Weight::from_parts(115_427, 0).saturating_mul(b.into()))
|
||||
// Standard Error: 1_561
|
||||
.saturating_add(Weight::from_parts(127_230, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
.saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into()))
|
||||
.saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into()))
|
||||
}
|
||||
/// Storage: `CollatorSelection::CandidateList` (r:1 w:0)
|
||||
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:1)
|
||||
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
|
||||
/// The range of component `b` is `[5, 20]`.
|
||||
fn remove_invulnerable(b: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `119 + b * (32 ±0)`
|
||||
// Estimated: `6287`
|
||||
// Minimum execution time: 14_815_000 picoseconds.
|
||||
Weight::from_parts(14_625_673, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6287))
|
||||
// Standard Error: 2_646
|
||||
.saturating_add(Weight::from_parts(193_155, 0).saturating_mul(b.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `CollatorSelection::DesiredCandidates` (r:0 w:1)
|
||||
/// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
fn set_desired_candidates() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 6_224_000 picoseconds.
|
||||
Weight::from_parts(6_590_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `CollatorSelection::CandidacyBond` (r:1 w:1)
|
||||
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
|
||||
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:100 w:100)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:100)
|
||||
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
|
||||
/// The range of component `c` is `[0, 100]`.
|
||||
/// The range of component `k` is `[0, 100]`.
|
||||
fn set_candidacy_bond(c: u32, k: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0 + c * (182 ±0) + k * (115 ±0)`
|
||||
// Estimated: `6287 + c * (901 ±29) + k * (901 ±29)`
|
||||
// Minimum execution time: 12_606_000 picoseconds.
|
||||
Weight::from_parts(12_842_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6287))
|
||||
// Standard Error: 206_311
|
||||
.saturating_add(Weight::from_parts(6_859_322, 0).saturating_mul(c.into()))
|
||||
// Standard Error: 206_311
|
||||
.saturating_add(Weight::from_parts(6_628_261, 0).saturating_mul(k.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(c.into())))
|
||||
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into())))
|
||||
.saturating_add(Weight::from_parts(0, 901).saturating_mul(c.into()))
|
||||
.saturating_add(Weight::from_parts(0, 901).saturating_mul(k.into()))
|
||||
}
|
||||
/// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0)
|
||||
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
|
||||
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
|
||||
/// The range of component `c` is `[3, 100]`.
|
||||
fn update_bond(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `319 + c * (49 ±0)`
|
||||
// Estimated: `6287`
|
||||
// Minimum execution time: 31_610_000 picoseconds.
|
||||
Weight::from_parts(34_921_968, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6287))
|
||||
// Standard Error: 1_584
|
||||
.saturating_add(Weight::from_parts(132_287, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
|
||||
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
|
||||
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Session::NextKeys` (r:1 w:0)
|
||||
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0)
|
||||
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1)
|
||||
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
|
||||
/// The range of component `c` is `[1, 99]`.
|
||||
fn register_as_candidate(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `765 + c * (52 ±0)`
|
||||
// Estimated: `6287 + c * (54 ±0)`
|
||||
// Minimum execution time: 42_703_000 picoseconds.
|
||||
Weight::from_parts(47_686_567, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6287))
|
||||
// Standard Error: 2_319
|
||||
.saturating_add(Weight::from_parts(161_883, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
.saturating_add(Weight::from_parts(0, 54).saturating_mul(c.into()))
|
||||
}
|
||||
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
|
||||
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0)
|
||||
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Session::NextKeys` (r:1 w:0)
|
||||
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
|
||||
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:1 w:1)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:2)
|
||||
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
|
||||
/// The range of component `c` is `[3, 100]`.
|
||||
fn take_candidate_slot(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `905 + c * (53 ±0)`
|
||||
// Estimated: `6287 + c * (54 ±0)`
|
||||
// Minimum execution time: 65_964_000 picoseconds.
|
||||
Weight::from_parts(71_134_634, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6287))
|
||||
// Standard Error: 2_881
|
||||
.saturating_add(Weight::from_parts(170_853, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(5))
|
||||
.saturating_add(T::DbWeight::get().writes(4))
|
||||
.saturating_add(Weight::from_parts(0, 54).saturating_mul(c.into()))
|
||||
}
|
||||
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
|
||||
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
|
||||
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1)
|
||||
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
|
||||
/// The range of component `c` is `[3, 100]`.
|
||||
fn leave_intent(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `347 + c * (48 ±0)`
|
||||
// Estimated: `6287`
|
||||
// Minimum execution time: 36_613_000 picoseconds.
|
||||
Weight::from_parts(40_351_254, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6287))
|
||||
// Standard Error: 2_282
|
||||
.saturating_add(Weight::from_parts(148_710, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `System::Account` (r:2 w:2)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1)
|
||||
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
|
||||
fn note_author() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `155`
|
||||
// Estimated: `6196`
|
||||
// Minimum execution time: 55_131_000 picoseconds.
|
||||
Weight::from_parts(56_088_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6196))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
/// Storage: `CollatorSelection::CandidateList` (r:1 w:0)
|
||||
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:100 w:0)
|
||||
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
|
||||
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
|
||||
/// Storage: `CollatorSelection::DesiredCandidates` (r:1 w:0)
|
||||
/// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
/// Storage: `System::Account` (r:97 w:97)
|
||||
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
/// The range of component `r` is `[1, 100]`.
|
||||
/// The range of component `c` is `[1, 100]`.
|
||||
fn new_session(r: u32, c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `2302 + c * (97 ±0) + r * (114 ±0)`
|
||||
// Estimated: `6287 + c * (2519 ±0) + r * (2603 ±0)`
|
||||
// Minimum execution time: 23_331_000 picoseconds.
|
||||
Weight::from_parts(23_736_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6287))
|
||||
// Standard Error: 365_295
|
||||
.saturating_add(Weight::from_parts(15_835_608, 0).saturating_mul(c.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into())))
|
||||
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into())))
|
||||
.saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into()))
|
||||
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(r.into()))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
|
||||
//! Autogenerated weights for `pallet_message_queue`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/parachain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=results-pallet_message_queue.json
|
||||
// --pallet=pallet_message_queue
|
||||
// --chain=dev
|
||||
// --output=new-benchmarks/pallet_message_queue.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_message_queue`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_message_queue::WeightInfo for WeightInfo<T> {
|
||||
/// Storage: `MessageQueue::ServiceHead` (r:1 w:0)
|
||||
/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`)
|
||||
/// Storage: `MessageQueue::BookStateFor` (r:2 w:2)
|
||||
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
|
||||
fn ready_ring_knit() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `223`
|
||||
// Estimated: `6044`
|
||||
// Minimum execution time: 15_177_000 picoseconds.
|
||||
Weight::from_parts(15_591_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6044))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `MessageQueue::BookStateFor` (r:2 w:2)
|
||||
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
|
||||
/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`)
|
||||
fn ready_ring_unknit() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `218`
|
||||
// Estimated: `6044`
|
||||
// Minimum execution time: 13_482_000 picoseconds.
|
||||
Weight::from_parts(13_950_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6044))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
|
||||
fn service_queue_base() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6`
|
||||
// Estimated: `3517`
|
||||
// Minimum execution time: 4_733_000 picoseconds.
|
||||
Weight::from_parts(4_944_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3517))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `MessageQueue::Pages` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`)
|
||||
fn service_page_base_completion() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `72`
|
||||
// Estimated: `69050`
|
||||
// Minimum execution time: 6_922_000 picoseconds.
|
||||
Weight::from_parts(7_105_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 69050))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `MessageQueue::Pages` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`)
|
||||
fn service_page_base_no_completion() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `72`
|
||||
// Estimated: `69050`
|
||||
// Minimum execution time: 7_240_000 picoseconds.
|
||||
Weight::from_parts(7_430_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 69050))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `MessageQueue::BookStateFor` (r:0 w:1)
|
||||
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
|
||||
/// Storage: `MessageQueue::Pages` (r:0 w:1)
|
||||
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`)
|
||||
fn service_page_item() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 159_880_000 picoseconds.
|
||||
Weight::from_parts(161_674_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`)
|
||||
/// Storage: `MessageQueue::BookStateFor` (r:1 w:0)
|
||||
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
|
||||
fn bump_service_head() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `171`
|
||||
// Estimated: `3517`
|
||||
// Minimum execution time: 8_730_000 picoseconds.
|
||||
Weight::from_parts(9_148_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3517))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
|
||||
/// Storage: `MessageQueue::Pages` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`)
|
||||
fn reap_page() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `65667`
|
||||
// Estimated: `69050`
|
||||
// Minimum execution time: 59_300_000 picoseconds.
|
||||
Weight::from_parts(60_857_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 69050))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
|
||||
/// Storage: `MessageQueue::Pages` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`)
|
||||
fn execute_overweight_page_removed() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `65667`
|
||||
// Estimated: `69050`
|
||||
// Minimum execution time: 75_919_000 picoseconds.
|
||||
Weight::from_parts(77_801_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 69050))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
|
||||
/// Storage: `MessageQueue::Pages` (r:1 w:1)
|
||||
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`)
|
||||
fn execute_overweight_page_updated() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `65667`
|
||||
// Estimated: `69050`
|
||||
// Minimum execution time: 110_599_000 picoseconds.
|
||||
Weight::from_parts(112_834_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 69050))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
|
||||
//! Autogenerated weights for `pallet_multisig`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/parachain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=results-pallet_multisig.json
|
||||
// --pallet=pallet_multisig
|
||||
// --chain=dev
|
||||
// --output=new-benchmarks/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: 15_963_000 picoseconds.
|
||||
Weight::from_parts(16_803_573, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
// Standard Error: 3
|
||||
.saturating_add(Weight::from_parts(501, 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: `263 + s * (2 ±0)`
|
||||
// Estimated: `6811`
|
||||
// Minimum execution time: 51_483_000 picoseconds.
|
||||
Weight::from_parts(39_405_257, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6811))
|
||||
// Standard Error: 538
|
||||
.saturating_add(Weight::from_parts(132_817, 0).saturating_mul(s.into()))
|
||||
// Standard Error: 5
|
||||
.saturating_add(Weight::from_parts(1_404, 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: `282`
|
||||
// Estimated: `6811`
|
||||
// Minimum execution time: 33_016_000 picoseconds.
|
||||
Weight::from_parts(22_290_579, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6811))
|
||||
// Standard Error: 464
|
||||
.saturating_add(Weight::from_parts(119_179, 0).saturating_mul(s.into()))
|
||||
// Standard Error: 4
|
||||
.saturating_add(Weight::from_parts(1_390, 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: `388 + s * (33 ±0)`
|
||||
// Estimated: `6811`
|
||||
// Minimum execution time: 55_907_000 picoseconds.
|
||||
Weight::from_parts(43_257_069, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6811))
|
||||
// Standard Error: 614
|
||||
.saturating_add(Weight::from_parts(161_107, 0).saturating_mul(s.into()))
|
||||
// Standard Error: 6
|
||||
.saturating_add(Weight::from_parts(1_467, 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: `263 + s * (2 ±0)`
|
||||
// Estimated: `6811`
|
||||
// Minimum execution time: 36_962_000 picoseconds.
|
||||
Weight::from_parts(38_010_134, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6811))
|
||||
// Standard Error: 704
|
||||
.saturating_add(Weight::from_parts(133_385, 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: `282`
|
||||
// Estimated: `6811`
|
||||
// Minimum execution time: 20_134_000 picoseconds.
|
||||
Weight::from_parts(20_794_717, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6811))
|
||||
// Standard Error: 556
|
||||
.saturating_add(Weight::from_parts(117_695, 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: `454 + s * (1 ±0)`
|
||||
// Estimated: `6811`
|
||||
// Minimum execution time: 38_167_000 picoseconds.
|
||||
Weight::from_parts(39_536_648, 0)
|
||||
.saturating_add(Weight::from_parts(0, 6811))
|
||||
// Standard Error: 649
|
||||
.saturating_add(Weight::from_parts(123_380, 0).saturating_mul(s.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
|
||||
//! Autogenerated weights for `pallet_proxy`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/parachain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=results-pallet_proxy.json
|
||||
// --pallet=pallet_proxy
|
||||
// --chain=dev
|
||||
// --output=new-benchmarks/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: `127 + p * (37 ±0)`
|
||||
// Estimated: `4706`
|
||||
// Minimum execution time: 16_811_000 picoseconds.
|
||||
Weight::from_parts(17_498_789, 0)
|
||||
.saturating_add(Weight::from_parts(0, 4706))
|
||||
// Standard Error: 1_033
|
||||
.saturating_add(Weight::from_parts(39_226, 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: `454 + a * (68 ±0) + p * (37 ±0)`
|
||||
// Estimated: `5698`
|
||||
// Minimum execution time: 42_360_000 picoseconds.
|
||||
Weight::from_parts(42_166_938, 0)
|
||||
.saturating_add(Weight::from_parts(0, 5698))
|
||||
// Standard Error: 1_953
|
||||
.saturating_add(Weight::from_parts(186_281, 0).saturating_mul(a.into()))
|
||||
// Standard Error: 2_018
|
||||
.saturating_add(Weight::from_parts(40_941, 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: `369 + a * (68 ±0)`
|
||||
// Estimated: `5698`
|
||||
// Minimum execution time: 28_790_000 picoseconds.
|
||||
Weight::from_parts(29_831_651, 0)
|
||||
.saturating_add(Weight::from_parts(0, 5698))
|
||||
// Standard Error: 1_469
|
||||
.saturating_add(Weight::from_parts(177_561, 0).saturating_mul(a.into()))
|
||||
// Standard Error: 1_518
|
||||
.saturating_add(Weight::from_parts(6_744, 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: `369 + a * (68 ±0)`
|
||||
// Estimated: `5698`
|
||||
// Minimum execution time: 28_875_000 picoseconds.
|
||||
Weight::from_parts(29_321_993, 0)
|
||||
.saturating_add(Weight::from_parts(0, 5698))
|
||||
// Standard Error: 1_580
|
||||
.saturating_add(Weight::from_parts(196_998, 0).saturating_mul(a.into()))
|
||||
// Standard Error: 1_632
|
||||
.saturating_add(Weight::from_parts(10_468, 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: `386 + a * (68 ±0) + p * (37 ±0)`
|
||||
// Estimated: `5698`
|
||||
// Minimum execution time: 37_912_000 picoseconds.
|
||||
Weight::from_parts(37_943_779, 0)
|
||||
.saturating_add(Weight::from_parts(0, 5698))
|
||||
// Standard Error: 1_776
|
||||
.saturating_add(Weight::from_parts(185_911, 0).saturating_mul(a.into()))
|
||||
// Standard Error: 1_835
|
||||
.saturating_add(Weight::from_parts(37_585, 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: `127 + p * (37 ±0)`
|
||||
// Estimated: `4706`
|
||||
// Minimum execution time: 27_681_000 picoseconds.
|
||||
Weight::from_parts(28_596_631, 0)
|
||||
.saturating_add(Weight::from_parts(0, 4706))
|
||||
// Standard Error: 1_091
|
||||
.saturating_add(Weight::from_parts(43_421, 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: `127 + p * (37 ±0)`
|
||||
// Estimated: `4706`
|
||||
// Minimum execution time: 27_554_000 picoseconds.
|
||||
Weight::from_parts(28_545_861, 0)
|
||||
.saturating_add(Weight::from_parts(0, 4706))
|
||||
// Standard Error: 2_208
|
||||
.saturating_add(Weight::from_parts(43_109, 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: `127 + p * (37 ±0)`
|
||||
// Estimated: `4706`
|
||||
// Minimum execution time: 27_032_000 picoseconds.
|
||||
Weight::from_parts(27_806_016, 0)
|
||||
.saturating_add(Weight::from_parts(0, 4706))
|
||||
// Standard Error: 1_267
|
||||
.saturating_add(Weight::from_parts(39_725, 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: `139`
|
||||
// Estimated: `4706`
|
||||
// Minimum execution time: 29_816_000 picoseconds.
|
||||
Weight::from_parts(30_613_421, 0)
|
||||
.saturating_add(Weight::from_parts(0, 4706))
|
||||
// Standard Error: 1_154
|
||||
.saturating_add(Weight::from_parts(12_164, 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: `164 + p * (37 ±0)`
|
||||
// Estimated: `4706`
|
||||
// Minimum execution time: 27_949_000 picoseconds.
|
||||
Weight::from_parts(28_784_363, 0)
|
||||
.saturating_add(Weight::from_parts(0, 4706))
|
||||
// Standard Error: 1_418
|
||||
.saturating_add(Weight::from_parts(43_671, 0).saturating_mul(p.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
|
||||
//! Autogenerated weights for `pallet_session`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/parachain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=results-pallet_session.json
|
||||
// --pallet=pallet_session
|
||||
// --chain=dev
|
||||
// --output=new-benchmarks/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: `Session::NextKeys` (r:1 w:1)
|
||||
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `Session::KeyOwner` (r:1 w:1)
|
||||
/// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn set_keys() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `298`
|
||||
// Estimated: `3763`
|
||||
// Minimum execution time: 21_752_000 picoseconds.
|
||||
Weight::from_parts(22_330_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3763))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `Session::NextKeys` (r:1 w:1)
|
||||
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `Session::KeyOwner` (r:0 w:1)
|
||||
/// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn purge_keys() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `280`
|
||||
// Estimated: `3745`
|
||||
// Minimum execution time: 15_661_000 picoseconds.
|
||||
Weight::from_parts(16_188_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3745))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
|
||||
//! Autogenerated weights for `pallet_sudo`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/parachain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=results-pallet_sudoo.json
|
||||
// --pallet=pallet_sudo
|
||||
// --chain=dev
|
||||
// --output=new-benchmarks/pallet_sudo.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_sudo`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_sudo::WeightInfo for WeightInfo<T> {
|
||||
/// Storage: `Sudo::Key` (r:1 w:1)
|
||||
/// Proof: `Sudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
|
||||
fn set_key() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `98`
|
||||
// Estimated: `1517`
|
||||
// Minimum execution time: 11_689_000 picoseconds.
|
||||
Weight::from_parts(12_230_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1517))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Sudo::Key` (r:1 w:0)
|
||||
/// Proof: `Sudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
|
||||
fn sudo() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `98`
|
||||
// Estimated: `1517`
|
||||
// Minimum execution time: 13_177_000 picoseconds.
|
||||
Weight::from_parts(13_585_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1517))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
}
|
||||
/// Storage: `Sudo::Key` (r:1 w:0)
|
||||
/// Proof: `Sudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
|
||||
fn sudo_as() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `98`
|
||||
// Estimated: `1517`
|
||||
// Minimum execution time: 13_108_000 picoseconds.
|
||||
Weight::from_parts(13_292_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1517))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
}
|
||||
/// Storage: `Sudo::Key` (r:1 w:1)
|
||||
/// Proof: `Sudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
|
||||
fn remove_key() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `98`
|
||||
// Estimated: `1517`
|
||||
// Minimum execution time: 10_717_000 picoseconds.
|
||||
Weight::from_parts(11_101_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1517))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
|
||||
//! Autogenerated weights for `pallet_timestamp`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/parachain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=results-pallet_timestamp.json
|
||||
// --pallet=pallet_timestamp
|
||||
// --chain=dev
|
||||
// --output=new-benchmarks/pallet_timestamp.rs
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use core::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_timestamp`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_timestamp::WeightInfo for WeightInfo<T> {
|
||||
/// Storage: `Timestamp::Now` (r:1 w:1)
|
||||
/// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
|
||||
/// Storage: `Aura::CurrentSlot` (r:1 w:0)
|
||||
/// Proof: `Aura::CurrentSlot` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
|
||||
fn set() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `86`
|
||||
// Estimated: `1493`
|
||||
// Minimum execution time: 9_158_000 picoseconds.
|
||||
Weight::from_parts(9_527_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1493))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
fn on_finalize() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `57`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 3_510_000 picoseconds.
|
||||
Weight::from_parts(3_645_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
//! Autogenerated weights for `pallet_utility`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/parachain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=results-pallet_utility.json
|
||||
// --pallet=pallet_utility
|
||||
// --chain=dev
|
||||
// --output=new-benchmarks/pallet_utility.rs
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use core::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_utility`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_utility::WeightInfo for WeightInfo<T> {
|
||||
/// The range of component `c` is `[0, 1000]`.
|
||||
fn batch(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 6_057_000 picoseconds.
|
||||
Weight::from_parts(4_367_274, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
// Standard Error: 2_090
|
||||
.saturating_add(Weight::from_parts(4_008_467, 0).saturating_mul(c.into()))
|
||||
}
|
||||
fn as_derivative() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 5_860_000 picoseconds.
|
||||
Weight::from_parts(6_000_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
}
|
||||
/// The range of component `c` is `[0, 1000]`.
|
||||
fn batch_all(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 6_017_000 picoseconds.
|
||||
Weight::from_parts(12_194_196, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
// Standard Error: 1_988
|
||||
.saturating_add(Weight::from_parts(4_264_201, 0).saturating_mul(c.into()))
|
||||
}
|
||||
fn dispatch_as() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 8_543_000 picoseconds.
|
||||
Weight::from_parts(8_753_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
}
|
||||
/// The range of component `c` is `[0, 1000]`.
|
||||
fn force_batch(c: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 5_875_000 picoseconds.
|
||||
Weight::from_parts(12_733_935, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
// Standard Error: 1_667
|
||||
.saturating_add(Weight::from_parts(3_957_502, 0).saturating_mul(c.into()))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
|
||||
//! Autogenerated weights for `pallet_xcm`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
|
||||
//! DATE: 2024-04-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `ip-172-31-15-118`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/release/parachain-template-node
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=results-pallet_xcm.json
|
||||
// --pallet=pallet_xcm
|
||||
// --chain=dev
|
||||
// --output=new-benchmarks/pallet_xcm.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_xcm`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
|
||||
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
|
||||
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
|
||||
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn send() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6`
|
||||
// Estimated: `1491`
|
||||
// Minimum execution time: 17_955_000 picoseconds.
|
||||
Weight::from_parts(18_187_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1491))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
|
||||
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
|
||||
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn send_blob() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6`
|
||||
// Estimated: `1491`
|
||||
// Minimum execution time: 18_092_000 picoseconds.
|
||||
Weight::from_parts(18_246_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1491))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Benchmark::Override` (r:0 w:0)
|
||||
/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn teleport_assets() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
|
||||
Weight::from_parts(18_446_744_073_709_551_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
}
|
||||
/// Storage: `Benchmark::Override` (r:0 w:0)
|
||||
/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn reserve_transfer_assets() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
|
||||
Weight::from_parts(18_446_744_073_709_551_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
}
|
||||
/// Storage: `Benchmark::Override` (r:0 w:0)
|
||||
/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn transfer_assets() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
|
||||
Weight::from_parts(18_446_744_073_709_551_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
}
|
||||
/// Storage: `Benchmark::Override` (r:0 w:0)
|
||||
/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn execute() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
|
||||
Weight::from_parts(18_446_744_073_709_551_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
}
|
||||
/// Storage: `Benchmark::Override` (r:0 w:0)
|
||||
/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn execute_blob() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
|
||||
Weight::from_parts(18_446_744_073_709_551_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::SupportedVersion` (r:0 w:1)
|
||||
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn force_xcm_version() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 9_556_000 picoseconds.
|
||||
Weight::from_parts(9_862_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
fn force_default_xcm_version() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 3_017_000 picoseconds.
|
||||
Weight::from_parts(3_204_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::VersionNotifiers` (r:1 w:1)
|
||||
/// Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `PolkadotXcm::QueryCounter` (r:1 w:1)
|
||||
/// Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
|
||||
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
|
||||
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `PolkadotXcm::Queries` (r:0 w:1)
|
||||
/// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn force_subscribe_version_notify() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6`
|
||||
// Estimated: `3471`
|
||||
// Minimum execution time: 25_492_000 picoseconds.
|
||||
Weight::from_parts(25_934_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3471))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(4))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::VersionNotifiers` (r:1 w:1)
|
||||
/// Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
|
||||
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
|
||||
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `PolkadotXcm::Queries` (r:0 w:1)
|
||||
/// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn force_unsubscribe_version_notify() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `99`
|
||||
// Estimated: `3564`
|
||||
// Minimum execution time: 26_759_000 picoseconds.
|
||||
Weight::from_parts(27_099_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3564))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::XcmExecutionSuspended` (r:0 w:1)
|
||||
/// Proof: `PolkadotXcm::XcmExecutionSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn force_suspension() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 2_982_000 picoseconds.
|
||||
Weight::from_parts(3_212_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::SupportedVersion` (r:5 w:2)
|
||||
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn migrate_supported_version() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `23`
|
||||
// Estimated: `13388`
|
||||
// Minimum execution time: 21_454_000 picoseconds.
|
||||
Weight::from_parts(21_914_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 13388))
|
||||
.saturating_add(T::DbWeight::get().reads(5))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::VersionNotifiers` (r:5 w:2)
|
||||
/// Proof: `PolkadotXcm::VersionNotifiers` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn migrate_version_notifiers() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `27`
|
||||
// Estimated: `13392`
|
||||
// Minimum execution time: 21_476_000 picoseconds.
|
||||
Weight::from_parts(21_886_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 13392))
|
||||
.saturating_add(T::DbWeight::get().reads(5))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::VersionNotifyTargets` (r:6 w:0)
|
||||
/// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn already_notified_target() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `40`
|
||||
// Estimated: `15880`
|
||||
// Minimum execution time: 22_903_000 picoseconds.
|
||||
Weight::from_parts(23_384_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 15880))
|
||||
.saturating_add(T::DbWeight::get().reads(6))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::VersionNotifyTargets` (r:2 w:1)
|
||||
/// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
|
||||
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
|
||||
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn notify_current_targets() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `40`
|
||||
// Estimated: `5980`
|
||||
// Minimum execution time: 23_670_000 picoseconds.
|
||||
Weight::from_parts(24_355_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 5980))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::VersionNotifyTargets` (r:4 w:0)
|
||||
/// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn notify_target_migration_fail() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `70`
|
||||
// Estimated: `10960`
|
||||
// Minimum execution time: 15_093_000 picoseconds.
|
||||
Weight::from_parts(15_560_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 10960))
|
||||
.saturating_add(T::DbWeight::get().reads(4))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::VersionNotifyTargets` (r:5 w:2)
|
||||
/// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn migrate_version_notify_targets() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `34`
|
||||
// Estimated: `13399`
|
||||
// Minimum execution time: 21_702_000 picoseconds.
|
||||
Weight::from_parts(22_220_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 13399))
|
||||
.saturating_add(T::DbWeight::get().reads(5))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::VersionNotifyTargets` (r:5 w:2)
|
||||
/// Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
|
||||
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
|
||||
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn migrate_and_notify_old_targets() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `40`
|
||||
// Estimated: `13405`
|
||||
// Minimum execution time: 35_406_000 picoseconds.
|
||||
Weight::from_parts(36_309_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 13405))
|
||||
.saturating_add(T::DbWeight::get().reads(7))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::QueryCounter` (r:1 w:1)
|
||||
/// Proof: `PolkadotXcm::QueryCounter` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `PolkadotXcm::Queries` (r:0 w:1)
|
||||
/// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn new_query() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `1485`
|
||||
// Minimum execution time: 3_502_000 picoseconds.
|
||||
Weight::from_parts(3_538_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1485))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::Queries` (r:1 w:1)
|
||||
/// Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn take_response() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `7576`
|
||||
// Estimated: `11041`
|
||||
// Minimum execution time: 32_124_000 picoseconds.
|
||||
Weight::from_parts(32_520_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 11041))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `PolkadotXcm::AssetTraps` (r:1 w:1)
|
||||
/// Proof: `PolkadotXcm::AssetTraps` (`max_values`: None, `max_size`: None, mode: `Measured`)
|
||||
fn claim_assets() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `24`
|
||||
// Estimated: `3489`
|
||||
// Minimum execution time: 46_695_000 picoseconds.
|
||||
Weight::from_parts(47_562_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 3489))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, 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: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||
write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_db_weights {
|
||||
use frame_support::weights::constants;
|
||||
|
||||
use super::constants::ParityDbWeight as W;
|
||||
|
||||
/// 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 sane() {
|
||||
// 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."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod constants {
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
weights::{constants, RuntimeDbWeight},
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||
/// the runtime.
|
||||
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||
read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||
write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_db_weights {
|
||||
use frame_support::weights::constants;
|
||||
|
||||
use super::constants::RocksDbWeight as W;
|
||||
|
||||
/// 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 sane() {
|
||||
// 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."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::{ConstU32, Contains, Everything, Get, Nothing, PalletInfoAccess},
|
||||
weights::Weight,
|
||||
PalletId,
|
||||
};
|
||||
use frame_system::EnsureRoot;
|
||||
use pallet_xcm::XcmPassthrough;
|
||||
use polkadot_parachain_primitives::primitives::{self, Sibling};
|
||||
use polkadot_runtime_common::impls::ToAuthor;
|
||||
use sp_runtime::traits::AccountIdConversion;
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom,
|
||||
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FixedWeightBounds,
|
||||
FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter, IsChildSystemParachain,
|
||||
IsConcrete, NativeAsset, NoChecking, ParentIsPreset, RelayChainAsNative,
|
||||
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
|
||||
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
|
||||
UsingComponents, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
|
||||
XcmFeeToAccount,
|
||||
};
|
||||
use xcm_executor::XcmExecutor;
|
||||
|
||||
use super::{
|
||||
weights, AccountId, AllPalletsWithSystem, Assets, Balance, Balances, ParachainInfo,
|
||||
ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee,
|
||||
XcmpQueue,
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
pub const RelayLocation: Location = Location::parent();
|
||||
pub const RelayNetwork: Option<NetworkId> = None;
|
||||
pub PlaceholderAccount: AccountId = PolkadotXcm::check_account();
|
||||
pub AssetsPalletLocation: Location =
|
||||
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
|
||||
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||
pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into();
|
||||
}
|
||||
|
||||
/// `AssetId/Balancer` converter for `TrustBackedAssets`
|
||||
pub type TrustBackedAssetsConvertedConcreteId =
|
||||
assets_common::TrustBackedAssetsConvertedConcreteId<AssetsPalletLocation, Balance>;
|
||||
|
||||
/// Type for specifying how a `Location` can be converted into an
|
||||
/// `AccountId`. This is used when determining ownership of accounts for asset
|
||||
/// transacting and when attempting to use XCM `Transact` in order to determine
|
||||
/// the dispatch Origin.
|
||||
pub type LocationToAccountId = (
|
||||
// The parent (Relay-chain) origin converts to the parent `AccountId`.
|
||||
ParentIsPreset<AccountId>,
|
||||
// Sibling parachain origins convert to AccountId via the `ParaId::into`.
|
||||
SiblingParachainConvertsVia<Sibling, AccountId>,
|
||||
// Straight up local `AccountId32` origins just alias directly to `AccountId`.
|
||||
AccountId32Aliases<RelayNetwork, AccountId>,
|
||||
);
|
||||
|
||||
/// Means for transacting assets on this chain.
|
||||
pub type LocalAssetTransactor = FungibleAdapter<
|
||||
// Use this currency:
|
||||
Balances,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
IsConcrete<RelayLocation>,
|
||||
// Do a simple punn to convert an AccountId32 Location into a native chain account ID:
|
||||
LocationToAccountId,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
AccountId,
|
||||
// We don't track any teleports.
|
||||
(),
|
||||
>;
|
||||
|
||||
/// Means for transacting assets besides the native currency on this chain.
|
||||
pub type LocalFungiblesTransactor = FungiblesAdapter<
|
||||
// Use this fungibles implementation:
|
||||
Assets,
|
||||
// Use this currency when it is a fungible asset matching the given location or name:
|
||||
TrustBackedAssetsConvertedConcreteId,
|
||||
// Convert an XCM MultiLocation into a local account id:
|
||||
LocationToAccountId,
|
||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||
AccountId,
|
||||
// We don't track any teleports of `Assets`.
|
||||
NoChecking,
|
||||
// We don't track any teleports of `Assets`, but a placeholder account is provided due to trait
|
||||
// bounds.
|
||||
PlaceholderAccount,
|
||||
>;
|
||||
|
||||
/// Means for transacting assets on this chain.
|
||||
pub type AssetTransactors = (LocalAssetTransactor, LocalFungiblesTransactor);
|
||||
|
||||
/// This is the type we use to convert an (incoming) XCM origin into a local
|
||||
/// `Origin` instance, ready for dispatching a transaction with Xcm's
|
||||
/// `Transact`. There is an `OriginKind` which can biases the kind of local
|
||||
/// `Origin` it will become.
|
||||
pub type XcmOriginToTransactDispatchOrigin = (
|
||||
// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
|
||||
// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
|
||||
// foreign chains who want to have a local sovereign account on this chain which they control.
|
||||
SovereignSignedViaLocation<LocationToAccountId, RuntimeOrigin>,
|
||||
// Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when
|
||||
// recognized.
|
||||
RelayChainAsNative<RelayChainOrigin, RuntimeOrigin>,
|
||||
// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
|
||||
// recognized.
|
||||
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, RuntimeOrigin>,
|
||||
// Native signed account converter; this just converts an `AccountId32` origin into a normal
|
||||
// `RuntimeOrigin::Signed` origin of the same 32-byte value.
|
||||
SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,
|
||||
// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.
|
||||
XcmPassthrough<RuntimeOrigin>,
|
||||
);
|
||||
|
||||
// This is a workaround. We have added Treasury in the master and it will be added in the next release.
|
||||
// We will collect fees on this pseudo treasury account until Treasury is rolled out.
|
||||
// When treasury will be introduced, it will use the same account for fee collection so transition should be smooth.
|
||||
pub struct TreasuryAccount;
|
||||
|
||||
impl Get<AccountId> for TreasuryAccount {
|
||||
fn get() -> AccountId {
|
||||
const ID: PalletId = PalletId(*b"py/trsry");
|
||||
AccountIdConversion::<AccountId>::into_account_truncating(&ID)
|
||||
}
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
|
||||
pub const UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
pub const MaxAssetsIntoHolding: u32 = 64;
|
||||
}
|
||||
|
||||
pub struct ParentOrParentsExecutivePlurality;
|
||||
impl Contains<Location> for ParentOrParentsExecutivePlurality {
|
||||
fn contains(location: &Location) -> bool {
|
||||
matches!(location.unpack(), (1, []) | (1, [Plurality { id: BodyId::Executive, .. }]))
|
||||
}
|
||||
}
|
||||
|
||||
pub type Barrier = TrailingSetTopicAsId<
|
||||
DenyThenTry<
|
||||
DenyReserveTransferToRelayChain,
|
||||
(
|
||||
TakeWeightCredit,
|
||||
WithComputedOrigin<
|
||||
(
|
||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||
AllowExplicitUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
|
||||
// ^^^ Parent and its exec plurality get free execution
|
||||
),
|
||||
UniversalLocation,
|
||||
ConstU32<8>,
|
||||
>,
|
||||
),
|
||||
>,
|
||||
>;
|
||||
|
||||
pub struct XcmConfig;
|
||||
impl xcm_executor::Config for XcmConfig {
|
||||
type Aliasers = Nothing;
|
||||
type AssetClaims = PolkadotXcm;
|
||||
type AssetExchanger = ();
|
||||
type AssetLocker = ();
|
||||
// How to withdraw and deposit an asset.
|
||||
type AssetTransactor = AssetTransactors;
|
||||
type AssetTrap = PolkadotXcm;
|
||||
type Barrier = Barrier;
|
||||
type CallDispatcher = RuntimeCall;
|
||||
type FeeManager = XcmFeeManagerFromComponents<
|
||||
IsChildSystemParachain<primitives::Id>,
|
||||
XcmFeeToAccount<Self::AssetTransactor, AccountId, TreasuryAccount>,
|
||||
>;
|
||||
type HrmpChannelAcceptedHandler = ();
|
||||
type HrmpChannelClosingHandler = ();
|
||||
type HrmpNewChannelOpenRequestHandler = ();
|
||||
type IsReserve = NativeAsset;
|
||||
type IsTeleporter = ();
|
||||
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
|
||||
type MessageExporter = ();
|
||||
type OriginConverter = XcmOriginToTransactDispatchOrigin;
|
||||
type PalletInstancesInfo = AllPalletsWithSystem;
|
||||
type ResponseHandler = PolkadotXcm;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type SafeCallFilter = Everything;
|
||||
type SubscriptionService = PolkadotXcm;
|
||||
type Trader =
|
||||
UsingComponents<WeightToFee, RelayLocation, AccountId, Balances, ToAuthor<Runtime>>;
|
||||
type TransactionalProcessor = FrameTransactionalProcessor;
|
||||
type UniversalAliases = Nothing;
|
||||
// Teleporting is disabled.
|
||||
type UniversalLocation = UniversalLocation;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
|
||||
type XcmSender = XcmRouter;
|
||||
}
|
||||
|
||||
/// No local origins on this chain are allowed to dispatch XCM sends/executions.
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
|
||||
|
||||
/// The means for routing XCM messages which are not for local execution into
|
||||
/// the right message queues.
|
||||
pub type XcmRouter = WithUniqueTopic<(
|
||||
// Two routers - use UMP to communicate with the relay chain:
|
||||
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, (), ()>,
|
||||
// ..and XCMP to communicate with the sibling chains.
|
||||
XcmpQueue,
|
||||
)>;
|
||||
|
||||
parameter_types! {
|
||||
pub const MaxLockers: u32 = 8;
|
||||
pub const MaxRemoteLockConsumers: u32 = 0;
|
||||
}
|
||||
|
||||
impl pallet_xcm::Config for Runtime {
|
||||
type AdminOrigin = EnsureRoot<AccountId>;
|
||||
// ^ Override for AdvertisedXcmVersion default
|
||||
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
|
||||
type Currency = Balances;
|
||||
type CurrencyMatcher = ();
|
||||
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type MaxLockers = MaxLockers;
|
||||
type MaxRemoteLockConsumers = MaxLockers;
|
||||
type RemoteLockConsumerIdentifier = ();
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
|
||||
type SovereignAccountOf = LocationToAccountId;
|
||||
type TrustedLockers = ();
|
||||
type UniversalLocation = UniversalLocation;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
|
||||
type WeightInfo = weights::pallet_xcm::WeightInfo<Runtime>;
|
||||
type XcmExecuteFilter = Nothing;
|
||||
// ^ Disable dispatchable execute on the XCM pallet.
|
||||
// Needs to be `Everything` for local testing.
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmReserveTransferFilter = Nothing;
|
||||
type XcmRouter = XcmRouter;
|
||||
type XcmTeleportFilter = Nothing;
|
||||
|
||||
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
|
||||
}
|
||||
|
||||
impl cumulus_pallet_xcm::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// ExtBuilder impl for all runtime integration tests
|
||||
use frame_support::weights::Weight;
|
||||
use parachain_template_runtime::{BuildStorage, Runtime, System};
|
||||
|
||||
pub fn run_with_system_weight<F: FnMut()>(w: Weight, mut assertions: F) {
|
||||
let mut t: sp_io::TestExternalities =
|
||||
frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap().into();
|
||||
t.execute_with(|| {
|
||||
System::set_block_consumed_resources(w, 0);
|
||||
assertions()
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
mod constant_tests {
|
||||
use parachain_template_runtime::constants::currency::*;
|
||||
|
||||
#[test]
|
||||
fn test_constants() {
|
||||
assert_eq!(MICROCENTS, 1_000_000);
|
||||
|
||||
assert_eq!(MILLICENTS, 1_000_000_000);
|
||||
|
||||
assert_eq!(CENTS, 1_000 * MILLICENTS);
|
||||
|
||||
assert_eq!(DOLLARS, 100 * CENTS);
|
||||
|
||||
assert_eq!(EXISTENTIAL_DEPOSIT, MILLICENTS);
|
||||
|
||||
// Ensure deposit function behavior remains constant
|
||||
assert_eq!(deposit(2, 3), 2 * 15 * CENTS + 3 * 6 * CENTS);
|
||||
}
|
||||
}
|
||||
|
||||
mod runtime_tests {
|
||||
use frame_support::{pallet_prelude::Weight, traits::TypedGet, PalletId};
|
||||
use parachain_template_runtime::{constants::currency::*, *};
|
||||
use xcm::latest::prelude::BodyId;
|
||||
|
||||
#[test]
|
||||
fn weight_to_fee_constants() {
|
||||
assert_eq!(P_FACTOR, 10);
|
||||
|
||||
assert_eq!(Q_FACTOR, 100);
|
||||
|
||||
assert_eq!(POLY_DEGREE, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn frame_system_constants() {
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
assert_eq!(
|
||||
MAXIMUM_BLOCK_WEIGHT,
|
||||
Weight::from_parts(
|
||||
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
|
||||
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64
|
||||
)
|
||||
);
|
||||
|
||||
#[cfg(feature = "async-backing")]
|
||||
assert_eq!(
|
||||
MAXIMUM_BLOCK_WEIGHT,
|
||||
Weight::from_parts(
|
||||
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
|
||||
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64
|
||||
)
|
||||
);
|
||||
|
||||
assert_eq!(AVERAGE_ON_INITIALIZE_RATIO, Perbill::from_percent(5));
|
||||
|
||||
assert_eq!(NORMAL_DISPATCH_RATIO, Perbill::from_percent(75));
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
assert_eq!(UNINCLUDED_SEGMENT_CAPACITY, 1);
|
||||
#[cfg(feature = "async-backing")]
|
||||
assert_eq!(UNINCLUDED_SEGMENT_CAPACITY, 3);
|
||||
|
||||
assert_eq!(BLOCK_PROCESSING_VELOCITY, 1);
|
||||
|
||||
assert_eq!(RELAY_CHAIN_SLOT_DURATION_MILLIS, 6000);
|
||||
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
assert_eq!(MILLISECS_PER_BLOCK, 12000);
|
||||
#[cfg(feature = "async-backing")]
|
||||
assert_eq!(MILLISECS_PER_BLOCK, 6000);
|
||||
|
||||
assert_eq!(SLOT_DURATION, MILLISECS_PER_BLOCK);
|
||||
|
||||
assert_eq!(MINUTES, 60_000 / (MILLISECS_PER_BLOCK as BlockNumber));
|
||||
|
||||
assert_eq!(HOURS, MINUTES * 60);
|
||||
|
||||
assert_eq!(DAYS, HOURS * 24);
|
||||
|
||||
assert_eq!(MAX_BLOCK_LENGTH, 5 * 1024 * 1024);
|
||||
|
||||
assert_eq!(SS58Prefix::get(), 42);
|
||||
|
||||
assert_eq!(<Runtime as frame_system::Config>::MaxConsumers::get(), 16);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn proxy_constants() {
|
||||
assert_eq!(MaxProxies::get(), 32);
|
||||
|
||||
assert_eq!(MaxPending::get(), 32);
|
||||
|
||||
assert_eq!(ProxyDepositBase::get(), deposit(1, 40));
|
||||
|
||||
assert_eq!(AnnouncementDepositBase::get(), deposit(1, 48));
|
||||
|
||||
assert_eq!(ProxyDepositFactor::get(), deposit(0, 33));
|
||||
|
||||
assert_eq!(AnnouncementDepositFactor::get(), deposit(0, 66));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn balances_constants() {
|
||||
assert_eq!(MaxFreezes::get(), 0);
|
||||
|
||||
assert_eq!(MaxLocks::get(), 50);
|
||||
|
||||
assert_eq!(MaxReserves::get(), 50);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn assets_constants() {
|
||||
assert_eq!(AssetDeposit::get(), 10 * CENTS);
|
||||
|
||||
assert_eq!(AssetAccountDeposit::get(), deposit(1, 16));
|
||||
|
||||
assert_eq!(ApprovalDeposit::get(), EXISTENTIAL_DEPOSIT);
|
||||
|
||||
assert_eq!(StringLimit::get(), 50);
|
||||
|
||||
assert_eq!(MetadataDepositBase::get(), deposit(1, 68));
|
||||
|
||||
assert_eq!(MetadataDepositPerByte::get(), deposit(0, 1));
|
||||
|
||||
assert_eq!(RemoveItemsLimit::get(), 1000);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transaction_payment_constants() {
|
||||
assert_eq!(TransactionByteFee::get(), 10 * MICROCENTS);
|
||||
|
||||
assert_eq!(OperationalFeeMultiplier::get(), 5);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cumulus_pallet_parachain_system_constants() {
|
||||
assert_eq!(ReservedXcmpWeight::get(), MAXIMUM_BLOCK_WEIGHT.saturating_div(4));
|
||||
|
||||
assert_eq!(ReservedDmpWeight::get(), MAXIMUM_BLOCK_WEIGHT.saturating_div(4));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn message_queue_constants() {
|
||||
assert_eq!(HeapSize::get(), 64 * 1024);
|
||||
assert_eq!(MaxStale::get(), 8);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cumulus_pallet_xcmp_queue_constants() {
|
||||
assert_eq!(MaxInboundSuspended::get(), 1000);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multisig_constants() {
|
||||
assert_eq!(DepositBase::get(), deposit(1, 88));
|
||||
|
||||
assert_eq!(DepositFactor::get(), deposit(0, 32));
|
||||
|
||||
assert_eq!(MaxSignatories::get(), 100);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn session_constants() {
|
||||
assert_eq!(Period::get(), 6 * HOURS);
|
||||
|
||||
assert_eq!(Offset::get(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[allow(clippy::assertions_on_constants)]
|
||||
fn aura_constants() {
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
assert!(!AllowMultipleBlocksPerSlot::get());
|
||||
#[cfg(feature = "async-backing")]
|
||||
assert!(AllowMultipleBlocksPerSlot::get());
|
||||
|
||||
assert_eq!(MaxAuthorities::get(), 100_000);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn collator_selection_constants() {
|
||||
let pallet_id_to_string = |id: PalletId| -> String {
|
||||
core::str::from_utf8(&id.0).unwrap_or_default().to_string()
|
||||
};
|
||||
|
||||
assert_eq!(pallet_id_to_string(PotId::get()), pallet_id_to_string(PalletId(*b"PotStake")));
|
||||
|
||||
assert_eq!(SessionLength::get(), 6 * HOURS);
|
||||
|
||||
assert_eq!(StakingAdminBodyId::get(), BodyId::Defense);
|
||||
|
||||
assert_eq!(MaxCandidates::get(), 100);
|
||||
|
||||
assert_eq!(MaxInvulnerables::get(), 20);
|
||||
|
||||
assert_eq!(MinEligibleCollators::get(), 4);
|
||||
}
|
||||
}
|
||||
|
||||
mod xcm_tests {
|
||||
use frame_support::weights::Weight;
|
||||
use parachain_template_runtime::xcm_config::*;
|
||||
|
||||
#[test]
|
||||
fn xcm_executor_constants() {
|
||||
assert_eq!(UnitWeightCost::get(), Weight::from_parts(1_000_000_000, 64 * 1024));
|
||||
assert_eq!(MaxInstructions::get(), 100);
|
||||
assert_eq!(MaxAssetsIntoHolding::get(), 64);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pallet_xcm_constants() {
|
||||
assert_eq!(MaxLockers::get(), 8);
|
||||
assert_eq!(MaxRemoteLockConsumers::get(), 0);
|
||||
assert_eq!(<parachain_template_runtime::Runtime as pallet_xcm::Config>::VERSION_DISCOVERY_QUEUE_SIZE, 100);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// Integration transaction weight-fee tests
|
||||
mod common;
|
||||
use common::*;
|
||||
use frame_support::pallet_prelude::*;
|
||||
use pallet_transaction_payment::Multiplier;
|
||||
use parachain_template_runtime::{Runtime, RuntimeBlockWeights};
|
||||
use polkadot_runtime_common::MinimumMultiplier;
|
||||
use sp_runtime::{traits::Convert, Perquintill};
|
||||
|
||||
fn min_multiplier() -> Multiplier {
|
||||
MinimumMultiplier::get()
|
||||
}
|
||||
|
||||
fn target() -> Weight {
|
||||
Perquintill::from_percent(25)
|
||||
* RuntimeBlockWeights::get().get(DispatchClass::Normal).max_total.unwrap()
|
||||
}
|
||||
|
||||
fn runtime_multiplier_update(fm: Multiplier) -> Multiplier {
|
||||
<Runtime as pallet_transaction_payment::Config>::FeeMultiplierUpdate::convert(fm)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multiplier_can_grow_from_zero() {
|
||||
// if the min is too small, then this will not change, and we are doomed forever.
|
||||
// the block ref time is 1/100th bigger than target.
|
||||
run_with_system_weight(target().set_ref_time(target().ref_time() * 101 / 100), || {
|
||||
let next = runtime_multiplier_update(min_multiplier());
|
||||
assert!(next > min_multiplier(), "{:?} !> {:?}", next, min_multiplier());
|
||||
});
|
||||
|
||||
// the block proof size is 1/100th bigger than target.
|
||||
run_with_system_weight(target().set_proof_size((target().proof_size() / 100) * 101), || {
|
||||
let next = runtime_multiplier_update(min_multiplier());
|
||||
assert!(next > min_multiplier(), "{:?} !> {:?}", next, min_multiplier());
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multiplier_cannot_go_below_limit() {
|
||||
// will not go any further below even if block is empty.
|
||||
run_with_system_weight(Weight::zero(), || {
|
||||
let next = runtime_multiplier_update(min_multiplier());
|
||||
assert_eq!(next, min_multiplier());
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Storage indices integration checks
|
||||
use frame_support::traits::PalletInfo;
|
||||
use parachain_template_runtime::{
|
||||
Aura, AuraExt, Authorship, Balances, CollatorSelection, CumulusXcm, MessageQueue, Multisig,
|
||||
ParachainInfo, ParachainSystem, PolkadotXcm, Proxy, Runtime, Session, Sudo, System, Timestamp,
|
||||
TransactionPayment, XcmpQueue,
|
||||
};
|
||||
|
||||
fn assert_pallet_prefix<P: 'static>(name: &str) {
|
||||
assert_eq!(<Runtime as frame_system::Config>::PalletInfo::name::<P>(), Some(name));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn verify_pallet_prefixes() {
|
||||
assert_pallet_prefix::<System>("System");
|
||||
assert_pallet_prefix::<ParachainSystem>("ParachainSystem");
|
||||
assert_pallet_prefix::<Timestamp>("Timestamp");
|
||||
assert_pallet_prefix::<ParachainInfo>("ParachainInfo");
|
||||
assert_pallet_prefix::<Proxy>("Proxy");
|
||||
assert_pallet_prefix::<Balances>("Balances");
|
||||
assert_pallet_prefix::<TransactionPayment>("TransactionPayment");
|
||||
assert_pallet_prefix::<Sudo>("Sudo");
|
||||
assert_pallet_prefix::<Multisig>("Multisig");
|
||||
assert_pallet_prefix::<Authorship>("Authorship");
|
||||
assert_pallet_prefix::<CollatorSelection>("CollatorSelection");
|
||||
assert_pallet_prefix::<Session>("Session");
|
||||
assert_pallet_prefix::<Aura>("Aura");
|
||||
assert_pallet_prefix::<AuraExt>("AuraExt");
|
||||
assert_pallet_prefix::<XcmpQueue>("XcmpQueue");
|
||||
assert_pallet_prefix::<PolkadotXcm>("PolkadotXcm");
|
||||
assert_pallet_prefix::<CumulusXcm>("CumulusXcm");
|
||||
assert_pallet_prefix::<MessageQueue>("MessageQueue");
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2024-02-17"
|
||||
targets = ["wasm32-unknown-unknown"]
|
||||
components = ["rustfmt", "clippy", "rust-src"]
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
format_macro_bodies = true
|
||||
format_macro_matchers = true
|
||||
format_strings = true
|
||||
imports_granularity = "Crate"
|
||||
match_arm_blocks = false
|
||||
reorder_impl_items = true
|
||||
group_imports = "StdExternalCrate"
|
||||
use_field_init_shorthand = true
|
||||
use_small_heuristics = "Max"
|
||||
|
||||
# most of these are unstable, so we enable them
|
||||
unstable_features = true
|
||||
|
||||
|
||||
# wanted to enable below, but they are removing the documentation comments if there is an empty line in between
|
||||
# wrap_comments = true
|
||||
# format_code_in_doc_comments = true
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
find . -name "Cargo.toml" -not -path "*/target/*" -exec toml-sort {} \;
|
||||
|
||||
CMD="git diff --name-only"
|
||||
|
||||
stdbuf -oL $CMD | {
|
||||
while IFS= read -r line; do
|
||||
echo ║ $line
|
||||
if [[ "$line" == *"Cargo.toml" ]]; then
|
||||
echo "Check fails: $line"
|
||||
echo "Please run './scripts/toml-sort.sh' to format Cargo.toml files properly."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# From the workspace directory, run :
|
||||
# ./scripts/toml-sort.sh
|
||||
# to format all Cargo.toml files, and
|
||||
# ./scripts/toml-sort.sh --check
|
||||
# to only check the formatting.
|
||||
|
||||
if ! type "toml-sort" > /dev/null; then
|
||||
echo "Run 'cargo install --git https://github.com/4meta5/toml_sort'"
|
||||
else
|
||||
find . -name "Cargo.toml" -not -path "*/target/*" -exec toml-sort {} $@ \;
|
||||
fi
|
||||
Executable
+102
@@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
|
||||
ZOMBIENET_V=v1.3.91
|
||||
POLKADOT_V=v1.6.0
|
||||
|
||||
case "$(uname -s)" in
|
||||
Linux*) MACHINE=Linux;;
|
||||
Darwin*) MACHINE=Mac;;
|
||||
*) exit 1
|
||||
esac
|
||||
|
||||
if [ $MACHINE = "Linux" ]; then
|
||||
ZOMBIENET_BIN=zombienet-linux-x64
|
||||
elif [ $MACHINE = "Mac" ]; then
|
||||
ZOMBIENET_BIN=zombienet-macos
|
||||
fi
|
||||
|
||||
BIN_DIR=bin-$POLKADOT_V
|
||||
|
||||
build_polkadot() {
|
||||
echo "cloning polkadot repository..."
|
||||
CWD=$(pwd)
|
||||
mkdir -p "$BIN_DIR"
|
||||
pushd /tmp
|
||||
git clone https://github.com/paritytech/polkadot-sdk.git
|
||||
pushd polkadot-sdk
|
||||
git checkout release-polkadot-$POLKADOT_V
|
||||
echo "building polkadot executable..."
|
||||
cargo build --release --features fast-runtime
|
||||
cp target/release/polkadot "$CWD/$BIN_DIR"
|
||||
cp target/release/polkadot-execute-worker "$CWD/$BIN_DIR"
|
||||
cp target/release/polkadot-prepare-worker "$CWD/$BIN_DIR"
|
||||
popd
|
||||
popd
|
||||
}
|
||||
|
||||
fetch_polkadot() {
|
||||
echo "fetching from polkadot repository..."
|
||||
echo $BIN_DIR
|
||||
mkdir -p "$BIN_DIR"
|
||||
pushd "$BIN_DIR"
|
||||
wget https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-$POLKADOT_V/polkadot
|
||||
wget https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-$POLKADOT_V/polkadot-execute-worker
|
||||
wget https://github.com/paritytech/polkadot-sdk/releases/download/polkadot-$POLKADOT_V/polkadot-prepare-worker
|
||||
chmod +x *
|
||||
popd
|
||||
}
|
||||
|
||||
zombienet_init() {
|
||||
if [ ! -f $ZOMBIENET_BIN ]; then
|
||||
echo "fetching zombienet executable..."
|
||||
curl -LO https://github.com/paritytech/zombienet/releases/download/$ZOMBIENET_V/$ZOMBIENET_BIN
|
||||
chmod +x $ZOMBIENET_BIN
|
||||
fi
|
||||
if [ ! -f $BIN_DIR/polkadot ]; then
|
||||
fetch_polkadot
|
||||
fi
|
||||
}
|
||||
|
||||
zombienet_build() {
|
||||
if [ ! -f $ZOMBIENET_BIN ]; then
|
||||
echo "fetching zombienet executable..."
|
||||
curl -LO https://github.com/paritytech/zombienet/releases/download/$ZOMBIENET_V/$ZOMBIENET_BIN
|
||||
chmod +x $ZOMBIENET_BIN
|
||||
fi
|
||||
if [ ! -f $BIN_DIR/polkadot ]; then
|
||||
build_polkadot
|
||||
fi
|
||||
}
|
||||
|
||||
zombienet_devnet() {
|
||||
zombienet_init
|
||||
cargo build --release
|
||||
echo "spawning rococo-local relay chain plus devnet as a parachain..."
|
||||
local dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
./$ZOMBIENET_BIN spawn "$dir/../zombienet-config/devnet.toml" -p native
|
||||
}
|
||||
|
||||
|
||||
print_help() {
|
||||
echo "This is a shell script to automate the execution of zombienet."
|
||||
echo ""
|
||||
echo "$ ./zombienet.sh init # fetches zombienet and polkadot executables"
|
||||
echo "$ ./zombienet.sh build # builds polkadot executables from source"
|
||||
echo "$ ./zombienet.sh devnet # spawns a rococo-local relay chain plus parachain devnet-local as a parachain"
|
||||
}
|
||||
|
||||
SUBCOMMAND=$1
|
||||
case $SUBCOMMAND in
|
||||
"" | "-h" | "--help")
|
||||
print_help
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
zombienet_${SUBCOMMAND} $@
|
||||
if [ $? = 127 ]; then
|
||||
echo "Error: '$SUBCOMMAND' is not a known SUBCOMMAND." >&2
|
||||
echo "Run './zombienet.sh --help' for a list of known subcommands." >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,60 @@
|
||||
[package]
|
||||
name = "template-fuzzer"
|
||||
version = "0.1.0"
|
||||
[package.authors]
|
||||
workspace = true
|
||||
[package.description]
|
||||
workspace = true
|
||||
[package.edition]
|
||||
workspace = true
|
||||
[package.license]
|
||||
workspace = true
|
||||
[package.repository]
|
||||
workspace = true
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
substrate-runtime-fuzzer = { workspace = true }
|
||||
ziggy = { workspace = true }
|
||||
|
||||
parachain-template-runtime = { path = "../runtime" }
|
||||
parachains-common = { workspace = true }
|
||||
|
||||
parity-scale-codec = { workspace = true }
|
||||
|
||||
frame-support = { workspace = true }
|
||||
frame-system = { workspace = true }
|
||||
|
||||
sp-consensus-aura = { workspace = true }
|
||||
sp-runtime = { workspace = true }
|
||||
sp-state-machine = { workspace = true }
|
||||
|
||||
pallet-balances = { workspace = true }
|
||||
pallet-timestamp = { workspace = true }
|
||||
|
||||
cumulus-pallet-parachain-system = { workspace = true }
|
||||
cumulus-primitives-core = { workspace = true }
|
||||
cumulus-primitives-parachain-inherent = { workspace = true }
|
||||
cumulus-test-relay-sproof-builder = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = [ "std", "try-runtime" ]
|
||||
std = [
|
||||
"frame-support/std",
|
||||
"pallet-timestamp/std",
|
||||
"parachain-template-runtime/std",
|
||||
"parity-scale-codec/std",
|
||||
"sp-consensus-aura/std",
|
||||
"sp-runtime/std",
|
||||
]
|
||||
try-runtime = [
|
||||
"frame-support/try-runtime",
|
||||
"frame-system/try-runtime",
|
||||
"pallet-timestamp/try-runtime",
|
||||
"parachain-template-runtime/try-runtime",
|
||||
"sp-runtime/try-runtime",
|
||||
]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -0,0 +1,12 @@
|
||||
FROM rust:1-buster
|
||||
USER root
|
||||
|
||||
RUN apt-get update && apt-get -y install protobuf-compiler libclang-dev clang binutils-dev libunwind-dev
|
||||
|
||||
RUN mkdir -p /fuzztest
|
||||
|
||||
ADD . /fuzztest/
|
||||
|
||||
WORKDIR /fuzztest/template-fuzzer
|
||||
|
||||
CMD ["/bin/bash", "/fuzztest/template-fuzzer/run-fuzzer.sh"]
|
||||
@@ -0,0 +1,13 @@
|
||||
## Template Fuzzer
|
||||
|
||||
This a fuzzer implementation for OpenZeppelin's runtime templates. Currently there is a single runtime (generic one) and a single fuzzer setup.
|
||||
This code is highly experimental, if you notice any flaws consider creating an issue or a pull request.
|
||||
|
||||
### How to run the fuzzer
|
||||
|
||||
We have provided a docker packaging for the fuzzer, so that you can run it like this from the **repository root directory**
|
||||
|
||||
```bash
|
||||
docker build -t fuzzer -f template-fuzzer/Dockerfile .
|
||||
docker run --mount source=output,target=/fuzztest/template-fuzzer/output fuzzer
|
||||
```
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
rustup target add wasm32-unknown-unknown
|
||||
rustup component add rust-src
|
||||
cargo install ziggy cargo-afl honggfuzz grcov
|
||||
AFL_SKIP_CPUFREQ=true AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=true cargo ziggy fuzz -t 20 -j 5
|
||||
@@ -0,0 +1,289 @@
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use cumulus_primitives_core::relay_chain::Slot;
|
||||
use frame_support::{
|
||||
dispatch::GetDispatchInfo,
|
||||
pallet_prelude::Encode,
|
||||
traits::{IntegrityTest, TryState, TryStateSelect},
|
||||
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
|
||||
};
|
||||
use parachain_template_runtime::{
|
||||
AllPalletsWithSystem, Balance, Balances, BlockNumber, Executive, Runtime, RuntimeCall,
|
||||
RuntimeOrigin, SudoConfig, UncheckedExtrinsic, SLOT_DURATION,
|
||||
};
|
||||
use parachains_common::AccountId;
|
||||
use sp_consensus_aura::AURA_ENGINE_ID;
|
||||
use sp_runtime::{
|
||||
traits::{Dispatchable, Header},
|
||||
Digest, DigestItem, Storage,
|
||||
};
|
||||
use substrate_runtime_fuzzer::{Data, INITIAL_TIMESTAMP, MAX_TIME_FOR_BLOCK};
|
||||
|
||||
pub type Externalities = sp_state_machine::BasicExternalities;
|
||||
|
||||
fn main() {
|
||||
let endowed_accounts: Vec<AccountId> = (0..5).map(|i| [i; 32].into()).collect();
|
||||
|
||||
let genesis_storage: Storage = {
|
||||
use parachain_template_runtime::{
|
||||
BalancesConfig, CollatorSelectionConfig, RuntimeGenesisConfig, SessionConfig,
|
||||
SessionKeys,
|
||||
};
|
||||
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
||||
use sp_runtime::{app_crypto::ByteArray, BuildStorage};
|
||||
|
||||
let initial_authorities: Vec<(AccountId, AuraId)> =
|
||||
vec![([0; 32].into(), AuraId::from_slice(&[0; 32]).unwrap())];
|
||||
let root: AccountId = [0; 32].into();
|
||||
|
||||
RuntimeGenesisConfig {
|
||||
system: Default::default(),
|
||||
balances: BalancesConfig {
|
||||
// Configure endowed accounts with initial balance of 1 << 60.
|
||||
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
|
||||
},
|
||||
aura: Default::default(),
|
||||
session: SessionConfig {
|
||||
keys: initial_authorities
|
||||
.iter()
|
||||
.map(|x| (x.0.clone(), x.0.clone(), SessionKeys { aura: x.1.clone() }))
|
||||
.collect::<Vec<_>>(),
|
||||
},
|
||||
collator_selection: CollatorSelectionConfig {
|
||||
invulnerables: initial_authorities.iter().map(|x| (x.0.clone())).collect(),
|
||||
candidacy_bond: 1 << 57,
|
||||
desired_candidates: 1,
|
||||
},
|
||||
aura_ext: Default::default(),
|
||||
parachain_info: Default::default(),
|
||||
parachain_system: Default::default(),
|
||||
polkadot_xcm: Default::default(),
|
||||
assets: Default::default(),
|
||||
transaction_payment: Default::default(),
|
||||
sudo: SudoConfig { key: Some(root) },
|
||||
treasury: Default::default(),
|
||||
}
|
||||
.build_storage()
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
ziggy::fuzz!(|data: &[u8]| {
|
||||
let mut iteratable = Data::from_data(data);
|
||||
|
||||
// Max weight for a block.
|
||||
let max_weight: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND * 2, 0);
|
||||
|
||||
let extrinsics: Vec<(Option<u32>, usize, RuntimeCall)> =
|
||||
iteratable.extract_extrinsics::<RuntimeCall>();
|
||||
|
||||
if extrinsics.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
// `externalities` represents the state of our mock chain.
|
||||
let mut externalities = Externalities::new(genesis_storage.clone());
|
||||
|
||||
let mut current_block: u32 = 1;
|
||||
let mut current_weight: Weight = Weight::zero();
|
||||
// let mut already_seen = 0; // This must be uncommented if you want to print events
|
||||
let mut elapsed: Duration = Duration::ZERO;
|
||||
|
||||
let start_block = |block: u32, lapse: u32| {
|
||||
#[cfg(not(fuzzing))]
|
||||
println!("\ninitializing block {}", block + lapse);
|
||||
|
||||
let next_block = block + lapse;
|
||||
let current_timestamp = INITIAL_TIMESTAMP + u64::from(next_block) * SLOT_DURATION;
|
||||
let pre_digest = match current_timestamp {
|
||||
INITIAL_TIMESTAMP => Default::default(),
|
||||
_ => Digest {
|
||||
logs: vec![DigestItem::PreRuntime(
|
||||
AURA_ENGINE_ID,
|
||||
Slot::from(current_timestamp / SLOT_DURATION).encode(),
|
||||
)],
|
||||
},
|
||||
};
|
||||
|
||||
let prev_header = match next_block {
|
||||
1 => None,
|
||||
_ => Some(Executive::finalize_block()),
|
||||
};
|
||||
|
||||
let parent_header = &Header::new(
|
||||
next_block + 1,
|
||||
Default::default(),
|
||||
Default::default(),
|
||||
prev_header.clone().map(|x| x.hash()).unwrap_or_default(),
|
||||
pre_digest,
|
||||
);
|
||||
Executive::initialize_block(parent_header);
|
||||
|
||||
// We apply the timestamp extrinsic for the current block.
|
||||
Executive::apply_extrinsic(UncheckedExtrinsic::new_unsigned(RuntimeCall::Timestamp(
|
||||
pallet_timestamp::Call::set { now: current_timestamp },
|
||||
)))
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
|
||||
let parachain_validation_data = {
|
||||
use cumulus_primitives_core::{relay_chain::HeadData, PersistedValidationData};
|
||||
use cumulus_primitives_parachain_inherent::ParachainInherentData;
|
||||
use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;
|
||||
|
||||
let parent_head =
|
||||
HeadData(prev_header.clone().unwrap_or(parent_header.clone()).encode());
|
||||
let sproof_builder = RelayStateSproofBuilder {
|
||||
para_id: 100.into(),
|
||||
current_slot: Slot::from(2 * current_timestamp / SLOT_DURATION),
|
||||
included_para_head: Some(parent_head.clone()),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let (relay_parent_storage_root, relay_chain_state) =
|
||||
sproof_builder.into_state_root_and_proof();
|
||||
let data = ParachainInherentData {
|
||||
validation_data: PersistedValidationData {
|
||||
parent_head,
|
||||
relay_parent_number: next_block,
|
||||
relay_parent_storage_root,
|
||||
max_pov_size: 1000,
|
||||
},
|
||||
relay_chain_state,
|
||||
downward_messages: Default::default(),
|
||||
horizontal_messages: Default::default(),
|
||||
};
|
||||
cumulus_pallet_parachain_system::Call::set_validation_data { data }
|
||||
};
|
||||
|
||||
Executive::apply_extrinsic(UncheckedExtrinsic::new_unsigned(
|
||||
RuntimeCall::ParachainSystem(parachain_validation_data),
|
||||
))
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
|
||||
// Calls that need to be called before each block starts (init_calls) go here
|
||||
};
|
||||
|
||||
externalities.execute_with(|| start_block(current_block, 0));
|
||||
|
||||
for (maybe_lapse, origin, extrinsic) in extrinsics {
|
||||
// If the lapse is in the range [0, MAX_BLOCK_LAPSE] we finalize the block and initialize
|
||||
// a new one.
|
||||
if let Some(lapse) = maybe_lapse {
|
||||
// We update our state variables
|
||||
current_weight = Weight::zero();
|
||||
elapsed = Duration::ZERO;
|
||||
|
||||
// We start the next block
|
||||
externalities.execute_with(|| start_block(current_block, lapse));
|
||||
current_block += lapse;
|
||||
}
|
||||
|
||||
// We get the current time for timing purposes.
|
||||
let now = Instant::now();
|
||||
|
||||
let mut call_weight = Weight::zero();
|
||||
// We compute the weight to avoid overweight blocks.
|
||||
externalities.execute_with(|| {
|
||||
call_weight = extrinsic.get_dispatch_info().weight;
|
||||
});
|
||||
|
||||
current_weight = current_weight.saturating_add(call_weight);
|
||||
if current_weight.ref_time() >= max_weight.ref_time() {
|
||||
#[cfg(not(fuzzing))]
|
||||
println!("Skipping because of max weight {max_weight}");
|
||||
continue;
|
||||
}
|
||||
|
||||
externalities.execute_with(|| {
|
||||
let origin_account = endowed_accounts[origin % endowed_accounts.len()].clone();
|
||||
#[cfg(not(fuzzing))]
|
||||
{
|
||||
println!("\n origin: {origin_account:?}");
|
||||
println!(" call: {extrinsic:?}");
|
||||
}
|
||||
let _res = extrinsic.clone().dispatch(RuntimeOrigin::signed(origin_account));
|
||||
#[cfg(not(fuzzing))]
|
||||
println!(" result: {_res:?}");
|
||||
|
||||
// Uncomment to print events for debugging purposes
|
||||
/*
|
||||
#[cfg(not(fuzzing))]
|
||||
{
|
||||
let all_events = statemine_runtime::System::events();
|
||||
let events: Vec<_> = all_events.clone().into_iter().skip(already_seen).collect();
|
||||
already_seen = all_events.len();
|
||||
println!(" events: {:?}\n", events);
|
||||
}
|
||||
*/
|
||||
});
|
||||
|
||||
elapsed += now.elapsed();
|
||||
}
|
||||
|
||||
#[cfg(not(fuzzing))]
|
||||
println!("\n time spent: {elapsed:?}");
|
||||
assert!(elapsed.as_secs() <= MAX_TIME_FOR_BLOCK, "block execution took too much time");
|
||||
|
||||
// We end the final block
|
||||
externalities.execute_with(|| {
|
||||
// Finilization
|
||||
Executive::finalize_block();
|
||||
// Invariants
|
||||
#[cfg(not(fuzzing))]
|
||||
println!("\ntesting invariants for block {current_block}");
|
||||
<AllPalletsWithSystem as TryState<BlockNumber>>::try_state(
|
||||
current_block,
|
||||
TryStateSelect::All,
|
||||
)
|
||||
.unwrap();
|
||||
});
|
||||
|
||||
// After execution of all blocks.
|
||||
externalities.execute_with(|| {
|
||||
// We keep track of the sum of balance of accounts
|
||||
let mut counted_free = 0;
|
||||
let mut counted_reserved = 0;
|
||||
|
||||
for acc in frame_system::Account::<Runtime>::iter() {
|
||||
// Check that the consumer/provider state is valid.
|
||||
let acc_consumers = acc.1.consumers;
|
||||
let acc_providers = acc.1.providers;
|
||||
assert!(!(acc_consumers > 0 && acc_providers == 0), "Invalid state");
|
||||
|
||||
// Increment our balance counts
|
||||
counted_free += acc.1.data.free;
|
||||
counted_reserved += acc.1.data.reserved;
|
||||
// Check that locks and holds are valid.
|
||||
let max_lock: Balance =
|
||||
Balances::locks(&acc.0).iter().map(|l| l.amount).max().unwrap_or_default();
|
||||
assert_eq!(
|
||||
max_lock, acc.1.data.frozen,
|
||||
"Max lock should be equal to frozen balance"
|
||||
);
|
||||
let sum_holds: Balance =
|
||||
pallet_balances::Holds::<Runtime>::get(&acc.0).iter().map(|l| l.amount).sum();
|
||||
assert!(
|
||||
sum_holds <= acc.1.data.reserved,
|
||||
"Sum of all holds ({sum_holds}) should be less than or equal to reserved \
|
||||
balance {}",
|
||||
acc.1.data.reserved
|
||||
);
|
||||
}
|
||||
|
||||
let total_issuance = pallet_balances::TotalIssuance::<Runtime>::get();
|
||||
let counted_issuance = counted_free + counted_reserved;
|
||||
// The reason we do not simply use `!=` here is that some balance might be transfered to another chain via XCM.
|
||||
// If we find some kind of workaround for this, we could replace `<` by `!=` here and make the check stronger.
|
||||
assert!(
|
||||
total_issuance <= counted_issuance,
|
||||
"Inconsistent total issuance: {total_issuance} but counted {counted_issuance}"
|
||||
);
|
||||
|
||||
#[cfg(not(fuzzing))]
|
||||
println!("running integrity tests");
|
||||
// We run all developer-defined integrity tests
|
||||
<AllPalletsWithSystem as IntegrityTest>::integrity_test();
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
keys = [
|
||||
"workspace",
|
||||
"name",
|
||||
"package",
|
||||
"bin",
|
||||
"lib",
|
||||
"test",
|
||||
"dependencies",
|
||||
"dev-dependencies",
|
||||
"build-dependencies",
|
||||
"features",
|
||||
"default",
|
||||
"std",
|
||||
]
|
||||
|
||||
inline_keys = [
|
||||
"package",
|
||||
"workspace",
|
||||
"path",
|
||||
"git",
|
||||
"branch",
|
||||
"rev",
|
||||
"version",
|
||||
"default-features",
|
||||
"optional",
|
||||
"features",
|
||||
]
|
||||
|
||||
sort_string_arrays = true
|
||||
@@ -0,0 +1,23 @@
|
||||
# Zombienet configuration
|
||||
|
||||
Zombienet aims to be a testing framework for Substrate based blockchains, providing a simple cli tool that allows users to spawn and test ephemeral networks.
|
||||
|
||||
## Start a development chain
|
||||
|
||||
Firstly build Polkadot binaries with:
|
||||
|
||||
```sh
|
||||
$ scripts/zombienet.sh build
|
||||
```
|
||||
|
||||
This process can take some time, so please be patient. If on Linux, you can alternatively download the binaries to speed up the process with:
|
||||
|
||||
```shell
|
||||
$ scripts/zombinet.sh init
|
||||
```
|
||||
|
||||
Once Polkadot binaries are in place you can spawn a local testnet by running the following command:
|
||||
|
||||
```shell
|
||||
$ scripts/zombienet.sh devnet
|
||||
```
|
||||
@@ -0,0 +1,31 @@
|
||||
[relaychain]
|
||||
chain = "rococo-local"
|
||||
default_command = "./bin-v1.6.0/polkadot"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "alice"
|
||||
validator = true
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
validator = true
|
||||
|
||||
[[parachains]]
|
||||
id = 1000
|
||||
addToGenesis = true
|
||||
cumulus_based = true
|
||||
chain = "dev"
|
||||
|
||||
[[parachains.collators]]
|
||||
name = "collator01"
|
||||
command = "./target/release/parachain-template-node"
|
||||
ws_port = 9933
|
||||
rpc_port = 8833
|
||||
args = ["--rpc-max-connections 10000"]
|
||||
|
||||
[[parachains.collators]]
|
||||
name = "collator02"
|
||||
ws_port = 9822
|
||||
rpc_port = 8822
|
||||
command = "./target/release/parachain-template-node"
|
||||
args = ["--rpc-max-connections 10000"]
|
||||
Reference in New Issue
Block a user