From 9c611065a28f3633c8e37e03646a2e366e3dc78e Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Tue, 11 Jun 2024 15:42:39 +0200 Subject: [PATCH] Relay v1.6.3: added support for bridge-hub-kusama/1002005 (#3011) * New BHK 1_002_005 + codegen * New relayer version --------- Co-authored-by: Serban Iorga --- Cargo.lock | 3 +- .../client-bridge-hub-kusama/Cargo.toml | 1 + .../src/codegen_runtime.rs | 266 ++---------------- .../client-bridge-hub-kusama/src/lib.rs | 21 +- substrate-relay/Cargo.toml | 2 +- 5 files changed, 47 insertions(+), 246 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fed33e6cfa..b9cc1631f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6785,6 +6785,7 @@ dependencies = [ "bp-parachains", "bp-polkadot", "bp-polkadot-core", + "bp-runtime", "bridge-runtime-common", "parity-scale-codec", "relay-substrate-client", @@ -9364,7 +9365,7 @@ dependencies = [ [[package]] name = "substrate-relay" -version = "1.6.2" +version = "1.6.3" dependencies = [ "anyhow", "async-std", diff --git a/relay-clients/client-bridge-hub-kusama/Cargo.toml b/relay-clients/client-bridge-hub-kusama/Cargo.toml index c1f6d1ece7..f2fdeeed40 100644 --- a/relay-clients/client-bridge-hub-kusama/Cargo.toml +++ b/relay-clients/client-bridge-hub-kusama/Cargo.toml @@ -22,6 +22,7 @@ bp-messages = { git = "https://github.com/paritytech/polkadot-sdk", branch = "ma bp-parachains = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } bp-polkadot = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } bp-polkadot-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } +bp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } bridge-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } relay-substrate-client = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } diff --git a/relay-clients/client-bridge-hub-kusama/src/codegen_runtime.rs b/relay-clients/client-bridge-hub-kusama/src/codegen_runtime.rs index e14cc0d3d0..06496b3482 100644 --- a/relay-clients/client-bridge-hub-kusama/src/codegen_runtime.rs +++ b/relay-clients/client-bridge-hub-kusama/src/codegen_runtime.rs @@ -16,8 +16,8 @@ //! Autogenerated runtime API //! THIS FILE WAS AUTOGENERATED USING parity-bridges-common::runtime-codegen -//! EXECUTED COMMAND: target/debug/runtime-codegen --from-node-url -//! wss://kusama-bridge-hub-rpc.polkadot.io +//! EXECUTED COMMAND: target/debug/runtime-codegen --from-wasm-file +//! bridge-hub-kusama_runtime-v1002005.compact.compressed.wasm #[allow(dead_code, unused_imports, non_camel_case_types)] #[allow(clippy::all)] @@ -90,10 +90,6 @@ pub mod api { pub last_confirmed_nonce: ::core::primitive::u64, } #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct InboundMessageDetails { - pub dispatch_weight: ::sp_weights::Weight, - } - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] pub struct LaneId(pub [::core::primitive::u8; 4usize]); #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] pub struct MessageKey { @@ -114,12 +110,6 @@ pub mod api { pub latest_generated_nonce: ::core::primitive::u64, } #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct OutboundMessageDetails { - pub nonce: ::core::primitive::u64, - pub dispatch_weight: ::sp_weights::Weight, - pub size: ::core::primitive::u32, - } - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] pub enum ReceivalResult<_0> { #[codec(index = 0)] Dispatched(runtime_types::bp_runtime::messages::MessageDispatchResult<_0>), @@ -669,26 +659,6 @@ pub mod api { pub resume_threshold: ::core::primitive::u32, } } - pub mod cumulus_primitives_core { - use super::runtime_types; - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct CollationInfo { - pub upward_messages: ::subxt::ext::subxt_core::alloc::vec::Vec< - ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u8>, - >, - pub horizontal_messages: ::subxt::ext::subxt_core::alloc::vec::Vec< - runtime_types::polkadot_core_primitives::OutboundHrmpMessage< - runtime_types::polkadot_parachain_primitives::primitives::Id, - >, - >, - pub new_validation_code: ::core::option::Option< - runtime_types::polkadot_parachain_primitives::primitives::ValidationCode, - >, - pub processed_downward_messages: ::core::primitive::u32, - pub hrmp_watermark: ::core::primitive::u32, - pub head_data: runtime_types::polkadot_parachain_primitives::primitives::HeadData, - } - } pub mod cumulus_primitives_parachain_inherent { use super::runtime_types; #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] @@ -738,6 +708,29 @@ pub mod api { pub id: _3, } } + pub mod frame_metadata_hash_extension { + use super::runtime_types; + #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] + pub struct CheckMetadataHash { + pub mode: runtime_types::frame_metadata_hash_extension::Mode, + } + #[derive( + ::codec::Decode, + ::codec::Encode, + Clone, + Debug, + Eq, + PartialEq, + scale_info::TypeInfo, + Copy, + )] + pub enum Mode { + #[codec(index = 0)] + Disabled, + #[codec(index = 1)] + Enabled, + } + } pub mod frame_support { use super::runtime_types; pub mod dispatch { @@ -1987,28 +1980,6 @@ pub mod api { }, } } - pub mod types { - use super::runtime_types; - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct FeeDetails<_0> { - pub inclusion_fee: ::core::option::Option< - runtime_types::pallet_transaction_payment::types::InclusionFee<_0>, - >, - pub tip: _0, - } - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct InclusionFee<_0> { - pub base_fee: _0, - pub len_fee: _0, - pub adjusted_weight_fee: _0, - } - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct RuntimeDispatchInfo<_0, _1> { - pub weight: _1, - pub class: runtime_types::frame_support::dispatch::DispatchClass, - pub partial_fee: _0, - } - } #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] pub struct ChargeTransactionPayment(#[codec(compact)] pub ::core::primitive::u128); #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] @@ -2520,10 +2491,6 @@ pub mod api { PartialEq, )] pub struct Id(pub ::core::primitive::u32); - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct ValidationCode( - pub ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u8>, - ); } } pub mod polkadot_primitives { @@ -2878,67 +2845,6 @@ pub mod api { pub mod v1 { use super::runtime_types; #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub enum AgentExecuteCommand { - #[codec(index = 0)] - TransferToken { - token: ::subxt::ext::subxt_core::utils::H160, - recipient: ::subxt::ext::subxt_core::utils::H160, - amount: ::core::primitive::u128, - }, - } - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub enum Command { - #[codec(index = 0)] - AgentExecute { - agent_id: ::subxt::ext::subxt_core::utils::H256, - command: - runtime_types::snowbridge_core::outbound::v1::AgentExecuteCommand, - }, - #[codec(index = 1)] - Upgrade { - impl_address: ::subxt::ext::subxt_core::utils::H160, - impl_code_hash: ::subxt::ext::subxt_core::utils::H256, - initializer: ::core::option::Option< - runtime_types::snowbridge_core::outbound::v1::Initializer, - >, - }, - #[codec(index = 2)] - CreateAgent { agent_id: ::subxt::ext::subxt_core::utils::H256 }, - #[codec(index = 3)] - CreateChannel { - channel_id: runtime_types::snowbridge_core::ChannelId, - agent_id: ::subxt::ext::subxt_core::utils::H256, - mode: runtime_types::snowbridge_core::outbound::v1::OperatingMode, - }, - #[codec(index = 4)] - UpdateChannel { - channel_id: runtime_types::snowbridge_core::ChannelId, - mode: runtime_types::snowbridge_core::outbound::v1::OperatingMode, - }, - #[codec(index = 5)] - SetOperatingMode { - mode: runtime_types::snowbridge_core::outbound::v1::OperatingMode, - }, - #[codec(index = 6)] - TransferNativeFromAgent { - agent_id: ::subxt::ext::subxt_core::utils::H256, - recipient: ::subxt::ext::subxt_core::utils::H160, - amount: ::core::primitive::u128, - }, - #[codec(index = 7)] - SetTokenTransferFees { - create_asset_xcm: ::core::primitive::u128, - transfer_asset_xcm: ::core::primitive::u128, - register_token: runtime_types::primitive_types::U256, - }, - #[codec(index = 8)] - SetPricingParameters { - exchange_rate: runtime_types::snowbridge_core::pricing::UD60x18, - delivery_cost: ::core::primitive::u128, - multiplier: runtime_types::snowbridge_core::pricing::UD60x18, - }, - } - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] pub struct Initializer { pub params: ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u8>, @@ -2953,11 +2859,6 @@ pub mod api { } } #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct Fee<_0> { - pub local: _0, - pub remote: _0, - } - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] pub enum SendError { #[codec(index = 0)] MessageTooLarge, @@ -2981,8 +2882,6 @@ pub mod api { pub local: _0, pub remote: runtime_types::primitive_types::U256, } - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct UD60x18(pub runtime_types::primitive_types::U256); } #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] pub struct Channel { @@ -3002,19 +2901,6 @@ pub mod api { } } } - pub mod snowbridge_outbound_queue_merkle_tree { - use super::runtime_types; - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct MerkleProof { - pub root: ::subxt::ext::subxt_core::utils::H256, - pub proof: ::subxt::ext::subxt_core::alloc::vec::Vec< - ::subxt::ext::subxt_core::utils::H256, - >, - pub number_of_leaves: ::core::primitive::u64, - pub leaf_index: ::core::primitive::u64, - pub leaf: ::subxt::ext::subxt_core::utils::H256, - } - } pub mod snowbridge_pallet_ethereum_client { use super::runtime_types; pub mod pallet { @@ -3454,15 +3340,6 @@ pub mod api { PartialEq, )] pub struct Slot(pub ::core::primitive::u64); - #[derive( - ::codec::Decode, - ::codec::Encode, - ::subxt::ext::subxt_core::ext::codec::CompactAs, - Clone, - Debug, - PartialEq, - )] - pub struct SlotDuration(pub ::core::primitive::u64); } pub mod sp_core { use super::runtime_types; @@ -3491,40 +3368,12 @@ pub mod api { pub struct Signature(pub [::core::primitive::u8; 64usize]); } #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct OpaqueMetadata( - pub ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u8>, - ); - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] pub enum Void {} } - pub mod sp_inherents { - use super::runtime_types; - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct CheckInherentsResult { - pub okay: ::core::primitive::bool, - pub fatal_error: ::core::primitive::bool, - pub errors: runtime_types::sp_inherents::InherentData, - } - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct InherentData { - pub data: ::subxt::ext::subxt_core::utils::KeyedVec< - [::core::primitive::u8; 8usize], - ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u8>, - >, - } - } pub mod sp_runtime { use super::runtime_types; pub mod generic { use super::runtime_types; - pub mod block { - use super::runtime_types; - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct Block<_0, _1> { - pub header: _0, - pub extrinsics: ::subxt::ext::subxt_core::alloc::vec::Vec<_1>, - } - } pub mod digest { use super::runtime_types; #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] @@ -3551,71 +3400,6 @@ pub mod api { } } } - pub mod transaction_validity { - use super::runtime_types; - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub enum InvalidTransaction { - #[codec(index = 0)] - Call, - #[codec(index = 1)] - Payment, - #[codec(index = 2)] - Future, - #[codec(index = 3)] - Stale, - #[codec(index = 4)] - BadProof, - #[codec(index = 5)] - AncientBirthBlock, - #[codec(index = 6)] - ExhaustsResources, - #[codec(index = 7)] - Custom(::core::primitive::u8), - #[codec(index = 8)] - BadMandatory, - #[codec(index = 9)] - MandatoryValidation, - #[codec(index = 10)] - BadSigner, - } - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub enum TransactionSource { - #[codec(index = 0)] - InBlock, - #[codec(index = 1)] - Local, - #[codec(index = 2)] - External, - } - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub enum TransactionValidityError { - #[codec(index = 0)] - Invalid(runtime_types::sp_runtime::transaction_validity::InvalidTransaction), - #[codec(index = 1)] - Unknown(runtime_types::sp_runtime::transaction_validity::UnknownTransaction), - } - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub enum UnknownTransaction { - #[codec(index = 0)] - CannotLookup, - #[codec(index = 1)] - NoUnsignedValidator, - #[codec(index = 2)] - Custom(::core::primitive::u8), - } - #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] - pub struct ValidTransaction { - pub priority: ::core::primitive::u64, - pub requires: ::subxt::ext::subxt_core::alloc::vec::Vec< - ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u8>, - >, - pub provides: ::subxt::ext::subxt_core::alloc::vec::Vec< - ::subxt::ext::subxt_core::alloc::vec::Vec<::core::primitive::u8>, - >, - pub longevity: ::core::primitive::u64, - pub propagate: ::core::primitive::bool, - } - } #[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)] pub enum DispatchError { #[codec(index = 0)] diff --git a/relay-clients/client-bridge-hub-kusama/src/lib.rs b/relay-clients/client-bridge-hub-kusama/src/lib.rs index 3980833a2c..a8d47fdead 100644 --- a/relay-clients/client-bridge-hub-kusama/src/lib.rs +++ b/relay-clients/client-bridge-hub-kusama/src/lib.rs @@ -18,8 +18,9 @@ pub mod codegen_runtime; -use bp_bridge_hub_kusama::{SignedExtension, AVERAGE_BLOCK_INTERVAL}; +use bp_bridge_hub_kusama::AVERAGE_BLOCK_INTERVAL; use bp_polkadot::SuffixedCommonSignedExtensionExt; +use bp_polkadot_core::SuffixedCommonSignedExtension; use codec::Encode; use relay_substrate_client::{ calls::UtilityCall as MockUtilityCall, Chain, ChainWithBalances, ChainWithMessages, @@ -32,6 +33,20 @@ use sp_runtime::{generic::SignedPayload, traits::IdentifyAccount}; use std::time::Duration; pub use codegen_runtime::api::runtime_types; +use runtime_types::frame_metadata_hash_extension::Mode; + +use bp_runtime::extensions::{ + BridgeRejectObsoleteHeadersAndMessages, GenericSignedExtensionSchema, + RefundBridgedParachainMessagesSchema, +}; + +pub type CheckMetadataHash = GenericSignedExtensionSchema>; + +pub type SignedExtension = SuffixedCommonSignedExtension<( + BridgeRejectObsoleteHeadersAndMessages, + RefundBridgedParachainMessagesSchema, + CheckMetadataHash, +)>; pub type RuntimeCall = runtime_types::bridge_hub_kusama_runtime::RuntimeCall; pub type BridgeMessagesCall = runtime_types::pallet_bridge_messages::pallet::Call; @@ -96,7 +111,7 @@ impl ChainWithTransactions for BridgeHubKusama { param.genesis_hash, unsigned.nonce, unsigned.tip, - (((), ()), ((), ())), + (((), (), Mode::Disabled), ((), (), None)), ), )?; @@ -125,5 +140,5 @@ impl ChainWithMessages for BridgeHubKusama { impl ChainWithRuntimeVersion for BridgeHubKusama { const RUNTIME_VERSION: Option = - Some(SimpleRuntimeVersion { spec_version: 1_002_004, transaction_version: 4 }); + Some(SimpleRuntimeVersion { spec_version: 1_002_005, transaction_version: 5 }); } diff --git a/substrate-relay/Cargo.toml b/substrate-relay/Cargo.toml index 6aa049ca56..1d4d6bb5e8 100644 --- a/substrate-relay/Cargo.toml +++ b/substrate-relay/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "substrate-relay" -version = "1.6.2" +version = "1.6.3" authors.workspace = true edition.workspace = true license = "GPL-3.0-or-later WITH Classpath-exception-2.0"