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 all 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
30 changes: 3 additions & 27 deletions .gitlab/pipeline/zombienet/polkadot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ zombienet-polkadot-smoke-0001-parachains-smoke-test:
- .zombienet-polkadot-common
before_script:
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="${POLKADOT_IMAGE}":${PIPELINE_IMAGE_TAG}
- export COL_IMAGE="docker.io/paritypr/colander:4519" # The collator image is fixed
- export COL_IMAGE="${COLANDER_IMAGE}":${PIPELINE_IMAGE_TAG}
- echo "Zombienet Tests Config"
- echo "gh-dir ${GH_DIR}"
- echo "local-dir ${LOCAL_DIR}"
Expand All @@ -127,12 +127,12 @@ zombienet-polkadot-smoke-0002-parachains-parachains-upgrade-smoke:
- .zombienet-polkadot-common
before_script:
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="${POLKADOT_IMAGE}":${PIPELINE_IMAGE_TAG}
- export COL_IMAGE="docker.io/parity/polkadot-collator:latest" # Use cumulus lastest image
- export CUMULUS_IMAGE="docker.io/paritypr/polkadot-parachain-debug:${DOCKER_IMAGES_VERSION}"
- echo "Zombienet Tests Config"
- echo "gh-dir ${GH_DIR}"
- echo "local-dir ${LOCAL_DIR}"
- echo "polkadot image ${ZOMBIENET_INTEGRATION_TEST_IMAGE}"
- echo "colander image ${COL_IMAGE}"
- echo "polkadot-parachain image ${CUMULUS_IMAGE}"
- echo "malus image ${MALUS_IMAGE}"
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
Expand Down Expand Up @@ -193,27 +193,3 @@ zombienet-polkadot-malus-0001-dispute-valid:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/integrationtests"
--test="0001-dispute-valid-block.zndsl"

zombienet-polkadot-async-backing-compatibility:
extends:
- .zombienet-polkadot-common
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/async_backing"
--test="001-async-backing-compatibility.zndsl"

zombienet-polkadot-async-backing-runtime-upgrade:
extends:
- .zombienet-polkadot-common
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/async_backing"
--test="002-async-backing-runtime-upgrade.zndsl"

zombienet-polkadot-async-backing-collator-mix:
extends:
- .zombienet-polkadot-common
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}/async_backing"
--test="003-async-backing-collator-mix.zndsl"
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
3 changes: 0 additions & 3 deletions cumulus/client/relay-chain-inprocess-interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,3 @@ metered = { package = "prioritized-metered-channel", version = "0.5.1", default-

# Cumulus
cumulus-test-service = { path = "../../test/service" }

[features]
network-protocol-staging = [ "polkadot-service/network-protocol-staging" ]
4 changes: 0 additions & 4 deletions cumulus/client/relay-chain-minimal-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,3 @@ tracing = "0.1.37"
async-trait = "0.1.73"
futures = "0.3.28"

[features]
network-protocol-staging = [
"polkadot-node-network-protocol/network-protocol-staging",
]
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
11 changes: 5 additions & 6 deletions cumulus/client/relay-chain-minimal-node/src/collator_overseer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use polkadot_node_network_protocol::{
peer_set::PeerSetProtocolNames,
request_response::{
v1::{self, AvailableDataFetchingRequest},
vstaging, IncomingRequestReceiver, ReqProtocolNames,
v2, IncomingRequestReceiver, ReqProtocolNames,
},
};
use polkadot_node_subsystem_util::metrics::{prometheus::Registry, Metrics};
Expand Down Expand Up @@ -63,9 +63,8 @@ pub(crate) struct CollatorOverseerGenArgs<'a> {
pub authority_discovery_service: AuthorityDiscoveryService,
/// Receiver for collation request protocol v1.
pub collation_req_receiver_v1: IncomingRequestReceiver<v1::CollationFetchingRequest>,
/// Receiver for collation request protocol vstaging.
pub collation_req_receiver_vstaging:
IncomingRequestReceiver<vstaging::CollationFetchingRequest>,
/// Receiver for collation request protocol v2.
pub collation_req_receiver_v2: IncomingRequestReceiver<v2::CollationFetchingRequest>,
/// Receiver for availability request protocol
pub available_data_req_receiver: IncomingRequestReceiver<AvailableDataFetchingRequest>,
/// Prometheus registry, commonly used for production systems, less so for test.
Expand All @@ -88,7 +87,7 @@ fn build_overseer(
sync_oracle,
authority_discovery_service,
collation_req_receiver_v1,
collation_req_receiver_vstaging,
collation_req_receiver_v2,
available_data_req_receiver,
registry,
spawner,
Expand Down Expand Up @@ -121,7 +120,7 @@ fn build_overseer(
peer_id: network_service.local_peer_id(),
collator_pair,
request_receiver_v1: collation_req_receiver_v1,
request_receiver_vstaging: collation_req_receiver_vstaging,
request_receiver_v2: collation_req_receiver_v2,
metrics: Metrics::register(registry)?,
};
CollatorProtocolSubsystem::new(side)
Expand Down
12 changes: 6 additions & 6 deletions cumulus/client/relay-chain-minimal-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use polkadot_network_bridge::{peer_sets_info, IsAuthority};
use polkadot_node_network_protocol::{
peer_set::PeerSetProtocolNames,
request_response::{
v1, vstaging, IncomingRequest, IncomingRequestReceiver, Protocol, ReqProtocolNames,
v1, v2, IncomingRequest, IncomingRequestReceiver, Protocol, ReqProtocolNames,
},
};

Expand Down Expand Up @@ -182,7 +182,7 @@ async fn new_minimal_relay_chain(
}

let request_protocol_names = ReqProtocolNames::new(genesis_hash, config.chain_spec.fork_id());
let (collation_req_receiver_v1, collation_req_receiver_vstaging, available_data_req_receiver) =
let (collation_req_receiver_v1, collation_req_receiver_v2, available_data_req_receiver) =
build_request_response_protocol_receivers(&request_protocol_names, &mut net_config);

let best_header = relay_chain_rpc_client
Expand Down Expand Up @@ -212,7 +212,7 @@ async fn new_minimal_relay_chain(
sync_oracle,
authority_discovery_service,
collation_req_receiver_v1,
collation_req_receiver_vstaging,
collation_req_receiver_v2,
available_data_req_receiver,
registry: prometheus_registry.as_ref(),
spawner: task_manager.spawn_handle(),
Expand All @@ -234,19 +234,19 @@ fn build_request_response_protocol_receivers(
config: &mut FullNetworkConfiguration,
) -> (
IncomingRequestReceiver<v1::CollationFetchingRequest>,
IncomingRequestReceiver<vstaging::CollationFetchingRequest>,
IncomingRequestReceiver<v2::CollationFetchingRequest>,
IncomingRequestReceiver<v1::AvailableDataFetchingRequest>,
) {
let (collation_req_receiver_v1, cfg) =
IncomingRequest::get_config_receiver(request_protocol_names);
config.add_request_response_protocol(cfg);
let (collation_req_receiver_vstaging, cfg) =
let (collation_req_receiver_v2, cfg) =
IncomingRequest::get_config_receiver(request_protocol_names);
config.add_request_response_protocol(cfg);
let (available_data_req_receiver, cfg) =
IncomingRequest::get_config_receiver(request_protocol_names);
config.add_request_response_protocol(cfg);
let cfg = Protocol::ChunkFetchingV1.get_outbound_only_config(request_protocol_names);
config.add_request_response_protocol(cfg);
(collation_req_receiver_v1, collation_req_receiver_vstaging, available_data_req_receiver)
(collation_req_receiver_v1, collation_req_receiver_v2, available_data_req_receiver)
}
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
5 changes: 0 additions & 5 deletions cumulus/client/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,3 @@ cumulus-relay-chain-interface = { path = "../relay-chain-interface" }
cumulus-relay-chain-inprocess-interface = { path = "../relay-chain-inprocess-interface" }
cumulus-relay-chain-minimal-node = { path = "../relay-chain-minimal-node" }

[features]
network-protocol-staging = [
"cumulus-relay-chain-inprocess-interface/network-protocol-staging",
"cumulus-relay-chain-minimal-node/network-protocol-staging",
]
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
5 changes: 1 addition & 4 deletions cumulus/parachain-template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,4 @@ try-runtime = [
"polkadot-cli/try-runtime",
"sp-runtime/try-runtime",
]
network-protocol-staging = [
"cumulus-client-service/network-protocol-staging",
"polkadot-cli/network-protocol-staging",
]

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
1 change: 0 additions & 1 deletion polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ jemalloc-allocator = [
# Enables timeout-based tests supposed to be run only in CI environment as they may be flaky
# when run locally depending on system load
ci-only-tests = [ "polkadot-node-core-pvf/ci-only-tests" ]
network-protocol-staging = [ "polkadot-cli/network-protocol-staging" ]

# Configuration for building a .deb package - for use with `cargo-deb`
[package.metadata.deb]
Expand Down
1 change: 0 additions & 1 deletion polkadot/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,3 @@ runtime-metrics = [
"polkadot-node-metrics/runtime-metrics",
"service/runtime-metrics",
]
network-protocol-staging = [ "service/network-protocol-staging" ]
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 @@ -237,7 +237,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
Loading