Skip to content

Commit

Permalink
Use generated runtimes for BHR/BHW (paritytech#2106)
Browse files Browse the repository at this point in the history
* Use generated runtimes for BHR/BHW

* Deduplicate BHR/BHW runtimes

* Add script for regenerating runtimes
  • Loading branch information
serban300 committed Apr 10, 2024
1 parent 7ed68b9 commit ef9823d
Show file tree
Hide file tree
Showing 16 changed files with 3,647 additions and 411 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ impl MessagesCliBridge for BridgeHubRococoToBridgeHubWococoMessagesCliBridge {
substrate_relay_helper::generate_receive_message_proof_call_builder!(
BridgeHubRococoMessagesToBridgeHubWococoMessageLane,
BridgeHubRococoMessagesToBridgeHubWococoMessageLaneReceiveMessagesProofCallBuilder,
relay_bridge_hub_wococo_client::runtime::Call::BridgeRococoMessages,
relay_bridge_hub_wococo_client::runtime::BridgeRococoMessagesCall::receive_messages_proof
relay_bridge_hub_wococo_client::RuntimeCall::BridgeRococoMessages,
relay_bridge_hub_wococo_client::BridgeMessagesCall::receive_messages_proof
);

substrate_relay_helper::generate_receive_message_delivery_proof_call_builder!(
BridgeHubRococoMessagesToBridgeHubWococoMessageLane,
BridgeHubRococoMessagesToBridgeHubWococoMessageLaneReceiveMessagesDeliveryProofCallBuilder,
relay_bridge_hub_rococo_client::runtime::Call::BridgeWococoMessages,
relay_bridge_hub_rococo_client::runtime::BridgeWococoMessagesCall::receive_messages_delivery_proof
relay_bridge_hub_rococo_client::RuntimeCall::BridgeWococoMessages,
relay_bridge_hub_rococo_client::BridgeMessagesCall::receive_messages_delivery_proof
);

/// Description of BridgeHubRococo -> BridgeHubWococo messages bridge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ impl MessagesCliBridge for BridgeHubWococoToBridgeHubRococoMessagesCliBridge {
substrate_relay_helper::generate_receive_message_proof_call_builder!(
BridgeHubWococoMessagesToBridgeHubRococoMessageLane,
BridgeHubWococoMessagesToBridgeHubRococoMessageLaneReceiveMessagesProofCallBuilder,
relay_bridge_hub_rococo_client::runtime::Call::BridgeWococoMessages,
relay_bridge_hub_rococo_client::runtime::BridgeWococoMessagesCall::receive_messages_proof
relay_bridge_hub_rococo_client::RuntimeCall::BridgeWococoMessages,
relay_bridge_hub_rococo_client::BridgeMessagesCall::receive_messages_proof
);

substrate_relay_helper::generate_receive_message_delivery_proof_call_builder!(
BridgeHubWococoMessagesToBridgeHubRococoMessageLane,
BridgeHubWococoMessagesToBridgeHubRococoMessageLaneReceiveMessagesDeliveryProofCallBuilder,
relay_bridge_hub_wococo_client::runtime::Call::BridgeRococoMessages,
relay_bridge_hub_wococo_client::runtime::BridgeRococoMessagesCall::receive_messages_delivery_proof
relay_bridge_hub_wococo_client::RuntimeCall::BridgeRococoMessages,
relay_bridge_hub_wococo_client::BridgeMessagesCall::receive_messages_delivery_proof
);

/// Description of BridgeHubWococo -> BridgeHubRococo messages bridge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ pub struct RococoFinalityToBridgeHubWococo;
substrate_relay_helper::generate_submit_finality_proof_call_builder!(
RococoFinalityToBridgeHubWococo,
RococoFinalityToBridgeHubWococoCallBuilder,
relay_bridge_hub_wococo_client::runtime::Call::BridgeRococoGrandpa,
relay_bridge_hub_wococo_client::runtime::BridgeRococoGrandpaCall::submit_finality_proof
relay_bridge_hub_wococo_client::RuntimeCall::BridgeRococoGrandpa,
relay_bridge_hub_wococo_client::BridgeGrandpaCall::submit_finality_proof
);

#[async_trait]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ impl SubmitParachainHeadsCallBuilder<BridgeHubRococoToBridgeHubWococo>
parachains: Vec<(ParaId, ParaHash)>,
parachain_heads_proof: ParaHeadsProof,
) -> CallOf<relay_bridge_hub_wococo_client::BridgeHubWococo> {
relay_bridge_hub_wococo_client::runtime::Call::BridgeRococoParachain(
relay_bridge_hub_wococo_client::runtime::BridgeParachainCall::submit_parachain_heads {
relay_bridge_hub_wococo_client::RuntimeCall::BridgeRococoParachain(
relay_bridge_hub_wococo_client::BridgeParachainCall::submit_parachain_heads {
at_relay_block: (at_relay_block.0, at_relay_block.1),
parachains,
parachain_heads_proof,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ pub struct WococoFinalityToBridgeHubRococo;
substrate_relay_helper::generate_submit_finality_proof_call_builder!(
WococoFinalityToBridgeHubRococo,
WococoFinalityToBridgeHubRococoCallBuilder,
relay_bridge_hub_rococo_client::runtime::Call::BridgeWococoGrandpa,
relay_bridge_hub_rococo_client::runtime::BridgeWococoGrandpaCall::submit_finality_proof
relay_bridge_hub_rococo_client::RuntimeCall::BridgeWococoGrandpa,
relay_bridge_hub_rococo_client::BridgeGrandpaCall::submit_finality_proof
);

#[async_trait]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ impl SubmitParachainHeadsCallBuilder<BridgeHubWococoToBridgeHubRococo>
parachains: Vec<(ParaId, ParaHash)>,
parachain_heads_proof: ParaHeadsProof,
) -> CallOf<relay_bridge_hub_rococo_client::BridgeHubRococo> {
relay_bridge_hub_rococo_client::runtime::Call::BridgeWococoParachain(
bp_parachains::BridgeParachainCall::submit_parachain_heads {
relay_bridge_hub_rococo_client::RuntimeCall::BridgeWococoParachain(
relay_bridge_hub_rococo_client::BridgeParachainCall::submit_parachain_heads {
at_relay_block: (at_relay_block.0, at_relay_block.1),
parachains,
parachain_heads_proof,
Expand Down
12 changes: 4 additions & 8 deletions bridges/relays/bin-substrate/src/cli/init_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,8 @@ impl BridgeInitializer for RococoToBridgeHubWococoCliBridge {
fn encode_init_bridge(
init_data: <Self::Engine as Engine<Self::Source>>::InitializationData,
) -> <Self::Target as Chain>::Call {
relay_bridge_hub_wococo_client::runtime::Call::BridgeRococoGrandpa(
relay_bridge_hub_wococo_client::runtime::BridgeRococoGrandpaCall::initialize {
init_data,
},
relay_bridge_hub_wococo_client::RuntimeCall::BridgeRococoGrandpa(
relay_bridge_hub_wococo_client::BridgeGrandpaCall::initialize { init_data },
)
}
}
Expand All @@ -194,10 +192,8 @@ impl BridgeInitializer for WococoToBridgeHubRococoCliBridge {
fn encode_init_bridge(
init_data: <Self::Engine as Engine<Self::Source>>::InitializationData,
) -> <Self::Target as Chain>::Call {
relay_bridge_hub_rococo_client::runtime::Call::BridgeWococoGrandpa(
relay_bridge_hub_rococo_client::runtime::BridgeWococoGrandpaCall::initialize {
init_data,
},
relay_bridge_hub_rococo_client::RuntimeCall::BridgeWococoGrandpa(
relay_bridge_hub_rococo_client::BridgeGrandpaCall::initialize { init_data },
)
}
}
Expand Down
5 changes: 4 additions & 1 deletion bridges/relays/client-bridge-hub-rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.5", features = ["derive"] }
scale-info = { version = "2.6.0", default-features = false, features = ["derive"] }
relay-substrate-client = { path = "../client-substrate" }
subxt = { version = "0.28.0", default-features = false, features = [] }

# Bridge dependencies

Expand All @@ -17,12 +17,15 @@ bp-bridge-hub-wococo = { path = "../../primitives/chain-bridge-hub-wococo" }
bp-header-chain = { path = "../../primitives/header-chain" }
bp-messages = { path = "../../primitives/messages" }
bp-parachains = { path = "../../primitives/parachains" }
bp-polkadot-core = { path = "../../primitives/polkadot-core" }
bp-runtime = { path = "../../primitives/runtime" }
bp-wococo = { path = "../../primitives/chain-wococo" }

bridge-runtime-common = { path = "../../bin/runtime-common" }
relay-substrate-client = { path = "../client-substrate" }

# Substrate Dependencies

sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-weights = { git = "https://github.com/paritytech/substrate", branch = "master" }
Loading

0 comments on commit ef9823d

Please sign in to comment.