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

Add basic equivocation detection pipeline schema #2338

Merged
merged 4 commits into from
Aug 11, 2023
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
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ use crate::cli::bridge::{CliBridgeBase, RelayToRelayHeadersCliBridge};
use async_trait::async_trait;
use relay_substrate_client::{AccountKeyPairOf, Client};
use substrate_relay_helper::{
finality::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalitySyncPipeline},
finality::SubstrateFinalitySyncPipeline,
finality_base::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalityPipeline},
TransactionParams,
};

Expand All @@ -37,11 +38,15 @@ substrate_relay_helper::generate_submit_finality_proof_call_builder!(
);

#[async_trait]
impl SubstrateFinalitySyncPipeline for KusamaFinalityToBridgeHubPolkadot {
impl SubstrateFinalityPipeline for KusamaFinalityToBridgeHubPolkadot {
type SourceChain = relay_kusama_client::Kusama;
type TargetChain = relay_bridge_hub_polkadot_client::BridgeHubPolkadot;

type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
}

#[async_trait]
impl SubstrateFinalitySyncPipeline for KusamaFinalityToBridgeHubPolkadot {
type SubmitFinalityProofCallBuilder = KusamaFinalityToBridgeHubPolkadotCallBuilder;

async fn start_relay_guards(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ use crate::cli::bridge::{CliBridgeBase, RelayToRelayHeadersCliBridge};
use async_trait::async_trait;
use relay_substrate_client::{AccountKeyPairOf, Client};
use substrate_relay_helper::{
finality::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalitySyncPipeline},
finality::SubstrateFinalitySyncPipeline,
finality_base::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalityPipeline},
TransactionParams,
};

Expand All @@ -37,11 +38,15 @@ substrate_relay_helper::generate_submit_finality_proof_call_builder!(
);

#[async_trait]
impl SubstrateFinalitySyncPipeline for PolkadotFinalityToBridgeHubKusama {
impl SubstrateFinalityPipeline for PolkadotFinalityToBridgeHubKusama {
type SourceChain = relay_polkadot_client::Polkadot;
type TargetChain = relay_bridge_hub_kusama_client::BridgeHubKusama;

type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
}

#[async_trait]
impl SubstrateFinalitySyncPipeline for PolkadotFinalityToBridgeHubKusama {
type SubmitFinalityProofCallBuilder = PolkadotFinalityToBridgeHubKusamaCallBuilder;

async fn start_relay_guards(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@
//! Millau-to-Rialto headers sync entrypoint.

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

/// Description of Millau -> Rialto finalized headers bridge.
#[derive(Clone, Debug)]
pub struct MillauFinalityToRialto;

impl SubstrateFinalitySyncPipeline for MillauFinalityToRialto {
impl SubstrateFinalityPipeline for MillauFinalityToRialto {
type SourceChain = relay_millau_client::Millau;
type TargetChain = relay_rialto_client::Rialto;

type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
}

impl SubstrateFinalitySyncPipeline for MillauFinalityToRialto {
type SubmitFinalityProofCallBuilder = DirectSubmitGrandpaFinalityProofCallBuilder<
Self,
rialto_runtime::Runtime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@
//! Rialto-to-Millau headers sync entrypoint.

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

/// Description of Millau -> Rialto finalized headers bridge.
#[derive(Clone, Debug)]
pub struct RialtoFinalityToMillau;

impl SubstrateFinalitySyncPipeline for RialtoFinalityToMillau {
impl SubstrateFinalityPipeline for RialtoFinalityToMillau {
type SourceChain = relay_rialto_client::Rialto;
type TargetChain = relay_millau_client::Millau;

type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
}

impl SubstrateFinalitySyncPipeline for RialtoFinalityToMillau {
type SubmitFinalityProofCallBuilder = DirectSubmitGrandpaFinalityProofCallBuilder<
Self,
millau_runtime::Runtime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
//! Millau-to-RialtoParachain headers sync entrypoint.

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

substrate_relay_helper::generate_submit_finality_proof_call_builder!(
Expand All @@ -50,11 +51,14 @@ substrate_relay_helper::generate_submit_finality_proof_call_builder!(
#[derive(Clone, Debug)]
pub struct MillauFinalityToRialtoParachain;

impl SubstrateFinalitySyncPipeline for MillauFinalityToRialtoParachain {
impl SubstrateFinalityPipeline for MillauFinalityToRialtoParachain {
type SourceChain = relay_millau_client::Millau;
type TargetChain = relay_rialto_parachain_client::RialtoParachain;

type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
}

impl SubstrateFinalitySyncPipeline for MillauFinalityToRialtoParachain {
type SubmitFinalityProofCallBuilder = MillauFinalityToRialtoParachainCallBuilder;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ use crate::cli::bridge::{CliBridgeBase, RelayToRelayHeadersCliBridge};
use async_trait::async_trait;
use relay_substrate_client::{AccountKeyPairOf, Client};
use substrate_relay_helper::{
finality::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalitySyncPipeline},
finality::SubstrateFinalitySyncPipeline,
finality_base::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalityPipeline},
TransactionParams,
};

Expand All @@ -37,11 +38,15 @@ substrate_relay_helper::generate_submit_finality_proof_call_builder!(
);

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

type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
}

#[async_trait]
impl SubstrateFinalitySyncPipeline for RococoFinalityToBridgeHubWococo {
type SubmitFinalityProofCallBuilder = RococoFinalityToBridgeHubWococoCallBuilder;

async fn start_relay_guards(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ use crate::cli::bridge::{CliBridgeBase, RelayToRelayHeadersCliBridge};
use async_trait::async_trait;
use relay_substrate_client::{AccountKeyPairOf, Client};
use substrate_relay_helper::{
finality::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalitySyncPipeline},
finality::SubstrateFinalitySyncPipeline,
finality_base::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalityPipeline},
TransactionParams,
};

Expand All @@ -37,11 +38,15 @@ substrate_relay_helper::generate_submit_finality_proof_call_builder!(
);

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

type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
}

#[async_trait]
impl SubstrateFinalitySyncPipeline for WococoFinalityToBridgeHubRococo {
type SubmitFinalityProofCallBuilder = WococoFinalityToBridgeHubRococoCallBuilder;

async fn start_relay_guards(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@
//! Westend-to-Millau headers sync entrypoint.

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

/// Description of Westend -> Millau finalized headers bridge.
#[derive(Clone, Debug)]
pub struct WestendFinalityToMillau;

impl SubstrateFinalitySyncPipeline for WestendFinalityToMillau {
impl SubstrateFinalityPipeline for WestendFinalityToMillau {
type SourceChain = relay_westend_client::Westend;
type TargetChain = relay_millau_client::Millau;

type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
}

impl SubstrateFinalitySyncPipeline for WestendFinalityToMillau {
type SubmitFinalityProofCallBuilder = DirectSubmitGrandpaFinalityProofCallBuilder<
Self,
millau_runtime::Runtime,
Expand Down
2 changes: 1 addition & 1 deletion relays/bin-substrate/src/cli/init_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use relay_substrate_client::{AccountKeyPairOf, Chain, UnsignedTransaction};
use sp_core::Pair;
use structopt::StructOpt;
use strum::{EnumString, EnumVariantNames, VariantNames};
use substrate_relay_helper::finality::engine::{Engine, Grandpa as GrandpaFinalityEngine};
use substrate_relay_helper::finality_base::engine::{Engine, Grandpa as GrandpaFinalityEngine};

/// Initialize bridge pallet.
#[derive(StructOpt)]
Expand Down
1 change: 1 addition & 0 deletions relays/client-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ bp-kusama = { path = "../../primitives/chain-kusama" }
# Substrate Dependencies

sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master" }
3 changes: 3 additions & 0 deletions relays/client-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use relay_substrate_client::{
Chain, ChainWithBalances, ChainWithGrandpa, RelayChain, UnderlyingChainProvider,
};
use sp_core::storage::StorageKey;
use sp_session::MembershipProof;
use std::time::Duration;

/// Kusama header id.
Expand Down Expand Up @@ -50,6 +51,8 @@ impl Chain for Kusama {
impl ChainWithGrandpa for Kusama {
const SYNCED_HEADERS_GRANDPA_INFO_METHOD: &'static str =
KUSAMA_SYNCED_HEADERS_GRANDPA_INFO_METHOD;

type KeyOwnerProof = MembershipProof;
}

impl ChainWithBalances for Kusama {
Expand Down
1 change: 1 addition & 0 deletions relays/client-millau/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ frame-system = { git = "https://github.com/paritytech/substrate", branch = "mast
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master" }
3 changes: 3 additions & 0 deletions relays/client-millau/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use relay_substrate_client::{
};
use sp_core::{storage::StorageKey, Pair};
use sp_runtime::{generic::SignedPayload, traits::IdentifyAccount};
use sp_session::MembershipProof;
use std::time::Duration;

/// Millau header id.
Expand Down Expand Up @@ -60,6 +61,8 @@ impl Chain for Millau {
impl ChainWithGrandpa for Millau {
const SYNCED_HEADERS_GRANDPA_INFO_METHOD: &'static str =
MILLAU_SYNCED_HEADERS_GRANDPA_INFO_METHOD;

type KeyOwnerProof = MembershipProof;
}

impl ChainWithBalances for Millau {
Expand Down
1 change: 1 addition & 0 deletions relays/client-polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ bp-polkadot = { path = "../../primitives/chain-polkadot" }
# Substrate Dependencies

sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master" }
3 changes: 3 additions & 0 deletions relays/client-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use relay_substrate_client::{
Chain, ChainWithBalances, ChainWithGrandpa, RelayChain, UnderlyingChainProvider,
};
use sp_core::storage::StorageKey;
use sp_session::MembershipProof;
use std::time::Duration;

/// Polkadot header id.
Expand Down Expand Up @@ -50,6 +51,8 @@ impl Chain for Polkadot {
impl ChainWithGrandpa for Polkadot {
const SYNCED_HEADERS_GRANDPA_INFO_METHOD: &'static str =
POLKADOT_SYNCED_HEADERS_GRANDPA_INFO_METHOD;

type KeyOwnerProof = MembershipProof;
}

impl ChainWithBalances for Polkadot {
Expand Down
1 change: 1 addition & 0 deletions relays/client-rialto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ frame-support = { git = "https://github.com/paritytech/substrate", branch = "mas
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master" }
3 changes: 3 additions & 0 deletions relays/client-rialto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use relay_substrate_client::{
};
use sp_core::{storage::StorageKey, Pair};
use sp_runtime::{generic::SignedPayload, traits::IdentifyAccount};
use sp_session::MembershipProof;
use std::time::Duration;

/// Rialto header id.
Expand All @@ -51,6 +52,8 @@ impl Chain for Rialto {
impl ChainWithGrandpa for Rialto {
const SYNCED_HEADERS_GRANDPA_INFO_METHOD: &'static str =
RIALTO_SYNCED_HEADERS_GRANDPA_INFO_METHOD;

type KeyOwnerProof = MembershipProof;
}

impl RelayChain for Rialto {
Expand Down
1 change: 1 addition & 0 deletions relays/client-rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ bp-rococo = { path = "../../primitives/chain-rococo" }
# Substrate Dependencies

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