diff --git a/bridges/bin/millau/node/Cargo.toml b/bridges/bin/millau/node/Cargo.toml index 9d4b9e0f704..88175ba6993 100644 --- a/bridges/bin/millau/node/Cargo.toml +++ b/bridges/bin/millau/node/Cargo.toml @@ -58,6 +58,4 @@ frame-benchmarking-cli = { git = "https://github.com/paritytech/polkadot-sdk", b [features] default = [] -runtime-benchmarks = [ - "millau-runtime/runtime-benchmarks", -] +runtime-benchmarks = [ "millau-runtime/runtime-benchmarks" ] diff --git a/bridges/bin/millau/node/src/service.rs b/bridges/bin/millau/node/src/service.rs index 1e31ecdd14d..cb57dd118cc 100644 --- a/bridges/bin/millau/node/src/service.rs +++ b/bridges/bin/millau/node/src/service.rs @@ -181,7 +181,7 @@ pub fn new_partial( /// Builds a new service for a full client. pub fn new_full(config: Configuration) -> Result { - use sc_network_common::sync::warp::WarpSyncParams; + use sc_service::WarpSyncParams; let sc_service::PartialComponents { client, @@ -242,6 +242,7 @@ pub fn new_full(config: Configuration) -> Result { import_queue, block_announce_validator_builder: None, warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)), + block_relay: None, })?; if config.offchain_worker.enabled { diff --git a/bridges/bin/millau/runtime/Cargo.toml b/bridges/bin/millau/runtime/Cargo.toml index 861a40120db..302a04d0244 100644 --- a/bridges/bin/millau/runtime/Cargo.toml +++ b/bridges/bin/millau/runtime/Cargo.toml @@ -82,16 +82,15 @@ static_assertions = "1.1" substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } [features] -default = ["std"] +default = [ "std" ] std = [ - "sp-consensus-beefy/std", "bp-messages/std", "bp-millau/std", "bp-parachains/std", "bp-polkadot-core/std", "bp-relayers/std", - "bp-rialto/std", "bp-rialto-parachain/std", + "bp-rialto/std", "bp-runtime/std", "bp-westend/std", "bp-xcm-bridge-hub-router/std", @@ -104,8 +103,8 @@ std = [ "pallet-aura/std", "pallet-authorship/std", "pallet-balances/std", - "pallet-beefy/std", "pallet-beefy-mmr/std", + "pallet-beefy/std", "pallet-bridge-grandpa/std", "pallet-bridge-messages/std", "pallet-bridge-parachains/std", @@ -120,12 +119,13 @@ std = [ "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", "pallet-utility/std", - "pallet-xcm/std", "pallet-xcm-bridge-hub-router/std", + "pallet-xcm/std", "scale-info/std", "sp-api/std", "sp-block-builder/std", "sp-consensus-aura/std", + "sp-consensus-beefy/std", "sp-core/std", "sp-inherents/std", "sp-io/std", @@ -135,20 +135,21 @@ std = [ "sp-std/std", "sp-transaction-pool/std", "sp-version/std", - "xcm/std", "xcm-builder/std", "xcm-executor/std", + "xcm/std", ] runtime-benchmarks = [ "bridge-runtime-common/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-bridge-grandpa/runtime-benchmarks", "pallet-bridge-messages/runtime-benchmarks", "pallet-bridge-parachains/runtime-benchmarks", "pallet-bridge-relayers/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", "pallet-xcm-bridge-hub-router/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", ] diff --git a/bridges/bin/millau/runtime/src/lib.rs b/bridges/bin/millau/runtime/src/lib.rs index cf2b887d1ab..27f00c801bc 100644 --- a/bridges/bin/millau/runtime/src/lib.rs +++ b/bridges/bin/millau/runtime/src/lib.rs @@ -55,7 +55,7 @@ use sp_std::prelude::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; -use xcm_builder::NetworkExportTable; +use xcm_builder::{NetworkExportTable, NetworkExportTableItem}; // to be able to use Millau runtime in `bridge-runtime-common` tests pub use bridge_runtime_common; @@ -583,8 +583,15 @@ impl pallet_utility::Config for Runtime { // this config is totally incorrect - the pallet is not actually used at this runtime. We need // it only to be able to run benchmarks and make required traits (and default weights for tests). parameter_types! { - pub BridgeTable: Vec<(xcm::prelude::NetworkId, xcm::prelude::MultiLocation, Option)> - = vec![(xcm_config::RialtoNetwork::get(), xcm_config::TokenLocation::get(), Some((xcm_config::TokenAssetId::get(), 1_000_000_000_u128).into()))]; + pub BridgeTable: Vec + = vec![ + NetworkExportTableItem::new( + xcm_config::RialtoNetwork::get(), + None, + xcm_config::TokenLocation::get(), + Some((xcm_config::TokenAssetId::get(), 1_000_000_000_u128).into()) + ) + ]; } impl pallet_xcm_bridge_hub_router::Config for Runtime { type WeightInfo = (); diff --git a/bridges/bin/rialto-parachain/node/Cargo.toml b/bridges/bin/rialto-parachain/node/Cargo.toml index e57ed60e5a2..d83ed44c321 100644 --- a/bridges/bin/rialto-parachain/node/Cargo.toml +++ b/bridges/bin/rialto-parachain/node/Cargo.toml @@ -14,7 +14,7 @@ name = 'rialto-parachain-collator' [features] default = [] -runtime-benchmarks = ['rialto-parachain-runtime/runtime-benchmarks'] +runtime-benchmarks = [ 'rialto-parachain-runtime/runtime-benchmarks' ] [dependencies] clap = { version = "4.4.6", features = ["derive"] } diff --git a/bridges/bin/rialto-parachain/node/src/service.rs b/bridges/bin/rialto-parachain/node/src/service.rs index c43241d4945..86c5a761590 100644 --- a/bridges/bin/rialto-parachain/node/src/service.rs +++ b/bridges/bin/rialto-parachain/node/src/service.rs @@ -283,6 +283,7 @@ where Box::new(block_announce_validator) })), warp_sync_params: None, + block_relay: None, })?; let rpc_client = client.clone(); diff --git a/bridges/bin/rialto-parachain/runtime/Cargo.toml b/bridges/bin/rialto-parachain/runtime/Cargo.toml index 8f987e27f36..bc4f8fb4d5c 100644 --- a/bridges/bin/rialto-parachain/runtime/Cargo.toml +++ b/bridges/bin/rialto-parachain/runtime/Cargo.toml @@ -81,62 +81,66 @@ bridge-runtime-common = { path = "../../runtime-common", features = ["integrity- static_assertions = "1.1" [features] -default = ['std'] +default = [ 'std' ] runtime-benchmarks = [ - 'sp-runtime/runtime-benchmarks', + 'bridge-runtime-common/runtime-benchmarks', 'frame-benchmarking', 'frame-support/runtime-benchmarks', 'frame-system-benchmarking/runtime-benchmarks', 'frame-system/runtime-benchmarks', 'pallet-balances/runtime-benchmarks', + 'pallet-bridge-grandpa/runtime-benchmarks', + 'pallet-bridge-messages/runtime-benchmarks', + 'pallet-bridge-relayers/runtime-benchmarks', 'pallet-timestamp/runtime-benchmarks', 'pallet-xcm/runtime-benchmarks', + 'sp-runtime/runtime-benchmarks', 'xcm-builder/runtime-benchmarks', ] std = [ "bp-messages/std", "bp-millau/std", "bp-relayers/std", - "bp-runtime/std", "bp-rialto-parachain/std", + "bp-runtime/std", "bridge-runtime-common/std", "codec/std", - "scale-info/std", - "sp-api/std", - "sp-std/std", - "sp-io/std", - "sp-core/std", - "sp-runtime/std", - "sp-version/std", - "sp-offchain/std", - "sp-session/std", - "sp-block-builder/std", - "sp-transaction-pool/std", - "sp-inherents/std", - "frame-support/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-core/std", + "cumulus-primitives-timestamp/std", "frame-executive/std", - "frame-system/std", + "frame-support/std", "frame-system-rpc-runtime-api/std", + "frame-system/std", + "pallet-aura/std", "pallet-balances/std", "pallet-bridge-grandpa/std", "pallet-bridge-messages/std", "pallet-bridge-relayers/std", - "pallet-timestamp/std", "pallet-sudo/std", - "pallet-transaction-payment/std", + "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", "pallet-xcm/std", "parachain-info/std", "polkadot-parachain-primitives/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-pallet-xcm/std", - "cumulus-primitives-core/std", - "cumulus-primitives-timestamp/std", - "xcm/std", + "scale-info/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", "xcm-builder/std", "xcm-executor/std", - "pallet-aura/std", - "sp-consensus-aura/std", + "xcm/std", ] diff --git a/bridges/bin/rialto/node/Cargo.toml b/bridges/bin/rialto/node/Cargo.toml index 8fcf395dfb0..06352a13779 100644 --- a/bridges/bin/rialto/node/Cargo.toml +++ b/bridges/bin/rialto/node/Cargo.toml @@ -47,7 +47,7 @@ polkadot-node-core-pvf-execute-worker = { git = "https://github.com/paritytech/p polkadot-node-core-pvf-prepare-worker = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } polkadot-primitives = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } -polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false, features = [ "full-node", "polkadot-native" ] } +polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false, features = [ "full-node" ] } [build-dependencies] substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } diff --git a/bridges/bin/rialto/node/src/chain_spec.rs b/bridges/bin/rialto/node/src/chain_spec.rs index 505dc5a760b..6d1180d12a9 100644 --- a/bridges/bin/rialto/node/src/chain_spec.rs +++ b/bridges/bin/rialto/node/src/chain_spec.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity Bridges Common. If not, see . -use polkadot_primitives::v5::{AssignmentId, ValidatorId}; +use polkadot_primitives::v6::{AssignmentId, ValidatorId}; use rialto_runtime::{ AccountId, BabeConfig, BalancesConfig, BeefyConfig, BridgeMillauMessagesConfig, ConfigurationConfig, GrandpaConfig, RuntimeGenesisConfig, SessionConfig, SessionKeys, @@ -245,8 +245,8 @@ fn testnet_genesis( validation_upgrade_cooldown: 2u32, validation_upgrade_delay: 2, code_retention_period: 1200, - max_code_size: polkadot_primitives::v5::MAX_CODE_SIZE, - max_pov_size: polkadot_primitives::v5::MAX_POV_SIZE, + max_code_size: polkadot_primitives::v6::MAX_CODE_SIZE, + max_pov_size: polkadot_primitives::v6::MAX_POV_SIZE, max_head_data_size: 32 * 1024, group_rotation_frequency: 20, max_upward_queue_count: 8, diff --git a/bridges/bin/rialto/runtime/Cargo.toml b/bridges/bin/rialto/runtime/Cargo.toml index 7bd89803caf..2bdadfd0cde 100644 --- a/bridges/bin/rialto/runtime/Cargo.toml +++ b/bridges/bin/rialto/runtime/Cargo.toml @@ -80,9 +80,8 @@ static_assertions = "1.1" substrate-wasm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } [features] -default = ["std"] +default = [ "std" ] std = [ - "sp-consensus-beefy/std", "bp-messages/std", "bp-millau/std", "bp-relayers/std", @@ -99,8 +98,8 @@ std = [ "pallet-authorship/std", "pallet-babe/std", "pallet-balances/std", - "pallet-beefy/std", "pallet-beefy-mmr/std", + "pallet-beefy/std", "pallet-bridge-beefy/std", "pallet-bridge-grandpa/std", "pallet-bridge-messages/std", @@ -109,13 +108,13 @@ std = [ "pallet-message-queue/std", "pallet-mmr/std", "pallet-offences/std", - "pallet-xcm/std", "pallet-session/std", "pallet-shift-session-manager/std", "pallet-sudo/std", "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", + "pallet-xcm/std", "polkadot-primitives/std", "polkadot-runtime-common/std", "polkadot-runtime-parachains/std", @@ -124,6 +123,7 @@ std = [ "sp-authority-discovery/std", "sp-block-builder/std", "sp-consensus-babe/std", + "sp-consensus-beefy/std", "sp-core/std", "sp-inherents/std", "sp-io/std", @@ -133,18 +133,21 @@ std = [ "sp-std/std", "sp-transaction-pool/std", "sp-version/std", - "xcm/std", "xcm-builder/std", "xcm-executor/std", + "xcm/std", ] runtime-benchmarks = [ "bridge-runtime-common/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "pallet-bridge-grandpa/runtime-benchmarks", "pallet-bridge-messages/runtime-benchmarks", + "pallet-bridge-relayers/runtime-benchmarks", "pallet-message-queue/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", ] diff --git a/bridges/bin/rialto/runtime/src/lib.rs b/bridges/bin/rialto/runtime/src/lib.rs index c00e32e9f31..684b3e5bf46 100644 --- a/bridges/bin/rialto/runtime/src/lib.rs +++ b/bridges/bin/rialto/runtime/src/lib.rs @@ -37,6 +37,10 @@ use pallet_grandpa::{ fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, }; use pallet_transaction_payment::{FeeDetails, Multiplier, RuntimeDispatchInfo}; +use polkadot_primitives::Id as ParaId; +use polkadot_runtime_parachains::runtime_api_impl::{ + v7 as parachains_runtime_api_impl, vstaging as parachains_staging_runtime_api_impl, +}; use sp_api::impl_runtime_apis; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_consensus_beefy::{ecdsa_crypto::AuthorityId as BeefyId, mmr::MmrLeafVersion, ValidatorSet}; @@ -522,7 +526,7 @@ construct_runtime!( ParachainsOrigin: polkadot_runtime_parachains::origin::{Pallet, Origin}, Configuration: polkadot_runtime_parachains::configuration::{Pallet, Call, Storage, Config}, Shared: polkadot_runtime_parachains::shared::{Pallet, Call, Storage}, - Inclusion: polkadot_runtime_parachains::inclusion::{Pallet, Call, Storage, Event}, + ParaInclusion: polkadot_runtime_parachains::inclusion::{Pallet, Call, Storage, Event}, ParasInherent: polkadot_runtime_parachains::paras_inherent::{Pallet, Call, Storage, Inherent}, Scheduler: polkadot_runtime_parachains::scheduler::{Pallet, Storage}, Paras: polkadot_runtime_parachains::paras::{Pallet, Call, Storage, Event, Config, ValidateUnsigned}, @@ -799,58 +803,59 @@ impl_runtime_apis! { } } + #[api_version(8)] impl polkadot_primitives::runtime_api::ParachainHost for Runtime { - fn validators() -> Vec { - polkadot_runtime_parachains::runtime_api_impl::v5::validators::() + fn validators() -> Vec { + parachains_runtime_api_impl::validators::() } - fn validator_groups() -> (Vec>, polkadot_primitives::v5::GroupRotationInfo) { - polkadot_runtime_parachains::runtime_api_impl::v5::validator_groups::() + fn validator_groups() -> (Vec>, polkadot_primitives::GroupRotationInfo) { + parachains_runtime_api_impl::validator_groups::() } - fn availability_cores() -> Vec> { - polkadot_runtime_parachains::runtime_api_impl::v5::availability_cores::() + fn availability_cores() -> Vec> { + parachains_runtime_api_impl::availability_cores::() } - fn persisted_validation_data(para_id: polkadot_primitives::v5::Id, assumption: polkadot_primitives::v5::OccupiedCoreAssumption) - -> Option> { - polkadot_runtime_parachains::runtime_api_impl::v5::persisted_validation_data::(para_id, assumption) + fn persisted_validation_data(para_id: ParaId, assumption: polkadot_primitives::OccupiedCoreAssumption) + -> Option> { + parachains_runtime_api_impl::persisted_validation_data::(para_id, assumption) } fn assumed_validation_data( - para_id: polkadot_primitives::v5::Id, + para_id: ParaId, expected_persisted_validation_data_hash: Hash, - ) -> Option<(polkadot_primitives::v5::PersistedValidationData, polkadot_primitives::v5::ValidationCodeHash)> { - polkadot_runtime_parachains::runtime_api_impl::v5::assumed_validation_data::( + ) -> Option<(polkadot_primitives::PersistedValidationData, polkadot_primitives::ValidationCodeHash)> { + parachains_runtime_api_impl::assumed_validation_data::( para_id, expected_persisted_validation_data_hash, ) } fn check_validation_outputs( - para_id: polkadot_primitives::v5::Id, - outputs: polkadot_primitives::v5::CandidateCommitments, + para_id: ParaId, + outputs: polkadot_primitives::CandidateCommitments, ) -> bool { - polkadot_runtime_parachains::runtime_api_impl::v5::check_validation_outputs::(para_id, outputs) + parachains_runtime_api_impl::check_validation_outputs::(para_id, outputs) } - fn session_index_for_child() -> polkadot_primitives::v5::SessionIndex { - polkadot_runtime_parachains::runtime_api_impl::v5::session_index_for_child::() + fn session_index_for_child() -> polkadot_primitives::SessionIndex { + parachains_runtime_api_impl::session_index_for_child::() } - fn validation_code(para_id: polkadot_primitives::v5::Id, assumption: polkadot_primitives::v5::OccupiedCoreAssumption) - -> Option { - polkadot_runtime_parachains::runtime_api_impl::v5::validation_code::(para_id, assumption) + fn validation_code(para_id: ParaId, assumption: polkadot_primitives::OccupiedCoreAssumption) + -> Option { + parachains_runtime_api_impl::validation_code::(para_id, assumption) } - fn candidate_pending_availability(para_id: polkadot_primitives::v5::Id) -> Option> { - polkadot_runtime_parachains::runtime_api_impl::v5::candidate_pending_availability::(para_id) + fn candidate_pending_availability(para_id: ParaId) -> Option> { + parachains_runtime_api_impl::candidate_pending_availability::(para_id) } - fn candidate_events() -> Vec> { - polkadot_runtime_parachains::runtime_api_impl::v5::candidate_events::(|ev| { + fn candidate_events() -> Vec> { + parachains_runtime_api_impl::candidate_events::(|ev| { match ev { - RuntimeEvent::Inclusion(ev) => { + RuntimeEvent::ParaInclusion(ev) => { Some(ev) } _ => None, @@ -858,75 +863,99 @@ impl_runtime_apis! { }) } - fn session_info(index: polkadot_primitives::v5::SessionIndex) -> Option { - polkadot_runtime_parachains::runtime_api_impl::v5::session_info::(index) + fn session_info(index: polkadot_primitives::SessionIndex) -> Option { + parachains_runtime_api_impl::session_info::(index) } - fn dmq_contents(recipient: polkadot_primitives::v5::Id) -> Vec> { - polkadot_runtime_parachains::runtime_api_impl::v5::dmq_contents::(recipient) + fn session_executor_params(session_index: polkadot_primitives::SessionIndex) -> Option { + parachains_runtime_api_impl::session_executor_params::(session_index) } - fn inbound_hrmp_channels_contents( - recipient: polkadot_primitives::v5::Id - ) -> BTreeMap>> { - polkadot_runtime_parachains::runtime_api_impl::v5::inbound_hrmp_channels_contents::(recipient) + fn dmq_contents(recipient: ParaId) -> Vec> { + parachains_runtime_api_impl::dmq_contents::(recipient) } - fn validation_code_by_hash(hash: polkadot_primitives::v5::ValidationCodeHash) -> Option { - polkadot_runtime_parachains::runtime_api_impl::v5::validation_code_by_hash::(hash) + fn inbound_hrmp_channels_contents( + recipient: ParaId + ) -> BTreeMap>> { + parachains_runtime_api_impl::inbound_hrmp_channels_contents::(recipient) } - fn on_chain_votes() -> Option> { - polkadot_runtime_parachains::runtime_api_impl::v5::on_chain_votes::() + fn validation_code_by_hash(hash: polkadot_primitives::ValidationCodeHash) -> Option { + parachains_runtime_api_impl::validation_code_by_hash::(hash) } - fn submit_pvf_check_statement(stmt: polkadot_primitives::v5::PvfCheckStatement, signature: polkadot_primitives::v5::ValidatorSignature) { - polkadot_runtime_parachains::runtime_api_impl::v5::submit_pvf_check_statement::(stmt, signature) + fn on_chain_votes() -> Option> { + parachains_runtime_api_impl::on_chain_votes::() } - fn pvfs_require_precheck() -> Vec { - polkadot_runtime_parachains::runtime_api_impl::v5::pvfs_require_precheck::() + fn submit_pvf_check_statement( + stmt: polkadot_primitives::PvfCheckStatement, + signature: polkadot_primitives::ValidatorSignature + ) { + parachains_runtime_api_impl::submit_pvf_check_statement::(stmt, signature) } - fn validation_code_hash(para_id: polkadot_primitives::v5::Id, assumption: polkadot_primitives::v5::OccupiedCoreAssumption) - -> Option - { - polkadot_runtime_parachains::runtime_api_impl::v5::validation_code_hash::(para_id, assumption) + fn pvfs_require_precheck() -> Vec { + parachains_runtime_api_impl::pvfs_require_precheck::() } - fn disputes() -> Vec<(polkadot_primitives::v5::SessionIndex, polkadot_primitives::v5::CandidateHash, polkadot_primitives::v5::DisputeState)> { - polkadot_runtime_parachains::runtime_api_impl::v5::get_session_disputes::() + fn validation_code_hash(para_id: ParaId, assumption: polkadot_primitives::OccupiedCoreAssumption) + -> Option + { + parachains_runtime_api_impl::validation_code_hash::(para_id, assumption) } - fn session_executor_params(session_index: polkadot_primitives::v5::SessionIndex) -> Option { - polkadot_runtime_parachains::runtime_api_impl::v5::session_executor_params::(session_index) + fn disputes() -> Vec<(polkadot_primitives::SessionIndex, polkadot_primitives::CandidateHash, polkadot_primitives::DisputeState)> { + parachains_runtime_api_impl::get_session_disputes::() } fn unapplied_slashes( - ) -> Vec<(polkadot_primitives::v5::SessionIndex, polkadot_primitives::v5::CandidateHash, polkadot_primitives::v5::slashing::PendingSlashes)> { - polkadot_runtime_parachains::runtime_api_impl::v5::unapplied_slashes::() + ) -> Vec<(polkadot_primitives::SessionIndex, polkadot_primitives::CandidateHash, polkadot_primitives::slashing::PendingSlashes)> { + parachains_runtime_api_impl::unapplied_slashes::() } fn key_ownership_proof( - _validator_id: polkadot_primitives::v5::ValidatorId, - ) -> Option { - unimplemented!("Not used at Rialto") + validator_id: polkadot_primitives::ValidatorId, + ) -> Option { + use codec::Encode; + + Historical::prove((polkadot_primitives::PARACHAIN_KEY_TYPE_ID, validator_id)) + .map(|p| p.encode()) + .map(polkadot_primitives::slashing::OpaqueKeyOwnershipProof::new) } fn submit_report_dispute_lost( - dispute_proof: polkadot_primitives::v5::slashing::DisputeProof, - key_ownership_proof: polkadot_primitives::v5::slashing::OpaqueKeyOwnershipProof, + dispute_proof: polkadot_primitives::slashing::DisputeProof, + key_ownership_proof: polkadot_primitives::slashing::OpaqueKeyOwnershipProof, ) -> Option<()> { - polkadot_runtime_parachains::runtime_api_impl::v5::submit_unsigned_slashing_report::( + parachains_runtime_api_impl::submit_unsigned_slashing_report::( dispute_proof, key_ownership_proof, ) } + + fn minimum_backing_votes() -> u32 { + parachains_runtime_api_impl::minimum_backing_votes::() + } + + fn para_backing_state(para_id: ParaId) -> Option { + parachains_runtime_api_impl::backing_state::(para_id) + } + + fn async_backing_params() -> polkadot_primitives::AsyncBackingParams { + parachains_runtime_api_impl::async_backing_params::() + } + + fn disabled_validators() -> Vec { + parachains_staging_runtime_api_impl::disabled_validators::() + } + } impl sp_authority_discovery::AuthorityDiscoveryApi for Runtime { fn authorities() -> Vec { - polkadot_runtime_parachains::runtime_api_impl::v5::relevant_authority_ids::() + parachains_runtime_api_impl::relevant_authority_ids::() } } diff --git a/bridges/bin/rialto/runtime/src/parachains.rs b/bridges/bin/rialto/runtime/src/parachains.rs index aba204af7cf..972edbf3528 100644 --- a/bridges/bin/rialto/runtime/src/parachains.rs +++ b/bridges/bin/rialto/runtime/src/parachains.rs @@ -28,7 +28,7 @@ use frame_support::{ weights::{Weight, WeightMeter}, }; use frame_system::EnsureRoot; -use polkadot_primitives::v5::{ValidatorId, ValidatorIndex}; +use polkadot_primitives::v6::{ValidatorId, ValidatorIndex}; use polkadot_runtime_common::{paras_registrar, paras_sudo_wrapper, slots}; use polkadot_runtime_parachains::{ configuration as parachains_configuration, disputes as parachains_disputes, @@ -118,8 +118,9 @@ impl parachains_paras::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = ParasWeightInfo; type UnsignedPriority = ParasUnsignedPriority; - type QueueFootprinter = crate::Inclusion; + type QueueFootprinter = crate::ParaInclusion; type NextSessionRotation = Babe; + type OnNewHead = Registrar; } /// Test weight for the `Paras` pallet. @@ -234,7 +235,7 @@ impl pallet_message_queue::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor; - type QueueChangeHandler = crate::Inclusion; + type QueueChangeHandler = crate::ParaInclusion; type WeightInfo = (); type QueuePausedQuery = (); } diff --git a/bridges/modules/beefy/Cargo.toml b/bridges/modules/beefy/Cargo.toml index 0f5bd0a546d..37f9bf96d57 100644 --- a/bridges/modules/beefy/Cargo.toml +++ b/bridges/modules/beefy/Cargo.toml @@ -35,7 +35,7 @@ sp-io = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" bp-test-utils = { path = "../../primitives/test-utils" } [features] -default = ["std"] +default = [ "std" ] std = [ "bp-beefy/std", "bp-runtime/std", @@ -49,7 +49,4 @@ std = [ "sp-runtime/std", "sp-std/std", ] -try-runtime = [ - "frame-support/try-runtime", - "frame-system/try-runtime", -] +try-runtime = [ "frame-support/try-runtime", "frame-system/try-runtime" ] diff --git a/bridges/modules/parachains/README.md b/bridges/modules/parachains/README.md index d3f52c791ab..9ca60803834 100644 --- a/bridges/modules/parachains/README.md +++ b/bridges/modules/parachains/README.md @@ -9,15 +9,15 @@ to verify storage proofs, generated at the bridged relay chain. ## A Brief Introduction into Parachains Finality -You can find detailed information on parachains finality in the [Polkadot](https://github.com/paritytech/polkadot) -and [Cumulus](https://github.com/paritytech/cumulus) repositories. This section gives a brief overview of how -the parachain finality works and how to build a light client for a parachain. +You can find detailed information on parachains finality in the +[Polkadot-SDK](https://github.com/paritytech/polkadot-sdk) repository. This section gives a brief overview of how the +parachain finality works and how to build a light client for a parachain. The main thing there is that the parachain generates blocks on its own, but it can't achieve finality without help of its relay chain. Instead, the parachain collators create a block and hand it over to the relay chain validators. Validators validate the block and register the new parachain head in the -[`Heads` map](https://github.com/paritytech/polkadot/blob/88013730166ba90745ae7c9eb3e0c1be1513c7cc/runtime/parachains/src/paras/mod.rs#L645) -of the [`paras`](https://github.com/paritytech/polkadot/tree/master/runtime/parachains/src/paras) pallet, +[`Heads` map](https://github.com/paritytech/polkadot-sdk/blob/bc5005217a8c2e7c95b9011c96d7e619879b1200/polkadot/runtime/parachains/src/paras/mod.rs#L683-L686) +of the [`paras`](https://github.com/paritytech/polkadot-sdk/tree/master/polkadot/runtime/parachains/src/paras) pallet, deployed at the relay chain. Keep in mind that this pallet, deployed at a relay chain, is **NOT** a bridge pallet, even though the names are similar. diff --git a/bridges/modules/shift-session-manager/Cargo.toml b/bridges/modules/shift-session-manager/Cargo.toml index a30b88890ad..14f6bdc10c8 100644 --- a/bridges/modules/shift-session-manager/Cargo.toml +++ b/bridges/modules/shift-session-manager/Cargo.toml @@ -25,7 +25,7 @@ sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", branch sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } [features] -default = ["std"] +default = [ "std" ] std = [ "codec/std", "frame-support/std", @@ -35,7 +35,4 @@ std = [ "sp-staking/std", "sp-std/std", ] -try-runtime = [ - "frame-support/try-runtime", - "frame-system/try-runtime", -] +try-runtime = [ "frame-support/try-runtime", "frame-system/try-runtime" ] diff --git a/bridges/modules/xcm-bridge-hub-router/src/benchmarking.rs b/bridges/modules/xcm-bridge-hub-router/src/benchmarking.rs index 4bbe414f663..c4d1e3971e7 100644 --- a/bridges/modules/xcm-bridge-hub-router/src/benchmarking.rs +++ b/bridges/modules/xcm-bridge-hub-router/src/benchmarking.rs @@ -60,6 +60,8 @@ benchmarks_instance_pallet! { is_congested: false, delivery_fee_factor: MINIMAL_DELIVERY_FEE_FACTOR + MINIMAL_DELIVERY_FEE_FACTOR, }); + + let _ = T::ensure_bridged_target_destination(); T::make_congested(); }: { crate::Pallet::::on_initialize(Zero::zero()) @@ -79,11 +81,11 @@ benchmarks_instance_pallet! { } send_message { - // make local queue congested, because it means additional db write - T::make_congested(); - let dest = T::ensure_bridged_target_destination(); let xcm = sp_std::vec![].into(); + + // make local queue congested, because it means additional db write + T::make_congested(); }: { send_xcm::>(dest, xcm).expect("message is sent") } diff --git a/bridges/modules/xcm-bridge-hub-router/src/mock.rs b/bridges/modules/xcm-bridge-hub-router/src/mock.rs index 58df21a6d90..2152b4eb28f 100644 --- a/bridges/modules/xcm-bridge-hub-router/src/mock.rs +++ b/bridges/modules/xcm-bridge-hub-router/src/mock.rs @@ -27,7 +27,7 @@ use sp_runtime::{ BuildStorage, }; use xcm::prelude::*; -use xcm_builder::NetworkExportTable; +use xcm_builder::{NetworkExportTable, NetworkExportTableItem}; pub type AccountId = u64; type Block = frame_system::mocking::MockBlock; @@ -53,8 +53,15 @@ parameter_types! { pub UniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(ThisNetworkId::get()), Parachain(1000)); pub SiblingBridgeHubLocation: MultiLocation = ParentThen(X1(Parachain(1002))).into(); pub BridgeFeeAsset: AssetId = MultiLocation::parent().into(); - pub BridgeTable: Vec<(NetworkId, MultiLocation, Option)> - = vec![(BridgedNetworkId::get(), SiblingBridgeHubLocation::get(), Some((BridgeFeeAsset::get(), BASE_FEE).into()))]; + pub BridgeTable: Vec + = vec![ + NetworkExportTableItem::new( + BridgedNetworkId::get(), + None, + SiblingBridgeHubLocation::get(), + Some((BridgeFeeAsset::get(), BASE_FEE).into()) + ) + ]; } impl frame_system::Config for TestRuntime { diff --git a/bridges/primitives/beefy/Cargo.toml b/bridges/primitives/beefy/Cargo.toml index 2d89bfaacae..6c6e66afedf 100644 --- a/bridges/primitives/beefy/Cargo.toml +++ b/bridges/primitives/beefy/Cargo.toml @@ -26,7 +26,7 @@ sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "mas sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } [features] -default = ["std"] +default = [ "std" ] std = [ "bp-runtime/std", "codec/std", @@ -37,5 +37,5 @@ std = [ "serde/std", "sp-consensus-beefy/std", "sp-runtime/std", - "sp-std/std" + "sp-std/std", ] diff --git a/bridges/primitives/chain-asset-hub-rococo/Cargo.toml b/bridges/primitives/chain-asset-hub-rococo/Cargo.toml new file mode 100644 index 00000000000..d5e4328893d --- /dev/null +++ b/bridges/primitives/chain-asset-hub-rococo/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "bp-asset-hub-rococo" +description = "Primitives of AssetHubRococo parachain runtime." +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } + +# Substrate Dependencies +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } + +# Bridge Dependencies +bp-xcm-bridge-hub-router = { path = "../xcm-bridge-hub-router", default-features = false } + +[features] +default = [ "std" ] +std = [ + "bp-xcm-bridge-hub-router/std", + "codec/std", + "frame-support/std", + "scale-info/std", +] diff --git a/bridges/primitives/chain-asset-hub-rococo/src/lib.rs b/bridges/primitives/chain-asset-hub-rococo/src/lib.rs new file mode 100644 index 00000000000..f1ea1e9c88c --- /dev/null +++ b/bridges/primitives/chain-asset-hub-rococo/src/lib.rs @@ -0,0 +1,52 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Parity Bridges Common. + +// Parity Bridges Common is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity Bridges Common is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity Bridges Common. If not, see . + +//! Module with configuration which reflects AssetHubRococo runtime setup. + +#![cfg_attr(not(feature = "std"), no_std)] + +use codec::{Decode, Encode}; +use scale_info::TypeInfo; + +pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall; + +/// `AssetHubRococo` Runtime `Call` enum. +/// +/// The enum represents a subset of possible `Call`s we can send to `AssetHubRococo` chain. +/// Ideally this code would be auto-generated from metadata, because we want to +/// avoid depending directly on the ENTIRE runtime just to get the encoding of `Dispatchable`s. +/// +/// All entries here (like pretty much in the entire file) must be kept in sync with +/// `AssetHubRococo` `construct_runtime`, so that we maintain SCALE-compatibility. +#[allow(clippy::large_enum_variant)] +#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)] +pub enum Call { + /// `ToWococoXcmRouter` bridge pallet. + #[codec(index = 43)] + ToWococoXcmRouter(XcmBridgeHubRouterCall), +} + +frame_support::parameter_types! { + /// Some sane weight to execute `xcm::Transact(pallet-xcm-bridge-hub-router::Call::report_bridge_status)`. + pub const XcmBridgeHubRouterTransactCallMaxWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(200_000_000, 6144); + + /// Base delivery fee to `BridgeHubRococo`. + /// (initially was calculated by test `BridgeHubRococo::can_calculate_weight_for_paid_export_message_with_reserve_transfer`) + pub const BridgeHubRococoBaseFeeInRocs: u128 = 1214739988; +} + +/// Identifier of AssetHubRococo in the Rococo relay chain. +pub const ASSET_HUB_ROCOCO_PARACHAIN_ID: u32 = 1000; diff --git a/bridges/primitives/chain-asset-hub-wococo/Cargo.toml b/bridges/primitives/chain-asset-hub-wococo/Cargo.toml new file mode 100644 index 00000000000..5120bd2b431 --- /dev/null +++ b/bridges/primitives/chain-asset-hub-wococo/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "bp-asset-hub-wococo" +description = "Primitives of AssetHubWococo parachain runtime." +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } +scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } + +# Substrate Dependencies +frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } + +# Bridge Dependencies +bp-xcm-bridge-hub-router = { path = "../xcm-bridge-hub-router", default-features = false } + +[features] +default = [ "std" ] +std = [ + "bp-xcm-bridge-hub-router/std", + "codec/std", + "frame-support/std", + "scale-info/std", +] diff --git a/bridges/primitives/chain-asset-hub-wococo/src/lib.rs b/bridges/primitives/chain-asset-hub-wococo/src/lib.rs new file mode 100644 index 00000000000..5ce66054d64 --- /dev/null +++ b/bridges/primitives/chain-asset-hub-wococo/src/lib.rs @@ -0,0 +1,52 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Parity Bridges Common. + +// Parity Bridges Common is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity Bridges Common is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity Bridges Common. If not, see . + +//! Module with configuration which reflects AssetHubWococo runtime setup. + +#![cfg_attr(not(feature = "std"), no_std)] + +use codec::{Decode, Encode}; +use scale_info::TypeInfo; + +pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall; + +/// `AssetHubWococo` Runtime `Call` enum. +/// +/// The enum represents a subset of possible `Call`s we can send to `AssetHubWococo` chain. +/// Ideally this code would be auto-generated from metadata, because we want to +/// avoid depending directly on the ENTIRE runtime just to get the encoding of `Dispatchable`s. +/// +/// All entries here (like pretty much in the entire file) must be kept in sync with +/// `AssetHubWococo` `construct_runtime`, so that we maintain SCALE-compatibility. +#[allow(clippy::large_enum_variant)] +#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)] +pub enum Call { + /// `ToRococoXcmRouter` bridge pallet. + #[codec(index = 44)] + ToRococoXcmRouter(XcmBridgeHubRouterCall), +} + +frame_support::parameter_types! { + /// Some sane weight to execute `xcm::Transact(pallet-xcm-bridge-hub-router::Call::report_bridge_status)`. + pub const XcmBridgeHubRouterTransactCallMaxWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(200_000_000, 6144); + + /// Base delivery fee to `BridgeHubWococo`. + /// (initially was calculated by test `BridgeHubWococo::can_calculate_weight_for_paid_export_message_with_reserve_transfer`) + pub const BridgeHubWococoBaseFeeInWocs: u128 = 1214739988; +} + +/// Identifier of AssetHubWococo in the Wococo relay chain. +pub const ASSET_HUB_WOCOCO_PARACHAIN_ID: u32 = 1000; diff --git a/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs b/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs index a50bda23ac8..6da5cd3818f 100644 --- a/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs @@ -74,5 +74,8 @@ pub const WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME: &str = "BridgeRococoMessa /// chains. pub const WITH_BRIDGE_HUB_ROCOCO_RELAYERS_PALLET_NAME: &str = "BridgeRelayers"; +/// Pallet index of `BridgeWococoMessages: pallet_bridge_messages::`. +pub const WITH_BRIDGE_WOCOCO_MESSAGES_PALLET_INDEX: u8 = 46; + decl_bridge_finality_runtime_apis!(bridge_hub_rococo); decl_bridge_messages_runtime_apis!(bridge_hub_rococo); diff --git a/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs b/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs index ce4600f5ff3..0c771736804 100644 --- a/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs @@ -68,5 +68,8 @@ pub const WITH_BRIDGE_HUB_WOCOCO_MESSAGES_PALLET_NAME: &str = "BridgeWococoMessa /// chains. pub const WITH_BRIDGE_HUB_WOCOCO_RELAYERS_PALLET_NAME: &str = "BridgeRelayers"; +/// Pallet index of `BridgeRococoMessages: pallet_bridge_messages::`. +pub const WITH_BRIDGE_ROCOCO_MESSAGES_PALLET_INDEX: u8 = 45; + decl_bridge_finality_runtime_apis!(bridge_hub_wococo); decl_bridge_messages_runtime_apis!(bridge_hub_wococo); diff --git a/bridges/primitives/chain-millau/Cargo.toml b/bridges/primitives/chain-millau/Cargo.toml index 220e8d657e7..4efdf667ac8 100644 --- a/bridges/primitives/chain-millau/Cargo.toml +++ b/bridges/primitives/chain-millau/Cargo.toml @@ -38,7 +38,7 @@ sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" sp-trie = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } [features] -default = ["std"] +default = [ "std" ] std = [ "bp-beefy/std", "bp-header-chain/std", diff --git a/bridges/primitives/chain-rialto-parachain/Cargo.toml b/bridges/primitives/chain-rialto-parachain/Cargo.toml index 0963aa0776e..0122c508e2b 100644 --- a/bridges/primitives/chain-rialto-parachain/Cargo.toml +++ b/bridges/primitives/chain-rialto-parachain/Cargo.toml @@ -25,7 +25,7 @@ sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "mas sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } [features] -default = ["std"] +default = [ "std" ] std = [ "bp-bridge-hub-cumulus/std", "bp-messages/std", diff --git a/bridges/primitives/chain-rialto/Cargo.toml b/bridges/primitives/chain-rialto/Cargo.toml index a588320af93..083abbd5458 100644 --- a/bridges/primitives/chain-rialto/Cargo.toml +++ b/bridges/primitives/chain-rialto/Cargo.toml @@ -24,7 +24,7 @@ sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "mas sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } [features] -default = ["std"] +default = [ "std" ] std = [ "bp-header-chain/std", "bp-messages/std", diff --git a/bridges/primitives/chain-westend/Cargo.toml b/bridges/primitives/chain-westend/Cargo.toml index c6712857dd6..abc04224dca 100644 --- a/bridges/primitives/chain-westend/Cargo.toml +++ b/bridges/primitives/chain-westend/Cargo.toml @@ -21,7 +21,7 @@ sp-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } [features] -default = ["std"] +default = [ "std" ] std = [ "bp-header-chain/std", "bp-polkadot-core/std", diff --git a/bridges/relays/bin-substrate/src/cli/register_parachain.rs b/bridges/relays/bin-substrate/src/cli/register_parachain.rs index a72feecdae8..90464335166 100644 --- a/bridges/relays/bin-substrate/src/cli/register_parachain.rs +++ b/bridges/relays/bin-substrate/src/cli/register_parachain.rs @@ -103,8 +103,8 @@ impl RegisterParachain { let para_id: ParaId = relay_client .storage_value(StorageKey(para_id_key.to_vec()), None) .await? - .unwrap_or(polkadot_primitives::v5::LOWEST_PUBLIC_ID) - .max(polkadot_primitives::v5::LOWEST_PUBLIC_ID); + .unwrap_or(polkadot_primitives::v6::LOWEST_PUBLIC_ID) + .max(polkadot_primitives::v6::LOWEST_PUBLIC_ID); log::info!(target: "bridge", "Going to reserve parachain id: {:?}", para_id); // step 1: reserve a parachain id