Retire OldV1SessionInfo (#6744)

This commit is contained in:
s0me0ne-unkn0wn
2023-02-20 11:30:45 +01:00
committed by GitHub
parent d009d13523
commit bad4afca36
5 changed files with 17 additions and 145 deletions
+2 -33
View File
@@ -460,39 +460,8 @@ where
),
Request::CandidateEvents(sender) =>
query!(CandidateEvents, candidate_events(), ver = 1, sender),
Request::SessionInfo(index, sender) => {
let api_version = client
.api_version_parachain_host(relay_parent)
.await
.unwrap_or_default()
.unwrap_or_default();
let res = if api_version >= 2 {
let res = client.session_info(relay_parent, index).await.map_err(|e| {
RuntimeApiError::Execution {
runtime_api_name: "SessionInfo",
source: std::sync::Arc::new(e),
}
});
metrics.on_request(res.is_ok());
res
} else {
#[allow(deprecated)]
let res = client.session_info_before_version_2(relay_parent, index).await.map_err(|e| {
RuntimeApiError::Execution {
runtime_api_name: "SessionInfo",
source: std::sync::Arc::new(e),
}
});
metrics.on_request(res.is_ok());
res.map(|r| r.map(|old| old.into()))
};
let _ = sender.send(res.clone());
res.ok().map(|res| RequestResult::SessionInfo(relay_parent, index, res))
},
Request::SessionInfo(index, sender) =>
query!(SessionInfo, session_info(index), ver = 2, sender),
Request::SessionExecutorParams(session_index, sender) => query!(
SessionExecutorParams,
session_executor_params(session_index),
@@ -19,9 +19,9 @@ use polkadot_primitives::{
runtime_api::ParachainHost, vstaging::ExecutorParams, Block, BlockId, BlockNumber,
CandidateCommitments, CandidateEvent, CandidateHash, CommittedCandidateReceipt, CoreState,
DisputeState, GroupRotationInfo, Hash, Id, InboundDownwardMessage, InboundHrmpMessage,
OccupiedCoreAssumption, OldV1SessionInfo, PersistedValidationData, PvfCheckStatement,
ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode, ValidationCodeHash,
ValidatorId, ValidatorIndex, ValidatorSignature,
OccupiedCoreAssumption, PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes,
SessionIndex, SessionInfo, ValidationCode, ValidationCodeHash, ValidatorId, ValidatorIndex,
ValidatorSignature,
};
use sp_api::{ApiError, ApiExt, ProvideRuntimeApi};
use sp_authority_discovery::AuthorityDiscoveryApi;
@@ -148,15 +148,6 @@ pub trait RuntimeApiSubsystemClient {
index: SessionIndex,
) -> Result<Option<SessionInfo>, ApiError>;
/// Get the session info for the given session, if stored.
///
/// NOTE: This function is only available since parachain host version 2.
async fn session_info_before_version_2(
&self,
at: Hash,
index: SessionIndex,
) -> Result<Option<OldV1SessionInfo>, ApiError>;
/// Submits a PVF pre-checking statement into the transaction pool.
///
/// NOTE: This function is only available since parachain host version 2.
@@ -380,16 +371,6 @@ where
self.runtime_api().api_version::<dyn ParachainHost<Block>>(&BlockId::Hash(at))
}
#[warn(deprecated)]
async fn session_info_before_version_2(
&self,
at: Hash,
index: SessionIndex,
) -> Result<Option<OldV1SessionInfo>, ApiError> {
#[allow(deprecated)]
self.runtime_api().session_info_before_version_2(&BlockId::Hash(at), index)
}
async fn disputes(
&self,
at: Hash,