Backport from polkadot-sdk with actual master (#2633)

* Backport from `polkadot-sdk`

* lingua stuff

* Fixes

* Fix

* Features?

* Fix - v5 -> v6

* zepter format features

* try zepter with CI

* Fix imports

* Fix

* Fix

* Fix

* Revert zepther pipeline
This commit is contained in:
Branislav Kontur
2023-10-19 10:04:26 +02:00
committed by Bastian Köcher
parent dcd2debbb2
commit f539157da2
29 changed files with 353 additions and 143 deletions
+1 -3
View File
@@ -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" ]
+2 -1
View File
@@ -181,7 +181,7 @@ pub fn new_partial(
/// Builds a new service for a full client.
pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
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<TaskManager, ServiceError> {
import_queue,
block_announce_validator_builder: None,
warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)),
block_relay: None,
})?;
if config.offchain_worker.enabled {
+8 -7
View File
@@ -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",
]
+10 -3
View File
@@ -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<xcm::prelude::MultiAsset>)>
= vec![(xcm_config::RialtoNetwork::get(), xcm_config::TokenLocation::get(), Some((xcm_config::TokenAssetId::get(), 1_000_000_000_u128).into()))];
pub BridgeTable: Vec<NetworkExportTableItem>
= 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 = ();
+1 -1
View File
@@ -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"] }
@@ -283,6 +283,7 @@ where
Box::new(block_announce_validator)
})),
warp_sync_params: None,
block_relay: None,
})?;
let rpc_client = client.clone();
+32 -28
View File
@@ -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",
]
+1 -1
View File
@@ -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" }
+3 -3
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
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,
+8 -5
View File
@@ -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",
]
+88 -59
View File
@@ -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<T>},
Shared: polkadot_runtime_parachains::shared::{Pallet, Call, Storage},
Inclusion: polkadot_runtime_parachains::inclusion::{Pallet, Call, Storage, Event<T>},
ParaInclusion: polkadot_runtime_parachains::inclusion::{Pallet, Call, Storage, Event<T>},
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<T>, ValidateUnsigned},
@@ -799,58 +803,59 @@ impl_runtime_apis! {
}
}
#[api_version(8)]
impl polkadot_primitives::runtime_api::ParachainHost<Block, Hash, BlockNumber> for Runtime {
fn validators() -> Vec<polkadot_primitives::v5::ValidatorId> {
polkadot_runtime_parachains::runtime_api_impl::v5::validators::<Runtime>()
fn validators() -> Vec<polkadot_primitives::ValidatorId> {
parachains_runtime_api_impl::validators::<Runtime>()
}
fn validator_groups() -> (Vec<Vec<polkadot_primitives::v5::ValidatorIndex>>, polkadot_primitives::v5::GroupRotationInfo<BlockNumber>) {
polkadot_runtime_parachains::runtime_api_impl::v5::validator_groups::<Runtime>()
fn validator_groups() -> (Vec<Vec<polkadot_primitives::ValidatorIndex>>, polkadot_primitives::GroupRotationInfo<BlockNumber>) {
parachains_runtime_api_impl::validator_groups::<Runtime>()
}
fn availability_cores() -> Vec<polkadot_primitives::v5::CoreState<Hash, BlockNumber>> {
polkadot_runtime_parachains::runtime_api_impl::v5::availability_cores::<Runtime>()
fn availability_cores() -> Vec<polkadot_primitives::CoreState<Hash, BlockNumber>> {
parachains_runtime_api_impl::availability_cores::<Runtime>()
}
fn persisted_validation_data(para_id: polkadot_primitives::v5::Id, assumption: polkadot_primitives::v5::OccupiedCoreAssumption)
-> Option<polkadot_primitives::v5::PersistedValidationData<Hash, BlockNumber>> {
polkadot_runtime_parachains::runtime_api_impl::v5::persisted_validation_data::<Runtime>(para_id, assumption)
fn persisted_validation_data(para_id: ParaId, assumption: polkadot_primitives::OccupiedCoreAssumption)
-> Option<polkadot_primitives::PersistedValidationData<Hash, BlockNumber>> {
parachains_runtime_api_impl::persisted_validation_data::<Runtime>(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<Hash, BlockNumber>, polkadot_primitives::v5::ValidationCodeHash)> {
polkadot_runtime_parachains::runtime_api_impl::v5::assumed_validation_data::<Runtime>(
) -> Option<(polkadot_primitives::PersistedValidationData<Hash, BlockNumber>, polkadot_primitives::ValidationCodeHash)> {
parachains_runtime_api_impl::assumed_validation_data::<Runtime>(
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::<Runtime>(para_id, outputs)
parachains_runtime_api_impl::check_validation_outputs::<Runtime>(para_id, outputs)
}
fn session_index_for_child() -> polkadot_primitives::v5::SessionIndex {
polkadot_runtime_parachains::runtime_api_impl::v5::session_index_for_child::<Runtime>()
fn session_index_for_child() -> polkadot_primitives::SessionIndex {
parachains_runtime_api_impl::session_index_for_child::<Runtime>()
}
fn validation_code(para_id: polkadot_primitives::v5::Id, assumption: polkadot_primitives::v5::OccupiedCoreAssumption)
-> Option<polkadot_primitives::v5::ValidationCode> {
polkadot_runtime_parachains::runtime_api_impl::v5::validation_code::<Runtime>(para_id, assumption)
fn validation_code(para_id: ParaId, assumption: polkadot_primitives::OccupiedCoreAssumption)
-> Option<polkadot_primitives::ValidationCode> {
parachains_runtime_api_impl::validation_code::<Runtime>(para_id, assumption)
}
fn candidate_pending_availability(para_id: polkadot_primitives::v5::Id) -> Option<polkadot_primitives::v5::CommittedCandidateReceipt<Hash>> {
polkadot_runtime_parachains::runtime_api_impl::v5::candidate_pending_availability::<Runtime>(para_id)
fn candidate_pending_availability(para_id: ParaId) -> Option<polkadot_primitives::CommittedCandidateReceipt<Hash>> {
parachains_runtime_api_impl::candidate_pending_availability::<Runtime>(para_id)
}
fn candidate_events() -> Vec<polkadot_primitives::v5::CandidateEvent<Hash>> {
polkadot_runtime_parachains::runtime_api_impl::v5::candidate_events::<Runtime, _>(|ev| {
fn candidate_events() -> Vec<polkadot_primitives::CandidateEvent<Hash>> {
parachains_runtime_api_impl::candidate_events::<Runtime, _>(|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_primitives::v5::SessionInfo> {
polkadot_runtime_parachains::runtime_api_impl::v5::session_info::<Runtime>(index)
fn session_info(index: polkadot_primitives::SessionIndex) -> Option<polkadot_primitives::SessionInfo> {
parachains_runtime_api_impl::session_info::<Runtime>(index)
}
fn dmq_contents(recipient: polkadot_primitives::v5::Id) -> Vec<polkadot_primitives::v5::InboundDownwardMessage<BlockNumber>> {
polkadot_runtime_parachains::runtime_api_impl::v5::dmq_contents::<Runtime>(recipient)
fn session_executor_params(session_index: polkadot_primitives::SessionIndex) -> Option<polkadot_primitives::ExecutorParams> {
parachains_runtime_api_impl::session_executor_params::<Runtime>(session_index)
}
fn dmq_contents(recipient: ParaId) -> Vec<polkadot_primitives::InboundDownwardMessage<BlockNumber>> {
parachains_runtime_api_impl::dmq_contents::<Runtime>(recipient)
}
fn inbound_hrmp_channels_contents(
recipient: polkadot_primitives::v5::Id
) -> BTreeMap<polkadot_primitives::v5::Id, Vec<polkadot_primitives::v5::InboundHrmpMessage<BlockNumber>>> {
polkadot_runtime_parachains::runtime_api_impl::v5::inbound_hrmp_channels_contents::<Runtime>(recipient)
recipient: ParaId
) -> BTreeMap<ParaId, Vec<polkadot_primitives::InboundHrmpMessage<BlockNumber>>> {
parachains_runtime_api_impl::inbound_hrmp_channels_contents::<Runtime>(recipient)
}
fn validation_code_by_hash(hash: polkadot_primitives::v5::ValidationCodeHash) -> Option<polkadot_primitives::v5::ValidationCode> {
polkadot_runtime_parachains::runtime_api_impl::v5::validation_code_by_hash::<Runtime>(hash)
fn validation_code_by_hash(hash: polkadot_primitives::ValidationCodeHash) -> Option<polkadot_primitives::ValidationCode> {
parachains_runtime_api_impl::validation_code_by_hash::<Runtime>(hash)
}
fn on_chain_votes() -> Option<polkadot_primitives::v5::ScrapedOnChainVotes<Hash>> {
polkadot_runtime_parachains::runtime_api_impl::v5::on_chain_votes::<Runtime>()
fn on_chain_votes() -> Option<polkadot_primitives::ScrapedOnChainVotes<Hash>> {
parachains_runtime_api_impl::on_chain_votes::<Runtime>()
}
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::<Runtime>(stmt, signature)
fn submit_pvf_check_statement(
stmt: polkadot_primitives::PvfCheckStatement,
signature: polkadot_primitives::ValidatorSignature
) {
parachains_runtime_api_impl::submit_pvf_check_statement::<Runtime>(stmt, signature)
}
fn pvfs_require_precheck() -> Vec<polkadot_primitives::v5::ValidationCodeHash> {
polkadot_runtime_parachains::runtime_api_impl::v5::pvfs_require_precheck::<Runtime>()
fn pvfs_require_precheck() -> Vec<polkadot_primitives::ValidationCodeHash> {
parachains_runtime_api_impl::pvfs_require_precheck::<Runtime>()
}
fn validation_code_hash(para_id: polkadot_primitives::v5::Id, assumption: polkadot_primitives::v5::OccupiedCoreAssumption)
-> Option<polkadot_primitives::v5::ValidationCodeHash>
fn validation_code_hash(para_id: ParaId, assumption: polkadot_primitives::OccupiedCoreAssumption)
-> Option<polkadot_primitives::ValidationCodeHash>
{
polkadot_runtime_parachains::runtime_api_impl::v5::validation_code_hash::<Runtime>(para_id, assumption)
parachains_runtime_api_impl::validation_code_hash::<Runtime>(para_id, assumption)
}
fn disputes() -> Vec<(polkadot_primitives::v5::SessionIndex, polkadot_primitives::v5::CandidateHash, polkadot_primitives::v5::DisputeState<BlockNumber>)> {
polkadot_runtime_parachains::runtime_api_impl::v5::get_session_disputes::<Runtime>()
}
fn session_executor_params(session_index: polkadot_primitives::v5::SessionIndex) -> Option<polkadot_primitives::v5::ExecutorParams> {
polkadot_runtime_parachains::runtime_api_impl::v5::session_executor_params::<Runtime>(session_index)
fn disputes() -> Vec<(polkadot_primitives::SessionIndex, polkadot_primitives::CandidateHash, polkadot_primitives::DisputeState<BlockNumber>)> {
parachains_runtime_api_impl::get_session_disputes::<Runtime>()
}
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::<Runtime>()
) -> Vec<(polkadot_primitives::SessionIndex, polkadot_primitives::CandidateHash, polkadot_primitives::slashing::PendingSlashes)> {
parachains_runtime_api_impl::unapplied_slashes::<Runtime>()
}
fn key_ownership_proof(
_validator_id: polkadot_primitives::v5::ValidatorId,
) -> Option<polkadot_primitives::v5::slashing::OpaqueKeyOwnershipProof> {
unimplemented!("Not used at Rialto")
validator_id: polkadot_primitives::ValidatorId,
) -> Option<polkadot_primitives::slashing::OpaqueKeyOwnershipProof> {
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::<Runtime>(
parachains_runtime_api_impl::submit_unsigned_slashing_report::<Runtime>(
dispute_proof,
key_ownership_proof,
)
}
fn minimum_backing_votes() -> u32 {
parachains_runtime_api_impl::minimum_backing_votes::<Runtime>()
}
fn para_backing_state(para_id: ParaId) -> Option<polkadot_primitives::async_backing::BackingState> {
parachains_runtime_api_impl::backing_state::<Runtime>(para_id)
}
fn async_backing_params() -> polkadot_primitives::AsyncBackingParams {
parachains_runtime_api_impl::async_backing_params::<Runtime>()
}
fn disabled_validators() -> Vec<polkadot_primitives::ValidatorIndex> {
parachains_staging_runtime_api_impl::disabled_validators::<Runtime>()
}
}
impl sp_authority_discovery::AuthorityDiscoveryApi<Block> for Runtime {
fn authorities() -> Vec<AuthorityDiscoveryId> {
polkadot_runtime_parachains::runtime_api_impl::v5::relevant_authority_ids::<Runtime>()
parachains_runtime_api_impl::relevant_authority_ids::<Runtime>()
}
}
+4 -3
View File
@@ -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<AggregateMessageOrigin>;
type QueueChangeHandler = crate::Inclusion;
type QueueChangeHandler = crate::ParaInclusion;
type WeightInfo = ();
type QueuePausedQuery = ();
}
+2 -5
View File
@@ -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" ]
+5 -5
View File
@@ -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.
@@ -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" ]
@@ -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::<T, I>::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::<crate::Pallet<T, I>>(dest, xcm).expect("message is sent")
}
@@ -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<TestRuntime>;
@@ -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<MultiAsset>)>
= vec![(BridgedNetworkId::get(), SiblingBridgeHubLocation::get(), Some((BridgeFeeAsset::get(), BASE_FEE).into()))];
pub BridgeTable: Vec<NetworkExportTableItem>
= vec![
NetworkExportTableItem::new(
BridgedNetworkId::get(),
None,
SiblingBridgeHubLocation::get(),
Some((BridgeFeeAsset::get(), BASE_FEE).into())
)
];
}
impl frame_system::Config for TestRuntime {
+2 -2
View File
@@ -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",
]
@@ -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",
]
@@ -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 <http://www.gnu.org/licenses/>.
//! 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;
@@ -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",
]
@@ -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 <http://www.gnu.org/licenses/>.
//! 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;
@@ -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::<Instance1>`.
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);
@@ -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::<Instance2>`.
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);
+1 -1
View File
@@ -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",
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
@@ -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