Skip to content

Commit

Permalink
Align with BridgesV2 backports - companion for paritytech/polkadot-sd…
Browse files Browse the repository at this point in the history
…k#4935 (#3022)

* Companion for paritytech/polkadot-sdk#4935

* Fix imports for `FromBridgedChainMessagesProof` / `FromBridgedChainMessagesDeliveryProof`

* Align with `polkadot-sdk`

* Align with actual `polkadot-sdk`

* Align with actual `polkadot-sdk`

* fmt

* Undienerize back to master

* Update tools/runtime-codegen
  • Loading branch information
bkontur authored Jul 12, 2024
1 parent d85fc52 commit 5a5206b
Show file tree
Hide file tree
Showing 19 changed files with 1,338 additions and 943 deletions.
1,659 changes: 1,010 additions & 649 deletions Cargo.lock

Large diffs are not rendered by default.

46 changes: 22 additions & 24 deletions relay-clients/client-bridge-hub-kusama/src/codegen_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1346,30 +1346,28 @@ pub mod api {
#[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)]
pub enum Call {
#[codec(index = 0)]
set_owner {
new_owner: ::core::option::Option<::sp_core::crypto::AccountId32>,
},
#[codec(index = 1)]
set_operating_mode {
operating_mode: runtime_types::bp_messages::MessagesOperatingMode,
},
#[codec(index = 2)]
receive_messages_proof {
relayer_id_at_bridged_chain: ::sp_core::crypto::AccountId32,
proof: ::bridge_runtime_common::messages::target::FromBridgedChainMessagesProof<
::subxt::ext::subxt_core::utils::H256,
>,
messages_count: ::core::primitive::u32,
dispatch_weight: ::sp_weights::Weight,
},
#[codec(index = 3)]
receive_messages_delivery_proof {
proof: ::bridge_runtime_common::messages::source::FromBridgedChainMessagesDeliveryProof<
::subxt::ext::subxt_core::utils::H256,
>,
relayers_state: ::bp_messages::UnrewardedRelayersState,
},
}
set_owner { new_owner: ::core::option::Option<::sp_core::crypto::AccountId32> },
#[codec(index = 1)]
set_operating_mode {
operating_mode: runtime_types::bp_messages::MessagesOperatingMode,
},
#[codec(index = 2)]
receive_messages_proof {
relayer_id_at_bridged_chain: ::sp_core::crypto::AccountId32,
proof: ::bp_messages::target_chain::FromBridgedChainMessagesProof<
::subxt::ext::subxt_core::utils::H256,
>,
messages_count: ::core::primitive::u32,
dispatch_weight: ::sp_weights::Weight,
},
#[codec(index = 3)]
receive_messages_delivery_proof {
proof: ::bp_messages::source_chain::FromBridgedChainMessagesDeliveryProof<
::subxt::ext::subxt_core::utils::H256,
>,
relayers_state: ::bp_messages::UnrewardedRelayersState,
},
}
#[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)]
pub enum Error {
#[codec(index = 0)]
Expand Down
46 changes: 22 additions & 24 deletions relay-clients/client-bridge-hub-polkadot/src/codegen_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1346,30 +1346,28 @@ pub mod api {
#[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)]
pub enum Call {
#[codec(index = 0)]
set_owner {
new_owner: ::core::option::Option<::sp_core::crypto::AccountId32>,
},
#[codec(index = 1)]
set_operating_mode {
operating_mode: runtime_types::bp_messages::MessagesOperatingMode,
},
#[codec(index = 2)]
receive_messages_proof {
relayer_id_at_bridged_chain: ::sp_core::crypto::AccountId32,
proof: ::bridge_runtime_common::messages::target::FromBridgedChainMessagesProof<
::subxt::ext::subxt_core::utils::H256,
>,
messages_count: ::core::primitive::u32,
dispatch_weight: ::sp_weights::Weight,
},
#[codec(index = 3)]
receive_messages_delivery_proof {
proof: ::bridge_runtime_common::messages::source::FromBridgedChainMessagesDeliveryProof<
::subxt::ext::subxt_core::utils::H256,
>,
relayers_state: ::bp_messages::UnrewardedRelayersState,
},
}
set_owner { new_owner: ::core::option::Option<::sp_core::crypto::AccountId32> },
#[codec(index = 1)]
set_operating_mode {
operating_mode: runtime_types::bp_messages::MessagesOperatingMode,
},
#[codec(index = 2)]
receive_messages_proof {
relayer_id_at_bridged_chain: ::sp_core::crypto::AccountId32,
proof: ::bp_messages::target_chain::FromBridgedChainMessagesProof<
::subxt::ext::subxt_core::utils::H256,
>,
messages_count: ::core::primitive::u32,
dispatch_weight: ::sp_weights::Weight,
},
#[codec(index = 3)]
receive_messages_delivery_proof {
proof: ::bp_messages::source_chain::FromBridgedChainMessagesDeliveryProof<
::subxt::ext::subxt_core::utils::H256,
>,
relayers_state: ::bp_messages::UnrewardedRelayersState,
},
}
#[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)]
pub enum Error {
#[codec(index = 0)]
Expand Down
46 changes: 22 additions & 24 deletions relay-clients/client-bridge-hub-rococo/src/codegen_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1419,30 +1419,28 @@ pub mod api {
#[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)]
pub enum Call {
#[codec(index = 0)]
set_owner {
new_owner: ::core::option::Option<::sp_core::crypto::AccountId32>,
},
#[codec(index = 1)]
set_operating_mode {
operating_mode: runtime_types::bp_messages::MessagesOperatingMode,
},
#[codec(index = 2)]
receive_messages_proof {
relayer_id_at_bridged_chain: ::sp_core::crypto::AccountId32,
proof: ::bridge_runtime_common::messages::target::FromBridgedChainMessagesProof<
::subxt::ext::subxt_core::utils::H256,
>,
messages_count: ::core::primitive::u32,
dispatch_weight: ::sp_weights::Weight,
},
#[codec(index = 3)]
receive_messages_delivery_proof {
proof: ::bridge_runtime_common::messages::source::FromBridgedChainMessagesDeliveryProof<
::subxt::ext::subxt_core::utils::H256,
>,
relayers_state: ::bp_messages::UnrewardedRelayersState,
},
}
set_owner { new_owner: ::core::option::Option<::sp_core::crypto::AccountId32> },
#[codec(index = 1)]
set_operating_mode {
operating_mode: runtime_types::bp_messages::MessagesOperatingMode,
},
#[codec(index = 2)]
receive_messages_proof {
relayer_id_at_bridged_chain: ::sp_core::crypto::AccountId32,
proof: ::bp_messages::target_chain::FromBridgedChainMessagesProof<
::subxt::ext::subxt_core::utils::H256,
>,
messages_count: ::core::primitive::u32,
dispatch_weight: ::sp_weights::Weight,
},
#[codec(index = 3)]
receive_messages_delivery_proof {
proof: ::bp_messages::source_chain::FromBridgedChainMessagesDeliveryProof<
::subxt::ext::subxt_core::utils::H256,
>,
relayers_state: ::bp_messages::UnrewardedRelayersState,
},
}
#[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)]
pub enum Error {
#[codec(index = 0)]
Expand Down
46 changes: 22 additions & 24 deletions relay-clients/client-bridge-hub-westend/src/codegen_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1359,30 +1359,28 @@ pub mod api {
#[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)]
pub enum Call {
#[codec(index = 0)]
set_owner {
new_owner: ::core::option::Option<::sp_core::crypto::AccountId32>,
},
#[codec(index = 1)]
set_operating_mode {
operating_mode: runtime_types::bp_messages::MessagesOperatingMode,
},
#[codec(index = 2)]
receive_messages_proof {
relayer_id_at_bridged_chain: ::sp_core::crypto::AccountId32,
proof: ::bridge_runtime_common::messages::target::FromBridgedChainMessagesProof<
::subxt::ext::subxt_core::utils::H256,
>,
messages_count: ::core::primitive::u32,
dispatch_weight: ::sp_weights::Weight,
},
#[codec(index = 3)]
receive_messages_delivery_proof {
proof: ::bridge_runtime_common::messages::source::FromBridgedChainMessagesDeliveryProof<
::subxt::ext::subxt_core::utils::H256,
>,
relayers_state: ::bp_messages::UnrewardedRelayersState,
},
}
set_owner { new_owner: ::core::option::Option<::sp_core::crypto::AccountId32> },
#[codec(index = 1)]
set_operating_mode {
operating_mode: runtime_types::bp_messages::MessagesOperatingMode,
},
#[codec(index = 2)]
receive_messages_proof {
relayer_id_at_bridged_chain: ::sp_core::crypto::AccountId32,
proof: ::bp_messages::target_chain::FromBridgedChainMessagesProof<
::subxt::ext::subxt_core::utils::H256,
>,
messages_count: ::core::primitive::u32,
dispatch_weight: ::sp_weights::Weight,
},
#[codec(index = 3)]
receive_messages_delivery_proof {
proof: ::bp_messages::source_chain::FromBridgedChainMessagesDeliveryProof<
::subxt::ext::subxt_core::utils::H256,
>,
relayers_state: ::bp_messages::UnrewardedRelayersState,
},
}
#[derive(::codec::Decode, ::codec::Encode, Clone, Debug, PartialEq)]
pub enum Error {
#[codec(index = 0)]
Expand Down
24 changes: 23 additions & 1 deletion relay-clients/client-polkadot-bulletin/src/codegen_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,29 @@ pub mod api {
use super::runtime_types;
#[derive(:: codec :: Decode, :: codec :: Encode, Clone, Debug, PartialEq)]
pub enum Call {
# [codec (index = 0)] set_owner { new_owner : :: core :: option :: Option < :: sp_core :: crypto :: AccountId32 > , } , # [codec (index = 1)] set_operating_mode { operating_mode : runtime_types :: bp_messages :: MessagesOperatingMode , } , # [codec (index = 2)] receive_messages_proof { relayer_id_at_bridged_chain : :: sp_core :: crypto :: AccountId32 , proof : :: bridge_runtime_common :: messages :: target :: FromBridgedChainMessagesProof < :: subxt :: utils :: H256 > , messages_count : :: core :: primitive :: u32 , dispatch_weight : :: sp_weights :: Weight , } , # [codec (index = 3)] receive_messages_delivery_proof { proof : :: bridge_runtime_common :: messages :: source :: FromBridgedChainMessagesDeliveryProof < :: subxt :: utils :: H256 > , relayers_state : :: bp_messages :: UnrewardedRelayersState , } , }
#[codec(index = 0)]
set_owner { new_owner: ::core::option::Option<::sp_core::crypto::AccountId32> },
#[codec(index = 1)]
set_operating_mode {
operating_mode: runtime_types::bp_messages::MessagesOperatingMode,
},
#[codec(index = 2)]
receive_messages_proof {
relayer_id_at_bridged_chain: ::sp_core::crypto::AccountId32,
proof: ::bp_messages::target_chain::FromBridgedChainMessagesProof<
::subxt::utils::H256,
>,
messages_count: ::core::primitive::u32,
dispatch_weight: ::sp_weights::Weight,
},
#[codec(index = 3)]
receive_messages_delivery_proof {
proof: ::bp_messages::source_chain::FromBridgedChainMessagesDeliveryProof<
::subxt::utils::H256,
>,
relayers_state: ::bp_messages::UnrewardedRelayersState,
},
}
#[derive(:: codec :: Decode, :: codec :: Encode, Clone, Debug, PartialEq)]
pub enum Error {
# [codec (index = 0)] NotOperatingNormally , # [codec (index = 1)] InactiveOutboundLane , # [codec (index = 2)] MessageDispatchInactive , # [codec (index = 3)] MessageRejectedByChainVerifier (runtime_types :: bp_messages :: VerificationError ,) , # [codec (index = 4)] MessageRejectedByLaneVerifier (runtime_types :: bp_messages :: VerificationError ,) , # [codec (index = 5)] MessageRejectedByPallet (runtime_types :: bp_messages :: VerificationError ,) , # [codec (index = 6)] FailedToWithdrawMessageFee , # [codec (index = 7)] TooManyMessagesInTheProof , # [codec (index = 8)] InvalidMessagesProof , # [codec (index = 9)] InvalidMessagesDeliveryProof , # [codec (index = 10)] InvalidUnrewardedRelayersState , # [codec (index = 11)] InsufficientDispatchWeight , # [codec (index = 12)] MessageIsNotYetSent , # [codec (index = 13)] ReceivalConfirmation (runtime_types :: pallet_bridge_messages :: outbound_lane :: ReceivalConfirmationError ,) , # [codec (index = 14)] BridgeModule (runtime_types :: bp_runtime :: OwnedBridgeModuleError ,) , }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use relay_bridge_hub_kusama_client::BridgeHubKusama;
use relay_bridge_hub_polkadot_client::BridgeHubPolkadot;
use substrate_relay_helper::{
cli::bridge::{CliBridgeBase, MessagesCliBridge},
messages_lane::SubstrateMessageLane,
messages::SubstrateMessageLane,
UtilityPalletBatchCallBuilder,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use relay_bridge_hub_kusama_client::BridgeHubKusama;
use relay_bridge_hub_polkadot_client::BridgeHubPolkadot;
use substrate_relay_helper::{
cli::bridge::{CliBridgeBase, MessagesCliBridge},
messages_lane::SubstrateMessageLane,
messages::SubstrateMessageLane,
UtilityPalletBatchCallBuilder,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use relay_bridge_hub_polkadot_client::BridgeHubPolkadot;
use relay_polkadot_bulletin_client::PolkadotBulletin;
use substrate_relay_helper::{
cli::bridge::{CliBridgeBase, MessagesCliBridge},
messages_lane::SubstrateMessageLane,
messages::SubstrateMessageLane,
UtilityPalletBatchCallBuilder,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use relay_bridge_hub_polkadot_client::BridgeHubPolkadot;
use relay_polkadot_bulletin_client::PolkadotBulletin;
use substrate_relay_helper::{
cli::bridge::{CliBridgeBase, MessagesCliBridge},
messages_lane::SubstrateMessageLane,
messages::SubstrateMessageLane,
UtilityPalletBatchCallBuilder,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use bp_polkadot_core::parachains::{ParaHash, ParaHeadsProof, ParaId};
use bp_runtime::Chain;
use relay_substrate_client::{CallOf, HeaderIdOf};
use substrate_relay_helper::{
messages_lane::MessagesRelayLimits,
messages::MessagesRelayLimits,
parachains::{SubmitParachainHeadsCallBuilder, SubstrateParachainsPipeline},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use super::BridgeHubRococoAsBridgeHubPolkadot;
use relay_polkadot_bulletin_client::PolkadotBulletin as RococoBulletin;
use substrate_relay_helper::{
cli::bridge::{CliBridgeBase, MessagesCliBridge},
messages_lane::SubstrateMessageLane,
messages::SubstrateMessageLane,
UtilityPalletBatchCallBuilder,
};

Expand Down
6 changes: 5 additions & 1 deletion substrate-relay/src/bridges/rococo_bulletin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use bp_runtime::{
AccountIdOf, BalanceOf, BlockNumberOf, ChainId, HashOf, HasherOf, HeaderOf, NonceOf,
SignatureOf,
};
use frame_support::pallet_prelude::Weight;
use frame_support::{pallet_prelude::Weight, sp_runtime::StateVersion};
use relay_substrate_client::{
ChainWithRuntimeVersion, Error as SubstrateError, SignParam, SimpleRuntimeVersion,
UnsignedTransaction,
Expand Down Expand Up @@ -51,6 +51,8 @@ impl bp_runtime::Chain for RococoBaseAsPolkadot {
type Nonce = NonceOf<bp_rococo::Rococo>;
type Signature = SignatureOf<bp_rococo::Rococo>;

const STATE_VERSION: StateVersion = StateVersion::V1;

fn max_extrinsic_size() -> u32 {
bp_rococo::Rococo::max_extrinsic_size()
}
Expand Down Expand Up @@ -150,6 +152,8 @@ impl bp_runtime::Chain for BaseBridgeHubRococoAsBridgeHubPolkadot {
type Nonce = NonceOf<bp_bridge_hub_rococo::BridgeHubRococo>;
type Signature = SignatureOf<bp_bridge_hub_rococo::BridgeHubRococo>;

const STATE_VERSION: StateVersion = StateVersion::V1;

fn max_extrinsic_size() -> u32 {
bp_bridge_hub_rococo::BridgeHubRococo::max_extrinsic_size()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use super::BridgeHubRococoAsBridgeHubPolkadot;
use relay_polkadot_bulletin_client::PolkadotBulletin as RococoBulletin;
use substrate_relay_helper::{
cli::bridge::{CliBridgeBase, MessagesCliBridge},
messages_lane::SubstrateMessageLane,
messages::SubstrateMessageLane,
UtilityPalletBatchCallBuilder,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use bp_runtime::Chain;
use relay_substrate_client::{CallOf, HeaderIdOf};
use substrate_relay_helper::{
cli::bridge::{CliBridgeBase, MessagesCliBridge, ParachainToRelayHeadersCliBridge},
messages_lane::MessagesRelayLimits,
messages::MessagesRelayLimits,
parachains::{SubmitParachainHeadsCallBuilder, SubstrateParachainsPipeline},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use relay_bridge_hub_rococo_client::BridgeHubRococo;
use relay_bridge_hub_westend_client::BridgeHubWestend;
use substrate_relay_helper::{
cli::bridge::{CliBridgeBase, MessagesCliBridge},
messages_lane::SubstrateMessageLane,
messages::SubstrateMessageLane,
UtilityPalletBatchCallBuilder,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use relay_bridge_hub_rococo_client::BridgeHubRococo;
use relay_bridge_hub_westend_client::BridgeHubWestend;
use substrate_relay_helper::{
cli::bridge::{CliBridgeBase, MessagesCliBridge},
messages_lane::SubstrateMessageLane,
messages::SubstrateMessageLane,
UtilityPalletBatchCallBuilder,
};

Expand Down
Loading

0 comments on commit 5a5206b

Please sign in to comment.