Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate polkadot-primitives to v6 #1543

Merged
merged 25 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d8a9792
migrate primitives to v6
slumber Sep 13, 2023
1b191d8
fix import
slumber Sep 13, 2023
22d0c74
bump rococo version
slumber Sep 13, 2023
1b5679d
bump wococo too
slumber Sep 13, 2023
27d45f7
fix pallet
slumber Sep 13, 2023
c264250
fix doc job
slumber Sep 13, 2023
b23f36c
fmt
slumber Sep 13, 2023
21feed2
drop LOWES_USER_ID reexport
slumber Sep 13, 2023
4ffdc01
revert comment
slumber Sep 13, 2023
4049260
merge runtime api into v7
slumber Sep 13, 2023
3953c5d
enable async backing API on Westend
slumber Sep 13, 2023
9cb2847
bump westend
slumber Sep 14, 2023
b8b8121
Merge branch 'master' into slumber-async-backing-v6-primitives
slumber Sep 14, 2023
4cb5e35
Enable validation/collation v2 protocols (#1542)
sandreim Sep 15, 2023
955f339
Merge remote-tracking branch 'origin/master' into slumber-async-backi…
slumber Sep 18, 2023
3c839be
use default zombienet images
slumber Sep 19, 2023
2cccd8c
Merge remote-tracking branch 'origin/master' into slumber-async-backi…
slumber Sep 19, 2023
cc45b79
override pipeline images
slumber Sep 19, 2023
a91eb83
Merge remote-tracking branch 'origin/master' into slumber-async-backi…
slumber Sep 20, 2023
b17c2d0
Merge branch 'master' into slumber-async-backing-v6-primitives
slumber Sep 25, 2023
1888da6
update zombienet collator command
slumber Sep 25, 2023
68668f0
Merge branch 'master' into slumber-async-backing-v6-primitives
slumber Sep 25, 2023
535c94a
use cumulus image
slumber Sep 26, 2023
692b269
use cumulus image from the pr
slumber Sep 26, 2023
a189394
drop compatibility tests
slumber Sep 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bridges/primitives/chain-bridge-hub-cumulus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// This is a copy-paste from the cumulus repo's `parachains-common` crate.
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(constants::WEIGHT_REF_TIME_PER_SECOND, 0)
.saturating_div(2)
.set_proof_size(polkadot_primitives::v5::MAX_POV_SIZE as u64);
.set_proof_size(polkadot_primitives::MAX_POV_SIZE as u64);

/// All cumulus bridge hubs assume that about 5 percent of the block weight is consumed by
/// `on_initialize` handlers. This is used to limit the maximal weight of a single extrinsic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use futures::{Stream, StreamExt};
use polkadot_core_primitives::{Block, BlockNumber, Hash, Header};
use polkadot_overseer::RuntimeApiSubsystemClient;
use polkadot_primitives::{
async_backing::{AsyncBackingParams, BackingState},
slashing,
vstaging::{AsyncBackingParams, BackingState},
};
use sc_authority_discovery::{AuthorityDiscovery, Error as AuthorityDiscoveryError};
use sp_api::{ApiError, RuntimeApiInfo};
Expand Down Expand Up @@ -346,16 +346,16 @@ impl RuntimeApiSubsystemClient for BlockChainRpcClient {
Ok(self.rpc_client.parachain_host_minimum_backing_votes(at, session_index).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?)
async fn async_backing_params(&self, at: Hash) -> Result<AsyncBackingParams, ApiError> {
Ok(self.rpc_client.parachain_host_async_backing_params(at).await?)
}

async fn staging_para_backing_state(
async fn para_backing_state(
&self,
at: Hash,
para_id: cumulus_primitives_core::ParaId,
) -> Result<Option<BackingState>, ApiError> {
Ok(self.rpc_client.parachain_host_staging_para_backing_state(at, para_id).await?)
Ok(self.rpc_client.parachain_host_para_backing_state(at, para_id).await?)
}
}

Expand Down
25 changes: 8 additions & 17 deletions cumulus/client/relay-chain-rpc-interface/src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ use parity_scale_codec::{Decode, Encode};

use cumulus_primitives_core::{
relay_chain::{
slashing,
vstaging::{AsyncBackingParams, BackingState},
BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash,
async_backing::{AsyncBackingParams, BackingState},
slashing, BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash,
CommittedCandidateReceipt, CoreState, DisputeState, ExecutorParams, GroupRotationInfo,
Hash as RelayHash, Header as RelayHeader, InboundHrmpMessage, OccupiedCoreAssumption,
PvfCheckStatement, ScrapedOnChainVotes, SessionIndex, SessionInfo, ValidationCode,
Expand Down Expand Up @@ -599,30 +598,22 @@ impl RelayChainRpcClient {
}

#[allow(missing_docs)]
pub async fn parachain_host_staging_async_backing_params(
pub async fn parachain_host_async_backing_params(
&self,
at: RelayHash,
) -> Result<AsyncBackingParams, RelayChainError> {
self.call_remote_runtime_function(
"ParachainHost_staging_async_backing_params",
at,
None::<()>,
)
.await
self.call_remote_runtime_function("ParachainHost_async_backing_params", at, None::<()>)
.await
}

#[allow(missing_docs)]
pub async fn parachain_host_staging_para_backing_state(
pub async fn parachain_host_para_backing_state(
&self,
at: RelayHash,
para_id: ParaId,
) -> Result<Option<BackingState>, RelayChainError> {
self.call_remote_runtime_function(
"ParachainHost_staging_para_backing_state",
at,
Some(para_id),
)
.await
self.call_remote_runtime_function("ParachainHost_para_backing_state", at, Some(para_id))
.await
}

fn send_register_message_to_worker(
Expand Down
2 changes: 1 addition & 1 deletion cumulus/pallets/parachain-system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ impl<T: Config> Pallet<T> {
hrmp_max_message_num_per_candidate: 2,
validation_upgrade_cooldown: 2,
validation_upgrade_delay: 2,
async_backing_params: relay_chain::vstaging::AsyncBackingParams {
async_backing_params: relay_chain::AsyncBackingParams {
allowed_ancestry_len: 0,
max_candidate_depth: 0,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ decl_test_relay_chains! {
Hrmp: kusama_runtime::Hrmp,
}
},
#[api_version(6)]
#[api_version(7)]
pub struct Westend {
genesis = westend::genesis(),
on_init = (),
Expand All @@ -79,7 +79,7 @@ decl_test_relay_chains! {
Balances: westend_runtime::Balances,
}
},
#[api_version(5)]
#[api_version(7)]
pub struct Rococo {
genesis = rococo::genesis(),
on_init = (),
Expand All @@ -94,7 +94,7 @@ decl_test_relay_chains! {
Balances: rococo_runtime::Balances,
}
},
#[api_version(5)]
#[api_version(7)]
pub struct Wococo {
genesis = rococo::genesis(),
on_init = (),
Expand Down
2 changes: 1 addition & 1 deletion cumulus/test/relay-sproof-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Default for RelayStateSproofBuilder {
hrmp_max_message_num_per_candidate: 5,
validation_upgrade_cooldown: 6,
validation_upgrade_delay: 6,
async_backing_params: relay_chain::vstaging::AsyncBackingParams {
async_backing_params: relay_chain::AsyncBackingParams {
allowed_ancestry_len: 0,
max_candidate_depth: 0,
},
Expand Down
7 changes: 3 additions & 4 deletions polkadot/node/collation-generation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ use polkadot_node_subsystem::{
SubsystemContext, SubsystemError, SubsystemResult,
};
use polkadot_node_subsystem_util::{
request_availability_cores, request_persisted_validation_data,
request_staging_async_backing_params, request_validation_code, request_validation_code_hash,
request_validators,
request_async_backing_params, request_availability_cores, request_persisted_validation_data,
request_validation_code, request_validation_code_hash, request_validators,
};
use polkadot_primitives::{
collator_signature_payload, CandidateCommitments, CandidateDescriptor, CandidateReceipt,
Expand Down Expand Up @@ -208,7 +207,7 @@ async fn handle_new_activations<Context>(
let (availability_cores, validators, async_backing_params) = join!(
request_availability_cores(relay_parent, ctx.sender()).await,
request_validators(relay_parent, ctx.sender()).await,
request_staging_async_backing_params(relay_parent, ctx.sender()).await,
request_async_backing_params(relay_parent, ctx.sender()).await,
);

let availability_cores = availability_cores??;
Expand Down
8 changes: 4 additions & 4 deletions polkadot/node/collation-generation/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ fn requests_availability_per_relay_parent() {
}
Some(AllMessages::RuntimeApi(RuntimeApiMessage::Request(
_hash,
RuntimeApiRequest::StagingAsyncBackingParams(
RuntimeApiRequest::AsyncBackingParams(
tx,
),
))) => {
Expand Down Expand Up @@ -235,7 +235,7 @@ fn requests_validation_data_for_scheduled_matches() {
},
Some(AllMessages::RuntimeApi(RuntimeApiMessage::Request(
_hash,
RuntimeApiRequest::StagingAsyncBackingParams(tx),
RuntimeApiRequest::AsyncBackingParams(tx),
))) => {
tx.send(Err(RuntimeApiError::NotSupported {
runtime_api_name: "doesnt_matter",
Expand Down Expand Up @@ -332,7 +332,7 @@ fn sends_distribute_collation_message() {
},
Some(AllMessages::RuntimeApi(RuntimeApiMessage::Request(
_hash,
RuntimeApiRequest::StagingAsyncBackingParams(tx),
RuntimeApiRequest::AsyncBackingParams(tx),
))) => {
tx.send(Err(RuntimeApiError::NotSupported {
runtime_api_name: "doesnt_matter",
Expand Down Expand Up @@ -494,7 +494,7 @@ fn fallback_when_no_validation_code_hash_api() {
},
Some(AllMessages::RuntimeApi(RuntimeApiMessage::Request(
_hash,
RuntimeApiRequest::StagingAsyncBackingParams(tx),
RuntimeApiRequest::AsyncBackingParams(tx),
))) => {
tx.send(Err(RuntimeApiError::NotSupported {
runtime_api_name: "doesnt_matter",
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/core/backing/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ async fn test_startup(virtual_overseer: &mut VirtualOverseer, test_state: &TestS
assert_matches!(
virtual_overseer.recv().await,
AllMessages::RuntimeApi(
RuntimeApiMessage::Request(parent, RuntimeApiRequest::StagingAsyncBackingParams(tx))
RuntimeApiMessage::Request(parent, RuntimeApiRequest::AsyncBackingParams(tx))
) if parent == test_state.relay_parent => {
tx.send(Err(ASYNC_BACKING_DISABLED_ERROR)).unwrap();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ use polkadot_node_subsystem::{
messages::{ChainApiMessage, FragmentTreeMembership},
ActivatedLeaf, TimeoutExt,
};
use polkadot_primitives::{vstaging as vstaging_primitives, BlockNumber, Header, OccupiedCore};
use polkadot_primitives::{AsyncBackingParams, BlockNumber, Header, OccupiedCore};

use super::*;

const ASYNC_BACKING_PARAMETERS: vstaging_primitives::AsyncBackingParams =
vstaging_primitives::AsyncBackingParams { max_candidate_depth: 4, allowed_ancestry_len: 3 };
const ASYNC_BACKING_PARAMETERS: AsyncBackingParams =
AsyncBackingParams { max_candidate_depth: 4, allowed_ancestry_len: 3 };

struct TestLeaf {
activated: ActivatedLeaf,
Expand Down Expand Up @@ -56,7 +56,7 @@ async fn activate_leaf(
assert_matches!(
virtual_overseer.recv().await,
AllMessages::RuntimeApi(
RuntimeApiMessage::Request(parent, RuntimeApiRequest::StagingAsyncBackingParams(tx))
RuntimeApiMessage::Request(parent, RuntimeApiRequest::AsyncBackingParams(tx))
) if parent == leaf_hash => {
tx.send(Ok(ASYNC_BACKING_PARAMETERS)).unwrap();
}
Expand Down
12 changes: 5 additions & 7 deletions polkadot/node/core/dispute-coordinator/src/initialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use polkadot_node_subsystem_util::runtime::{
self, key_ownership_proof, submit_report_dispute_lost, RuntimeInfo,
};
use polkadot_primitives::{
vstaging, BlockNumber, CandidateHash, CandidateReceipt, CompactStatement, DisputeStatement,
slashing, BlockNumber, CandidateHash, CandidateReceipt, CompactStatement, DisputeStatement,
DisputeStatementSet, Hash, ScrapedOnChainVotes, SessionIndex, ValidDisputeStatementKind,
ValidatorId, ValidatorIndex,
};
Expand Down Expand Up @@ -385,7 +385,7 @@ impl Initialized {
&mut self,
ctx: &mut Context,
relay_parent: Hash,
unapplied_slashes: Vec<(SessionIndex, CandidateHash, vstaging::slashing::PendingSlashes)>,
unapplied_slashes: Vec<(SessionIndex, CandidateHash, slashing::PendingSlashes)>,
) {
for (session_index, candidate_hash, pending) in unapplied_slashes {
gum::info!(
Expand Down Expand Up @@ -422,11 +422,9 @@ impl Initialized {
match res {
Ok(Some(key_ownership_proof)) => {
key_ownership_proofs.push(key_ownership_proof);
let time_slot = vstaging::slashing::DisputesTimeSlot::new(
session_index,
candidate_hash,
);
let dispute_proof = vstaging::slashing::DisputeProof {
let time_slot =
slashing::DisputesTimeSlot::new(session_index, candidate_hash);
let dispute_proof = slashing::DisputeProof {
time_slot,
kind: pending.kind,
validator_index: *validator_index,
Expand Down
10 changes: 4 additions & 6 deletions polkadot/node/core/prospective-parachains/src/fragment_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ use std::{

use super::LOG_TARGET;
use bitvec::prelude::*;
use polkadot_node_subsystem_util::inclusion_emulator::staging::{
use polkadot_node_subsystem_util::inclusion_emulator::{
ConstraintModifications, Constraints, Fragment, ProspectiveCandidate, RelayChainBlockInfo,
};
use polkadot_primitives::vstaging::{
use polkadot_primitives::{
BlockNumber, CandidateHash, CommittedCandidateReceipt, Hash, HeadData, Id as ParaId,
PersistedValidationData,
};
Expand Down Expand Up @@ -981,10 +981,8 @@ impl FragmentNode {
mod tests {
use super::*;
use assert_matches::assert_matches;
use polkadot_node_subsystem_util::inclusion_emulator::staging::InboundHrmpLimitations;
use polkadot_primitives::vstaging::{
BlockNumber, CandidateCommitments, CandidateDescriptor, HeadData,
};
use polkadot_node_subsystem_util::inclusion_emulator::InboundHrmpLimitations;
use polkadot_primitives::{BlockNumber, CandidateCommitments, CandidateDescriptor, HeadData};
use polkadot_primitives_test_helpers as test_helpers;

fn make_constraints(
Expand Down
13 changes: 7 additions & 6 deletions polkadot/node/core/prospective-parachains/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//! backing phases of parachain consensus.
//!
//! This is primarily an implementation of "Fragment Trees", as described in
//! [`polkadot_node_subsystem_util::inclusion_emulator::staging`].
//! [`polkadot_node_subsystem_util::inclusion_emulator`].
//!
//! This subsystem also handles concerns such as the relay-chain being forkful and session changes.

Expand All @@ -42,13 +42,14 @@ use polkadot_node_subsystem::{
overseer, ActiveLeavesUpdate, FromOrchestra, OverseerSignal, SpawnedSubsystem, SubsystemError,
};
use polkadot_node_subsystem_util::{
inclusion_emulator::staging::{Constraints, RelayChainBlockInfo},
inclusion_emulator::{Constraints, RelayChainBlockInfo},
request_session_index_for_child,
runtime::{prospective_parachains_mode, ProspectiveParachainsMode},
};
use polkadot_primitives::vstaging::{
BlockNumber, CandidateHash, CandidatePendingAvailability, CommittedCandidateReceipt, CoreState,
Hash, HeadData, Header, Id as ParaId, PersistedValidationData,
use polkadot_primitives::{
async_backing::CandidatePendingAvailability, BlockNumber, CandidateHash,
CommittedCandidateReceipt, CoreState, Hash, HeadData, Header, Id as ParaId,
PersistedValidationData,
};

use crate::{
Expand Down Expand Up @@ -792,7 +793,7 @@ async fn fetch_backing_state<Context>(
let (tx, rx) = oneshot::channel();
ctx.send_message(RuntimeApiMessage::Request(
relay_parent,
RuntimeApiRequest::StagingParaBackingState(para_id, tx),
RuntimeApiRequest::ParaBackingState(para_id, tx),
))
.await;

Expand Down
12 changes: 6 additions & 6 deletions polkadot/node/core/prospective-parachains/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use polkadot_node_subsystem::{
};
use polkadot_node_subsystem_test_helpers as test_helpers;
use polkadot_primitives::{
vstaging::{AsyncBackingParams, BackingState, Constraints, InboundHrmpLimitations},
async_backing::{AsyncBackingParams, BackingState, Constraints, InboundHrmpLimitations},
CommittedCandidateReceipt, HeadData, Header, PersistedValidationData, ScheduledCore,
ValidationCodeHash,
};
Expand Down Expand Up @@ -219,7 +219,7 @@ async fn handle_leaf_activation(
assert_matches!(
virtual_overseer.recv().await,
AllMessages::RuntimeApi(
RuntimeApiMessage::Request(parent, RuntimeApiRequest::StagingAsyncBackingParams(tx))
RuntimeApiMessage::Request(parent, RuntimeApiRequest::AsyncBackingParams(tx))
) if parent == *hash => {
tx.send(Ok(async_backing_params)).unwrap();
}
Expand Down Expand Up @@ -284,7 +284,7 @@ async fn handle_leaf_activation(
let para_id = match message {
AllMessages::RuntimeApi(RuntimeApiMessage::Request(
_,
RuntimeApiRequest::StagingParaBackingState(p_id, _),
RuntimeApiRequest::ParaBackingState(p_id, _),
)) => p_id,
_ => panic!("received unexpected message {:?}", message),
};
Expand All @@ -303,7 +303,7 @@ async fn handle_leaf_activation(
assert_matches!(
message,
AllMessages::RuntimeApi(
RuntimeApiMessage::Request(parent, RuntimeApiRequest::StagingParaBackingState(p_id, tx))
RuntimeApiMessage::Request(parent, RuntimeApiRequest::ParaBackingState(p_id, tx))
) if parent == *hash && p_id == para_id => {
tx.send(Ok(Some(backing_state))).unwrap();
}
Expand Down Expand Up @@ -499,7 +499,7 @@ fn should_do_no_work_if_async_backing_disabled_for_leaf() {
assert_matches!(
virtual_overseer.recv().await,
AllMessages::RuntimeApi(
RuntimeApiMessage::Request(parent, RuntimeApiRequest::StagingAsyncBackingParams(tx))
RuntimeApiMessage::Request(parent, RuntimeApiRequest::AsyncBackingParams(tx))
) if parent == hash => {
tx.send(Err(ASYNC_BACKING_DISABLED_ERROR)).unwrap();
}
Expand Down Expand Up @@ -1569,7 +1569,7 @@ fn uses_ancestry_only_within_session() {
assert_matches!(
virtual_overseer.recv().await,
AllMessages::RuntimeApi(
RuntimeApiMessage::Request(parent, RuntimeApiRequest::StagingAsyncBackingParams(tx))
RuntimeApiMessage::Request(parent, RuntimeApiRequest::AsyncBackingParams(tx))
) if parent == hash => {
tx.send(Ok(AsyncBackingParams { max_candidate_depth: 0, allowed_ancestry_len: ancestry_len })).unwrap();
}
Expand Down
Loading