mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-07 04:58:01 +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:
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",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -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