mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-21 01:41:03 +00:00
Add staging runtime api (#5048)
* Move `trait ParachainHost` to a separate version independent module `trait ParachainHost` is no longer part of a specific primitives version. Instead there is a single trait for stable and staging api versions. The trait contains stable AND staging methods. The latter are explicitly marked as unstable. * Fix `use` primitives `polkadot_primitives::v2` becomes `polkadot_primitives::runtime_api` * Staging API declaration and stubs Introduces the concept for 'staging functions' in runtime API. These functions are still in testing and they are meant to be used only within test networks (Westend). They coexist with the stable calls for technical reasons - maintaining different runtime APIs for different networks is hard to implement. Check the doc comments in source files for more details how the staging API should be used. * Add new staging method - get_session_disputes() Add `staging_get_session_disputes` to `ParachainHost` as the first method of the staging API. * Hide vstaging runtime api implementations behind feature flag * Fix test runtime * fn staging_get_session_disputes() is renamed to fn staging_get_disputes()
This commit is contained in:
committed by
GitHub
parent
04f5a15be4
commit
fd020c07e5
@@ -19,8 +19,9 @@
|
||||
//! Provides the [`AbstractClient`] trait that is a super trait that combines all the traits the client implements.
|
||||
//! There is also the [`Client`] enum that combines all the different clients into one common structure.
|
||||
|
||||
use polkadot_primitives::v2::{
|
||||
AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce, ParachainHost,
|
||||
use polkadot_primitives::{
|
||||
runtime_api::ParachainHost,
|
||||
v2::{AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce},
|
||||
};
|
||||
use sc_client_api::{AuxStore, Backend as BackendT, BlockchainEvents, KeyIterator, UsageProvider};
|
||||
use sc_executor::NativeElseWasmExecutor;
|
||||
|
||||
@@ -23,7 +23,10 @@
|
||||
#![warn(missing_docs)]
|
||||
|
||||
use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
||||
use polkadot_primitives::v2::{Block, BlockId, Hash, ParachainHost};
|
||||
use polkadot_primitives::{
|
||||
runtime_api::ParachainHost,
|
||||
v2::{Block, BlockId, Hash},
|
||||
};
|
||||
use polkadot_subsystem::{
|
||||
errors::RuntimeApiError,
|
||||
messages::{RuntimeApiMessage, RuntimeApiRequest as Request},
|
||||
|
||||
@@ -21,10 +21,11 @@ use futures::channel::oneshot;
|
||||
use polkadot_node_primitives::{BabeAllowedSlots, BabeEpoch, BabeEpochConfiguration};
|
||||
use polkadot_node_subsystem_test_helpers::make_subsystem_context;
|
||||
use polkadot_primitives::v2::{
|
||||
AuthorityDiscoveryId, CandidateEvent, CommittedCandidateReceipt, CoreState, GroupRotationInfo,
|
||||
Id as ParaId, InboundDownwardMessage, InboundHrmpMessage, OccupiedCoreAssumption,
|
||||
PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo,
|
||||
ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
|
||||
AuthorityDiscoveryId, BlockNumber, CandidateEvent, CandidateHash, CommittedCandidateReceipt,
|
||||
CoreState, DisputeState, GroupRotationInfo, Id as ParaId, InboundDownwardMessage,
|
||||
InboundHrmpMessage, OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement,
|
||||
ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode, ValidationCodeHash,
|
||||
ValidatorId, ValidatorIndex, ValidatorSignature,
|
||||
};
|
||||
use sp_core::testing::TaskExecutor;
|
||||
use std::{
|
||||
@@ -189,6 +190,10 @@ sp_api::mock_impl_runtime_apis! {
|
||||
) -> Option<ValidationCodeHash> {
|
||||
self.validation_code_hash.get(¶).map(|c| c.clone())
|
||||
}
|
||||
|
||||
fn staging_get_disputes() -> Vec<(SessionIndex, CandidateHash, DisputeState<BlockNumber>)> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
impl BabeApi<Block> for MockRuntimeApi {
|
||||
|
||||
@@ -71,7 +71,10 @@ use futures::{channel::oneshot, future::BoxFuture, select, Future, FutureExt, St
|
||||
use lru::LruCache;
|
||||
|
||||
use client::{BlockImportNotification, BlockchainEvents, FinalityNotification};
|
||||
use polkadot_primitives::v2::{Block, BlockId, BlockNumber, Hash, ParachainHost};
|
||||
use polkadot_primitives::{
|
||||
runtime_api::ParachainHost,
|
||||
v2::{Block, BlockId, BlockNumber, Hash},
|
||||
};
|
||||
use sp_api::{ApiExt, ProvideRuntimeApi};
|
||||
|
||||
use polkadot_node_network_protocol::v1 as protocol_v1;
|
||||
|
||||
@@ -54,7 +54,7 @@ pub use sp_core::traits::SpawnNamed;
|
||||
#[cfg(feature = "full-node")]
|
||||
pub use {
|
||||
polkadot_overseer::{Handle, Overseer, OverseerConnector, OverseerHandle},
|
||||
polkadot_primitives::v2::ParachainHost,
|
||||
polkadot_primitives::runtime_api::ParachainHost,
|
||||
relay_chain_selection::SelectRelayChain,
|
||||
sc_client_api::AuxStore,
|
||||
sp_authority_discovery::AuthorityDiscoveryApi,
|
||||
|
||||
@@ -34,7 +34,7 @@ use polkadot_overseer::{
|
||||
Overseer, OverseerConnector, OverseerHandle,
|
||||
};
|
||||
|
||||
use polkadot_primitives::v2::ParachainHost;
|
||||
use polkadot_primitives::runtime_api::ParachainHost;
|
||||
use sc_authority_discovery::Service as AuthorityDiscoveryService;
|
||||
use sc_client_api::AuxStore;
|
||||
use sc_keystore::LocalKeystore;
|
||||
|
||||
Reference in New Issue
Block a user