mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 21:01:05 +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:
@@ -42,12 +42,12 @@ use polkadot_node_primitives::{
|
||||
ValidationResult,
|
||||
};
|
||||
use polkadot_primitives::{
|
||||
async_backing, slashing, AuthorityDiscoveryId, BackedCandidate, BlockNumber, CandidateEvent,
|
||||
CandidateHash, CandidateIndex, CandidateReceipt, CollatorId, CommittedCandidateReceipt,
|
||||
CoreState, DisputeState, ExecutorParams, GroupIndex, GroupRotationInfo, Hash,
|
||||
Header as BlockHeader, Id as ParaId, InboundDownwardMessage, InboundHrmpMessage,
|
||||
MultiDisputeStatementSet, OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement,
|
||||
PvfExecTimeoutKind, SessionIndex, SessionInfo, SignedAvailabilityBitfield,
|
||||
async_backing, slashing, vstaging::NodeFeatures, AuthorityDiscoveryId, BackedCandidate,
|
||||
BlockNumber, CandidateEvent, CandidateHash, CandidateIndex, CandidateReceipt, CollatorId,
|
||||
CommittedCandidateReceipt, CoreState, DisputeState, ExecutorParams, GroupIndex,
|
||||
GroupRotationInfo, Hash, Header as BlockHeader, Id as ParaId, InboundDownwardMessage,
|
||||
InboundHrmpMessage, MultiDisputeStatementSet, OccupiedCoreAssumption, PersistedValidationData,
|
||||
PvfCheckStatement, PvfExecTimeoutKind, SessionIndex, SessionInfo, SignedAvailabilityBitfield,
|
||||
SignedAvailabilityBitfields, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
|
||||
ValidatorSignature,
|
||||
};
|
||||
@@ -718,6 +718,8 @@ pub enum RuntimeApiRequest {
|
||||
///
|
||||
/// If it's not supported by the Runtime, the async backing is said to be disabled.
|
||||
AsyncBackingParams(RuntimeApiSender<async_backing::AsyncBackingParams>),
|
||||
/// Get the node features.
|
||||
NodeFeatures(SessionIndex, RuntimeApiSender<NodeFeatures>),
|
||||
}
|
||||
|
||||
impl RuntimeApiRequest {
|
||||
@@ -746,6 +748,9 @@ impl RuntimeApiRequest {
|
||||
|
||||
/// `DisabledValidators`
|
||||
pub const DISABLED_VALIDATORS_RUNTIME_REQUIREMENT: u32 = 8;
|
||||
|
||||
/// `Node features`
|
||||
pub const NODE_FEATURES_RUNTIME_REQUIREMENT: u32 = 9;
|
||||
}
|
||||
|
||||
/// A message to the Runtime API subsystem.
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
use async_trait::async_trait;
|
||||
use polkadot_primitives::{
|
||||
async_backing, runtime_api::ParachainHost, slashing, Block, BlockNumber, CandidateCommitments,
|
||||
CandidateEvent, CandidateHash, CommittedCandidateReceipt, CoreState, DisputeState,
|
||||
ExecutorParams, GroupRotationInfo, Hash, Id, InboundDownwardMessage, InboundHrmpMessage,
|
||||
OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes,
|
||||
SessionIndex, SessionInfo, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
|
||||
ValidatorSignature,
|
||||
async_backing, runtime_api::ParachainHost, slashing, vstaging, Block, BlockNumber,
|
||||
CandidateCommitments, CandidateEvent, CandidateHash, CommittedCandidateReceipt, CoreState,
|
||||
DisputeState, ExecutorParams, GroupRotationInfo, Hash, Id, InboundDownwardMessage,
|
||||
InboundHrmpMessage, OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement,
|
||||
ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode, ValidationCodeHash,
|
||||
ValidatorId, ValidatorIndex, ValidatorSignature,
|
||||
};
|
||||
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
|
||||
use sp_api::{ApiError, ApiExt, ProvideRuntimeApi};
|
||||
@@ -257,8 +257,14 @@ pub trait RuntimeApiSubsystemClient {
|
||||
) -> Result<Option<async_backing::BackingState>, ApiError>;
|
||||
|
||||
// === v8 ===
|
||||
|
||||
/// Gets the disabled validators at a specific block height
|
||||
async fn disabled_validators(&self, at: Hash) -> Result<Vec<ValidatorIndex>, ApiError>;
|
||||
|
||||
// === v9 ===
|
||||
|
||||
/// Get the node features.
|
||||
async fn node_features(&self, at: Hash) -> Result<vstaging::NodeFeatures, ApiError>;
|
||||
}
|
||||
|
||||
/// Default implementation of [`RuntimeApiSubsystemClient`] using the client.
|
||||
@@ -508,6 +514,10 @@ where
|
||||
self.client.runtime_api().async_backing_params(at)
|
||||
}
|
||||
|
||||
async fn node_features(&self, at: Hash) -> Result<vstaging::NodeFeatures, ApiError> {
|
||||
self.client.runtime_api().node_features(at)
|
||||
}
|
||||
|
||||
async fn disabled_validators(&self, at: Hash) -> Result<Vec<ValidatorIndex>, ApiError> {
|
||||
self.client.runtime_api().disabled_validators(at)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user