Skip to content

Commit

Permalink
Removing runtime api entry for bulk core count
Browse files Browse the repository at this point in the history
  • Loading branch information
BradleyOlson64 committed Nov 30, 2023
1 parent f4cacfe commit 456be79
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
async fn node_features(&self, at: Hash) -> Result<NodeFeatures, ApiError> {
Ok(self.rpc_client.parachain_host_node_features(at).await?)
}

async fn bulk_core_count(&self, at: Hash) -> Result<u16, ApiError> {
Ok(self.rpc_client.parachain_host_bulk_core_count(at).await?)
}
}

#[async_trait::async_trait]
Expand Down
8 changes: 0 additions & 8 deletions cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,14 +607,6 @@ impl RelayChainRpcClient {
.await
}

pub async fn parachain_host_bulk_core_count(
&self,
at: RelayHash
) -> Result<u16, RelayChainError> {
self.call_remote_runtime_function("ParachainHost_bulk_core_count", at, None::<()>)
.await
}

pub async fn parachain_host_disabled_validators(
&self,
at: RelayHash,
Expand Down
18 changes: 0 additions & 18 deletions polkadot/node/core/runtime-api/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ pub(crate) struct RequestResultCache {
para_backing_state: LruMap<(Hash, ParaId), Option<async_backing::BackingState>>,
async_backing_params: LruMap<Hash, async_backing::AsyncBackingParams>,
node_features: LruMap<SessionIndex, vstaging::NodeFeatures>,
bulk_core_count: LruMap<SessionIndex, u16>,
}

impl Default for RequestResultCache {
Expand Down Expand Up @@ -103,7 +102,6 @@ impl Default for RequestResultCache {
para_backing_state: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
async_backing_params: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
node_features: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
bulk_core_count: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
}
}
}
Expand Down Expand Up @@ -509,21 +507,6 @@ impl RequestResultCache {
) {
self.async_backing_params.insert(key, value);
}

pub(crate) fn bulk_core_count(
&mut self,
session_index: SessionIndex,
) -> Option<&u16> {
self.bulk_core_count.get(&session_index).map(|v| &*v)
}

pub(crate) fn cache_bulk_core_count(
&mut self,
session_index: SessionIndex,
value: u16,
) {
self.bulk_core_count.insert(session_index, value);
}
}

pub(crate) enum RequestResult {
Expand Down Expand Up @@ -575,5 +558,4 @@ pub(crate) enum RequestResult {
ParaBackingState(Hash, ParaId, Option<async_backing::BackingState>),
AsyncBackingParams(Hash, async_backing::AsyncBackingParams),
NodeFeatures(SessionIndex, vstaging::NodeFeatures),
BulkCoreCount(SessionIndex, u16),
}
4 changes: 0 additions & 4 deletions polkadot/node/core/runtime-api/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,6 @@ impl RuntimeApiSubsystemClient for MockSubsystemClient {
async fn disabled_validators(&self, _: Hash) -> Result<Vec<ValidatorIndex>, ApiError> {
todo!("Not required for tests")
}

async fn bulk_core_count(&self, _: Hash) -> Result<u16, ApiError> {
todo!("Not required for tests")
}
}

#[test]
Expand Down
2 changes: 0 additions & 2 deletions polkadot/node/subsystem-types/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,6 @@ pub enum RuntimeApiRequest {
AsyncBackingParams(RuntimeApiSender<async_backing::AsyncBackingParams>),
/// Get the node features.
NodeFeatures(SessionIndex, RuntimeApiSender<NodeFeatures>),
/// Get the bulk core count
BulkCoreCount(SessionIndex, RuntimeApiSender<u16>),
}

impl RuntimeApiRequest {
Expand Down
12 changes: 0 additions & 12 deletions polkadot/node/subsystem-types/src/runtime_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,6 @@ pub trait RuntimeApiSubsystemClient {

/// Get the node features.
async fn node_features(&self, at: Hash) -> Result<vstaging::NodeFeatures, ApiError>;

// === v10 ===

/// Get the bulk core count
async fn bulk_core_count(&self, at: Hash) -> Result<u16, ApiError>;
}

/// Default implementation of [`RuntimeApiSubsystemClient`] using the client.
Expand Down Expand Up @@ -526,11 +521,4 @@ where
async fn disabled_validators(&self, at: Hash) -> Result<Vec<ValidatorIndex>, ApiError> {
self.client.runtime_api().disabled_validators(at)
}

async fn bulk_core_count(
&self,
at: Hash,
) -> Result<u16, ApiError> {
self.client.runtime_api().bulk_core_count(at)
}
}
29 changes: 0 additions & 29 deletions polkadot/node/subsystem-util/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,33 +535,4 @@ pub async fn request_node_features(
} else {
res.map(Some)
}
}

/// Request current bulk core count
/// Pass in the session index for caching purposes, as it should only change on session boundaries.
/// Prior to runtime API version 10, just return 0.
pub async fn request_bulk_core_count(
parent: Hash,
session_index: SessionIndex,
sender: &mut impl overseer::SubsystemSender<RuntimeApiMessage>,
) -> Result<u16> {
let res = recv_runtime(
request_from_runtime(parent, sender, |tx| {
RuntimeApiRequest::BulkCoreCount(session_index, tx)
})
.await,
)
.await;

if let Err(Error::RuntimeRequest(RuntimeApiError::NotSupported { .. })) = res {
gum::trace!(
target: LOG_TARGET,
?parent,
"Querying the bulk core count from the runtime is not supported by the current Runtime API",
);

Ok(0u16)
} else {
res.map(Some)
}
}
6 changes: 0 additions & 6 deletions polkadot/primitives/src/runtime_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,5 @@ sp_api::decl_runtime_apis! {
/// This is a staging method! Do not use on production runtimes!
#[api_version(9)]
fn node_features() -> vstaging::NodeFeatures;

/***** Added in v10 *****/

/// Get bulk core count
#[api_version(10)]
fn bulk_core_count() -> u16
}
}

0 comments on commit 456be79

Please sign in to comment.