Skip to content

Commit

Permalink
Move finality Engine to finality_base folder
Browse files Browse the repository at this point in the history
  • Loading branch information
serban300 committed Aug 9, 2023
1 parent 2a22466 commit 2f5d02e
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +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},
TransactionParams,
finality::SubstrateFinalitySyncPipeline,
finality_base::engine::Grandpa as GrandpaFinalityEngine, TransactionParams,
};

/// Description of Kusama -> PolkadotBridgeHub finalized headers bridge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +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},
TransactionParams,
finality::SubstrateFinalitySyncPipeline,
finality_base::engine::Grandpa as GrandpaFinalityEngine, TransactionParams,
};

/// Description of Polkadot -> KusamaBridgeHub finalized headers bridge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! 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,
};

/// Description of Millau -> Rialto finalized headers bridge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! 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,
};

/// Description of Millau -> Rialto finalized headers bridge.
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,
};

substrate_relay_helper::generate_submit_finality_proof_call_builder!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +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},
TransactionParams,
finality::SubstrateFinalitySyncPipeline,
finality_base::engine::Grandpa as GrandpaFinalityEngine, TransactionParams,
};

/// Description of Rococo -> Wococo finalized headers bridge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +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},
TransactionParams,
finality::SubstrateFinalitySyncPipeline,
finality_base::engine::Grandpa as GrandpaFinalityEngine, TransactionParams,
};

/// Description of Wococo -> Rococo finalized headers bridge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! 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,
};

/// Description of Westend -> Millau finalized headers bridge.
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
2 changes: 1 addition & 1 deletion relays/lib-substrate-relay/src/finality/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//! and authorities set from source to target chain. The finality sync starts
//! with this header.
use crate::{error::Error, finality::engine::Engine};
use crate::{error::Error, finality_base::engine::Engine};
use sp_core::Pair;

use bp_runtime::HeaderIdOf;
Expand Down
3 changes: 1 addition & 2 deletions relays/lib-substrate-relay/src/finality/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
use crate::{
finality::{
engine::Engine,
source::{SubstrateFinalityProof, SubstrateFinalitySource},
target::SubstrateFinalityTarget,
},
TransactionParams,
};

use crate::finality_base::engine::Engine;
use async_trait::async_trait;
use bp_header_chain::justification::GrandpaJustification;
use finality_relay::FinalitySyncPipeline;
Expand All @@ -38,7 +38,6 @@ use relay_utils::metrics::MetricsParams;
use sp_core::Pair;
use std::{fmt::Debug, marker::PhantomData};

pub mod engine;
pub mod initialize;
pub mod source;
pub mod target;
Expand Down
5 changes: 4 additions & 1 deletion relays/lib-substrate-relay/src/finality/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

//! Default generic implementation of finality source for basic Substrate client.
use crate::finality::{engine::Engine, FinalitySyncPipelineAdapter, SubstrateFinalitySyncPipeline};
use crate::{
finality::{FinalitySyncPipelineAdapter, SubstrateFinalitySyncPipeline},
finality_base::engine::Engine,
};

use async_std::sync::{Arc, Mutex};
use async_trait::async_trait;
Expand Down
3 changes: 2 additions & 1 deletion relays/lib-substrate-relay/src/finality/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
use crate::{
finality::{
engine::Engine, source::SubstrateFinalityProof, FinalitySyncPipelineAdapter,
source::SubstrateFinalityProof, FinalitySyncPipelineAdapter,
SubmitFinalityProofCallBuilder, SubstrateFinalitySyncPipeline,
},
finality_base::engine::Engine,
TransactionParams,
};

Expand Down
20 changes: 20 additions & 0 deletions relays/lib-substrate-relay/src/finality_base/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2019-2023 Parity Technologies (UK) Ltd.
// This file is part of Parity Bridges Common.

// Parity Bridges Common is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Parity Bridges Common is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.

//! Types and functions intended to ease adding of new Substrate -> Substrate
//! finality pipelines.
pub mod engine;
1 change: 1 addition & 0 deletions relays/lib-substrate-relay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use std::marker::PhantomData;

pub mod error;
pub mod finality;
pub mod finality_base;
pub mod messages;
pub mod on_demand;
pub mod parachains;
Expand Down
2 changes: 1 addition & 1 deletion relays/lib-substrate-relay/src/on_demand/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ use relay_utils::{

use crate::{
finality::{
engine::Engine,
source::{RequiredHeaderNumberRef, SubstrateFinalitySource},
target::SubstrateFinalityTarget,
SubstrateFinalitySyncPipeline, RECENT_FINALITY_PROOFS_LIMIT,
},
finality_base::engine::Engine,
on_demand::OnDemandRelay,
TransactionParams,
};
Expand Down

0 comments on commit 2f5d02e

Please sign in to comment.