Move some associated types from relay_substrate_client::Chain to bp_runtime::Chain (#1087)

* move some associated types from relay_substrate_client::Chain to bp_runtime::Chain

* dummy commit

* Revert "dummy commit"

This reverts commit 81bc64aa092df115a7c68e7bb7ca5e83ec31fd20.
This commit is contained in:
Svyatoslav Nikolsky
2021-09-09 11:19:39 +03:00
committed by Bastian Köcher
parent 1df7076c4f
commit 7369ff9d70
34 changed files with 254 additions and 162 deletions
@@ -19,6 +19,7 @@
use crate::finality_target::SubstrateFinalityTarget;
use bp_header_chain::justification::GrandpaJustification;
use bp_runtime::AccountIdOf;
use finality_relay::{FinalitySyncParams, FinalitySyncPipeline};
use relay_substrate_client::{finality_source::FinalitySource, BlockNumberOf, Chain, Client, HashOf, SyncHeader};
use relay_utils::{metrics::MetricsParams, BlockNumberBase};
@@ -63,13 +64,13 @@ pub trait SubstrateFinalitySyncPipeline: 'static + Clone + Debug + Send + Sync {
fn start_relay_guards(&self) {}
/// Returns id of account that we're using to sign transactions at target chain.
fn transactions_author(&self) -> <Self::TargetChain as Chain>::AccountId;
fn transactions_author(&self) -> AccountIdOf<Self::TargetChain>;
/// Make submit header transaction.
fn make_submit_finality_proof_transaction(
&self,
era: bp_runtime::TransactionEraOf<Self::TargetChain>,
transaction_nonce: <Self::TargetChain as Chain>::Index,
transaction_nonce: bp_runtime::IndexOf<Self::TargetChain>,
header: <Self::FinalitySyncPipeline as FinalitySyncPipeline>::Header,
proof: <Self::FinalitySyncPipeline as FinalitySyncPipeline>::FinalityProof,
) -> Bytes;
@@ -22,6 +22,7 @@ use crate::on_demand_headers::OnDemandHeadersRelay;
use async_trait::async_trait;
use bp_messages::{LaneId, MessageNonce};
use bp_runtime::{AccountIdOf, IndexOf};
use frame_support::weights::Weight;
use messages_relay::message_lane::{MessageLane, SourceHeaderIdOf, TargetHeaderIdOf};
use relay_substrate_client::{
@@ -101,24 +102,24 @@ pub trait SubstrateMessageLane: 'static + Clone + Send + Sync {
type TargetChain: Chain;
/// Returns id of account that we're using to sign transactions at target chain (messages proof).
fn target_transactions_author(&self) -> <Self::TargetChain as Chain>::AccountId;
fn target_transactions_author(&self) -> AccountIdOf<Self::TargetChain>;
/// Make messages delivery transaction.
fn make_messages_delivery_transaction(
&self,
transaction_nonce: <Self::TargetChain as Chain>::Index,
transaction_nonce: IndexOf<Self::TargetChain>,
generated_at_header: SourceHeaderIdOf<Self::MessageLane>,
nonces: RangeInclusive<MessageNonce>,
proof: <Self::MessageLane as MessageLane>::MessagesProof,
) -> Bytes;
/// Returns id of account that we're using to sign transactions at source chain (delivery proof).
fn source_transactions_author(&self) -> <Self::SourceChain as Chain>::AccountId;
fn source_transactions_author(&self) -> AccountIdOf<Self::SourceChain>;
/// Make messages receiving proof transaction.
fn make_messages_receiving_proof_transaction(
&self,
transaction_nonce: <Self::SourceChain as Chain>::Index,
transaction_nonce: IndexOf<Self::SourceChain>,
generated_at_header: TargetHeaderIdOf<Self::MessageLane>,
proof: <Self::MessageLane as MessageLane>::MessagesReceivingProof,
) -> Bytes;
@@ -108,7 +108,7 @@ where
BlockNumber = <P::MessageLane as MessageLane>::SourceHeaderNumber,
Balance = <P::MessageLane as MessageLane>::SourceChainBalance,
>,
BalanceOf<P::SourceChain>: TryFrom<<P::TargetChain as Chain>::Balance> + Bounded,
BalanceOf<P::SourceChain>: TryFrom<BalanceOf<P::TargetChain>> + Bounded,
P::TargetChain: Chain<
Hash = <P::MessageLane as MessageLane>::TargetHeaderHash,
BlockNumber = <P::MessageLane as MessageLane>::TargetHeaderNumber,
@@ -454,7 +454,7 @@ mod tests {
fn make_messages_receiving_proof_transaction(
&self,
_transaction_nonce: <Rococo as Chain>::Index,
_transaction_nonce: IndexOf<Rococo>,
_generated_at_block: TargetHeaderIdOf<Self::MessageLane>,
_proof: <Self::MessageLane as MessageLane>::MessagesReceivingProof,
) -> Bytes {
@@ -467,7 +467,7 @@ mod tests {
fn make_messages_delivery_transaction(
&self,
_transaction_nonce: <Wococo as Chain>::Index,
_transaction_nonce: IndexOf<Wococo>,
_generated_at_header: SourceHeaderIdOf<Self::MessageLane>,
_nonces: RangeInclusive<MessageNonce>,
_proof: <Self::MessageLane as MessageLane>::MessagesProof,