Upgrade polkadot sdk v1.13.0 (#298)

* generic template updated to v1.13.0

* evm dependency upgrades

* evm dependency upgrades after moonbeam

* importing frontier updates 

* upgrade fuzzer to v1.11.0 

* upgrade fuzzer to v1.12.0

* generic template fuzzer updated

* evm fuzzer

---------

Co-authored-by: Nikita Khateev <nikita.khateev@openzeppelin.com>
This commit is contained in:
Özgün Özerk
2024-09-13 12:18:35 +03:00
committed by GitHub
parent a4b7acf9bd
commit ba730fab22
31 changed files with 4973 additions and 4319 deletions
+2019 -1690
View File
File diff suppressed because it is too large Load Diff
+119 -119
View File
@@ -28,143 +28,143 @@ 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-consensus-aura = { 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" }
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-try-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-assets = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-authorship = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-conviction-voting = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-message-queue = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-multisig = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-preimage = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-proxy = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-referenda = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-scheduler = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-session = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-treasury = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-whitelist = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-chain-spec = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-cli = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-executor = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-network = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-offchain = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-service = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-telemetry = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-tracing = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-arithmetic = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-genesis-builder = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-inherents = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.13.0" }
sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-offchain = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-session = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-std = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-version = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.13.0" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.13.0" }
# Polkadot
pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.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" }
], tag = "polkadot-v1.13.0" }
polkadot-parachain-primitives = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.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-storage-weight-reclaim = { 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" }
assets-common = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-client-consensus-proposer = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-primitives-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-primitives-storage-weight-reclaim = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-primitives-utility = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-collator-selection = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
parachain-info = { package = "staging-parachain-info", git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
parachains-common = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
# EVM
fc-api = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
fc-consensus = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
fc-db = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
fc-mapping-sync = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
fc-rpc = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
fc-rpc-core = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
fc-storage = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
fp-account = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false, features = [
fc-api = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
fc-consensus = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
fc-db = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
fc-mapping-sync = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
fc-rpc = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
fc-rpc-core = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
fc-storage = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
fp-account = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false, features = [
"serde",
] }
fp-dynamic-fee = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
fp-evm = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
fp-rpc = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
fp-self-contained = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
pallet-base-fee = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
pallet-ethereum = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false, features = [
fp-dynamic-fee = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
fp-evm = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
fp-rpc = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
fp-self-contained = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
pallet-base-fee = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
pallet-ethereum = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false, features = [
"forbid-evm-reentrancy",
] }
pallet-evm = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false, features = [
pallet-evm = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false, features = [
"forbid-evm-reentrancy",
] }
pallet-evm-chain-id = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
pallet-evm-precompile-modexp = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
pallet-evm-precompile-sha3fips = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
pallet-evm-precompile-simple = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.10.0", default-features = false }
pallet-evm-chain-id = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
pallet-evm-precompile-modexp = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
pallet-evm-precompile-sha3fips = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
pallet-evm-precompile-simple = { git = "https://github.com/OpenZeppelin/frontier", branch = "polkadot-v1.13.0", default-features = false }
# Moonbeam
pallet-asset-manager = { git = "https://github.com/OpenZeppelin/moonbeam.git", branch = "polkadot-v1.10.0", default-features = false }
xcm-primitives = { git = "https://github.com/OpenZeppelin/moonbeam.git", branch = "polkadot-v1.10.0", default-features = false }
pallet-asset-manager = { git = "https://github.com/OpenZeppelin/moonbeam.git", branch = "polkadot-v1.13.0", default-features = false }
xcm-primitives = { git = "https://github.com/OpenZeppelin/moonbeam.git", branch = "polkadot-v1.13.0", default-features = false }
# Fuzzer
substrate-runtime-fuzzer = { git = "https://github.com/srlabs/substrate-runtime-fuzzer.git", default-features = false }
substrate-runtimes-fuzzers = { git = "https://github.com/srlabs/substrate-runtime-fuzzer.git", default-features = false, tag = "polkadot-v1.12.0" }
ziggy = { version = "0.8", default-features = false }
[workspace.lints.clippy]
-1
View File
@@ -93,7 +93,6 @@ substrate-build-script-utils = { workspace = true }
[features]
default = []
async-backing = []
experimental = []
runtime-benchmarks = [
"evm-runtime-template/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
+1 -2
View File
@@ -16,8 +16,7 @@ use sp_runtime::traits::{IdentifyAccount, Verify};
use crate::contracts::{parse_contracts, ContractsPath};
/// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec =
sc_service::GenericChainSpec<evm_runtime_template::RuntimeGenesisConfig, Extensions>;
pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;
/// The default XCM version to set in genesis config.
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
+1 -1
View File
@@ -190,7 +190,7 @@ pub fn run() -> Result<()> {
match cmd {
BenchmarkCmd::Pallet(cmd) =>
if cfg!(feature = "runtime-benchmarks") {
runner.sync_run(|config| cmd.run::<sp_runtime::traits::HashingFor<Block>, ReclaimHostFunctions>(config))
runner.sync_run(|config| cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ReclaimHostFunctions>(Some(config.chain_spec)))
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
+22 -16
View File
@@ -7,12 +7,13 @@ use std::{
// Local
use evm_runtime_template::opaque::Block;
use fc_rpc::{EthTask, OverrideHandle};
use fc_rpc::EthTask;
pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool};
pub use fc_storage::{StorageOverride, StorageOverrideHandler};
use futures::{future, prelude::*};
// Substrate
use sc_client_api::BlockchainEvents;
use sc_executor::WasmExecutor;
use sc_executor::{HostFunctions, WasmExecutor};
use sc_network_sync::SyncingService;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sp_api::ConstructRuntimeApi;
@@ -24,7 +25,7 @@ pub type FullClient<RuntimeApi, Executor> =
sc_service::TFullClient<Block, RuntimeApi, WasmExecutor<Executor>>;
/// Frontier DB backend type.
pub type FrontierBackend = fc_db::Backend<Block>;
pub type FrontierBackend<C> = fc_db::Backend<Block, C>;
pub fn db_config_dir(config: &Configuration) -> PathBuf {
config.base_path.config_dir(config.chain_spec.id())
@@ -124,13 +125,13 @@ impl<Api> EthCompatRuntimeApiCollection for Api where
{
}
pub async fn spawn_frontier_tasks<RuntimeApi, Functions>(
pub async fn spawn_frontier_tasks<RuntimeApi, Executor>(
task_manager: &TaskManager,
client: Arc<FullClient<RuntimeApi, Functions>>,
client: Arc<FullClient<RuntimeApi, Executor>>,
backend: Arc<FullBackend>,
frontier_backend: FrontierBackend,
frontier_backend: Arc<FrontierBackend<FullClient<RuntimeApi, Executor>>>,
filter_pool: Option<FilterPool>,
overrides: Arc<OverrideHandle<Block>>,
storage_override: Arc<dyn StorageOverride<Block>>,
fee_history_cache: FeeHistoryCache,
fee_history_cache_limit: FeeHistoryCacheLimit,
sync: Arc<SyncingService<Block>>,
@@ -140,13 +141,13 @@ pub async fn spawn_frontier_tasks<RuntimeApi, Functions>(
>,
>,
) where
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, Functions>>,
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, Executor>>,
RuntimeApi: Send + Sync + 'static,
RuntimeApi::RuntimeApi: EthCompatRuntimeApiCollection,
Functions: sc_executor::sp_wasm_interface::HostFunctions,
Executor: HostFunctions + 'static,
{
// Spawn main mapping sync worker background task.
match frontier_backend {
match &*frontier_backend {
fc_db::Backend::KeyValue(b) => {
task_manager.spawn_essential_handle().spawn(
"frontier-mapping-sync-worker",
@@ -156,10 +157,10 @@ pub async fn spawn_frontier_tasks<RuntimeApi, Functions>(
Duration::new(6, 0),
client.clone(),
backend,
overrides.clone(),
Arc::new(b),
storage_override.clone(),
b.clone(),
3,
0,
0u32,
fc_mapping_sync::SyncStrategy::Normal,
sync,
pubsub_notification_sinks,
@@ -174,10 +175,10 @@ pub async fn spawn_frontier_tasks<RuntimeApi, Functions>(
fc_mapping_sync::sql::SyncWorker::run(
client.clone(),
backend,
Arc::new(b),
b.clone(),
client.import_notification_stream(),
fc_mapping_sync::sql::SyncWorkerConfig {
read_notification_timeout: Duration::from_secs(10),
read_notification_timeout: Duration::from_secs(30),
check_indexed_blocks_interval: Duration::from_secs(60),
},
fc_mapping_sync::SyncStrategy::Parachain,
@@ -203,6 +204,11 @@ pub async fn spawn_frontier_tasks<RuntimeApi, Functions>(
task_manager.spawn_essential_handle().spawn(
"frontier-fee-history",
Some("frontier"),
EthTask::fee_history_task(client, overrides, fee_history_cache, fee_history_cache_limit),
EthTask::fee_history_task(
client,
storage_override,
fee_history_cache,
fee_history_cache_limit,
),
);
}
+5 -5
View File
@@ -1,9 +1,9 @@
use std::{collections::BTreeMap, sync::Arc};
// Frontier
pub use fc_rpc::{EthBlockDataCacheTask, EthConfig, OverrideHandle};
pub use fc_rpc::{EthBlockDataCacheTask, EthConfig};
pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool};
pub use fc_storage::overrides_handle;
pub use fc_storage::StorageOverride;
use fp_rpc::{ConvertTransaction, ConvertTransactionRuntimeApi, EthereumRuntimeRPCApi};
use jsonrpsee::RpcModule;
// Substrate
@@ -12,7 +12,7 @@ use sc_client_api::{
client::BlockchainEvents,
AuxStore, UsageProvider,
};
use sc_network::NetworkService;
use sc_network::service::traits::NetworkService;
use sc_network_sync::SyncingService;
use sc_rpc::SubscriptionTaskExecutor;
use sc_transaction_pool::{ChainApi, Pool};
@@ -40,13 +40,13 @@ pub struct EthDeps<B: BlockT, C, P, A: ChainApi, CT, CIDP> {
/// Whether to enable dev signer
pub enable_dev_signer: bool,
/// Network service
pub network: Arc<NetworkService<B, B::Hash>>,
pub network: Arc<dyn NetworkService>,
/// Chain syncing service
pub sync: Arc<SyncingService<B>>,
/// Frontier Backend.
pub frontier_backend: Arc<dyn fc_api::Backend<B>>,
/// Ethereum data access overrides.
pub overrides: Arc<OverrideHandle<B>>,
pub overrides: Arc<dyn StorageOverride<B>>,
/// Cache for Ethereum block data.
pub block_data_cache: Arc<EthBlockDataCacheTask<B>>,
/// EthFilterApi pool.
+1 -1
View File
@@ -20,7 +20,7 @@ use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_inherents::CreateInherentDataProviders;
use sp_runtime::traits::Block as BlockT;
pub use self::eth::{overrides_handle, EthDeps};
pub use self::eth::EthDeps;
use crate::rpc::eth::create_eth;
/// A type representing all RPC extensions.
+27 -28
View File
@@ -28,26 +28,26 @@ use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
use sc_client_api::Backend;
use sc_consensus::ImportQueue;
use sc_executor::WasmExecutor;
use sc_network::NetworkBlock;
use sc_network::{config::FullNetworkConfiguration, 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_core::U256;
use sp_core::{H256, U256};
use sp_keystore::KeystorePtr;
use substrate_prometheus_endpoint::Registry;
use crate::eth::{
db_config_dir, new_frontier_partial, spawn_frontier_tasks, BackendType, EthConfiguration,
FrontierBackend, FrontierPartialComponents,
FrontierBackend, FrontierPartialComponents, StorageOverrideHandler,
};
#[cfg(not(feature = "runtime-benchmarks"))]
type HostFunctions =
pub type HostFunctions =
(sp_io::SubstrateHostFunctions, cumulus_client_service::storage_proof_size::HostFunctions);
#[cfg(feature = "runtime-benchmarks")]
type HostFunctions = (
pub type HostFunctions = (
sp_io::SubstrateHostFunctions,
cumulus_client_service::storage_proof_size::HostFunctions,
frame_benchmarking::benchmarking::HostFunctions,
@@ -72,8 +72,8 @@ pub type Service = PartialComponents<
ParachainBlockImport,
Option<Telemetry>,
Option<TelemetryWorkerHandle>,
FrontierBackend,
Arc<fc_rpc::OverrideHandle<Block>>,
FrontierBackend<ParachainClient>,
Arc<dyn fc_storage::StorageOverride<Block>>,
),
>;
@@ -132,14 +132,14 @@ pub fn new_partial(
&task_manager,
)?;
let overrides = crate::rpc::overrides_handle(client.clone());
let storage_override = Arc::new(StorageOverrideHandler::new(client.clone()));
let frontier_backend = match eth_config.frontier_backend_type {
BackendType::KeyValue => FrontierBackend::KeyValue(fc_db::kv::Backend::open(
BackendType::KeyValue => FrontierBackend::KeyValue(Arc::new(fc_db::kv::Backend::open(
Arc::clone(&client),
&config.database,
&db_config_dir(config),
)?),
)?)),
BackendType::Sql => {
let db_path = db_config_dir(config).join("sql");
std::fs::create_dir_all(&db_path).expect("failed creating sql db directory");
@@ -156,10 +156,10 @@ pub fn new_partial(
}),
eth_config.frontier_sql_backend_pool_size,
std::num::NonZeroU32::new(eth_config.frontier_sql_backend_num_ops_timeout),
overrides.clone(),
storage_override.clone(),
))
.unwrap_or_else(|err| panic!("failed creating sql backend: {:?}", err));
FrontierBackend::Sql(backend)
FrontierBackend::Sql(Arc::new(backend))
}
};
@@ -171,7 +171,13 @@ pub fn new_partial(
task_manager,
transaction_pool,
select_chain: (),
other: (block_import, telemetry, telemetry_worker_handle, frontier_backend, overrides),
other: (
block_import,
telemetry,
telemetry_worker_handle,
frontier_backend,
storage_override,
),
})
}
@@ -198,7 +204,10 @@ async fn start_node_impl(
let (block_import, mut telemetry, telemetry_worker_handle, frontier_backend, overrides) =
params.other;
let net_config = sc_network::config::FullNetworkConfiguration::new(&parachain_config.network);
let frontier_backend = Arc::new(frontier_backend);
let net_config: FullNetworkConfiguration<Block, H256, sc_network::NetworkWorker<_, _>> =
sc_network::config::FullNetworkConfiguration::new(&parachain_config.network);
let client = params.client.clone();
let backend = params.backend.clone();
@@ -248,7 +257,7 @@ async fn start_node_impl(
transaction_pool: Some(OffchainTransactionPoolFactory::new(
transaction_pool.clone(),
)),
network_provider: network.clone(),
network_provider: Arc::new(network.clone()),
is_validator: parachain_config.role.is_authority(),
enable_http_requests: false,
custom_extensions: move |_| vec![],
@@ -306,9 +315,9 @@ async fn start_node_impl(
enable_dev_signer,
network: network.clone(),
sync: sync_service.clone(),
frontier_backend: match frontier_backend.clone() {
fc_db::Backend::KeyValue(b) => Arc::new(b),
fc_db::Backend::Sql(b) => Arc::new(b),
frontier_backend: match &*frontier_backend.clone() {
fc_db::Backend::KeyValue(b) => b.clone(),
fc_db::Backend::Sql(b) => b.clone(),
},
overrides: overrides.clone(),
block_data_cache: block_data_cache.clone(),
@@ -454,8 +463,6 @@ fn build_import_queue(
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,
_,
@@ -469,7 +476,6 @@ fn build_import_queue(
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
Ok(timestamp)
},
slot_duration,
&task_manager.spawn_essential_handle(),
config.prometheus_registry(),
telemetry,
@@ -498,11 +504,6 @@ fn start_consensus(
#[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.
#[cfg(not(feature = "async-backing"))]
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(),
@@ -539,8 +540,6 @@ fn start_consensus(
collator_key,
para_id,
overseer_handle,
#[cfg(not(feature = "async-backing"))]
slot_duration,
relay_chain_slot_duration,
proposer,
collator_service,
+2 -4
View File
@@ -69,9 +69,7 @@ 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-parachain-system = { workspace = true }
cumulus-pallet-session-benchmarking = { workspace = true }
cumulus-pallet-xcm = { workspace = true }
cumulus-pallet-xcmp-queue = { workspace = true }
@@ -115,6 +113,7 @@ std = [
"cumulus-pallet-session-benchmarking/std",
"cumulus-pallet-xcm/std",
"cumulus-pallet-xcmp-queue/std",
"cumulus-primitives-aura/std",
"cumulus-primitives-core/std",
"cumulus-primitives-storage-weight-reclaim/std",
"cumulus-primitives-utility/std",
@@ -261,7 +260,6 @@ try-runtime = [
"sp-runtime/try-runtime",
]
experimental = [ "pallet-aura/experimental" ]
# A feature that should be enabled when the runtime should be built for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller, like logging for example.
+9 -5
View File
@@ -1,5 +1,5 @@
use frame_support::{
genesis_builder_helper::{build_config, create_default_config},
genesis_builder_helper::{build_state, get_preset},
traits::OnFinalize,
weights::Weight,
};
@@ -549,12 +549,16 @@ impl_runtime_apis! {
}
impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
fn create_default_config() -> Vec<u8> {
create_default_config::<RuntimeGenesisConfig>()
fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
build_state::<RuntimeGenesisConfig>(config)
}
fn build_config(config: Vec<u8>) -> sp_genesis_builder::Result {
build_config::<RuntimeGenesisConfig>(config)
fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, |_| None)
}
fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
Default::default()
}
}
}
+4 -5
View File
@@ -50,7 +50,7 @@ use crate::{
constants::{
currency::{deposit, CENTS, EXISTENTIAL_DEPOSIT, GRAND, MICROCENTS},
AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MAX_BLOCK_LENGTH,
NORMAL_DISPATCH_RATIO, SLOT_DURATION, VERSION, WEIGHT_PER_GAS,
NORMAL_DISPATCH_RATIO, VERSION, WEIGHT_PER_GAS,
},
opaque,
types::{
@@ -204,10 +204,7 @@ impl pallet_preimage::Config for Runtime {
}
impl pallet_timestamp::Config for Runtime {
#[cfg(feature = "experimental")]
type MinimumPeriod = ConstU64<0>;
#[cfg(not(feature = "experimental"))]
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
/// A timestamp: milliseconds since the unix epoch.
type Moment = u64;
type OnTimestampSet = Aura;
@@ -329,7 +326,7 @@ impl pallet_transaction_payment::Config for Runtime {
/// With fast adjusting fees change rapidly, but fixed for all users at each block (no tipping)
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter<Balances, ()>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type RuntimeEvent = RuntimeEvent;
type WeightToFee = WeightToFee;
@@ -412,7 +409,9 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ChannelInfo = ParachainSystem;
type ControllerOrigin = EnsureRoot<AccountId>;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type MaxActiveOutboundChannels = ConstU32<128>;
type MaxInboundSuspended = MaxInboundSuspended;
type MaxPageSize = ConstU32<{ 1 << 16 }>;
/// Ensure that this value is not set to null (or NoPriceForMessageDelivery) to prevent spamming
type PriceForSiblingDelivery = PriceForSiblingParachainDelivery;
type RuntimeEvent = RuntimeEvent;
@@ -233,6 +233,7 @@ impl xcm_executor::Config for XcmConfig {
// Teleporting is disabled.
type UniversalLocation = UniversalLocation;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type XcmRecorder = PolkadotXcm;
type XcmSender = XcmRouter;
}
@@ -68,6 +68,28 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
// TODO: below is random
fn burn_allow_death() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 25_741_000 picoseconds.
Weight::from_parts(26_321_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
// TODO: below is random
fn burn_keep_alive() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 25_741_000 picoseconds.
Weight::from_parts(26_321_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(116), added: 2591, mode: `MaxEncodedLen`)
fn force_set_balance_killing() -> Weight {
@@ -46,20 +46,6 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
.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: `76`
// Estimated: `1561`
// Minimum execution time: 19_753_000 picoseconds.
Weight::from_parts(20_033_000, 0)
.saturating_add(Weight::from_parts(0, 1561))
.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 {
@@ -100,16 +86,6 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
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 {
-1
View File
@@ -15,7 +15,6 @@ 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 }
evm-runtime-template = { path = "../runtime" }
+208 -253
View File
@@ -1,297 +1,207 @@
use std::time::{Duration, Instant};
use std::{
iter,
time::{Duration, Instant},
};
use cumulus_primitives_core::relay_chain::Slot;
// Local Imports
use evm_runtime_template::{
configs::MaxCandidates, constants::SLOT_DURATION, AccountId, AllPalletsWithSystem, Balance,
Balances, BlockNumber, EVMChainIdConfig, Executive, Runtime, RuntimeCall, RuntimeOrigin,
SudoConfig, UncheckedExtrinsic,
Balances, EVMChainIdConfig, Executive, Runtime, RuntimeCall, RuntimeOrigin, SudoConfig,
UncheckedExtrinsic,
};
use frame_support::{
dispatch::GetDispatchInfo,
pallet_prelude::Encode,
traits::{IntegrityTest, TryState, TryStateSelect},
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
};
use sp_consensus_aura::AURA_ENGINE_ID;
use frame_system::Account;
use pallet_balances::{Holds, TotalIssuance};
use parity_scale_codec::{DecodeLimit, Encode};
use sp_consensus_aura::{Slot, AURA_ENGINE_ID};
use sp_runtime::{
testing::H256,
traits::{Dispatchable, Header},
Digest, DigestItem, Storage,
};
use substrate_runtime_fuzzer::{Data, INITIAL_TIMESTAMP, MAX_TIME_FOR_BLOCK};
use sp_state_machine::BasicExternalities;
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 evm_runtime_template::{
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, x.0, SessionKeys { aura: x.1.clone() }))
.collect::<Vec<_>>(),
},
collator_selection: CollatorSelectionConfig {
invulnerables: initial_authorities.iter().map(|x| x.0).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(),
base_fee: Default::default(), // TODO: reconsider default value
evm_chain_id: EVMChainIdConfig {
chain_id: 1000, // TODO: select a good value
..Default::default()
},
evm: Default::default(),
ethereum: Default::default(),
}
.build_storage()
.unwrap()
fn generate_genesis(accounts: &[AccountId]) -> Storage {
use evm_runtime_template::{
BalancesConfig, CollatorSelectionConfig, RuntimeGenesisConfig, SessionConfig, SessionKeys,
};
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_runtime::{app_crypto::ByteArray, BuildStorage};
ziggy::fuzz!(|data: &[u8]| {
let mut iterable = Data::from_data(data);
// Configure endowed accounts with initial balance of 1 << 60.
let balances = accounts.iter().cloned().map(|k| (k, 1 << 60)).collect();
let invulnerables: Vec<AccountId> = vec![[0; 32].into()];
let session_keys = vec![(
[0; 32].into(),
[0; 32].into(),
SessionKeys { aura: AuraId::from_slice(&[0; 32]).unwrap() },
)];
let root: AccountId = [0; 32].into();
// Max weight for a block.
let max_weight: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND * 2, 0);
RuntimeGenesisConfig {
system: Default::default(),
balances: BalancesConfig { balances },
aura: Default::default(),
session: SessionConfig { keys: session_keys },
collator_selection: CollatorSelectionConfig {
invulnerables,
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(),
base_fee: Default::default(), // TODO: reconsider default value
evm_chain_id: EVMChainIdConfig {
chain_id: 1000, // TODO: select a good value
..Default::default()
},
evm: Default::default(),
ethereum: Default::default(),
}
.build_storage()
.unwrap()
}
let extrinsics: Vec<(Option<u32>, usize, RuntimeCall)> =
iterable.extract_extrinsics::<RuntimeCall>();
fn process_input(accounts: &[AccountId], genesis: &Storage, data: &[u8]) {
let mut data = data;
// We build the list of extrinsics we will execute
let extrinsics: Vec<(/* lapse */ u8, /* origin */ u8, RuntimeCall)> =
iter::from_fn(|| DecodeLimit::decode_with_depth_limit(64, &mut data).ok())
.filter(|(_, _, x)| !matches!(x, RuntimeCall::System(_)))
.collect();
if extrinsics.is_empty() {
return;
}
if extrinsics.is_empty() {
return;
}
let mut block: u32 = 1;
let mut weight: Weight = 0.into();
let mut elapsed: Duration = Duration::ZERO;
// `externalities` represents the state of our mock chain.
let mut externalities = Externalities::new(genesis_storage.clone());
BasicExternalities::execute_with_storage(&mut genesis.clone(), || {
let initial_total_issuance = TotalIssuance::<Runtime>::get();
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;
initialize_block(block);
let start_block = |block: u32, lapse: u32| {
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 {
let origin_no = origin % endowed_accounts.len();
for (lapse, origin, extrinsic) in extrinsics {
let origin_no = origin as usize % accounts.len();
if !recursive_call_filter(&extrinsic, origin_no) {
continue;
}
// 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();
if lapse > 0 {
finalize_block(elapsed);
block += u32::from(lapse) * 393; // 393 * 256 = 100608 which nearly corresponds to a week
weight = 0.into();
elapsed = Duration::ZERO;
// We start the next block
externalities.execute_with(|| start_block(current_block, lapse));
current_block += lapse;
initialize_block(block);
}
// 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() {
println!("Skipping because of max weight {max_weight}");
weight.saturating_accrue(extrinsic.get_dispatch_info().weight);
if weight.ref_time() >= 2 * WEIGHT_REF_TIME_PER_SECOND {
println!("Extrinsic would exhaust block weight, skipping");
continue;
}
externalities.execute_with(|| {
let origin_account = endowed_accounts[origin_no];
{
println!("\n origin: {origin_account:?}");
println!(" call: {extrinsic:?}");
}
let _res = extrinsic.clone().dispatch(RuntimeOrigin::signed(origin_account));
println!(" result: {_res:?}");
let origin = accounts[origin_no].clone();
// 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);
}
*/
});
println!("\n origin: {origin:?}");
println!(" call: {extrinsic:?}");
let now = Instant::now(); // We get the current time for timing purposes.
#[allow(unused_variables)]
let res = extrinsic.dispatch(RuntimeOrigin::signed(origin));
elapsed += now.elapsed();
println!(" result: {res:?}");
}
println!("\n time spent: {elapsed:?}");
assert!(elapsed.as_secs() <= MAX_TIME_FOR_BLOCK, "block execution took too much time");
finalize_block(elapsed);
// We end the final block
externalities.execute_with(|| {
// Finilization
Executive::finalize_block();
// Invariants
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 transferred 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}"
);
println!("running integrity tests");
// We run all developer-defined integrity tests
<AllPalletsWithSystem as IntegrityTest>::integrity_test();
});
check_invariants(block, initial_total_issuance);
});
}
fn initialize_block(block: u32) {
println!("\ninitializing block {}", block);
let current_timestamp = u64::from(block) * SLOT_DURATION;
let prev_header = match block {
1 => None,
_ => Some(Executive::finalize_block()),
};
let parent_header = &Header::new(
block,
H256::default(),
H256::default(),
prev_header.clone().map(|x| x.hash()).unwrap_or_default(),
Digest {
logs: vec![DigestItem::PreRuntime(
AURA_ENGINE_ID,
Slot::from(u64::from(block)).encode(),
)],
},
);
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: 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
}
fn recursive_call_filter(call: &RuntimeCall, origin: usize) -> bool {
match call {
//recursion
@@ -359,3 +269,48 @@ fn recursive_call_filter(call: &RuntimeCall, origin: usize) -> bool {
_ => true,
}
}
fn finalize_block(elapsed: Duration) {
println!("\n time spent: {elapsed:?}");
assert!(elapsed.as_secs() <= 2, "block execution took too much time");
println!(" finalizing block");
Executive::finalize_block();
}
fn check_invariants(block: u32, initial_total_issuance: Balance) {
let mut counted_free = 0;
let mut counted_reserved = 0;
for (account, info) in Account::<Runtime>::iter() {
let consumers = info.consumers;
let providers = info.providers;
assert!(!(consumers > 0 && providers == 0), "Invalid c/p state");
counted_free += info.data.free;
counted_reserved += info.data.reserved;
let max_lock: Balance =
Balances::locks(&account).iter().map(|l| l.amount).max().unwrap_or_default();
assert_eq!(max_lock, info.data.frozen, "Max lock should be equal to frozen balance");
let sum_holds: Balance = Holds::<Runtime>::get(&account).iter().map(|l| l.amount).sum();
assert!(
sum_holds <= info.data.reserved,
"Sum of all holds ({sum_holds}) should be less than or equal to reserved balance {}",
info.data.reserved
);
}
let total_issuance = TotalIssuance::<Runtime>::get();
let counted_issuance = counted_free + counted_reserved;
assert_eq!(total_issuance, counted_issuance);
assert!(total_issuance <= initial_total_issuance);
// We run all developer-defined integrity tests
AllPalletsWithSystem::integrity_test();
AllPalletsWithSystem::try_state(block, TryStateSelect::All).unwrap();
}
fn main() {
let accounts: Vec<AccountId> = (0..5).map(|i| [i; 32].into()).collect();
let genesis = generate_genesis(&accounts);
ziggy::fuzz!(|data: &[u8]| {
process_input(&accounts, &genesis, data);
});
}
+2188 -1768
View File
File diff suppressed because it is too large Load Diff
+97 -98
View File
@@ -26,112 +26,111 @@ 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" }
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-executive = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-system-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
frame-try-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-assets = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-authorship = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-conviction-voting = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-message-queue = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-multisig = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-preimage = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-proxy = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-referenda = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-scheduler = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-session = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-treasury = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-whitelist = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-basic-authorship = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-chain-spec = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-cli = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-consensus = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-executor = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-network = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-offchain = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-service = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-sysinfo = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-telemetry = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-tracing = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-api = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-arithmetic = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-block-builder = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-genesis-builder = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-inherents = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-io = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.13.0" }
sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-offchain = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-session = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-std = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
sp-version = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.13.0" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.13.0" }
# Polkadot
pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.10.0" }
pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.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" }
], tag = "polkadot-v1.13.0" }
polkadot-parachain-primitives = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.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-storage-weight-reclaim = { 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" }
assets-common = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-client-collator = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-client-consensus-proposer = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-client-service = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-primitives-aura = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-primitives-storage-weight-reclaim = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-primitives-utility = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
pallet-collator-selection = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
parachain-info = { package = "staging-parachain-info", git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
parachains-common = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-v1.13.0" }
# Fuzzer
substrate-runtime-fuzzer = { git = "https://github.com/srlabs/substrate-runtime-fuzzer.git", default-features = false }
ziggy = { version = "0.8", default-features = false }
ziggy = { version = "1.0.2", default-features = false }
[workspace.lints.clippy]
-1
View File
@@ -76,7 +76,6 @@ substrate-build-script-utils = { workspace = true }
[features]
default = []
async-backing = []
experimental = []
runtime-benchmarks = [
"frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
+1 -2
View File
@@ -9,8 +9,7 @@ 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<generic_runtime_template::RuntimeGenesisConfig, Extensions>;
pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;
/// The default XCM version to set in genesis config.
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
+1 -1
View File
@@ -182,7 +182,7 @@ pub fn run() -> Result<()> {
match cmd {
BenchmarkCmd::Pallet(cmd) =>
if cfg!(feature = "runtime-benchmarks") {
runner.sync_run(|config| cmd.run::<sp_runtime::traits::HashingFor<Block>, ReclaimHostFunctions>(config))
runner.sync_run(|config| cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ReclaimHostFunctions>(Some(config.chain_spec)))
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
+6 -12
View File
@@ -142,7 +142,11 @@ async fn start_node_impl(
let params = new_partial(&parachain_config)?;
let (block_import, mut telemetry, telemetry_worker_handle) = params.other;
let net_config = sc_network::config::FullNetworkConfiguration::new(&parachain_config.network);
let net_config = sc_network::config::FullNetworkConfiguration::<
_,
_,
sc_network::NetworkWorker<Block, Hash>,
>::new(&parachain_config.network);
let client = params.client.clone();
let backend = params.backend.clone();
@@ -191,7 +195,7 @@ async fn start_node_impl(
transaction_pool: Some(OffchainTransactionPoolFactory::new(
transaction_pool.clone(),
)),
network_provider: network.clone(),
network_provider: Arc::new(network.clone()),
is_validator: parachain_config.role.is_authority(),
enable_http_requests: false,
custom_extensions: move |_| vec![],
@@ -322,8 +326,6 @@ fn build_import_queue(
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,
_,
@@ -337,7 +339,6 @@ fn build_import_queue(
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
Ok(timestamp)
},
slot_duration,
&task_manager.spawn_essential_handle(),
config.prometheus_registry(),
telemetry,
@@ -366,11 +367,6 @@ fn start_consensus(
#[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.
#[cfg(not(feature = "async-backing"))]
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(),
@@ -407,8 +403,6 @@ fn start_consensus(
collator_key,
para_id,
overseer_handle,
#[cfg(not(feature = "async-backing"))]
slot_duration,
relay_chain_slot_duration,
proposer,
collator_service,
+2 -4
View File
@@ -69,9 +69,7 @@ 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-parachain-system = { workspace = true }
cumulus-pallet-session-benchmarking = { workspace = true }
cumulus-pallet-xcm = { workspace = true }
cumulus-pallet-xcmp-queue = { workspace = true }
@@ -98,6 +96,7 @@ std = [
"cumulus-pallet-session-benchmarking/std",
"cumulus-pallet-xcm/std",
"cumulus-pallet-xcmp-queue/std",
"cumulus-primitives-aura/std",
"cumulus-primitives-core/std",
"cumulus-primitives-storage-weight-reclaim/std",
"cumulus-primitives-utility/std",
@@ -225,7 +224,6 @@ try-runtime = [
"sp-runtime/try-runtime",
]
experimental = [ "pallet-aura/experimental" ]
# A feature that should be enabled when the runtime should be built for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller, like logging for example.
+9 -5
View File
@@ -1,5 +1,5 @@
use frame_support::{
genesis_builder_helper::{build_config, create_default_config},
genesis_builder_helper::{build_state, get_preset},
weights::Weight,
};
use sp_api::impl_runtime_apis;
@@ -316,12 +316,16 @@ impl_runtime_apis! {
}
impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
fn create_default_config() -> Vec<u8> {
create_default_config::<RuntimeGenesisConfig>()
fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
build_state::<RuntimeGenesisConfig>(config)
}
fn build_config(config: Vec<u8>) -> sp_genesis_builder::Result {
build_config::<RuntimeGenesisConfig>(config)
fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, |_| None)
}
fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
Default::default()
}
}
}
+4 -5
View File
@@ -48,7 +48,7 @@ use crate::{
constants::{
currency::{deposit, CENTS, EXISTENTIAL_DEPOSIT, GRAND, MICROCENTS},
AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MAX_BLOCK_LENGTH,
NORMAL_DISPATCH_RATIO, SLOT_DURATION, VERSION,
NORMAL_DISPATCH_RATIO, VERSION,
},
types::{
AccountId, AssetKind, Balance, Beneficiary, Block, BlockNumber,
@@ -200,10 +200,7 @@ impl pallet_preimage::Config for Runtime {
}
impl pallet_timestamp::Config for Runtime {
#[cfg(feature = "experimental")]
type MinimumPeriod = ConstU64<0>;
#[cfg(not(feature = "experimental"))]
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
/// A timestamp: milliseconds since the unix epoch.
type Moment = u64;
type OnTimestampSet = Aura;
@@ -359,7 +356,7 @@ impl pallet_transaction_payment::Config for Runtime {
/// With fast adjusting fees change rapidly, but fixed for all users at each block (no tipping)
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter<Balances, ()>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type RuntimeEvent = RuntimeEvent;
type WeightToFee = WeightToFee;
@@ -442,7 +439,9 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ChannelInfo = ParachainSystem;
type ControllerOrigin = EnsureRoot<AccountId>;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type MaxActiveOutboundChannels = ConstU32<128>;
type MaxInboundSuspended = MaxInboundSuspended;
type MaxPageSize = ConstU32<{ 1 << 16 }>;
/// Ensure that this value is not set to null (or NoPriceForMessageDelivery) to prevent spamming
type PriceForSiblingDelivery = PriceForSiblingParachainDelivery;
type RuntimeEvent = RuntimeEvent;
@@ -182,6 +182,7 @@ impl xcm_executor::Config for XcmConfig {
// Teleporting is disabled.
type UniversalLocation = UniversalLocation;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type XcmRecorder = PolkadotXcm;
type XcmSender = XcmRouter;
}
@@ -68,6 +68,28 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
// TODO: below is random
fn burn_allow_death() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 25_741_000 picoseconds.
Weight::from_parts(26_321_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
// TODO: below is random
fn burn_keep_alive() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 25_741_000 picoseconds.
Weight::from_parts(26_321_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 {
@@ -46,20 +46,6 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
.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: `42`
// Estimated: `1527`
// Minimum execution time: 18_744_000 picoseconds.
Weight::from_parts(19_226_000, 0)
.saturating_add(Weight::from_parts(0, 1527))
.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 {
@@ -100,16 +86,6 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
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 {
@@ -15,7 +15,6 @@ 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 }
generic-runtime-template = { path = "../runtime" }
+201 -243
View File
@@ -1,290 +1,239 @@
use std::time::{Duration, Instant};
use std::{
iter,
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 frame_system::Account;
// Local Imports
use generic_runtime_template::{
configs::MaxCandidates, constants::SLOT_DURATION, AllPalletsWithSystem, Balance, Balances,
BlockNumber, Executive, Runtime, RuntimeCall, RuntimeOrigin, SudoConfig, UncheckedExtrinsic,
Executive, Runtime, RuntimeCall, RuntimeOrigin, SudoConfig, UncheckedExtrinsic,
};
use pallet_balances::{Holds, TotalIssuance};
use parachains_common::AccountId;
use sp_consensus_aura::AURA_ENGINE_ID;
use parity_scale_codec::{DecodeLimit, Encode};
use sp_consensus_aura::{Slot, AURA_ENGINE_ID};
use sp_runtime::{
testing::H256,
traits::{Dispatchable, Header},
Digest, DigestItem, Storage,
};
use substrate_runtime_fuzzer::{Data, INITIAL_TIMESTAMP, MAX_TIME_FOR_BLOCK};
use sp_state_machine::BasicExternalities;
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 generic_runtime_template::{
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()
fn generate_genesis(accounts: &[AccountId]) -> Storage {
use generic_runtime_template::{
BalancesConfig, CollatorSelectionConfig, RuntimeGenesisConfig, SessionConfig, SessionKeys,
};
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_runtime::{app_crypto::ByteArray, BuildStorage};
ziggy::fuzz!(|data: &[u8]| {
let mut iterable = Data::from_data(data);
// Configure endowed accounts with initial balance of 1 << 60.
let balances = accounts.iter().cloned().map(|k| (k, 1 << 60)).collect();
let invulnerables: Vec<AccountId> = vec![[0; 32].into()];
let session_keys = vec![(
[0; 32].into(),
[0; 32].into(),
SessionKeys { aura: AuraId::from_slice(&[0; 32]).unwrap() },
)];
let root: AccountId = [0; 32].into();
// Max weight for a block.
let max_weight: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND * 2, 0);
RuntimeGenesisConfig {
system: Default::default(),
balances: BalancesConfig { balances },
aura: Default::default(),
session: SessionConfig { keys: session_keys },
collator_selection: CollatorSelectionConfig {
invulnerables,
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()
}
let extrinsics: Vec<(Option<u32>, usize, RuntimeCall)> =
iterable.extract_extrinsics::<RuntimeCall>();
fn process_input(accounts: &[AccountId], genesis: &Storage, data: &[u8]) {
let mut data = data;
// We build the list of extrinsics we will execute
let extrinsics: Vec<(/* lapse */ u8, /* origin */ u8, RuntimeCall)> =
iter::from_fn(|| DecodeLimit::decode_with_depth_limit(64, &mut data).ok())
.filter(|(_, _, x)| !matches!(x, RuntimeCall::System(_)))
.collect();
if extrinsics.is_empty() {
return;
}
if extrinsics.is_empty() {
return;
}
let mut block: u32 = 1;
let mut weight: Weight = 0.into();
let mut elapsed: Duration = Duration::ZERO;
// `externalities` represents the state of our mock chain.
let mut externalities = Externalities::new(genesis_storage.clone());
BasicExternalities::execute_with_storage(&mut genesis.clone(), || {
let initial_total_issuance = TotalIssuance::<Runtime>::get();
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;
initialize_block(block);
let start_block = |block: u32, lapse: u32| {
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 {
for (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.
let origin_no = origin % endowed_accounts.len();
let origin_no = origin as usize % accounts.len();
if !recursive_call_filter(&extrinsic, origin_no) {
continue;
}
if let Some(lapse) = maybe_lapse {
// We update our state variables
current_weight = Weight::zero();
if lapse > 0 {
finalize_block(elapsed);
block += u32::from(lapse) * 393; // 393 * 256 = 100608 which nearly corresponds to a week
weight = 0.into();
elapsed = Duration::ZERO;
// We start the next block
externalities.execute_with(|| start_block(current_block, lapse));
current_block += lapse;
initialize_block(block);
}
// 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() {
println!("Skipping because of max weight {max_weight}");
weight.saturating_accrue(extrinsic.get_dispatch_info().weight);
if weight.ref_time() >= 2 * WEIGHT_REF_TIME_PER_SECOND {
println!("Extrinsic would exhaust block weight, skipping");
continue;
}
externalities.execute_with(|| {
let origin_account = endowed_accounts[origin_no].clone();
{
println!("\n origin: {origin_account:?}");
println!(" call: {extrinsic:?}");
}
let _res = extrinsic.clone().dispatch(RuntimeOrigin::signed(origin_account));
println!(" result: {_res:?}");
let origin = accounts[origin_no].clone();
// 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);
}
*/
});
println!("\n origin: {origin:?}");
println!(" call: {extrinsic:?}");
let now = Instant::now(); // We get the current time for timing purposes.
#[allow(unused_variables)]
let res = extrinsic.dispatch(RuntimeOrigin::signed(origin));
elapsed += now.elapsed();
println!(" result: {res:?}");
}
println!("\n time spent: {elapsed:?}");
assert!(elapsed.as_secs() <= MAX_TIME_FOR_BLOCK, "block execution took too much time");
finalize_block(elapsed);
// We end the final block
externalities.execute_with(|| {
// Finilization
Executive::finalize_block();
// Invariants
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 transferred 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}"
);
println!("running integrity tests");
// We run all developer-defined integrity tests
<AllPalletsWithSystem as IntegrityTest>::integrity_test();
});
check_invariants(block, initial_total_issuance);
});
}
fn initialize_block(block: u32) {
println!("\ninitializing block {}", block);
let current_timestamp = u64::from(block) * SLOT_DURATION;
let prev_header = match block {
1 => None,
_ => Some(Executive::finalize_block()),
};
let parent_header = &Header::new(
block,
H256::default(),
H256::default(),
prev_header.clone().map(|x| x.hash()).unwrap_or_default(),
Digest {
logs: vec![DigestItem::PreRuntime(
AURA_ENGINE_ID,
Slot::from(u64::from(block)).encode(),
)],
},
);
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: 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
}
fn finalize_block(elapsed: Duration) {
println!("\n time spent: {elapsed:?}");
assert!(elapsed.as_secs() <= 2, "block execution took too much time");
println!(" finalizing block");
Executive::finalize_block();
}
fn check_invariants(block: u32, initial_total_issuance: Balance) {
let mut counted_free = 0;
let mut counted_reserved = 0;
for (account, info) in Account::<Runtime>::iter() {
let consumers = info.consumers;
let providers = info.providers;
assert!(!(consumers > 0 && providers == 0), "Invalid c/p state");
counted_free += info.data.free;
counted_reserved += info.data.reserved;
let max_lock: Balance =
Balances::locks(&account).iter().map(|l| l.amount).max().unwrap_or_default();
assert_eq!(max_lock, info.data.frozen, "Max lock should be equal to frozen balance");
let sum_holds: Balance = Holds::<Runtime>::get(&account).iter().map(|l| l.amount).sum();
assert!(
sum_holds <= info.data.reserved,
"Sum of all holds ({sum_holds}) should be less than or equal to reserved balance {}",
info.data.reserved
);
}
let total_issuance = TotalIssuance::<Runtime>::get();
let counted_issuance = counted_free + counted_reserved;
assert_eq!(total_issuance, counted_issuance);
assert!(total_issuance <= initial_total_issuance);
// We run all developer-defined integrity tests
AllPalletsWithSystem::integrity_test();
AllPalletsWithSystem::try_state(block, TryStateSelect::All).unwrap();
}
fn recursive_call_filter(call: &RuntimeCall, origin: usize) -> bool {
match call {
//recursion
@@ -352,3 +301,12 @@ fn recursive_call_filter(call: &RuntimeCall, origin: usize) -> bool {
_ => true,
}
}
fn main() {
let accounts: Vec<AccountId> = (0..5).map(|i| [i; 32].into()).collect();
let genesis = generate_genesis(&accounts);
ziggy::fuzz!(|data: &[u8]| {
process_input(&accounts, &genesis, data);
});
}