mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-10-22 03:36:18 +00:00
Glutton Parachain (#2294)
* Glutton Parachain * implement collator stuff * add glutton * implement missing api calls * small changes * use shell-runtime as starting point * update docs * Glutton chain configurations * successfully build * add local chain config * chain spec * update Cargo.lock * Update parachains/runtimes/glutton/glutton-kusama/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update parachains/runtimes/glutton/glutton-kusama/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update parachains/runtimes/glutton/glutton-kusama/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update parachains/runtimes/glutton/glutton-kusama/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * explicit indices * update para_id * irrelevant docs * update glutton.json * para_id as cli argument * expect * merge * update * fixes * xcm-builder/runtime-benchmarks added * benchmarks enabled * add glutton to bench scripts + nitpick * remove local bootnode * ".git/.scripts/commands/fmt/fmt.sh" * make clippy happy * fix clippy * fix chain_spec * fix chain_spec 2 * fix chain_spec 3 * ".git/.scripts/commands/bench/bench.sh" pallet glutton-kusama-dev-1300 glutton pallet_glutton * Update polkadot-parachain/src/chain_spec/glutton.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update parachains/runtimes/glutton/glutton-kusama/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --------- Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: NachoPal <ignacio.palacios.santos@gmail.com> Co-authored-by: command-bot <>
This commit is contained in:
authored and
1 parent
17b2e1b300
commit
0bc3d2c0ce
16 files changed
+1048
-2
No files matched your search
Generated
+53
@@ -4354,6 +4354,40 @@ dependencies = [
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glutton-runtime"
|
||||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"cumulus-pallet-parachain-system",
|
||||
"cumulus-pallet-xcm",
|
||||
"cumulus-primitives-core",
|
||||
"frame-benchmarking",
|
||||
"frame-executive",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"frame-system-benchmarking",
|
||||
"frame-try-runtime",
|
||||
"pallet-glutton",
|
||||
"parachain-info",
|
||||
"parachains-common",
|
||||
"parity-scale-codec",
|
||||
"scale-info",
|
||||
"sp-api",
|
||||
"sp-block-builder",
|
||||
"sp-core",
|
||||
"sp-inherents",
|
||||
"sp-offchain",
|
||||
"sp-runtime",
|
||||
"sp-session",
|
||||
"sp-std",
|
||||
"sp-transaction-pool",
|
||||
"sp-version",
|
||||
"substrate-wasm-builder",
|
||||
"xcm",
|
||||
"xcm-builder",
|
||||
"xcm-executor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "group"
|
||||
version = "0.12.1"
|
||||
@@ -7128,6 +7162,24 @@ dependencies = [
|
||||
"sp-std",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pallet-glutton"
|
||||
version = "4.0.0-dev"
|
||||
source = "git+https://github.com/paritytech/substrate?branch=master#a14236059c2d3da052fb08295082341aa7b87240"
|
||||
dependencies = [
|
||||
"blake2",
|
||||
"frame-benchmarking",
|
||||
"frame-support",
|
||||
"frame-system",
|
||||
"log",
|
||||
"parity-scale-codec",
|
||||
"scale-info",
|
||||
"sp-core",
|
||||
"sp-io",
|
||||
"sp-runtime",
|
||||
"sp-std",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pallet-grandpa"
|
||||
version = "4.0.0-dev"
|
||||
@@ -9197,6 +9249,7 @@ dependencies = [
|
||||
"frame-benchmarking",
|
||||
"frame-benchmarking-cli",
|
||||
"futures",
|
||||
"glutton-runtime",
|
||||
"hex-literal 0.4.1",
|
||||
"jsonrpsee",
|
||||
"log",
|
||||
|
||||
@@ -50,6 +50,7 @@ members = [
|
||||
"parachains/runtimes/bridge-hubs/bridge-hub-polkadot",
|
||||
"parachains/runtimes/collectives/collectives-polkadot",
|
||||
"parachains/runtimes/contracts/contracts-rococo",
|
||||
"parachains/runtimes/glutton/glutton-kusama",
|
||||
"parachains/runtimes/testing/penpal",
|
||||
"test/client",
|
||||
"test/relay-sproof-builder",
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "Glutton 1300",
|
||||
"id": "glutton_kusama_1300",
|
||||
"chainType": "Live",
|
||||
"bootNodes": [],
|
||||
"telemetryEndpoints": null,
|
||||
"protocolId": "glutton_kusama_1300",
|
||||
"properties": {
|
||||
"ss58Format": 2
|
||||
},
|
||||
"relay_chain": "kusama",
|
||||
"para_id": 1300,
|
||||
"codeSubstitutes": {},
|
||||
"genesis": {
|
||||
"raw": {
|
||||
"top": {
|
||||
"0x0d715f2646c8f85767b5d2764bb2782604a74d81251e398fd8a0a4d55023bb3f": "0x14050000",
|
||||
"0x0d715f2646c8f85767b5d2764bb278264e7b9012096b41c4eb3aaf947f6ea429": "0x0000",
|
||||
"0x26aa394eea5630e07c48ae0c9558cef74e7b9012096b41c4eb3aaf947f6ea429": "0x0000",
|
||||
"0x26aa394eea5630e07c48ae0c9558cef75684a022a34dd8bfa2baaf44f172b710": "0x01",
|
||||
"0x26aa394eea5630e07c48ae0c9558cef78a42f33323cb5ced3b44dd825fda9fcc": "0x4545454545454545454545454545454545454545454545454545454545454545",
|
||||
"0x26aa394eea5630e07c48ae0c9558cef7a44704b568d21667356a5a050c118746b4def25cfda6ef3a00000000": "0x4545454545454545454545454545454545454545454545454545454545454545",
|
||||
"0x26aa394eea5630e07c48ae0c9558cef7a7fd6c28836b9a28522dc924110cf439": "0x01",
|
||||
"0x26aa394eea5630e07c48ae0c9558cef7f9cce9c888469bb1a0dceaa129672ef8": "0x041c676c7574746f6e",
|
||||
"0x3a63": "0x",
|
||||
"0x3a636f6465": "0x52bc537646db8e0528b52ffd0058b4cc04deb74577114e107877930e70565839d8f5c5fa791f7f0f5c593af01ed6cb7ac383ca0b0d8c5e36d281f7f762a3b9c9ec446be48a97b7d91b85fd0c036a24e77aab729d618f216e1c6d13b2b7245b6e29654a29059c127a108f103fedce21f4c8277e98923a2473bf33b2c9b973494a00509377ca01a9dca4c8a77676e7aa2e19f3718b1121f44edb57ac3320954f7ca926350099fbeb2549f9c4179f9e7328bf9a927d76f6d69c2be603b456bc3e6bade93f0d73d7d3340585cc2b9fd8f97ae4d3fe3a633e7bbd6241dcec19591372bb48907a33c598d6e1d326c4b7b7107c72def1bba70873c359347df34ed638eaf8f4c3eed8b4be4ec327f676e51d6d9c8633caa68b4debce954deb5b5cbfd69577b44753528479f5c5d8150bc2ee7c08bb9b8e35c55990ca525d6fb61d7ad68522d3540ad0f81d7a75c93baafd643fedfadb0efdf69a4a0199df5f5fac8885e2756e3be45c3526eed59d4684f4eaada902d99cd70c11bd9b40a457d7335ee7372df35b3bebab26dda5daa2205bdf572e80fa62400e947dcf129bd677889b20158767fe04bae5393afcc9c89d07c0dd9fe8e0ed4ac5fa931c3ee33fe898a81a3eb3c39fb85ffe249b281dde337ec39f90bc9ff044714fd47bce13c56eb5a37aa2dea4621df53c07cffcc98d89c281c3754cd40d9fd11cc78de370940ec77cc64bfe444e9474e7fcc23151d3ad1dbc873bcb7138ca398e898ad179a2a4b3a370f8e54f2adf315134345e63a2da45132572ed7294e6d744753beaf21ab7c1ecd844c5e872a27aa278b8746e674761ce13156d382a3a8ef3e028761e268a86c66f4cd40db72ccf61a26872f01bd60de7c15196f3305139883a0747896e2615261b1365c36fdcf01a1b376e4cdf414acf8187949714693770e8c89a2d27923afa5d37e28c1631f7706433ee6916374bebc615311d38743c6d268b5224ea8bad1b19c63a44188ecc72cfc9192ddee8780347bf1e3df0e566b4cb7dc878903d7ad8c071b50807c751ce7170443a744c37f17313d6430f8e92de430f9a65cdf8741c4c3a4e34991ca5b9a987e9cddc609fde038ecc7b701f1ca5c37dc0c171d4e5383ce0b80f8e12c51e3d2ecda79be20d37b91e3d7af4e028cb7b98a81e3db2761f78e08187a330e721f2e93839388f1d74f8e0388ec2e1382613009c878932f90e3c388ea3a4efe0289e376ec386c3e1d37bf0e0e13be49083d7388f1d9c87a332e7f1bc87fb70d48cfb581d1bf7c15133eec3def80e3eb80f47e9f01d1cf51cc7646333dd06c76d1ca5b9cd3aea721be7a1a6c677c861a2784c140fdfc16b72f01a47615eb38e8ace839b1cc56e5a00f47094e53d260a003d7c4e14003c871cdce4a8f6e92891fb98a81e7af09b89aa99a81ab761c36d266ac70eaf99281bb761c36b1c75c36b266a478def70d48d639367874985ce44d5a8e13c266ac744ed701e8e613e1d3527aac60e3e1d55c3afe984fbe028399f509c751f26aa8749c5e25ccec34449e9341345e3170f7e394a348fb8264a5e6e3351d23191638eb2716d1a71630ea138eba689ea71c301305173a2a6f3a0f9cd44eda083cf8992411a5800a5479b5478cf13cd791a471da54d948ea93eb571d47598de38ea38660e3c74b8cd44d5e4f01d13a56352e13d3a1ca563a26666569ab171d4734c6d9c1fe6667af56c961cd57309c559c73151372615dbf364c669262a731b930a9d9e27ed35266a66e4d944f5a4c27b9eb4678eca26ca9a3aa4596a1cf5d1d4c609c0dc7ebc3acf1fd8445d930a53cf13e872a244930aef79c26e39ca9aa8385d71d651d5cc1a471d4e6d9c9cb9e9bcfa9b26c55977d388e2acab0b75131cce29232bd7de79a26270d2062d655cc0061640e979e2057429628f17cfd5bd779e2814a6b0e2096e3003164fa0d063b9baa9779e08c5200a2bac808c2ab4a18b163dd1d5757ae7890e63ac21086258410a378ca147bafa8fde79a2571003041bac200663c868438fc8d563ef08810184316ce982031d38018c1ef5ac778418421865e8411a5210b3831ef552ef08dd800b38707183316990e10c3dea3cbda33dea526aaa38ed222d2a4ebbdc4b8a2a5fccc7b91469daa35811d93b6969aa38eb518b8ab38e730400bca6a498a2f39a7a12e6a56620d3d4932e9ff39a72c2e5e5bb2c4d1b873d6ab1717856fe301f764bd39eaa678b5f79d4b4c7614564cfde1891ec9d3346247bf6c588688a88a6fe554d9cd07287e1040b3b33333be9e299995948ea053276e7537bbb129fda6fa209c8ac7ff76fd76ff1dbdb1d9f6e1a25f566d34922d35414555e53510c3d015e53506879c57c8ac8b68c87b38c4fcfdbe5d3f45bdb971a806c1ff6f534e88bf93474c588107a28171bf21cceedf973c9d890ec9f2be6d8e45cbaabb57dd917d49e2fa66cda687e5d4ac5e0dc841e7a6b5b7cdead6deea1f3b06c6d5bc0b74bc5aab93df195b7b669eadb9fb6299b9e70620923477cfba66cda8cf8f6edb9b2691be2db79fa69fa9506d465ca9419f3cf5bdb8478e772afd69c3f4d5fb122aa871a50f56f6efb3d81b64c9932657e13fa76a74536ed05d739917a812e3090690a8a30dec4a7ed723e6da66767f7913114593cdf3cff66b3002cba688e3e0f5f7c5267d7d9224805c005324d0d6df9589af2ea199f343594e5d56d685e5d6f5475b27575b5a4543ee9be24393eb1abcb957ba9ce2c00064ed8a4dfcedbd919f3e1a93bb30018446193fe7a6b92175b57cc4d27dfa57cd2dfe2abcbbe58db676c7db1c8a676c586d05fe761cc879d87b70b529fd997790aed0e91ebab15916deed9e37a8cda3bca385bf6eb5bf68e4fecbb49f4f6723b0f6f7777af772fb3c7e7594384dd39ef90759e1b7bf3ae19526f36d71f32a901c8d4db15f3515f2cc81343434350bc4e65d3169f5df2e5f8c4a75536b1f3706b8e4dec3999f3129ff4333e299b36f7eaec347c6a672ff1697dda694c74f82542f1d7e3efac21b2ee7cddcda0fd9e8af9ecdcf6d76f78fef8eb0e42bddb04a9af375bf6ec32f269db4102235bdfaee71eb2f57675c58a58ffe9a96c52e761b95a3ff6e5995c23b9d76aee2f310f543d931a1893ebd7d9470a44c90e3d50029e09fc7576920251b2430f94805f67576c881b1afa751e967ca90259dfda1d9bd4239fb6fd7675d95a64933a4ed6aeae981065937acfc826751e967cadc67f2910259b7a26f0d7d93105a264871e2801bfcebe5811d9d0af5f7cd267576cc80efd3a0ff3300ff3b06aca2675bde1f993bdee20c4cb5a90ca520590adabab45ba820253ca20227541ca62f486511a233224138cd0189161c486511b468085017bc3c808a3314648180d615e303123178c88306ac18805a31f8cae18bd6034054b0336068c0c181a232c46658ca2c0cc8091198981b501830336064303b606ec0c58194657462bc0d8806101cb0276054c0b98184642c0ba807dc1b6300aLine truncated
|
||||
"0x3a65787472696e7369635f696e646578": "0x00000000",
|
||||
"0x45323df7cc47150b3930e2666b0aa3134e7b9012096b41c4eb3aaf947f6ea429": "0x0200",
|
||||
"0x79e2fe5d327165001f8232643023ed8b4e7b9012096b41c4eb3aaf947f6ea429": "0x0000",
|
||||
"0xc2eac8c3d5c3234dc0a1a2cbcf2683444e7b9012096b41c4eb3aaf947f6ea429": "0x0000"
|
||||
},
|
||||
"childrenDefault": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
[package]
|
||||
name = "glutton-runtime"
|
||||
version = "1.0.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.3.1", default-features = false, features = ["derive"] }
|
||||
|
||||
# Substrate
|
||||
frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" }
|
||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" }
|
||||
frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" }
|
||||
pallet-glutton = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" }
|
||||
sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
# Polkadot
|
||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
|
||||
# Cumulus
|
||||
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false }
|
||||
cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false }
|
||||
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
|
||||
parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
|
||||
parachains-common = { path = "../../../common", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
runtime-benchmarks = [
|
||||
"frame-benchmarking/runtime-benchmarks",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"frame-system-benchmarking/runtime-benchmarks",
|
||||
"frame-system/runtime-benchmarks",
|
||||
"pallet-glutton/runtime-benchmarks",
|
||||
"xcm-builder/runtime-benchmarks",
|
||||
]
|
||||
std = [
|
||||
"codec/std",
|
||||
"scale-info/std",
|
||||
"frame-executive/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"pallet-glutton/std",
|
||||
"sp-api/std",
|
||||
"sp-block-builder/std",
|
||||
"sp-core/std",
|
||||
"sp-inherents/std",
|
||||
"sp-offchain/std",
|
||||
"sp-runtime/std",
|
||||
"sp-session/std",
|
||||
"sp-std/std",
|
||||
"sp-transaction-pool/std",
|
||||
"sp-version/std",
|
||||
"xcm-builder/std",
|
||||
"xcm-executor/std",
|
||||
"xcm/std",
|
||||
"cumulus-pallet-parachain-system/std",
|
||||
"cumulus-pallet-xcm/std",
|
||||
"cumulus-primitives-core/std",
|
||||
"parachain-info/std",
|
||||
"parachains-common/std",
|
||||
]
|
||||
try-runtime = [
|
||||
"frame-executive/try-runtime",
|
||||
"frame-try-runtime/try-runtime",
|
||||
"pallet-glutton/try-runtime",
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
use substrate_wasm_builder::WasmBuilder;
|
||||
|
||||
fn main() {
|
||||
WasmBuilder::new()
|
||||
.with_current_project()
|
||||
.export_heap_base()
|
||||
.import_memory()
|
||||
.build()
|
||||
}
|
||||
@@ -0,0 +1,423 @@
|
||||
// Copyright (C) 2023 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! # Glutton Runtime
|
||||
//!
|
||||
//! The purpose of the Glutton parachain is to do stress testing on the Kusama
|
||||
//! network.
|
||||
//!
|
||||
//! There may be multiple instances of the Glutton parachain deployed and
|
||||
//! connected to Kusama.
|
||||
//!
|
||||
//! These parachains are not holding any real value. Their purpose is to stress
|
||||
//! test the network.
|
||||
//!
|
||||
//! ### Governance
|
||||
//!
|
||||
//! Glutton defers its governance (namely, its `Root` origin), to its Relay
|
||||
//! Chain parent, Kusama.
|
||||
//!
|
||||
//! ### XCM
|
||||
//!
|
||||
//! Since the main goal of Glutton is solely stress testing, the parachain will
|
||||
//! only be able receive XCM messages from Kusama via DMP. This way the Glutton
|
||||
//! parachains will be able to listen for upgrades that are coming from the
|
||||
//! Relay chain.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
// Make the WASM binary available.
|
||||
#[cfg(feature = "std")]
|
||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||
|
||||
pub mod weights;
|
||||
pub mod xcm_config;
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
|
||||
use frame_support::unsigned::TransactionValidityError;
|
||||
use scale_info::TypeInfo;
|
||||
use sp_api::impl_runtime_apis;
|
||||
use sp_core::OpaqueMetadata;
|
||||
use sp_runtime::{
|
||||
create_runtime_str, generic,
|
||||
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, DispatchInfoOf},
|
||||
transaction_validity::{TransactionSource, TransactionValidity},
|
||||
ApplyExtrinsicResult,
|
||||
};
|
||||
use sp_std::prelude::*;
|
||||
#[cfg(feature = "std")]
|
||||
use sp_version::NativeVersion;
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
pub use frame_support::{
|
||||
construct_runtime,
|
||||
dispatch::DispatchClass,
|
||||
parameter_types,
|
||||
traits::{Everything, IsInVec, Randomness},
|
||||
weights::{
|
||||
constants::{
|
||||
BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND,
|
||||
},
|
||||
IdentityFee, Weight,
|
||||
},
|
||||
StorageValue,
|
||||
};
|
||||
use frame_system::limits::{BlockLength, BlockWeights};
|
||||
use parachains_common::{AccountId, Signature};
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use sp_runtime::BuildStorage;
|
||||
pub use sp_runtime::{Perbill, Permill};
|
||||
|
||||
#[sp_version::runtime_version]
|
||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("glutton"),
|
||||
impl_name: create_runtime_str!("glutton"),
|
||||
authoring_version: 1,
|
||||
spec_version: 9430,
|
||||
impl_version: 0,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
transaction_version: 1,
|
||||
state_version: 1,
|
||||
};
|
||||
|
||||
/// The version information used to identify this runtime when compiled natively.
|
||||
#[cfg(feature = "std")]
|
||||
pub fn native_version() -> NativeVersion {
|
||||
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
|
||||
}
|
||||
|
||||
/// We assume that ~10% of the block weight is consumed by `on_initialize` handlers.
|
||||
/// This is used to limit the maximal weight of a single extrinsic.
|
||||
const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
|
||||
/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used
|
||||
/// by Operational extrinsics.
|
||||
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||
/// We allow for .5 seconds of compute with a 12 second average block time.
|
||||
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
|
||||
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
|
||||
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: BlockNumber = 4096;
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
pub RuntimeBlockLength: BlockLength =
|
||||
BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
|
||||
pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
|
||||
.base_block(BlockExecutionWeight::get())
|
||||
.for_class(DispatchClass::all(), |weights| {
|
||||
weights.base_extrinsic = ExtrinsicBaseWeight::get();
|
||||
})
|
||||
.for_class(DispatchClass::Normal, |weights| {
|
||||
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
|
||||
})
|
||||
.for_class(DispatchClass::Operational, |weights| {
|
||||
weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
|
||||
// Operational transactions have some extra reserved space, so that they
|
||||
// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
|
||||
weights.reserved = Some(
|
||||
MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
|
||||
);
|
||||
})
|
||||
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
|
||||
.build_or_panic();
|
||||
pub const SS58Prefix: u8 = 2;
|
||||
}
|
||||
|
||||
impl frame_system::Config for Runtime {
|
||||
type AccountId = AccountId;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||
type Index = Index;
|
||||
type BlockNumber = BlockNumber;
|
||||
type Hash = Hash;
|
||||
type Hashing = BlakeTwo256;
|
||||
type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type Version = Version;
|
||||
type PalletInfo = PalletInfo;
|
||||
type AccountData = ();
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type DbWeight = ();
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type SystemWeightInfo = ();
|
||||
type BlockWeights = RuntimeBlockWeights;
|
||||
type BlockLength = RuntimeBlockLength;
|
||||
type SS58Prefix = SS58Prefix;
|
||||
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
// We do anything the parent chain tells us in this runtime.
|
||||
pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(2);
|
||||
}
|
||||
|
||||
impl cumulus_pallet_parachain_system::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type OnSystemEvent = ();
|
||||
type SelfParaId = parachain_info::Pallet<Runtime>;
|
||||
type OutboundXcmpMessageSource = ();
|
||||
type DmpMessageHandler = cumulus_pallet_xcm::UnlimitedDmpExecution<Runtime>;
|
||||
type ReservedDmpWeight = ReservedDmpWeight;
|
||||
type XcmpMessageHandler = ();
|
||||
type ReservedXcmpWeight = ();
|
||||
type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases;
|
||||
}
|
||||
|
||||
impl parachain_info::Config for Runtime {}
|
||||
|
||||
impl pallet_glutton::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type WeightInfo = weights::pallet_glutton::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
construct_runtime! {
|
||||
pub enum Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = generic::Block<Header, sp_runtime::OpaqueExtrinsic>,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Storage, Config, Event<T>} = 0,
|
||||
ParachainSystem: cumulus_pallet_parachain_system::{
|
||||
Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned,
|
||||
} = 1,
|
||||
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 2,
|
||||
|
||||
// DMP handler.
|
||||
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin} = 10,
|
||||
|
||||
// The main stage.
|
||||
Glutton: pallet_glutton::{Pallet, Call, Storage, Event} = 20,
|
||||
}
|
||||
}
|
||||
|
||||
/// Simple implementation which fails any transaction which is signed.
|
||||
#[derive(Eq, PartialEq, Clone, Default, sp_core::RuntimeDebug, Encode, Decode, TypeInfo)]
|
||||
pub struct DisallowSigned;
|
||||
impl sp_runtime::traits::SignedExtension for DisallowSigned {
|
||||
const IDENTIFIER: &'static str = "DisallowSigned";
|
||||
type AccountId = AccountId;
|
||||
type Call = RuntimeCall;
|
||||
type AdditionalSigned = ();
|
||||
type Pre = ();
|
||||
fn additional_signed(
|
||||
&self,
|
||||
) -> sp_std::result::Result<(), sp_runtime::transaction_validity::TransactionValidityError> {
|
||||
Ok(())
|
||||
}
|
||||
fn pre_dispatch(
|
||||
self,
|
||||
who: &Self::AccountId,
|
||||
call: &Self::Call,
|
||||
info: &DispatchInfoOf<Self::Call>,
|
||||
len: usize,
|
||||
) -> Result<Self::Pre, TransactionValidityError> {
|
||||
self.validate(who, call, info, len).map(|_| ())
|
||||
}
|
||||
fn validate(
|
||||
&self,
|
||||
_who: &Self::AccountId,
|
||||
_call: &Self::Call,
|
||||
_info: &sp_runtime::traits::DispatchInfoOf<Self::Call>,
|
||||
_len: usize,
|
||||
) -> TransactionValidity {
|
||||
let i = sp_runtime::transaction_validity::InvalidTransaction::BadProof;
|
||||
Err(sp_runtime::transaction_validity::TransactionValidityError::Invalid(i))
|
||||
}
|
||||
}
|
||||
|
||||
/// Index of a transaction in the chain.
|
||||
pub type Index = u32;
|
||||
/// A hash of some data used by the chain.
|
||||
pub type Hash = sp_core::H256;
|
||||
/// An index to a block.
|
||||
pub type BlockNumber = u32;
|
||||
/// The address format for describing accounts.
|
||||
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
||||
/// Block header type as expected by this runtime.
|
||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||
/// Block type as expected by this runtime.
|
||||
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
|
||||
/// A Block signed with a Justification
|
||||
pub type SignedBlock = generic::SignedBlock<Block>;
|
||||
/// BlockId type as expected by this runtime.
|
||||
pub type BlockId = generic::BlockId<Block>;
|
||||
/// The SignedExtension to the basic transaction logic.
|
||||
pub type SignedExtra = DisallowSigned;
|
||||
/// Unchecked extrinsic type as expected by this runtime.
|
||||
pub type UncheckedExtrinsic =
|
||||
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
|
||||
/// Extrinsic type that has already been checked.
|
||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;
|
||||
/// Executive: handles dispatch to the various modules.
|
||||
pub type Executive = frame_executive::Executive<
|
||||
Runtime,
|
||||
Block,
|
||||
frame_system::ChainContext<Runtime>,
|
||||
Runtime,
|
||||
AllPalletsWithSystem,
|
||||
>;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
#[macro_use]
|
||||
extern crate frame_benchmarking;
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
mod benches {
|
||||
define_benchmarks!(
|
||||
[frame_system, SystemBench::<Runtime>]
|
||||
[pallet_glutton, Glutton]
|
||||
);
|
||||
}
|
||||
|
||||
impl_runtime_apis! {
|
||||
impl sp_api::Core<Block> for Runtime {
|
||||
fn version() -> RuntimeVersion {
|
||||
VERSION
|
||||
}
|
||||
|
||||
fn execute_block(block: Block) {
|
||||
Executive::execute_block(block)
|
||||
}
|
||||
|
||||
fn initialize_block(header: &<Block as BlockT>::Header) {
|
||||
Executive::initialize_block(header)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_api::Metadata<Block> for Runtime {
|
||||
fn metadata() -> OpaqueMetadata {
|
||||
OpaqueMetadata::new(Runtime::metadata().into())
|
||||
}
|
||||
|
||||
fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
|
||||
Runtime::metadata_at_version(version)
|
||||
}
|
||||
|
||||
fn metadata_versions() -> sp_std::vec::Vec<u32> {
|
||||
Runtime::metadata_versions()
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_block_builder::BlockBuilder<Block> for Runtime {
|
||||
fn apply_extrinsic(
|
||||
extrinsic: <Block as BlockT>::Extrinsic,
|
||||
) -> ApplyExtrinsicResult {
|
||||
Executive::apply_extrinsic(extrinsic)
|
||||
}
|
||||
|
||||
fn finalize_block() -> <Block as BlockT>::Header {
|
||||
Executive::finalize_block()
|
||||
}
|
||||
|
||||
fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
||||
data.create_extrinsics()
|
||||
}
|
||||
|
||||
fn check_inherents(block: Block, data: sp_inherents::InherentData) -> sp_inherents::CheckInherentsResult {
|
||||
data.check_extrinsics(&block)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
|
||||
fn validate_transaction(
|
||||
source: TransactionSource,
|
||||
tx: <Block as BlockT>::Extrinsic,
|
||||
block_hash: <Block as BlockT>::Hash,
|
||||
) -> TransactionValidity {
|
||||
Executive::validate_transaction(source, tx, block_hash)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
|
||||
fn offchain_worker(header: &<Block as BlockT>::Header) {
|
||||
Executive::offchain_worker(header)
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_session::SessionKeys<Block> for Runtime {
|
||||
fn decode_session_keys(_: Vec<u8>) -> Option<Vec<(Vec<u8>, sp_core::crypto::KeyTypeId)>> {
|
||||
Some(Vec::new())
|
||||
}
|
||||
|
||||
fn generate_session_keys(_: Option<Vec<u8>>) -> Vec<u8> {
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
|
||||
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
|
||||
ParachainSystem::collect_collation_info(header)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
||||
fn benchmark_metadata(extra: bool) -> (
|
||||
Vec<frame_benchmarking::BenchmarkList>,
|
||||
Vec<frame_support::traits::StorageInfo>,
|
||||
) {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkList};
|
||||
use frame_support::traits::StorageInfoTrait;
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
|
||||
let mut list = Vec::<BenchmarkList>::new();
|
||||
list_benchmarks!(list, extra);
|
||||
|
||||
let storage_info = AllPalletsWithSystem::storage_info();
|
||||
|
||||
(list, storage_info)
|
||||
}
|
||||
|
||||
fn dispatch_benchmark(
|
||||
config: frame_benchmarking::BenchmarkConfig
|
||||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey};
|
||||
use frame_system_benchmarking::Pallet as SystemBench;
|
||||
impl frame_system_benchmarking::Config for Runtime {}
|
||||
|
||||
use frame_support::traits::WhitelistedStorageKeys;
|
||||
let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();
|
||||
|
||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||
let params = (&config, &whitelist);
|
||||
add_benchmarks!(params, batches);
|
||||
Ok(batches)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct CheckInherents;
|
||||
|
||||
impl cumulus_pallet_parachain_system::CheckInherents<Block> for CheckInherents {
|
||||
fn check_inherents(
|
||||
_: &Block,
|
||||
_: &cumulus_pallet_parachain_system::RelayChainStateProof,
|
||||
) -> sp_inherents::CheckInherentsResult {
|
||||
sp_inherents::CheckInherentsResult::new()
|
||||
}
|
||||
}
|
||||
|
||||
cumulus_pallet_parachain_system::register_validate_block! {
|
||||
Runtime = Runtime,
|
||||
BlockExecutor = Executive,
|
||||
CheckInherents = CheckInherents,
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
pub mod pallet_glutton;
|
||||
@@ -0,0 +1,175 @@
|
||||
// Copyright Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for `pallet_glutton`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-05-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("glutton-kusama-dev-1300"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// target/production/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
|
||||
// --pallet=pallet_glutton
|
||||
// --chain=glutton-kusama-dev-1300
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/glutton/glutton-kusama/src/weights/
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use core::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `pallet_glutton`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_glutton::WeightInfo for WeightInfo<T> {
|
||||
/// Storage: Glutton TrashDataCount (r:1 w:1)
|
||||
/// Proof: Glutton TrashDataCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
/// Storage: Glutton TrashData (r:0 w:1000)
|
||||
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
|
||||
/// The range of component `n` is `[0, 1000]`.
|
||||
fn initialize_pallet_grow(n: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6`
|
||||
// Estimated: `1489`
|
||||
// Minimum execution time: 7_874_000 picoseconds.
|
||||
Weight::from_parts(7_943_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1489))
|
||||
// Standard Error: 1_822
|
||||
.saturating_add(Weight::from_parts(1_461_713, 0).saturating_mul(n.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
|
||||
}
|
||||
/// Storage: Glutton TrashDataCount (r:1 w:1)
|
||||
/// Proof: Glutton TrashDataCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
/// Storage: Glutton TrashData (r:0 w:1000)
|
||||
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
|
||||
/// The range of component `n` is `[0, 1000]`.
|
||||
fn initialize_pallet_shrink(n: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `66`
|
||||
// Estimated: `1489`
|
||||
// Minimum execution time: 8_562_000 picoseconds.
|
||||
Weight::from_parts(8_684_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1489))
|
||||
// Standard Error: 1_058
|
||||
.saturating_add(Weight::from_parts(951_263, 0).saturating_mul(n.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
|
||||
}
|
||||
/// The range of component `i` is `[0, 100000]`.
|
||||
fn waste_ref_time_iter(i: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 632_000 picoseconds.
|
||||
Weight::from_parts(648_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
// Standard Error: 20
|
||||
.saturating_add(Weight::from_parts(95_703, 0).saturating_mul(i.into()))
|
||||
}
|
||||
/// Storage: Glutton TrashData (r:5000 w:0)
|
||||
/// Proof: Glutton TrashData (max_values: Some(65000), max_size: Some(1036), added: 3016, mode: MaxEncodedLen)
|
||||
/// The range of component `i` is `[0, 5000]`.
|
||||
fn waste_proof_size_some(i: u32, ) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `119037 + i * (1022 ±0)`
|
||||
// Estimated: `990 + i * (3016 ±0)`
|
||||
// Minimum execution time: 508_000 picoseconds.
|
||||
Weight::from_parts(20_794_033, 0)
|
||||
.saturating_add(Weight::from_parts(0, 990))
|
||||
// Standard Error: 2_740
|
||||
.saturating_add(Weight::from_parts(5_120_718, 0).saturating_mul(i.into()))
|
||||
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(i.into())))
|
||||
.saturating_add(Weight::from_parts(0, 3016).saturating_mul(i.into()))
|
||||
}
|
||||
/// Storage: Glutton Storage (r:1 w:0)
|
||||
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
/// Storage: Glutton Compute (r:1 w:0)
|
||||
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
fn on_idle_high_proof_waste() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `89`
|
||||
// Estimated: `1489`
|
||||
// Minimum execution time: 92_266_435_000 picoseconds.
|
||||
Weight::from_parts(92_887_511_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1489))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
}
|
||||
/// Storage: Glutton Storage (r:1 w:0)
|
||||
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
/// Storage: Glutton Compute (r:1 w:0)
|
||||
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
fn on_idle_low_proof_waste() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `89`
|
||||
// Estimated: `1489`
|
||||
// Minimum execution time: 92_086_821_000 picoseconds.
|
||||
Weight::from_parts(92_651_037_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1489))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
}
|
||||
/// Storage: Glutton Storage (r:1 w:0)
|
||||
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
/// Storage: Glutton Compute (r:1 w:0)
|
||||
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
fn empty_on_idle() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `6`
|
||||
// Estimated: `1489`
|
||||
// Minimum execution time: 3_161_000 picoseconds.
|
||||
Weight::from_parts(3_222_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1489))
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
}
|
||||
/// Storage: Glutton Compute (r:0 w:1)
|
||||
/// Proof: Glutton Compute (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
fn set_compute() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 6_464_000 picoseconds.
|
||||
Weight::from_parts(6_617_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: Glutton Storage (r:0 w:1)
|
||||
/// Proof: Glutton Storage (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
|
||||
fn set_storage() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 6_510_000 picoseconds.
|
||||
Weight::from_parts(6_641_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 0))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// Copyright (C) 2023 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use super::{
|
||||
AccountId, AllPalletsWithSystem, ParachainInfo, Runtime, RuntimeCall, RuntimeEvent,
|
||||
RuntimeOrigin,
|
||||
};
|
||||
use frame_support::{
|
||||
match_types, parameter_types,
|
||||
traits::{Everything, Nothing},
|
||||
weights::Weight,
|
||||
};
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_builder::{
|
||||
AllowExplicitUnpaidExecutionFrom, FixedWeightBounds, ParentAsSuperuser, ParentIsPreset,
|
||||
SovereignSignedViaLocation,
|
||||
};
|
||||
|
||||
parameter_types! {
|
||||
pub const KusamaLocation: MultiLocation = MultiLocation::parent();
|
||||
pub const KusamaNetwork: Option<NetworkId> = Some(NetworkId::Kusama);
|
||||
pub UniversalLocation: InteriorMultiLocation = X1(Parachain(ParachainInfo::parachain_id().into()));
|
||||
}
|
||||
|
||||
/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
|
||||
/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
|
||||
/// bias the kind of local `Origin` it will become.
|
||||
pub type XcmOriginToTransactDispatchOrigin = (
|
||||
// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
|
||||
// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
|
||||
// foreign chains who want to have a local sovereign account on this chain which they control.
|
||||
SovereignSignedViaLocation<ParentIsPreset<AccountId>, RuntimeOrigin>,
|
||||
// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
|
||||
// transaction from the Root origin.
|
||||
ParentAsSuperuser<RuntimeOrigin>,
|
||||
);
|
||||
|
||||
match_types! {
|
||||
pub type JustTheParent: impl Contains<MultiLocation> = { MultiLocation { parents:1, interior: Here } };
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
|
||||
pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
pub const MaxAssetsIntoHolding: u32 = 64;
|
||||
}
|
||||
|
||||
pub struct XcmConfig;
|
||||
impl xcm_executor::Config for XcmConfig {
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type XcmSender = (); // sending XCM not supported
|
||||
type AssetTransactor = (); // balances not supported
|
||||
type OriginConverter = XcmOriginToTransactDispatchOrigin;
|
||||
type IsReserve = (); // balances not supported
|
||||
type IsTeleporter = (); // balances not supported
|
||||
type UniversalLocation = UniversalLocation;
|
||||
type Barrier = AllowExplicitUnpaidExecutionFrom<JustTheParent>;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>; // balances not supported
|
||||
type Trader = (); // balances not supported
|
||||
type ResponseHandler = (); // Don't handle responses for now.
|
||||
type AssetTrap = (); // don't trap for now
|
||||
type AssetClaims = (); // don't claim for now
|
||||
type SubscriptionService = (); // don't handle subscriptions for now
|
||||
type PalletInstancesInfo = AllPalletsWithSystem;
|
||||
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
|
||||
type AssetLocker = ();
|
||||
type AssetExchanger = ();
|
||||
type FeeManager = ();
|
||||
type MessageExporter = ();
|
||||
type UniversalAliases = Nothing;
|
||||
type CallDispatcher = RuntimeCall;
|
||||
type SafeCallFilter = Everything;
|
||||
}
|
||||
|
||||
impl cumulus_pallet_xcm::Config for Runtime {
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type XcmExecutor = xcm_executor::XcmExecutor<XcmConfig>;
|
||||
}
|
||||
@@ -23,6 +23,7 @@ serde_json = "1.0.96"
|
||||
# Local
|
||||
rococo-parachain-runtime = { path = "../parachains/runtimes/testing/rococo-parachain" }
|
||||
shell-runtime = { path = "../parachains/runtimes/starters/shell" }
|
||||
glutton-runtime = { path = "../parachains/runtimes/glutton/glutton-kusama" }
|
||||
seedling-runtime = { path = "../parachains/runtimes/starters/seedling" }
|
||||
statemint-runtime = { path = "../parachains/runtimes/assets/statemint" }
|
||||
statemine-runtime = { path = "../parachains/runtimes/assets/statemine" }
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
// Copyright Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::chain_spec::Extensions;
|
||||
use cumulus_primitives_core::ParaId;
|
||||
use sc_service::ChainType;
|
||||
|
||||
/// Specialized `ChainSpec` for the Glutton parachain runtime.
|
||||
pub type GluttonChainSpec =
|
||||
sc_service::GenericChainSpec<glutton_runtime::GenesisConfig, Extensions>;
|
||||
|
||||
pub fn glutton_development_config(para_id: ParaId) -> GluttonChainSpec {
|
||||
GluttonChainSpec::from_genesis(
|
||||
// Name
|
||||
"Glutton Development",
|
||||
// ID
|
||||
"glutton_dev",
|
||||
ChainType::Local,
|
||||
move || glutton_genesis(para_id),
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Extensions { relay_chain: "kusama-dev".into(), para_id: para_id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
pub fn glutton_local_config(para_id: ParaId) -> GluttonChainSpec {
|
||||
GluttonChainSpec::from_genesis(
|
||||
// Name
|
||||
"Glutton Local",
|
||||
// ID
|
||||
"glutton_local",
|
||||
ChainType::Local,
|
||||
move || glutton_genesis(para_id),
|
||||
Vec::new(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Extensions { relay_chain: "kusama-local".into(), para_id: para_id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
pub fn glutton_config(para_id: ParaId) -> GluttonChainSpec {
|
||||
let mut properties = sc_chain_spec::Properties::new();
|
||||
properties.insert("ss58Format".into(), 2.into());
|
||||
|
||||
GluttonChainSpec::from_genesis(
|
||||
// Name
|
||||
format!("Glutton {}", para_id).as_str(),
|
||||
// ID
|
||||
format!("glutton_kusama_{}", para_id).as_str(),
|
||||
ChainType::Live,
|
||||
move || glutton_genesis(para_id),
|
||||
Vec::new(),
|
||||
None,
|
||||
// Protocol ID
|
||||
Some(format!("glutton_kusama_{}", para_id).as_str()),
|
||||
None,
|
||||
Some(properties),
|
||||
Extensions { relay_chain: "kusama".into(), para_id: para_id.into() },
|
||||
)
|
||||
}
|
||||
|
||||
fn glutton_genesis(parachain_id: ParaId) -> glutton_runtime::GenesisConfig {
|
||||
glutton_runtime::GenesisConfig {
|
||||
system: glutton_runtime::SystemConfig {
|
||||
code: glutton_runtime::WASM_BINARY
|
||||
.expect("WASM binary was not build, please build it!")
|
||||
.to_vec(),
|
||||
},
|
||||
parachain_info: glutton_runtime::ParachainInfoConfig { parachain_id },
|
||||
parachain_system: Default::default(),
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ use sp_runtime::traits::{IdentifyAccount, Verify};
|
||||
pub mod bridge_hubs;
|
||||
pub mod collectives;
|
||||
pub mod contracts;
|
||||
pub mod glutton;
|
||||
pub mod penpal;
|
||||
pub mod rococo_parachain;
|
||||
pub mod seedling;
|
||||
|
||||
@@ -19,7 +19,7 @@ use crate::{
|
||||
cli::{Cli, RelayChainCli, Subcommand},
|
||||
service::{
|
||||
new_partial, Block, BridgeHubKusamaRuntimeExecutor, BridgeHubPolkadotRuntimeExecutor,
|
||||
BridgeHubRococoRuntimeExecutor, CollectivesPolkadotRuntimeExecutor,
|
||||
BridgeHubRococoRuntimeExecutor, CollectivesPolkadotRuntimeExecutor, GluttonRuntimeExecutor,
|
||||
StatemineRuntimeExecutor, StatemintRuntimeExecutor, WestmintRuntimeExecutor,
|
||||
},
|
||||
};
|
||||
@@ -54,6 +54,7 @@ enum Runtime {
|
||||
ContractsRococo,
|
||||
CollectivesPolkadot,
|
||||
CollectivesWestend,
|
||||
Glutton,
|
||||
BridgeHub(chain_spec::bridge_hubs::BridgeHubRuntimeType),
|
||||
}
|
||||
|
||||
@@ -111,6 +112,8 @@ fn runtime(id: &str) -> Runtime {
|
||||
id.parse::<chain_spec::bridge_hubs::BridgeHubRuntimeType>()
|
||||
.expect("Invalid value"),
|
||||
)
|
||||
} else if id.starts_with("glutton") {
|
||||
Runtime::Glutton
|
||||
} else {
|
||||
log::warn!("No specific runtime was recognized for ChainSpec's id: '{}', so Runtime::default() will be used", id);
|
||||
Runtime::default()
|
||||
@@ -214,6 +217,18 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
"polkadot-local",
|
||||
)),
|
||||
|
||||
// -- Glutton
|
||||
"glutton-kusama-dev" => Box::new(chain_spec::glutton::glutton_development_config(
|
||||
para_id.expect("Must specify parachain id"),
|
||||
)),
|
||||
"glutton-kusama-local" => Box::new(chain_spec::glutton::glutton_local_config(
|
||||
para_id.expect("Must specify parachain id"),
|
||||
)),
|
||||
// the chain spec as used for generating the upgrade genesis values
|
||||
"glutton-kusama-genesis" => Box::new(chain_spec::glutton::glutton_config(
|
||||
para_id.expect("Must specify parachain id"),
|
||||
)),
|
||||
|
||||
// -- Fallback (generic chainspec)
|
||||
"" => {
|
||||
log::warn!("No ChainSpec.id specified, so using default one, based on rococo-parachain runtime");
|
||||
@@ -243,6 +258,8 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
bridge_hub_runtime_type.chain_spec_from_json_file(path)?,
|
||||
Runtime::Penpal(_para_id) =>
|
||||
Box::new(chain_spec::penpal::PenpalChainSpec::from_json_file(path)?),
|
||||
Runtime::Glutton =>
|
||||
Box::new(chain_spec::glutton::GluttonChainSpec::from_json_file(path)?),
|
||||
Runtime::Default => Box::new(
|
||||
chain_spec::rococo_parachain::RococoParachainChainSpec::from_json_file(path)?,
|
||||
),
|
||||
@@ -258,12 +275,25 @@ fn extract_parachain_id(id: &str) -> (&str, &str, Option<ParaId>) {
|
||||
const KUSAMA_TEST_PARA_PREFIX: &str = "penpal-kusama-";
|
||||
const POLKADOT_TEST_PARA_PREFIX: &str = "penpal-polkadot-";
|
||||
|
||||
const GLUTTON_PARA_DEV_PREFIX: &str = "glutton-kusama-dev-";
|
||||
const GLUTTON_PARA_LOCAL_PREFIX: &str = "glutton-kusama-local-";
|
||||
const GLUTTON_PARA_GENESIS_PREFIX: &str = "glutton-kusama-genesis-";
|
||||
|
||||
let (norm_id, orig_id, para) = if let Some(suffix) = id.strip_prefix(KUSAMA_TEST_PARA_PREFIX) {
|
||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||
(&id[..KUSAMA_TEST_PARA_PREFIX.len() - 1], id, Some(para_id))
|
||||
} else if let Some(suffix) = id.strip_prefix(POLKADOT_TEST_PARA_PREFIX) {
|
||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||
(&id[..POLKADOT_TEST_PARA_PREFIX.len() - 1], id, Some(para_id))
|
||||
} else if let Some(suffix) = id.strip_prefix(GLUTTON_PARA_DEV_PREFIX) {
|
||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||
(&id[..GLUTTON_PARA_DEV_PREFIX.len() - 1], id, Some(para_id))
|
||||
} else if let Some(suffix) = id.strip_prefix(GLUTTON_PARA_LOCAL_PREFIX) {
|
||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||
(&id[..GLUTTON_PARA_LOCAL_PREFIX.len() - 1], id, Some(para_id))
|
||||
} else if let Some(suffix) = id.strip_prefix(GLUTTON_PARA_GENESIS_PREFIX) {
|
||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||
(&id[..GLUTTON_PARA_GENESIS_PREFIX.len() - 1], id, Some(para_id))
|
||||
} else {
|
||||
(id, id, None)
|
||||
};
|
||||
@@ -319,6 +349,7 @@ impl SubstrateCli for Cli {
|
||||
Runtime::BridgeHub(bridge_hub_runtime_type) =>
|
||||
bridge_hub_runtime_type.runtime_version(),
|
||||
Runtime::Penpal(_) => &penpal_runtime::VERSION,
|
||||
Runtime::Glutton => &glutton_runtime::VERSION,
|
||||
Runtime::Default => &rococo_parachain_runtime::VERSION,
|
||||
}
|
||||
}
|
||||
@@ -553,6 +584,16 @@ macro_rules! construct_async_run {
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::Glutton => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<glutton_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::shell_build_import_queue,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
}
|
||||
}
|
||||
}}
|
||||
@@ -659,7 +700,9 @@ pub fn run() -> Result<()> {
|
||||
bridge_hub_runtime_type
|
||||
)
|
||||
.into()),
|
||||
}
|
||||
},
|
||||
Runtime::Glutton =>
|
||||
cmd.run::<Block, GluttonRuntimeExecutor>(config),
|
||||
_ => Err(format!(
|
||||
"Chain '{:?}' doesn't support benchmarking",
|
||||
config.chain_spec.runtime()
|
||||
@@ -796,6 +839,12 @@ pub fn run() -> Result<()> {
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
Runtime::Glutton => runner.async_run(|_| {
|
||||
Ok((
|
||||
cmd.run::<Block, HostFunctionsOf<crate::service::GluttonRuntimeExecutor>, _>(Some(info_provider)),
|
||||
task_manager,
|
||||
))
|
||||
}),
|
||||
_ => Err("Chain doesn't support try-runtime".into()),
|
||||
}
|
||||
},
|
||||
@@ -963,6 +1012,17 @@ pub fn run() -> Result<()> {
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
Runtime::Glutton =>
|
||||
crate::service::start_shell_node::<glutton_runtime::RuntimeApi>(
|
||||
config,
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
id,
|
||||
hwbench,
|
||||
)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -206,6 +206,21 @@ impl sc_executor::NativeExecutionDispatch for ContractsRococoRuntimeExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
/// Native Glutton executor instance.
|
||||
pub struct GluttonRuntimeExecutor;
|
||||
|
||||
impl sc_executor::NativeExecutionDispatch for GluttonRuntimeExecutor {
|
||||
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
shell_runtime::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
shell_runtime::native_version()
|
||||
}
|
||||
}
|
||||
|
||||
/// Starts a `ServiceBuilder` for a full service.
|
||||
///
|
||||
/// Use this macro if you don't actually need the full service, but just the builder in order to
|
||||
|
||||
@@ -9,6 +9,10 @@ repeat=${5:-20}
|
||||
benchmarkOutput=./parachains/runtimes/$category/$runtimeName/src/weights
|
||||
benchmarkRuntimeName="$runtimeName-dev"
|
||||
|
||||
if [ $category = "glutton" ]; then
|
||||
benchmarkRuntimeName="$runtimeName-dev-1300"
|
||||
fi
|
||||
|
||||
# Load all pallet names in an array.
|
||||
pallets=($(
|
||||
${artifactsDir}/polkadot-parachain benchmark pallet --list --chain="${benchmarkRuntimeName}" |\
|
||||
|
||||
@@ -15,3 +15,5 @@ ${__dir}/benchmarks-ci.sh assets westmint target/$target $steps $repeat
|
||||
${__dir}/benchmarks-ci.sh bridge-hubs bridge-hub-polkadot target/$target $steps $repeat
|
||||
${__dir}/benchmarks-ci.sh bridge-hubs bridge-hub-kusama target/$target $steps $repeat
|
||||
${__dir}/benchmarks-ci.sh bridge-hubs bridge-hub-rococo target/$target $steps $repeat
|
||||
|
||||
${__dir}/benchmarks-ci.sh glutton glutton-kusama target/$target $steps $repeat
|
||||
Reference in new issue
Block a user