Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
tdimitrov committed Sep 1, 2023
1 parent 1d1f852 commit 3ee35c8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,13 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
.await?)
}

async fn disabled_validators(
&self,
at: Hash,
) -> Result<Vec<polkadot_primitives::ValidatorIndex>, ApiError> {
Ok(self.rpc_client.parachain_host_disabled_validators(at).await?)
}

async fn staging_async_backing_params(&self, at: Hash) -> Result<AsyncBackingParams, ApiError> {
Ok(self.rpc_client.parachain_host_staging_async_backing_params(at).await?)
}
Expand Down
8 changes: 8 additions & 0 deletions cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,14 @@ impl RelayChainRpcClient {
.await
}

pub async fn parachain_host_disabled_validators(
&self,
at: RelayHash,
) -> Result<Vec<ValidatorIndex>, RelayChainError> {
self.call_remote_runtime_function("ParachainHost_disabled_validators", at, None::<()>)
.await
}

#[allow(missing_docs)]
pub async fn parachain_host_staging_async_backing_params(
&self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub use impls::{RococoWococoMessageHandler, WococoRococoMessageHandler};
pub use parachains_common::{AccountId, Balance};
pub use paste;
use polkadot_parachain::primitives::HrmpChannelId;
use polkadot_primitives::runtime_api::runtime_decl_for_parachain_host::ParachainHostV6;
pub use polkadot_runtime_parachains::inclusion::{AggregateMessageOrigin, UmpQueueId};
pub use sp_core::{sr25519, storage::Storage, Get};
use sp_tracing;
Expand Down
8 changes: 4 additions & 4 deletions polkadot/node/core/runtime-api/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub(crate) struct RequestResultCache {
LruMap<Hash, Vec<(SessionIndex, CandidateHash, vstaging::slashing::PendingSlashes)>>,
key_ownership_proof:
LruMap<(Hash, ValidatorId), Option<vstaging::slashing::OpaqueKeyOwnershipProof>>,
disabled_validators: LruCache<Hash, Vec<ValidatorIndex>>,
disabled_validators: LruMap<Hash, Vec<ValidatorIndex>>,

staging_para_backing_state: LruMap<(Hash, ParaId), Option<vstaging::BackingState>>,
staging_async_backing_params: LruMap<Hash, vstaging::AsyncBackingParams>,
Expand Down Expand Up @@ -98,7 +98,7 @@ impl Default for RequestResultCache {
disputes: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
unapplied_slashes: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
key_ownership_proof: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
disabled_validators: LruCache::new(DEFAULT_CACHE_CAP),
disabled_validators: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),

staging_para_backing_state: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
staging_async_backing_params: LruMap::new(ByLength::new(DEFAULT_CACHE_CAP)),
Expand Down Expand Up @@ -440,15 +440,15 @@ impl RequestResultCache {
&mut self,
relay_parent: &Hash,
) -> Option<&Vec<ValidatorIndex>> {
self.disabled_validators.get(relay_parent)
self.disabled_validators.get(relay_parent).map(|v| &*v)
}

pub(crate) fn cache_disabled_validators(
&mut self,
relay_parent: Hash,
disabled_validators: Vec<ValidatorIndex>,
) {
self.disabled_validators.put(relay_parent, disabled_validators);
self.disabled_validators.insert(relay_parent, disabled_validators);
}

pub(crate) fn staging_para_backing_state(
Expand Down

0 comments on commit 3ee35c8

Please sign in to comment.