From 456be7987531c825dfc8d7c63356a72555d4dd19 Mon Sep 17 00:00:00 2001 From: BradleyOlson64 Date: Thu, 30 Nov 2023 13:08:22 -0800 Subject: [PATCH] Removing runtime api entry for bulk core count --- .../src/blockchain_rpc_client.rs | 4 --- .../src/rpc_client.rs | 8 ----- polkadot/node/core/runtime-api/src/cache.rs | 18 ------------ polkadot/node/core/runtime-api/src/tests.rs | 4 --- polkadot/node/subsystem-types/src/messages.rs | 2 -- .../subsystem-types/src/runtime_client.rs | 12 -------- .../node/subsystem-util/src/runtime/mod.rs | 29 ------------------- polkadot/primitives/src/runtime_api.rs | 6 ---- 8 files changed, 83 deletions(-) diff --git a/cumulus/client/relay-chain-minimal-node/src/blockchain_rpc_client.rs b/cumulus/client/relay-chain-minimal-node/src/blockchain_rpc_client.rs index 38a4f58e0930..a473b3bced02 100644 --- a/cumulus/client/relay-chain-minimal-node/src/blockchain_rpc_client.rs +++ b/cumulus/client/relay-chain-minimal-node/src/blockchain_rpc_client.rs @@ -369,10 +369,6 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient { async fn node_features(&self, at: Hash) -> Result { Ok(self.rpc_client.parachain_host_node_features(at).await?) } - - async fn bulk_core_count(&self, at: Hash) -> Result { - Ok(self.rpc_client.parachain_host_bulk_core_count(at).await?) - } } #[async_trait::async_trait] diff --git a/cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs b/cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs index 0f60e40ffe2e..cc993c6ff9f6 100644 --- a/cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs +++ b/cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs @@ -607,14 +607,6 @@ impl RelayChainRpcClient { .await } - pub async fn parachain_host_bulk_core_count( - &self, - at: RelayHash - ) -> Result { - self.call_remote_runtime_function("ParachainHost_bulk_core_count", at, None::<()>) - .await - } - pub async fn parachain_host_disabled_validators( &self, at: RelayHash, diff --git a/polkadot/node/core/runtime-api/src/cache.rs b/polkadot/node/core/runtime-api/src/cache.rs index dadd56266bad..8a7a3dc08b81 100644 --- a/polkadot/node/core/runtime-api/src/cache.rs +++ b/polkadot/node/core/runtime-api/src/cache.rs @@ -68,7 +68,6 @@ pub(crate) struct RequestResultCache { para_backing_state: LruMap<(Hash, ParaId), Option>, async_backing_params: LruMap, node_features: LruMap, - bulk_core_count: LruMap, } impl Default for RequestResultCache { @@ -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)), } } } @@ -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 { @@ -575,5 +558,4 @@ pub(crate) enum RequestResult { ParaBackingState(Hash, ParaId, Option), AsyncBackingParams(Hash, async_backing::AsyncBackingParams), NodeFeatures(SessionIndex, vstaging::NodeFeatures), - BulkCoreCount(SessionIndex, u16), } diff --git a/polkadot/node/core/runtime-api/src/tests.rs b/polkadot/node/core/runtime-api/src/tests.rs index 34e6fb542adb..b939bffb0e7f 100644 --- a/polkadot/node/core/runtime-api/src/tests.rs +++ b/polkadot/node/core/runtime-api/src/tests.rs @@ -276,10 +276,6 @@ impl RuntimeApiSubsystemClient for MockSubsystemClient { async fn disabled_validators(&self, _: Hash) -> Result, ApiError> { todo!("Not required for tests") } - - async fn bulk_core_count(&self, _: Hash) -> Result { - todo!("Not required for tests") - } } #[test] diff --git a/polkadot/node/subsystem-types/src/messages.rs b/polkadot/node/subsystem-types/src/messages.rs index ceff236b8425..43456daec302 100644 --- a/polkadot/node/subsystem-types/src/messages.rs +++ b/polkadot/node/subsystem-types/src/messages.rs @@ -720,8 +720,6 @@ pub enum RuntimeApiRequest { AsyncBackingParams(RuntimeApiSender), /// Get the node features. NodeFeatures(SessionIndex, RuntimeApiSender), - /// Get the bulk core count - BulkCoreCount(SessionIndex, RuntimeApiSender), } impl RuntimeApiRequest { diff --git a/polkadot/node/subsystem-types/src/runtime_client.rs b/polkadot/node/subsystem-types/src/runtime_client.rs index 1a6f04b6cd36..8369fd215f4f 100644 --- a/polkadot/node/subsystem-types/src/runtime_client.rs +++ b/polkadot/node/subsystem-types/src/runtime_client.rs @@ -265,11 +265,6 @@ pub trait RuntimeApiSubsystemClient { /// Get the node features. async fn node_features(&self, at: Hash) -> Result; - - // === v10 === - - /// Get the bulk core count - async fn bulk_core_count(&self, at: Hash) -> Result; } /// Default implementation of [`RuntimeApiSubsystemClient`] using the client. @@ -526,11 +521,4 @@ where async fn disabled_validators(&self, at: Hash) -> Result, ApiError> { self.client.runtime_api().disabled_validators(at) } - - async fn bulk_core_count( - &self, - at: Hash, - ) -> Result { - self.client.runtime_api().bulk_core_count(at) - } } diff --git a/polkadot/node/subsystem-util/src/runtime/mod.rs b/polkadot/node/subsystem-util/src/runtime/mod.rs index a597549817a2..4271e37d458e 100644 --- a/polkadot/node/subsystem-util/src/runtime/mod.rs +++ b/polkadot/node/subsystem-util/src/runtime/mod.rs @@ -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, -) -> Result { - 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) - } } \ No newline at end of file diff --git a/polkadot/primitives/src/runtime_api.rs b/polkadot/primitives/src/runtime_api.rs index 0e50b45603d9..e4c1d590f457 100644 --- a/polkadot/primitives/src/runtime_api.rs +++ b/polkadot/primitives/src/runtime_api.rs @@ -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 } }