Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added version guards to RBH<>WBH GRANDPA finality (and complex) relay #1697

Merged
merged 1 commit into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
//! Rococo-to-Wococo bridge hubs headers sync entrypoint.

use crate::cli::bridge::{CliBridgeBase, RelayToRelayHeadersCliBridge};
use substrate_relay_helper::finality::{
engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalitySyncPipeline,

use async_trait::async_trait;
use relay_substrate_client::{AccountKeyPairOf, Client};
use substrate_relay_helper::{
finality::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalitySyncPipeline},
TransactionParams,
};

/// Description of Rococo -> Wococo finalized headers bridge.
Expand All @@ -32,12 +36,27 @@ substrate_relay_helper::generate_mocked_submit_finality_proof_call_builder!(
relay_bridge_hub_wococo_client::runtime::BridgeGrandpaRococoCall::submit_finality_proof
);

#[async_trait]
impl SubstrateFinalitySyncPipeline for RococoFinalityToBridgeHubWococo {
type SourceChain = relay_rococo_client::Rococo;
type TargetChain = relay_bridge_hub_wococo_client::BridgeHubWococo;

type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
type SubmitFinalityProofCallBuilder = RococoFinalityToBridgeHubWococoCallBuilder;

async fn start_relay_guards(
target_client: &Client<Self::TargetChain>,
_transaction_params: &TransactionParams<AccountKeyPairOf<Self::TargetChain>>,
enable_version_guard: bool,
) -> relay_substrate_client::Result<()> {
if enable_version_guard {
relay_substrate_client::guard::abort_on_spec_version_change(
target_client.clone(),
target_client.simple_runtime_version().await?.0,
);
}
Ok(())
}
}

/// `Rococo` to BridgeHub `Wococo` bridge definition.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
//! Wococo-to-Rococo bridge hubs headers sync entrypoint.

use crate::cli::bridge::{CliBridgeBase, RelayToRelayHeadersCliBridge};
use substrate_relay_helper::finality::{
engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalitySyncPipeline,

use async_trait::async_trait;
use relay_substrate_client::{AccountKeyPairOf, Client};
use substrate_relay_helper::{
finality::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalitySyncPipeline},
TransactionParams,
};

/// Description of Wococo -> Rococo finalized headers bridge.
Expand All @@ -32,12 +36,27 @@ substrate_relay_helper::generate_mocked_submit_finality_proof_call_builder!(
relay_bridge_hub_rococo_client::runtime::BridgeWococoGrandpaCall::submit_finality_proof
);

#[async_trait]
impl SubstrateFinalitySyncPipeline for WococoFinalityToBridgeHubRococo {
type SourceChain = relay_wococo_client::Wococo;
type TargetChain = relay_bridge_hub_rococo_client::BridgeHubRococo;

type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
type SubmitFinalityProofCallBuilder = WococoFinalityToBridgeHubRococoCallBuilder;

async fn start_relay_guards(
target_client: &Client<Self::TargetChain>,
_transaction_params: &TransactionParams<AccountKeyPairOf<Self::TargetChain>>,
enable_version_guard: bool,
) -> relay_substrate_client::Result<()> {
if enable_version_guard {
relay_substrate_client::guard::abort_on_spec_version_change(
target_client.clone(),
target_client.simple_runtime_version().await?.0,
);
}
Ok(())
}
}

/// `Wococo` to BridgeHub `Rococo` bridge definition.
Expand Down