v3 into main (#390)

This commit is contained in:
Amar Singh
2024-12-25 00:20:08 -05:00
committed by GitHub
parent 8cb7cda000
commit 9158633607
36 changed files with 3296 additions and 1222 deletions
+1189 -634
View File
File diff suppressed because it is too large Load Diff
+9 -2
View File
@@ -26,8 +26,8 @@ serde_json = "1.0.121"
smallvec = "1.11.0"
# TODO: update to release
openzeppelin-polkadot-wrappers = { git = "https://github.com/openzeppelin/polkadot-runtime-wrappers", default-features = false, tag = "v0.1-rc1" }
openzeppelin-polkadot-wrappers-proc = { git = "https://github.com/openzeppelin/polkadot-runtime-wrappers", default-features = false, tag = "v0.1-rc1" }
openzeppelin-pallet-abstractions = { git = "https://github.com/OpenZeppelin/openzeppelin-pallet-abstractions", default-features = false, tag = "v0.1-rc3" }
openzeppelin-pallet-abstractions-proc = { git = "https://github.com/OpenZeppelin/openzeppelin-pallet-abstractions", default-features = false, tag = "v0.1-rc3" }
# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" }
@@ -130,6 +130,7 @@ cumulus-primitives-aura = { git = "https://github.com/paritytech/polkadot-sdk",
cumulus-primitives-core = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" }
cumulus-primitives-storage-weight-reclaim = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" }
cumulus-primitives-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" }
cumulus-primitives-utility = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" }
cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, tag = "polkadot-stable2407-1" }
@@ -151,6 +152,12 @@ orml-xtokens = { git = "https://github.com/OpenZeppelin/open-runtime-module-libr
# Fuzzer
ziggy = { version = "1.0.2", default-features = false }
# Tanssi
dp-consensus = { git = "https://github.com/OpenZeppelin/dancekit", default-features = false, tag = "polkadot-stable2407-1" }
nimbus-consensus = { git = "https://github.com/OpenZeppelin/moonkit", default-features = false, tag = "polkadot-stable2407-1" }
nimbus-primitives = { git = "https://github.com/OpenZeppelin/moonkit", default-features = false, tag = "polkadot-stable2407-1" }
pallet-author-inherent = { git = "https://github.com/OpenZeppelin/moonkit", default-features = false, tag = "polkadot-stable2407-1" }
pallet-cc-authorities-noting = { git = "https://github.com/OpenZeppelin/dancekit", default-features = false, tag = "polkadot-stable2407-1" }
[workspace.lints.clippy]
large_enum_variant = "allow"
+5 -1
View File
@@ -7,7 +7,7 @@ edition = { workspace = true }
license = { workspace = true }
publish = false
repository = { workspace = true }
version = "2.0.0"
version = "3.0.0"
[dependencies]
clap = { workspace = true }
@@ -70,6 +70,9 @@ cumulus-primitives-core = { workspace = true }
cumulus-primitives-parachain-inherent = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }
# Tanssi
nimbus-consensus = { workspace = true }
[build-dependencies]
substrate-build-script-utils = { workspace = true }
@@ -85,6 +88,7 @@ runtime-benchmarks = [
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
tanssi = []
try-runtime = [
"generic-runtime-template/try-runtime",
"polkadot-cli/try-runtime",
+30 -3
View File
@@ -1,7 +1,7 @@
use cumulus_primitives_core::ParaId;
use generic_runtime_template::{
constants::currency::EXISTENTIAL_DEPOSIT, AccountId, AuraId, Signature,
};
#[cfg(not(feature = "tanssi"))]
use generic_runtime_template::{constants::currency::EXISTENTIAL_DEPOSIT, AuraId};
use generic_runtime_template::{AccountId, Signature};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
use serde::{Deserialize, Serialize};
@@ -44,6 +44,7 @@ type AccountPublic = <Signature as Verify>::Signer;
///
/// This function's return type must always match the session keys of the chain
/// in tuple format.
#[cfg(not(feature = "tanssi"))]
pub fn get_collator_keys_from_seed(seed: &str) -> AuraId {
get_from_seed::<AuraId>(seed)
}
@@ -60,6 +61,8 @@ where
///
/// The input must be a tuple of individual keys (a single arg for now since we
/// have just one key).
///
#[cfg(not(feature = "tanssi"))]
pub fn template_session_keys(keys: AuraId) -> generic_runtime_template::SessionKeys {
generic_runtime_template::SessionKeys { aura: keys }
}
@@ -86,6 +89,7 @@ pub fn development_config() -> ChainSpec {
.with_chain_type(ChainType::Development)
.with_genesis_config_patch(testnet_genesis(
// initial collators.
#[cfg(not(feature = "tanssi"))]
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
@@ -137,6 +141,7 @@ pub fn local_testnet_config() -> ChainSpec {
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(testnet_genesis(
// initial collators.
#[cfg(not(feature = "tanssi"))]
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
@@ -169,6 +174,7 @@ pub fn local_testnet_config() -> ChainSpec {
.build()
}
#[cfg(not(feature = "tanssi"))]
fn testnet_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
@@ -205,3 +211,24 @@ fn testnet_genesis(
"sudo": { "key": Some(root) }
})
}
#[cfg(feature = "tanssi")]
fn testnet_genesis(
endowed_accounts: Vec<AccountId>,
root: AccountId,
id: ParaId,
) -> serde_json::Value {
serde_json::json!({
"balances": {
"balances": endowed_accounts.iter().cloned().map(|k| (k, 1u64 << 60)).collect::<Vec<_>>(),
},
"parachainInfo": {
"parachainId": id,
},
"treasury": {},
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
},
"sudo": { "key": Some(root) }
})
}
+4 -1
View File
@@ -115,7 +115,10 @@ pub fn run() -> Result<()> {
match &cli.subcommand {
Some(Subcommand::BuildSpec(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
runner.sync_run(|config| {
let chain_spec = config.chain_spec;
cmd.run(chain_spec, config.network)
})
},
Some(Subcommand::CheckBlock(cmd)) => {
construct_async_run!(|components, cli, cmd, config| {
+72 -13
View File
@@ -5,18 +5,24 @@ use std::{sync::Arc, time::Duration};
use cumulus_client_cli::CollatorOptions;
// Cumulus Imports
#[cfg(not(feature = "tanssi"))]
use cumulus_client_collator::service::CollatorService;
use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport;
#[cfg(not(feature = "tanssi"))]
use cumulus_client_consensus_proposer::Proposer;
use cumulus_client_service::{
build_network, build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks,
BuildNetworkParams, CollatorSybilResistance, DARecoveryProfile, ParachainHostFunctions,
StartRelayChainTasksParams,
};
#[cfg(not(feature = "tanssi"))]
use cumulus_primitives_core::relay_chain::CollatorPair;
#[cfg(feature = "async-backing")]
use cumulus_primitives_core::relay_chain::ValidationCode;
use cumulus_primitives_core::{relay_chain::CollatorPair, ParaId};
use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};
use cumulus_primitives_core::ParaId;
#[cfg(not(feature = "tanssi"))]
use cumulus_relay_chain_interface::OverseerHandle;
use cumulus_relay_chain_interface::RelayChainInterface;
// Substrate Imports
use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
// Local Runtime Types
@@ -29,9 +35,13 @@ use sc_consensus::ImportQueue;
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
use sc_network::NetworkBlock;
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
#[cfg(not(feature = "tanssi"))]
use sc_telemetry::TelemetryHandle;
use sc_telemetry::{Telemetry, TelemetryWorker, TelemetryWorkerHandle};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
#[cfg(not(feature = "tanssi"))]
use sp_keystore::KeystorePtr;
#[cfg(not(feature = "tanssi"))]
use substrate_prometheus_endpoint::Registry;
type ParachainExecutor = WasmExecutor<ParachainHostFunctions>;
@@ -104,15 +114,23 @@ pub fn new_partial(config: &Configuration) -> Result<Service, sc_service::Error>
client.clone(),
);
let block_import = ParachainBlockImport::new(client.clone(), backend.clone());
let import_queue = build_import_queue(
client.clone(),
block_import.clone(),
config,
telemetry.as_ref().map(|telemetry| telemetry.handle()),
&task_manager,
)?;
#[cfg(feature = "tanssi")]
let (block_import, import_queue) =
import_queue(config, client.clone(), backend.clone(), &task_manager);
#[cfg(not(feature = "tanssi"))]
let (block_import, import_queue) = {
let block_import = ParachainBlockImport::new(client.clone(), backend.clone());
(
block_import.clone(),
build_import_queue(
client.clone(),
block_import,
config,
telemetry.as_ref().map(|telemetry| telemetry.handle()),
&task_manager,
)?,
)
};
Ok(PartialComponents {
backend,
@@ -140,7 +158,10 @@ async fn start_node_impl(
let parachain_config = prepare_node_config(parachain_config);
let params = new_partial(&parachain_config)?;
#[cfg(not(feature = "tanssi"))]
let (block_import, mut telemetry, telemetry_worker_handle) = params.other;
#[cfg(feature = "tanssi")]
let (_, mut telemetry, telemetry_worker_handle) = params.other;
let net_config = sc_network::config::FullNetworkConfiguration::<
_,
_,
@@ -151,7 +172,7 @@ async fn start_node_impl(
let backend = params.backend.clone();
let mut task_manager = params.task_manager;
let (relay_chain_interface, collator_key) = build_relay_chain_interface(
let relay_chain_interface = build_relay_chain_interface(
polkadot_config,
&parachain_config,
telemetry_worker_handle,
@@ -162,7 +183,13 @@ async fn start_node_impl(
.await
.map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;
#[cfg(not(feature = "tanssi"))]
let (relay_chain_interface, collator_key) = relay_chain_interface;
#[cfg(feature = "tanssi")]
let (relay_chain_interface, _) = relay_chain_interface;
let validator = parachain_config.role.is_authority();
#[cfg(not(feature = "tanssi"))]
let prometheus_registry = parachain_config.prometheus_registry().cloned();
let transaction_pool = params.transaction_pool.clone();
let import_queue_service = params.import_queue.service();
@@ -291,6 +318,7 @@ async fn start_node_impl(
sync_service: sync_service.clone(),
})?;
#[cfg(not(feature = "tanssi"))]
if validator {
start_consensus(
client.clone(),
@@ -316,7 +344,37 @@ async fn start_node_impl(
Ok((task_manager, client))
}
#[cfg(feature = "tanssi")]
pub fn import_queue(
parachain_config: &Configuration,
client: Arc<ParachainClient>,
backend: Arc<ParachainBackend>,
task_manager: &TaskManager,
) -> (ParachainBlockImport, sc_consensus::BasicQueue<Block>) {
// The nimbus import queue ONLY checks the signature correctness
// Any other checks corresponding to the author-correctness should be done
// in the runtime
let block_import = ParachainBlockImport::new(client.clone(), backend);
let import_queue = nimbus_consensus::import_queue(
client,
block_import.clone(),
move |_, _| async move {
let time = sp_timestamp::InherentDataProvider::from_system_time();
Ok((time,))
},
&task_manager.spawn_essential_handle(),
parachain_config.prometheus_registry(),
false,
)
.expect("function never fails");
(block_import, import_queue)
}
/// Build the import queue for the parachain runtime.
#[cfg(not(feature = "tanssi"))]
fn build_import_queue(
client: Arc<ParachainClient>,
block_import: ParachainBlockImport,
@@ -343,6 +401,7 @@ fn build_import_queue(
))
}
#[cfg(not(feature = "tanssi"))]
fn start_consensus(
client: Arc<ParachainClient>,
#[cfg(feature = "async-backing")] backend: Arc<ParachainBackend>,
+31 -14
View File
@@ -5,7 +5,7 @@ description = "A generic parachain runtime template"
edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
version = "2.0.0"
version = "3.0.0"
[package.metadata.docs.rs]
targets = [ "x86_64-unknown-linux-gnu" ]
@@ -17,8 +17,8 @@ parity-scale-codec = { workspace = true, features = [ "derive" ] }
scale-info = { workspace = true, features = [ "derive" ] }
smallvec = { workspace = true }
openzeppelin-polkadot-wrappers = { workspace = true }
openzeppelin-polkadot-wrappers-proc = { workspace = true }
openzeppelin-pallet-abstractions = { workspace = true }
openzeppelin-pallet-abstractions-proc = { workspace = true }
# Substrate
frame-benchmarking = { workspace = true, optional = true }
@@ -30,8 +30,6 @@ frame-system-benchmarking = { workspace = true, optional = true }
frame-system-rpc-runtime-api = { workspace = true }
frame-try-runtime = { workspace = true, optional = true }
pallet-assets = { workspace = true }
pallet-aura = { workspace = true }
pallet-authorship = { workspace = true }
pallet-balances = { workspace = true }
pallet-conviction-voting = { workspace = true }
pallet-message-queue = { workspace = true }
@@ -40,7 +38,6 @@ pallet-preimage = { workspace = true }
pallet-proxy = { workspace = true }
pallet-referenda = { workspace = true }
pallet-scheduler = { workspace = true }
pallet-session = { workspace = true }
pallet-sudo = { workspace = true }
pallet-timestamp = { workspace = true }
pallet-transaction-payment = { workspace = true }
@@ -62,6 +59,12 @@ sp-std = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }
cumulus-pallet-aura-ext = { workspace = true }
pallet-aura = { workspace = true }
pallet-authorship = { workspace = true }
pallet-collator-selection = { workspace = true }
pallet-session = { workspace = true }
# Polkadot
pallet-xcm = { workspace = true }
polkadot-parachain-primitives = { workspace = true }
@@ -72,7 +75,6 @@ xcm-executor = { workspace = true }
# Cumulus
assets-common = { workspace = true }
cumulus-pallet-aura-ext = { workspace = true }
cumulus-pallet-parachain-system = { workspace = true }
cumulus-pallet-session-benchmarking = { workspace = true }
cumulus-pallet-xcm = { workspace = true }
@@ -80,8 +82,8 @@ cumulus-pallet-xcmp-queue = { workspace = true }
cumulus-primitives-aura = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-storage-weight-reclaim = { workspace = true }
cumulus-primitives-timestamp = { workspace = true }
cumulus-primitives-utility = { workspace = true }
pallet-collator-selection = { workspace = true }
parachain-info = { workspace = true }
parachains-common = { workspace = true }
@@ -92,9 +94,14 @@ pallet-xcm-weight-trader = { workspace = true }
xcm-primitives = { workspace = true }
# ORML
dp-consensus = { workspace = true }
nimbus-primitives = { workspace = true }
orml-traits = { workspace = true }
orml-xcm-support = { workspace = true }
orml-xtokens = { workspace = true }
pallet-author-inherent = { workspace = true }
# Tanssi
pallet-cc-authorities-noting = { workspace = true }
[dev-dependencies]
polkadot-runtime-parachains = { workspace = true }
@@ -116,7 +123,9 @@ std = [
"cumulus-primitives-aura/std",
"cumulus-primitives-core/std",
"cumulus-primitives-storage-weight-reclaim/std",
"cumulus-primitives-timestamp/std",
"cumulus-primitives-utility/std",
"dp-consensus/std",
"frame-benchmarking?/std",
"frame-executive/std",
"frame-metadata-hash-extension/std",
@@ -126,13 +135,16 @@ std = [
"frame-system/std",
"frame-try-runtime?/std",
"log/std",
"openzeppelin-polkadot-wrappers/std",
"nimbus-primitives/std",
"openzeppelin-pallet-abstractions/std",
"orml-xtokens/std",
"pallet-asset-manager/std",
"pallet-assets/std",
"pallet-aura/std",
"pallet-author-inherent/std",
"pallet-authorship/std",
"pallet-balances/std",
"pallet-cc-authorities-noting/std",
"pallet-collator-selection/std",
"pallet-conviction-voting/std",
"pallet-message-queue/std",
@@ -183,15 +195,18 @@ runtime-benchmarks = [
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
"cumulus-primitives-utility/runtime-benchmarks",
"dp-consensus/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"hex-literal",
"nimbus-primitives/runtime-benchmarks",
"pallet-asset-manager/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-author-inherent/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-cc-authorities-noting/runtime-benchmarks",
"pallet-conviction-voting/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
@@ -224,12 +239,14 @@ try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"frame-try-runtime/try-runtime",
"nimbus-primitives/try-runtime",
"orml-xtokens/try-runtime",
"pallet-asset-manager/try-runtime",
"pallet-assets/try-runtime",
"pallet-aura/try-runtime",
"pallet-authorship/try-runtime",
"pallet-author-inherent/try-runtime",
"pallet-balances/try-runtime",
"pallet-cc-authorities-noting/try-runtime",
"pallet-collator-selection/try-runtime",
"pallet-conviction-voting/try-runtime",
"pallet-message-queue/try-runtime",
@@ -238,8 +255,6 @@ try-runtime = [
"pallet-proxy/try-runtime",
"pallet-referenda/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-session/try-runtime",
"pallet-session/try-runtime",
"pallet-sudo/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
@@ -259,8 +274,10 @@ try-runtime = [
# to make it smaller, like logging for example.
on-chain-release-build = [ "sp-api/disable-logging" ]
async-backing = [ "openzeppelin-polkadot-wrappers-proc/async-backing" ]
async-backing = [ "openzeppelin-pallet-abstractions-proc/async-backing" ]
default = [ "std" ]
metadata-hash = [ "substrate-wasm-builder/metadata-hash" ]
tanssi = []
+57 -9
View File
@@ -1,11 +1,14 @@
use openzeppelin_polkadot_wrappers_proc::openzeppelin_runtime_apis;
use openzeppelin_pallet_abstractions_proc::openzeppelin_runtime_apis;
#[cfg(feature = "runtime-benchmarks")]
use crate::constants::currency::{CENTS, EXISTENTIAL_DEPOSIT};
#[cfg(not(feature = "async-backing"))]
#[cfg(all(not(feature = "async-backing"), not(feature = "tanssi")))]
use crate::Aura;
#[cfg(feature = "runtime-benchmarks")]
use crate::{
configs::xcm_config::RelayLocation,
constants::currency::{CENTS, EXISTENTIAL_DEPOSIT},
};
#[cfg(feature = "async-backing")]
use crate::{configs::XcmExecutorConfig, constants::SLOT_DURATION, types::ConsensusHook};
use crate::{constants::SLOT_DURATION, types::ConsensusHook};
use crate::{
constants::VERSION,
types::{AccountId, Balance, Block, Executive, Nonce},
@@ -16,19 +19,18 @@ use crate::{
#[cfg(feature = "runtime-benchmarks")]
type ExistentialDeposit = sp_core::ConstU128<EXISTENTIAL_DEPOSIT>;
#[cfg(not(feature = "tanssi"))]
#[openzeppelin_runtime_apis]
mod apis {
type Runtime = Runtime;
type Block = Block;
#[abstraction]
mod assets {
type RuntimeCall = RuntimeCall;
type TransactionPayment = TransactionPayment;
type Balance = Balance;
}
#[abstraction]
mod consensus {
type SessionKeys = SessionKeys;
#[cfg(not(feature = "async-backing"))]
@@ -39,7 +41,6 @@ mod apis {
type ConsensusHook = ConsensusHook;
}
#[abstraction]
mod system {
type Executive = Executive;
type System = System;
@@ -51,7 +52,54 @@ mod apis {
type RuntimeBlockWeights = RuntimeBlockWeights;
}
#[abstraction]
mod benchmarks {
type AllPalletsWithSystem = AllPalletsWithSystem;
type Assets = Assets;
type AssetManager = AssetManager;
type AssetType = AssetType;
type RuntimeOrigin = RuntimeOrigin;
type RelayLocation = RelayLocation;
type ParachainSystem = ParachainSystem;
type System = System;
type ExistentialDeposit = ExistentialDeposit;
type AssetId = AssetId;
type XCMConfig = XcmExecutorConfig;
type AccountId = AccountId;
type Cents = CENTS;
type FeeAssetId = FeeAssetId;
type TransactionByteFee = TransactionByteFee;
type Address = Address;
type Balances = Balances;
}
}
#[cfg(feature = "tanssi")]
#[openzeppelin_runtime_apis]
mod apis {
type Runtime = Runtime;
type Block = Block;
mod assets {
type RuntimeCall = RuntimeCall;
type TransactionPayment = TransactionPayment;
type Balance = Balance;
}
mod tanssi {
type SessionKeys = SessionKeys;
}
mod system {
type Executive = Executive;
type System = System;
type ParachainSystem = ParachainSystem;
type RuntimeVersion = VERSION;
type AccountId = AccountId;
type Nonce = Nonce;
type RuntimeGenesisConfig = RuntimeGenesisConfig;
type RuntimeBlockWeights = RuntimeBlockWeights;
}
mod benchmarks {
type AllPalletsWithSystem = AllPalletsWithSystem;
type Assets = Assets;
+48 -16
View File
@@ -1,14 +1,19 @@
pub mod asset_config;
pub use asset_config::AssetType;
pub mod governance;
pub mod weight;
pub mod xcm_config;
use asset_config::*;
#[cfg(feature = "tanssi")]
use cumulus_pallet_parachain_system::ExpectParentIncluded;
#[cfg(feature = "async-backing")]
use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
#[cfg(not(feature = "async-backing"))]
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use cumulus_primitives_core::{AggregateMessageOrigin, ParaId};
#[cfg(not(feature = "tanssi"))]
use frame_support::PalletId;
use frame_support::{
derive_impl,
dispatch::DispatchClass,
@@ -18,7 +23,6 @@ use frame_support::{
EitherOfDiverse, Everything, Nothing, TransformOrigin,
},
weights::{ConstantMultiplier, Weight},
PalletId,
};
use frame_system::{
limits::{BlockLength, BlockWeights},
@@ -26,13 +30,20 @@ use frame_system::{
};
pub use governance::origins::pallet_custom_origins;
use governance::{origins::Treasurer, tracks, Spender, WhitelistedCaller};
use openzeppelin_polkadot_wrappers::{
impl_openzeppelin_assets, impl_openzeppelin_consensus, impl_openzeppelin_governance,
impl_openzeppelin_system, impl_openzeppelin_xcm, AssetsConfig, ConsensusConfig,
GovernanceConfig, SystemConfig, XcmConfig,
use openzeppelin_pallet_abstractions::{
impl_openzeppelin_assets, impl_openzeppelin_governance, impl_openzeppelin_system,
impl_openzeppelin_xcm, AssetsConfig, AssetsWeight, GovernanceConfig, GovernanceWeight,
SystemConfig, SystemWeight, XcmConfig, XcmWeight,
};
#[cfg(not(feature = "tanssi"))]
use openzeppelin_pallet_abstractions::{
impl_openzeppelin_consensus, ConsensusConfig, ConsensusWeight,
};
#[cfg(feature = "tanssi")]
use openzeppelin_pallet_abstractions::{impl_openzeppelin_tanssi, TanssiConfig, TanssiWeight};
use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
#[cfg(not(feature = "tanssi"))]
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_runtime::{
traits::{AccountIdLookup, BlakeTwo256, IdentityLookup},
@@ -53,37 +64,54 @@ use xcm_primitives::{AbsoluteAndRelativeReserve, AsAssetType};
#[cfg(feature = "runtime-benchmarks")]
use crate::benchmark::{OpenHrmpChannel, PayWithEnsure};
#[cfg(not(feature = "tanssi"))]
use crate::{
constants::HOURS,
types::{BlockNumber, CollatorSelectionUpdateOrigin, ConsensusHook},
SessionKeys,
};
use crate::{
constants::{
currency::{deposit, CENTS, EXISTENTIAL_DEPOSIT, MICROCENTS},
AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MAX_BLOCK_LENGTH,
NORMAL_DISPATCH_RATIO,
AVERAGE_ON_INITIALIZE_RATIO, DAYS, MAXIMUM_BLOCK_WEIGHT, MAX_BLOCK_LENGTH,
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
},
types::{
AccountId, AssetId, AssetKind, Balance, Beneficiary, Block, BlockNumber,
CollatorSelectionUpdateOrigin, ConsensusHook, Hash, MessageQueueServiceWeight, Nonce,
PriceForSiblingParachainDelivery, ProxyType, TreasuryAccount, TreasuryInteriorLocation,
TreasuryPalletId, TreasuryPaymaster, Version,
AccountId, AssetId, AssetKind, Balance, Beneficiary, Block, Hash,
MessageQueueServiceWeight, Nonce, PriceForSiblingParachainDelivery, ProxyType,
TreasuryAccount, TreasuryInteriorLocation, TreasuryPalletId, TreasuryPaymaster, Version,
},
weights::{self, BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight},
AllPalletsWithSystem, AssetManager, Aura, Balances, CollatorSelection, MessageQueue,
OriginCaller, PalletInfo, ParachainInfo, ParachainSystem, PolkadotXcm, Preimage, Referenda,
Runtime, RuntimeCall, RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin,
RuntimeTask, Scheduler, Session, SessionKeys, System, Treasury, WeightToFee, XcmpQueue,
weights::{BlockExecutionWeight, ExtrinsicBaseWeight},
AllPalletsWithSystem, AssetManager, Balances, MessageQueue, OriginCaller, PalletInfo,
ParachainInfo, ParachainSystem, PolkadotXcm, Preimage, Referenda, Runtime, RuntimeCall,
RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, RuntimeOrigin, RuntimeTask, Scheduler,
System, Treasury, WeightToFee, XcmpQueue,
};
#[cfg(not(feature = "tanssi"))]
use crate::{Aura, CollatorSelection, Session};
// OpenZeppelin runtime wrappers configuration
pub struct OpenZeppelinRuntime;
impl SystemConfig for OpenZeppelinRuntime {
type AccountId = AccountId;
#[cfg(feature = "tanssi")]
type ConsensusHook = ExpectParentIncluded;
#[cfg(not(feature = "tanssi"))]
type ConsensusHook = ConsensusHook;
type ExistentialDeposit = ConstU128<EXISTENTIAL_DEPOSIT>;
type Lookup = AccountIdLookup<AccountId, ()>;
#[cfg(feature = "tanssi")]
type OnTimestampSet = ();
#[cfg(not(feature = "tanssi"))]
type OnTimestampSet = Aura;
type PreimageOrigin = EnsureRoot<AccountId>;
type ProxyType = ProxyType;
type SS58Prefix = ConstU16<42>;
type ScheduleOrigin = EnsureRoot<AccountId>;
type SlotDuration = ConstU64<SLOT_DURATION>;
type Version = Version;
}
#[cfg(not(feature = "tanssi"))]
impl ConsensusConfig for OpenZeppelinRuntime {
type CollatorSelectionUpdateOrigin = CollatorSelectionUpdateOrigin;
}
@@ -162,7 +190,11 @@ impl AssetsConfig for OpenZeppelinRuntime {
type WeightToFee = WeightToFee;
}
impl_openzeppelin_system!(OpenZeppelinRuntime);
#[cfg(not(feature = "tanssi"))]
impl_openzeppelin_consensus!(OpenZeppelinRuntime);
impl_openzeppelin_governance!(OpenZeppelinRuntime);
impl_openzeppelin_xcm!(OpenZeppelinRuntime);
impl_openzeppelin_assets!(OpenZeppelinRuntime);
#[cfg(feature = "tanssi")]
impl_openzeppelin_tanssi!();
@@ -0,0 +1,56 @@
#[cfg(not(feature = "tanssi"))]
use openzeppelin_pallet_abstractions::ConsensusWeight;
#[cfg(feature = "tanssi")]
use openzeppelin_pallet_abstractions::TanssiWeight;
use openzeppelin_pallet_abstractions::{AssetsWeight, GovernanceWeight, SystemWeight, XcmWeight};
use crate::{
configs::OpenZeppelinRuntime,
weights::{self, RocksDbWeight},
Runtime,
};
impl SystemWeight for OpenZeppelinRuntime {
type Balances = weights::pallet_balances::WeightInfo<Runtime>;
type DbWeight = RocksDbWeight;
type Multisig = weights::pallet_multisig::WeightInfo<Runtime>;
type ParachainSystem = weights::cumulus_pallet_parachain_system::WeightInfo<Runtime>;
type Preimage = weights::pallet_preimage::WeightInfo<Runtime>;
type Proxy = weights::pallet_proxy::WeightInfo<Runtime>;
type Scheduler = weights::pallet_scheduler::WeightInfo<Runtime>;
type Timestamp = weights::pallet_timestamp::WeightInfo<Runtime>;
type Utility = weights::pallet_utility::WeightInfo<Runtime>;
}
#[cfg(not(feature = "tanssi"))]
impl ConsensusWeight for OpenZeppelinRuntime {
type CollatorSelection = weights::pallet_collator_selection::WeightInfo<Runtime>;
type Session = weights::pallet_session::WeightInfo<Runtime>;
}
impl AssetsWeight for OpenZeppelinRuntime {
type AssetManager = weights::pallet_asset_manager::WeightInfo<Runtime>;
type Assets = weights::pallet_assets::WeightInfo<Runtime>;
}
impl GovernanceWeight for OpenZeppelinRuntime {
type ConvictionVoting = weights::pallet_conviction_voting::WeightInfo<Runtime>;
type Referenda = weights::pallet_referenda::WeightInfo<Runtime>;
type Sudo = weights::pallet_sudo::WeightInfo<Runtime>;
type Treasury = weights::pallet_treasury::WeightInfo<Runtime>;
type Whitelist = weights::pallet_whitelist::WeightInfo<Runtime>;
}
impl XcmWeight for OpenZeppelinRuntime {
type MessageQueue = weights::pallet_message_queue::WeightInfo<Runtime>;
type Xcm = weights::pallet_xcm::WeightInfo<Runtime>;
type XcmTransactor = weights::pallet_xcm_transactor::WeightInfo<Runtime>;
type XcmWeightTrader = weights::pallet_xcm_weight_trader::WeightInfo<Runtime>;
type XcmpQueue = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
}
#[cfg(feature = "tanssi")]
impl TanssiWeight for OpenZeppelinRuntime {
type AuthorInherent = pallet_author_inherent::weights::SubstrateWeight<Runtime>;
type AuthoritiesNoting = pallet_cc_authorities_noting::weights::SubstrateWeight<Runtime>;
}
+25 -8
View File
@@ -90,12 +90,18 @@ pub mod opaque {
pub type Hash = <BlakeTwo256 as HashT>::Output;
}
#[cfg(not(feature = "tanssi"))]
impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
}
}
#[cfg(feature = "tanssi")]
impl_opaque_keys! {
pub struct SessionKeys { }
}
/// The version information used to identify this runtime when compiled
/// natively.
#[cfg(feature = "std")]
@@ -105,23 +111,34 @@ pub fn native_version() -> NativeVersion {
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
}
use openzeppelin_polkadot_wrappers_proc::openzeppelin_construct_runtime;
use openzeppelin_pallet_abstractions_proc::openzeppelin_construct_runtime;
#[cfg(feature = "tanssi")]
#[openzeppelin_construct_runtime]
mod runtime {
#[abstraction]
struct System;
#[abstraction]
struct Consensus;
#[abstraction]
struct XCM;
#[abstraction]
struct Assets;
#[abstraction]
struct Governance;
struct Tanssi;
}
#[cfg(not(feature = "tanssi"))]
#[openzeppelin_construct_runtime]
mod runtime {
struct System;
struct XCM;
struct Assets;
struct Governance;
struct Consensus;
}
#[cfg(test)]
+22 -18
View File
@@ -1,10 +1,9 @@
use frame_support::{
parameter_types,
traits::{EitherOfDiverse, InstanceFilter},
weights::Weight,
PalletId,
};
#[cfg(not(feature = "tanssi"))]
use frame_support::traits::EitherOfDiverse;
use frame_support::{parameter_types, traits::InstanceFilter, weights::Weight, PalletId};
#[cfg(not(feature = "tanssi"))]
use frame_system::EnsureRoot;
#[cfg(not(feature = "tanssi"))]
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use polkadot_runtime_common::impls::{
@@ -29,14 +28,15 @@ use crate::{
constants::{HOURS, VERSION},
Treasury,
};
pub use crate::{
configs::{
xcm_config::RelayLocation, FeeAssetId, StakingAdminBodyId, ToSiblingBaseDeliveryFee,
TransactionByteFee,
},
#[cfg(not(feature = "tanssi"))]
use crate::{
configs::{xcm_config::RelayLocation, StakingAdminBodyId},
constants::{
BLOCK_PROCESSING_VELOCITY, RELAY_CHAIN_SLOT_DURATION_MILLIS, UNINCLUDED_SEGMENT_CAPACITY,
},
};
pub use crate::{
configs::{FeeAssetId, ToSiblingBaseDeliveryFee, TransactionByteFee},
AllPalletsWithSystem, Runtime, RuntimeBlockWeights, RuntimeCall, XcmpQueue,
};
@@ -107,14 +107,8 @@ pub type PriceForSiblingParachainDelivery = polkadot_runtime_common::xcm_sender:
XcmpQueue,
>;
/// We allow root and the StakingAdmin to execute privileged collator selection
/// operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<RelayLocation, StakingAdminBodyId>>,
>;
/// Configures the number of blocks that can be created without submission of validity proof to the relay chain
#[cfg(not(feature = "tanssi"))]
pub type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
Runtime,
RELAY_CHAIN_SLOT_DURATION_MILLIS,
@@ -122,6 +116,14 @@ pub type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
UNINCLUDED_SEGMENT_CAPACITY,
>;
/// We allow root and the StakingAdmin to execute privileged collator selection
/// operations.
#[cfg(not(feature = "tanssi"))]
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<RelayLocation, StakingAdminBodyId>>,
>;
/// These aliases are describing the Beneficiary and AssetKind for the Treasury pallet
pub type Beneficiary = VersionedLocation;
pub type AssetKind = VersionedLocatableAsset;
@@ -162,6 +164,7 @@ pub enum ProxyType {
NonTransfer,
/// Allows to finish the proxy
CancelProxy,
#[cfg(not(feature = "tanssi"))]
/// Allows to operate with collators list (invulnerables, candidates, etc.)
Collator,
}
@@ -176,6 +179,7 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. })
| RuntimeCall::Multisig { .. }
),
#[cfg(not(feature = "tanssi"))]
ProxyType::Collator => {
matches!(c, RuntimeCall::CollatorSelection { .. } | RuntimeCall::Multisig { .. })
}
@@ -24,6 +24,7 @@ pub mod extrinsic_weights;
pub mod pallet_asset_manager;
pub mod pallet_assets;
pub mod pallet_balances;
#[cfg(not(feature = "tanssi"))]
pub mod pallet_collator_selection;
pub mod pallet_conviction_voting;
pub mod pallet_message_queue;
@@ -32,6 +33,7 @@ pub mod pallet_preimage;
pub mod pallet_proxy;
pub mod pallet_referenda;
pub mod pallet_scheduler;
#[cfg(not(feature = "tanssi"))]
pub mod pallet_session;
pub mod pallet_sudo;
pub mod pallet_timestamp;
@@ -1,4 +1,3 @@
//! Autogenerated weights for `pallet_collator_selection`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.0
@@ -21,242 +20,253 @@
// --chain=dev
// --output=benchmarking/new-benchmarks/pallet_collator_selection.rs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
// #![cfg_attr(rustfmt, rustfmt_skip)]
// #![allow(unused_parens)]
// #![allow(unused_imports)]
// #![allow(missing_docs)]
use core::marker::PhantomData;
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_collator_selection`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_collator_selection::WeightInfo for WeightInfo<T> {
/// Storage: `Session::NextKeys` (r:20 w:0)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `CollatorSelection::Invulnerables` (r:0 w:1)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// The range of component `b` is `[1, 20]`.
fn set_invulnerables(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `197 + b * (79 ±0)`
// Estimated: `1188 + b * (2555 ±0)`
// Minimum execution time: 15_225_000 picoseconds.
Weight::from_parts(11_571_267, 0)
.saturating_add(Weight::from_parts(0, 1188))
// Standard Error: 5_469
.saturating_add(Weight::from_parts(4_047_420, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 2555).saturating_mul(b.into()))
}
/// Storage: `Session::NextKeys` (r:1 w:0)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:1)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `b` is `[1, 19]`.
/// The range of component `c` is `[1, 99]`.
fn add_invulnerable(b: u32, c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `828 + b * (32 ±0) + c * (53 ±0)`
// Estimated: `6287 + b * (37 ±0) + c * (53 ±0)`
// Minimum execution time: 51_115_000 picoseconds.
Weight::from_parts(46_321_661, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 18_486
.saturating_add(Weight::from_parts(346_609, 0).saturating_mul(b.into()))
// Standard Error: 3_504
.saturating_add(Weight::from_parts(202_188, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into()))
}
/// Storage: `CollatorSelection::CandidateList` (r:1 w:0)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:1)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// The range of component `b` is `[5, 20]`.
fn remove_invulnerable(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `153 + b * (32 ±0)`
// Estimated: `6287`
// Minimum execution time: 14_756_000 picoseconds.
Weight::from_parts(14_469_493, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 2_837
.saturating_add(Weight::from_parts(214_011, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `CollatorSelection::DesiredCandidates` (r:0 w:1)
/// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
fn set_desired_candidates() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 6_561_000 picoseconds.
Weight::from_parts(6_777_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `CollatorSelection::CandidacyBond` (r:1 w:1)
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:100 w:100)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:100)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// The range of component `c` is `[0, 100]`.
/// The range of component `k` is `[0, 100]`.
fn set_candidacy_bond(c: u32, k: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0 + c * (182 ±0) + k * (115 ±0)`
// Estimated: `6287 + c * (901 ±29) + k * (901 ±29)`
// Minimum execution time: 13_013_000 picoseconds.
Weight::from_parts(13_150_000, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 212_739
.saturating_add(Weight::from_parts(7_127_589, 0).saturating_mul(c.into()))
// Standard Error: 212_739
.saturating_add(Weight::from_parts(6_784_046, 0).saturating_mul(k.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into())))
.saturating_add(Weight::from_parts(0, 901).saturating_mul(c.into()))
.saturating_add(Weight::from_parts(0, 901).saturating_mul(k.into()))
}
/// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0)
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// The range of component `c` is `[3, 100]`.
fn update_bond(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `356 + c * (49 ±0)`
// Estimated: `6287`
// Minimum execution time: 34_412_000 picoseconds.
Weight::from_parts(37_538_467, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 2_658
.saturating_add(Weight::from_parts(140_363, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `Session::NextKeys` (r:1 w:0)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0)
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// The range of component `c` is `[1, 99]`.
fn register_as_candidate(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `799 + c * (52 ±0)`
// Estimated: `6287 + c * (54 ±0)`
// Minimum execution time: 45_366_000 picoseconds.
Weight::from_parts(49_711_930, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 3_239
.saturating_add(Weight::from_parts(180_195, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 54).saturating_mul(c.into()))
}
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0)
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `Session::NextKeys` (r:1 w:0)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:2)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// The range of component `c` is `[3, 100]`.
fn take_candidate_slot(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `939 + c * (53 ±0)`
// Estimated: `6287 + c * (54 ±0)`
// Minimum execution time: 68_436_000 picoseconds.
Weight::from_parts(73_112_305, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 4_118
.saturating_add(Weight::from_parts(214_419, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(4))
.saturating_add(Weight::from_parts(0, 54).saturating_mul(c.into()))
}
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// The range of component `c` is `[3, 100]`.
fn leave_intent(c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `381 + c * (48 ±0)`
// Estimated: `6287`
// Minimum execution time: 37_349_000 picoseconds.
Weight::from_parts(41_362_337, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 3_309
.saturating_add(Weight::from_parts(158_689, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
fn note_author() -> Weight {
// Proof Size summary in bytes:
// Measured: `192`
// Estimated: `6196`
// Minimum execution time: 56_862_000 picoseconds.
Weight::from_parts(57_890_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `CollatorSelection::CandidateList` (r:1 w:0)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:100 w:0)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::DesiredCandidates` (r:1 w:0)
/// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:97 w:97)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `r` is `[1, 100]`.
/// The range of component `c` is `[1, 100]`.
fn new_session(r: u32, c: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `2369 + c * (97 ±0) + r * (114 ±0)`
// Estimated: `6287 + c * (2519 ±0) + r * (2603 ±0)`
// Minimum execution time: 23_061_000 picoseconds.
Weight::from_parts(23_816_000, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 378_020
.saturating_add(Weight::from_parts(16_325_603, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into())))
.saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into()))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(r.into()))
}
/// Storage: `Session::NextKeys` (r:20 w:0)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `CollatorSelection::Invulnerables` (r:0 w:1)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// The range of component `b` is `[1, 20]`.
fn set_invulnerables(b: u32) -> Weight {
// Proof Size summary in bytes:
// Measured: `197 + b * (79 ±0)`
// Estimated: `1188 + b * (2555 ±0)`
// Minimum execution time: 15_225_000 picoseconds.
Weight::from_parts(11_571_267, 0)
.saturating_add(Weight::from_parts(0, 1188))
// Standard Error: 5_469
.saturating_add(Weight::from_parts(4_047_420, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 2555).saturating_mul(b.into()))
}
/// Storage: `Session::NextKeys` (r:1 w:0)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:1)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `b` is `[1, 19]`.
/// The range of component `c` is `[1, 99]`.
fn add_invulnerable(b: u32, c: u32) -> Weight {
// Proof Size summary in bytes:
// Measured: `828 + b * (32 ±0) + c * (53 ±0)`
// Estimated: `6287 + b * (37 ±0) + c * (53 ±0)`
// Minimum execution time: 51_115_000 picoseconds.
Weight::from_parts(46_321_661, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 18_486
.saturating_add(Weight::from_parts(346_609, 0).saturating_mul(b.into()))
// Standard Error: 3_504
.saturating_add(Weight::from_parts(202_188, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 37).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(0, 53).saturating_mul(c.into()))
}
/// Storage: `CollatorSelection::CandidateList` (r:1 w:0)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:1)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// The range of component `b` is `[5, 20]`.
fn remove_invulnerable(b: u32) -> Weight {
// Proof Size summary in bytes:
// Measured: `153 + b * (32 ±0)`
// Estimated: `6287`
// Minimum execution time: 14_756_000 picoseconds.
Weight::from_parts(14_469_493, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 2_837
.saturating_add(Weight::from_parts(214_011, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `CollatorSelection::DesiredCandidates` (r:0 w:1)
/// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
fn set_desired_candidates() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 6_561_000 picoseconds.
Weight::from_parts(6_777_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `CollatorSelection::CandidacyBond` (r:1 w:1)
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:100 w:100)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:100)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// The range of component `c` is `[0, 100]`.
/// The range of component `k` is `[0, 100]`.
fn set_candidacy_bond(c: u32, k: u32) -> Weight {
// Proof Size summary in bytes:
// Measured: `0 + c * (182 ±0) + k * (115 ±0)`
// Estimated: `6287 + c * (901 ±29) + k * (901 ±29)`
// Minimum execution time: 13_013_000 picoseconds.
Weight::from_parts(13_150_000, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 212_739
.saturating_add(Weight::from_parts(7_127_589, 0).saturating_mul(c.into()))
// Standard Error: 212_739
.saturating_add(Weight::from_parts(6_784_046, 0).saturating_mul(k.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(k.into())))
.saturating_add(Weight::from_parts(0, 901).saturating_mul(c.into()))
.saturating_add(Weight::from_parts(0, 901).saturating_mul(k.into()))
}
/// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0)
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// The range of component `c` is `[3, 100]`.
fn update_bond(c: u32) -> Weight {
// Proof Size summary in bytes:
// Measured: `356 + c * (49 ±0)`
// Estimated: `6287`
// Minimum execution time: 34_412_000 picoseconds.
Weight::from_parts(37_538_467, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 2_658
.saturating_add(Weight::from_parts(140_363, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `Session::NextKeys` (r:1 w:0)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0)
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// The range of component `c` is `[1, 99]`.
fn register_as_candidate(c: u32) -> Weight {
// Proof Size summary in bytes:
// Measured: `799 + c * (52 ±0)`
// Estimated: `6287 + c * (54 ±0)`
// Minimum execution time: 45_366_000 picoseconds.
Weight::from_parts(49_711_930, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 3_239
.saturating_add(Weight::from_parts(180_195, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
.saturating_add(Weight::from_parts(0, 54).saturating_mul(c.into()))
}
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::CandidacyBond` (r:1 w:0)
/// Proof: `CollatorSelection::CandidacyBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `Session::NextKeys` (r:1 w:0)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:2)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// The range of component `c` is `[3, 100]`.
fn take_candidate_slot(c: u32) -> Weight {
// Proof Size summary in bytes:
// Measured: `939 + c * (53 ±0)`
// Estimated: `6287 + c * (54 ±0)`
// Minimum execution time: 68_436_000 picoseconds.
Weight::from_parts(73_112_305, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 4_118
.saturating_add(Weight::from_parts(214_419, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(4))
.saturating_add(Weight::from_parts(0, 54).saturating_mul(c.into()))
}
/// Storage: `CollatorSelection::CandidateList` (r:1 w:1)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// The range of component `c` is `[3, 100]`.
fn leave_intent(c: u32) -> Weight {
// Proof Size summary in bytes:
// Measured: `381 + c * (48 ±0)`
// Estimated: `6287`
// Minimum execution time: 37_349_000 picoseconds.
Weight::from_parts(41_362_337, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 3_309
.saturating_add(Weight::from_parts(158_689, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:0 w:1)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
fn note_author() -> Weight {
// Proof Size summary in bytes:
// Measured: `192`
// Estimated: `6196`
// Minimum execution time: 56_862_000 picoseconds.
Weight::from_parts(57_890_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `CollatorSelection::CandidateList` (r:1 w:0)
/// Proof: `CollatorSelection::CandidateList` (`max_values`: Some(1), `max_size`: Some(4802), added: 5297, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::LastAuthoredBlock` (r:100 w:0)
/// Proof: `CollatorSelection::LastAuthoredBlock` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::Invulnerables` (r:1 w:0)
/// Proof: `CollatorSelection::Invulnerables` (`max_values`: Some(1), `max_size`: Some(641), added: 1136, mode: `MaxEncodedLen`)
/// Storage: `CollatorSelection::DesiredCandidates` (r:1 w:0)
/// Proof: `CollatorSelection::DesiredCandidates` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:97 w:97)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `r` is `[1, 100]`.
/// The range of component `c` is `[1, 100]`.
fn new_session(r: u32, c: u32) -> Weight {
// Proof Size summary in bytes:
// Measured: `2369 + c * (97 ±0) + r * (114 ±0)`
// Estimated: `6287 + c * (2519 ±0) + r * (2603 ±0)`
// Minimum execution time: 23_061_000 picoseconds.
Weight::from_parts(23_816_000, 0)
.saturating_add(Weight::from_parts(0, 6287))
// Standard Error: 378_020
.saturating_add(Weight::from_parts(16_325_603, 0).saturating_mul(c.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into())))
.saturating_add(Weight::from_parts(0, 2519).saturating_mul(c.into()))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(r.into()))
}
}
@@ -1,4 +1,3 @@
//! Autogenerated weights for `pallet_session`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.0
@@ -21,43 +20,45 @@
// --chain=dev
// --output=benchmarking/new-benchmarks/pallet_session.rs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
// #![cfg_attr(rustfmt, rustfmt_skip)]
// #![allow(unused_parens)]
// #![allow(unused_imports)]
// #![allow(missing_docs)]
use core::marker::PhantomData;
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_session`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_session::WeightInfo for WeightInfo<T> {
/// Storage: `Session::NextKeys` (r:1 w:1)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Session::KeyOwner` (r:1 w:1)
/// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn set_keys() -> Weight {
// Proof Size summary in bytes:
// Measured: `298`
// Estimated: `3763`
// Minimum execution time: 21_646_000 picoseconds.
Weight::from_parts(21_946_000, 0)
.saturating_add(Weight::from_parts(0, 3763))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Session::NextKeys` (r:1 w:1)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Session::KeyOwner` (r:0 w:1)
/// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn purge_keys() -> Weight {
// Proof Size summary in bytes:
// Measured: `280`
// Estimated: `3745`
// Minimum execution time: 15_321_000 picoseconds.
Weight::from_parts(15_898_000, 0)
.saturating_add(Weight::from_parts(0, 3745))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Session::NextKeys` (r:1 w:1)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Session::KeyOwner` (r:1 w:1)
/// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn set_keys() -> Weight {
// Proof Size summary in bytes:
// Measured: `298`
// Estimated: `3763`
// Minimum execution time: 21_646_000 picoseconds.
Weight::from_parts(21_946_000, 0)
.saturating_add(Weight::from_parts(0, 3763))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Session::NextKeys` (r:1 w:1)
/// Proof: `Session::NextKeys` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Session::KeyOwner` (r:0 w:1)
/// Proof: `Session::KeyOwner` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn purge_keys() -> Weight {
// Proof Size summary in bytes:
// Measured: `280`
// Estimated: `3745`
// Minimum execution time: 15_321_000 picoseconds.
Weight::from_parts(15_898_000, 0)
.saturating_add(Weight::from_parts(0, 3745))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
}
@@ -141,12 +141,7 @@ mod runtime_tests {
fn assets_constants() {
assert_eq!(<Runtime as pallet_assets::Config>::AssetDeposit::get(), 10 * CENTS);
// TODO: uncomment once patch is merged and updated RC is released and pointed to in deps
//assert_eq!(<Runtime as pallet_assets::Config>::AssetAccountDeposit::get(), deposit(1, 16));
assert_eq!(
<Runtime as pallet_assets::Config>::AssetAccountDeposit::get(),
EXISTENTIAL_DEPOSIT
);
assert_eq!(<Runtime as pallet_assets::Config>::AssetAccountDeposit::get(), deposit(1, 16));
assert_eq!(<Runtime as pallet_assets::Config>::ApprovalDeposit::get(), EXISTENTIAL_DEPOSIT);
@@ -237,7 +232,7 @@ mod runtime_tests {
pallet_id_to_string(PalletId(*b"PotStake"))
);
assert_eq!(configs::Period::get(), 6 * HOURS);
assert_eq!(configs::SessionLength::get(), 6 * HOURS);
assert_eq!(configs::StakingAdminBodyId::get(), BodyId::Defense);
@@ -60,6 +60,7 @@ std = [
"sp-runtime/std",
]
fuzzing = []
tanssi = []
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
+16 -7
View File
@@ -3,9 +3,11 @@ use std::{
time::{Duration, Instant},
};
#[cfg(not(feature = "tanssi"))]
use frame_support::traits::Get;
use frame_support::{
dispatch::GetDispatchInfo,
traits::{Get, IntegrityTest, TryState, TryStateSelect},
traits::{IntegrityTest, TryState, TryStateSelect},
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
};
use frame_system::Account;
@@ -26,15 +28,21 @@ use sp_runtime::{
use sp_state_machine::BasicExternalities;
fn generate_genesis(accounts: &[AccountId]) -> Storage {
use generic_runtime_template::{
BalancesConfig, CollatorSelectionConfig, RuntimeGenesisConfig, SessionConfig, SessionKeys,
};
use generic_runtime_template::{BalancesConfig, RuntimeGenesisConfig};
#[cfg(not(feature = "tanssi"))]
use generic_runtime_template::{CollatorSelectionConfig, SessionConfig, SessionKeys};
#[cfg(not(feature = "tanssi"))]
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_runtime::{app_crypto::ByteArray, BuildStorage};
#[cfg(not(feature = "tanssi"))]
use sp_runtime::app_crypto::ByteArray;
use sp_runtime::BuildStorage;
// Configure endowed accounts with initial balance of 1 << 60.
let balances = accounts.iter().cloned().map(|k| (k, 1 << 60)).collect();
#[cfg(not(feature = "tanssi"))]
let invulnerables: Vec<AccountId> = vec![[0; 32].into()];
#[cfg(not(feature = "tanssi"))]
let session_keys = vec![(
[0; 32].into(),
[0; 32].into(),
@@ -45,14 +53,14 @@ fn generate_genesis(accounts: &[AccountId]) -> Storage {
RuntimeGenesisConfig {
system: Default::default(),
balances: BalancesConfig { balances },
aura: Default::default(),
#[cfg(not(feature = "tanssi"))]
session: SessionConfig { keys: session_keys },
#[cfg(not(feature = "tanssi"))]
collator_selection: CollatorSelectionConfig {
invulnerables,
candidacy_bond: 1 << 57,
desired_candidates: 1,
},
aura_ext: Default::default(),
parachain_info: Default::default(),
parachain_system: Default::default(),
polkadot_xcm: Default::default(),
@@ -294,6 +302,7 @@ fn recursive_call_filter(call: &RuntimeCall, origin: usize) -> bool {
RuntimeCall::System(
frame_system::Call::set_code { .. } | frame_system::Call::kill_prefix { .. },
) => false,
#[cfg(not(feature = "tanssi"))]
RuntimeCall::CollatorSelection(
pallet_collator_selection::Call::set_desired_candidates { max },
) => *max < <Runtime as pallet_collator_selection::Config>::MaxCandidates::get(),