Companion for paritytech/polkadot#6744: Retire OldV1SessionInfo (#2213)

* Adjust commands

* Use `NetworkWorker::next_action()` instead of `poll()`

* rustfmt

* minor: fix mutability

* Move imports

* Replace `NetworkWorker::next_action()` with `run()`

* Import fix

* Make `NetworkWorker::run` consume self

* Retire `OldV1SessionInfo`

* update lockfile for {"polkadot", "substrate"}

* update lockfile for {"substrate", "polkadot"}

* update lockfile for {"substrate", "polkadot"}

* Make stuff compile

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Piotr Mikołajczyk <piomiko41@gmail.com>
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
Co-authored-by: parity-processbot <>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
s0me0ne-unkn0wn
2023-02-20 21:26:47 +01:00
committed by GitHub
parent 6582931c40
commit 70483f33d9
6 changed files with 323 additions and 308 deletions
+263 -254
View File
File diff suppressed because it is too large Load Diff
@@ -253,14 +253,6 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
Ok(self.rpc_client.parachain_host_session_info(at, index).await?)
}
async fn session_info_before_version_2(
&self,
at: Hash,
index: polkadot_primitives::SessionIndex,
) -> Result<Option<polkadot_primitives::OldV1SessionInfo>, sp_api::ApiError> {
Ok(self.rpc_client.parachain_host_session_info_before_version_2(at, index).await?)
}
async fn session_executor_params(
&self,
at: Hash,
@@ -108,7 +108,7 @@ pub(crate) fn build_collator_network(
return
}
network_worker.await
network_worker.run().await;
});
let network_starter = NetworkStarter::new(network_start_tx);
@@ -19,9 +19,9 @@ use cumulus_primitives_core::{
relay_chain::{
vstaging::ExecutorParams, CandidateCommitments, CandidateEvent, CandidateHash,
CommittedCandidateReceipt, CoreState, DisputeState, GroupRotationInfo, Hash as RelayHash,
Header as RelayHeader, InboundHrmpMessage, OccupiedCoreAssumption, OldV1SessionInfo,
PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode,
ValidationCodeHash, ValidatorId, ValidatorIndex, ValidatorSignature,
Header as RelayHeader, InboundHrmpMessage, OccupiedCoreAssumption, PvfCheckStatement,
ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode, ValidationCodeHash,
ValidatorId, ValidatorIndex, ValidatorSignature,
},
InboundDownwardMessage, ParaId, PersistedValidationData,
};
@@ -135,17 +135,6 @@ impl RelayChainRpcClient {
self.call_remote_runtime_function("BabeApi_current_epoch", at, None::<()>).await
}
/// Old method to fetch v1 session info.
pub async fn parachain_host_session_info_before_version_2(
&self,
at: RelayHash,
index: SessionIndex,
) -> Result<Option<OldV1SessionInfo>, RelayChainError> {
// The function in wasm never changes/gets augmented with a version
self.call_remote_runtime_function("ParachainHost_session_info", at, Some(index))
.await
}
/// Scrape dispute relevant from on-chain, backing votes and resolved disputes.
pub async fn parachain_host_on_chain_votes(
&self,
+12 -2
View File
@@ -229,9 +229,12 @@ pub fn run() -> Result<()> {
},
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
use parachain_template_runtime::MILLISECS_PER_BLOCK;
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
use try_runtime_cli::block_building_info::timestamp_with_aura_info;
let runner = cli.create_runner(cmd)?;
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
type HostFunctionsOf<E> = ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<E as NativeExecutionDispatch>::ExtendHostFunctions,
@@ -243,8 +246,15 @@ pub fn run() -> Result<()> {
sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
.map_err(|e| format!("Error: {:?}", e))?;
let info_provider = timestamp_with_aura_info(MILLISECS_PER_BLOCK);
runner.async_run(|_| {
Ok((cmd.run::<Block, HostFunctionsOf<ParachainNativeExecutor>>(), task_manager))
Ok((
cmd.run::<Block, HostFunctionsOf<ParachainNativeExecutor>, _>(Some(
info_provider,
)),
task_manager,
))
})
},
#[cfg(not(feature = "try-runtime"))]
+27 -12
View File
@@ -704,47 +704,62 @@ pub fn run() -> Result<()> {
},
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
use try_runtime_cli::block_building_info::timestamp_with_aura_info;
// grab the task manager.
let runner = cli.create_runner(cmd)?;
let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry);
let task_manager =
sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
.map_err(|e| format!("Error: {:?}", e))?;
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
type HostFunctionsOf<E> = ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<E as NativeExecutionDispatch>::ExtendHostFunctions,
>;
let info_provider = timestamp_with_aura_info(6000);
match runner.config().chain_spec.runtime() {
Runtime::Statemine => runner.async_run(|_| {
Ok((
cmd.run::<Block, HostFunctionsOf<StatemineRuntimeExecutor>>(),
cmd.run::<Block, HostFunctionsOf<StatemineRuntimeExecutor>, _>(Some(
info_provider,
)),
task_manager,
))
}),
Runtime::Westmint => runner.async_run(|_| {
Ok((cmd.run::<Block, HostFunctionsOf<WestmintRuntimeExecutor>>(), task_manager))
Ok((
cmd.run::<Block, HostFunctionsOf<WestmintRuntimeExecutor>, _>(Some(
info_provider,
)),
task_manager,
))
}),
Runtime::Statemint => runner.async_run(|_| {
Ok((
cmd.run::<Block, HostFunctionsOf<StatemintRuntimeExecutor>>(),
cmd.run::<Block, HostFunctionsOf<StatemintRuntimeExecutor>, _>(Some(
info_provider,
)),
task_manager,
))
}),
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend =>
runner.async_run(|_| {
Ok((
cmd.run::<Block, HostFunctionsOf<CollectivesPolkadotRuntimeExecutor>>(),
cmd.run::<Block, HostFunctionsOf<CollectivesPolkadotRuntimeExecutor>, _>(Some(info_provider)),
task_manager,
))
}),
Runtime::BridgeHub(bridge_hub_runtime_type) => match bridge_hub_runtime_type {
Runtime::BridgeHub(bridge_hub_runtime_type) =>
match bridge_hub_runtime_type {
chain_spec::bridge_hubs::BridgeHubRuntimeType::Polkadot |
chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotLocal |
chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotDevelopment => runner.async_run(|_| {
chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotDevelopment =>
runner.async_run(|_| {
Ok((
cmd.run::<Block, HostFunctionsOf<BridgeHubPolkadotRuntimeExecutor>>(),
cmd.run::<Block, HostFunctionsOf<BridgeHubPolkadotRuntimeExecutor>, _>(Some(info_provider)),
task_manager,
))
}),
@@ -752,7 +767,7 @@ pub fn run() -> Result<()> {
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaLocal |
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaDevelopment => runner.async_run(|_| {
Ok((
cmd.run::<Block, HostFunctionsOf<BridgeHubKusamaRuntimeExecutor>>(),
cmd.run::<Block, HostFunctionsOf<BridgeHubKusamaRuntimeExecutor>, _>(Some(info_provider)),
task_manager,
))
}),
@@ -760,7 +775,7 @@ pub fn run() -> Result<()> {
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal |
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment => runner.async_run(|_| {
Ok((
cmd.run::<Block, HostFunctionsOf<BridgeHubRococoRuntimeExecutor>>(),
cmd.run::<Block, HostFunctionsOf<BridgeHubRococoRuntimeExecutor>, _>(Some(info_provider)),
task_manager,
))
}),
@@ -773,13 +788,13 @@ pub fn run() -> Result<()> {
},
Runtime::Shell => runner.async_run(|_| {
Ok((
cmd.run::<Block, HostFunctionsOf<crate::service::ShellRuntimeExecutor>>(),
cmd.run::<Block, HostFunctionsOf<crate::service::ShellRuntimeExecutor>, _>(Some(info_provider)),
task_manager,
))
}),
Runtime::ContractsRococo => runner.async_run(|_| {
Ok((
cmd.run::<Block, HostFunctionsOf<crate::service::ContractsRococoRuntimeExecutor>>(),
cmd.run::<Block, HostFunctionsOf<crate::service::ContractsRococoRuntimeExecutor>, _>(Some(info_provider)),
task_manager,
))
}),