mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 15:11:03 +00:00
add NodeFeatures field to HostConfiguration and runtime API (#2177)
Adds a `NodeFeatures` bitfield value to the runtime `HostConfiguration`, with the purpose of coordinating the enabling of node-side features, such as: https://github.com/paritytech/polkadot-sdk/issues/628 and https://github.com/paritytech/polkadot-sdk/issues/598. These are features that require all validators enable them at the same time, assuming all/most nodes have upgraded their node versions. This PR doesn't add any feature yet. These are coming in future PRs. Also adds a runtime API for querying the state of the client features and an extrinsic for setting/unsetting a feature by its index in the bitfield. Note: originally part of: https://github.com/paritytech/polkadot-sdk/pull/1644, but posted as standalone to be reused by other PRs until the initial PR is merged
This commit is contained in:
@@ -23,11 +23,12 @@
|
||||
use pallet_nis::WithMaximumOf;
|
||||
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
|
||||
use primitives::{
|
||||
slashing, AccountId, AccountIndex, Balance, BlockNumber, CandidateEvent, CandidateHash,
|
||||
CommittedCandidateReceipt, CoreState, DisputeState, ExecutorParams, GroupRotationInfo, Hash,
|
||||
Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, Moment, Nonce,
|
||||
OccupiedCoreAssumption, PersistedValidationData, ScrapedOnChainVotes, SessionInfo, Signature,
|
||||
ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, PARACHAIN_KEY_TYPE_ID,
|
||||
slashing, vstaging::NodeFeatures, AccountId, AccountIndex, Balance, BlockNumber,
|
||||
CandidateEvent, CandidateHash, CommittedCandidateReceipt, CoreState, DisputeState,
|
||||
ExecutorParams, GroupRotationInfo, Hash, Id as ParaId, InboundDownwardMessage,
|
||||
InboundHrmpMessage, Moment, Nonce, OccupiedCoreAssumption, PersistedValidationData,
|
||||
ScrapedOnChainVotes, SessionInfo, Signature, ValidationCode, ValidationCodeHash, ValidatorId,
|
||||
ValidatorIndex, PARACHAIN_KEY_TYPE_ID,
|
||||
};
|
||||
use runtime_common::{
|
||||
assigned_slots, auctions, claims, crowdloan, impl_runtime_weights,
|
||||
@@ -1499,6 +1500,7 @@ pub mod migrations {
|
||||
frame_support::migrations::RemovePallet<TipsPalletName, <Runtime as frame_system::Config>::DbWeight>,
|
||||
|
||||
pallet_grandpa::migrations::MigrateV4ToV5<Runtime>,
|
||||
parachains_configuration::migration::v10::MigrateToV10<Runtime>,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1660,7 +1662,7 @@ sp_api::impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
#[api_version(8)]
|
||||
#[api_version(9)]
|
||||
impl primitives::runtime_api::ParachainHost<Block, Hash, BlockNumber> for Runtime {
|
||||
fn validators() -> Vec<ValidatorId> {
|
||||
parachains_runtime_api_impl::validators::<Runtime>()
|
||||
@@ -1808,6 +1810,9 @@ sp_api::impl_runtime_apis! {
|
||||
parachains_staging_runtime_api_impl::disabled_validators::<Runtime>()
|
||||
}
|
||||
|
||||
fn node_features() -> NodeFeatures {
|
||||
parachains_staging_runtime_api_impl::node_features::<Runtime>()
|
||||
}
|
||||
}
|
||||
|
||||
#[api_version(3)]
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
//! Autogenerated weights for `runtime_parachains::configuration`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-08-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2023-11-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `runner-fljshgub-project-163-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||
//! HOSTNAME: `runner-yprdrvc7-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("rococo-dev")`, DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
@@ -31,11 +31,11 @@
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=/builds/parity/mirrors/polkadot/.git/.artifacts/bench.json
|
||||
// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json
|
||||
// --pallet=runtime_parachains::configuration
|
||||
// --chain=rococo-dev
|
||||
// --header=./file_header.txt
|
||||
// --output=./runtime/rococo/src/weights/
|
||||
// --header=./polkadot/file_header.txt
|
||||
// --output=./polkadot/runtime/rococo/src/weights/
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
@@ -56,11 +56,11 @@ impl<T: frame_system::Config> runtime_parachains::configuration::WeightInfo for
|
||||
/// Proof: `ParasShared::CurrentSessionIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn set_config_with_block_number() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `127`
|
||||
// Estimated: `1612`
|
||||
// Minimum execution time: 9_051_000 picoseconds.
|
||||
Weight::from_parts(9_496_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1612))
|
||||
// Measured: `151`
|
||||
// Estimated: `1636`
|
||||
// Minimum execution time: 7_793_000 picoseconds.
|
||||
Weight::from_parts(8_192_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1636))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
@@ -72,11 +72,11 @@ impl<T: frame_system::Config> runtime_parachains::configuration::WeightInfo for
|
||||
/// Proof: `ParasShared::CurrentSessionIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn set_config_with_u32() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `127`
|
||||
// Estimated: `1612`
|
||||
// Minimum execution time: 9_104_000 picoseconds.
|
||||
Weight::from_parts(9_403_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1612))
|
||||
// Measured: `151`
|
||||
// Estimated: `1636`
|
||||
// Minimum execution time: 7_819_000 picoseconds.
|
||||
Weight::from_parts(8_004_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1636))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
@@ -88,11 +88,11 @@ impl<T: frame_system::Config> runtime_parachains::configuration::WeightInfo for
|
||||
/// Proof: `ParasShared::CurrentSessionIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn set_config_with_option_u32() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `127`
|
||||
// Estimated: `1612`
|
||||
// Minimum execution time: 9_112_000 picoseconds.
|
||||
Weight::from_parts(9_495_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1612))
|
||||
// Measured: `151`
|
||||
// Estimated: `1636`
|
||||
// Minimum execution time: 7_760_000 picoseconds.
|
||||
Weight::from_parts(8_174_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1636))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
@@ -114,11 +114,11 @@ impl<T: frame_system::Config> runtime_parachains::configuration::WeightInfo for
|
||||
/// Proof: `ParasShared::CurrentSessionIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn set_config_with_balance() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `127`
|
||||
// Estimated: `1612`
|
||||
// Minimum execution time: 9_011_000 picoseconds.
|
||||
Weight::from_parts(9_460_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1612))
|
||||
// Measured: `151`
|
||||
// Estimated: `1636`
|
||||
// Minimum execution time: 7_814_000 picoseconds.
|
||||
Weight::from_parts(8_098_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1636))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
@@ -130,11 +130,11 @@ impl<T: frame_system::Config> runtime_parachains::configuration::WeightInfo for
|
||||
/// Proof: `ParasShared::CurrentSessionIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn set_config_with_executor_params() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `127`
|
||||
// Estimated: `1612`
|
||||
// Minimum execution time: 9_940_000 picoseconds.
|
||||
Weight::from_parts(10_288_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1612))
|
||||
// Measured: `151`
|
||||
// Estimated: `1636`
|
||||
// Minimum execution time: 10_028_000 picoseconds.
|
||||
Weight::from_parts(10_386_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1636))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
@@ -146,11 +146,27 @@ impl<T: frame_system::Config> runtime_parachains::configuration::WeightInfo for
|
||||
/// Proof: `ParasShared::CurrentSessionIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn set_config_with_perbill() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `127`
|
||||
// Estimated: `1612`
|
||||
// Minimum execution time: 9_192_000 picoseconds.
|
||||
Weight::from_parts(9_595_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1612))
|
||||
// Measured: `151`
|
||||
// Estimated: `1636`
|
||||
// Minimum execution time: 7_867_000 picoseconds.
|
||||
Weight::from_parts(8_191_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1636))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
/// Storage: `Configuration::PendingConfigs` (r:1 w:1)
|
||||
/// Proof: `Configuration::PendingConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `Configuration::BypassConsistencyCheck` (r:1 w:0)
|
||||
/// Proof: `Configuration::BypassConsistencyCheck` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
/// Storage: `ParasShared::CurrentSessionIndex` (r:1 w:0)
|
||||
/// Proof: `ParasShared::CurrentSessionIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
fn set_node_feature() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `151`
|
||||
// Estimated: `1636`
|
||||
// Minimum execution time: 10_158_000 picoseconds.
|
||||
Weight::from_parts(10_430_000, 0)
|
||||
.saturating_add(Weight::from_parts(0, 1636))
|
||||
.saturating_add(T::DbWeight::get().reads(3))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user