mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-25 18:47:56 +00:00
Remove Westend<>Rococo header sync (#940)
* Remove scripts for Westend<>Rococo header sync * Remove Westend<>Rococo header sync code * Remove Westend<>Rococo init bridge CLI option * Modify Westend mock call to be placeholder * Fix call encoding test
This commit is contained in:
committed by
Bastian Köcher
parent
ebf9ae7546
commit
76625ed180
@@ -55,14 +55,14 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
/// See: https://github.com/paritytech/polkadot/blob/master/runtime/rococo/src/lib.rs
|
||||
#[derive(parity_scale_codec::Encode, parity_scale_codec::Decode, Debug, PartialEq, Eq, Clone)]
|
||||
pub enum Call {
|
||||
/// Westend bridge pallet.
|
||||
/// Generic bridge pallet.
|
||||
#[codec(index = 40)]
|
||||
BridgeGrandpaWestend(BridgeGrandpaWestendCall),
|
||||
BridgeCall(BridgeGrandpaCall),
|
||||
}
|
||||
|
||||
#[derive(parity_scale_codec::Encode, parity_scale_codec::Decode, Debug, PartialEq, Eq, Clone)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum BridgeGrandpaWestendCall {
|
||||
pub enum BridgeGrandpaCall {
|
||||
#[codec(index = 0)]
|
||||
submit_finality_proof(
|
||||
<PolkadotLike as Chain>::Header,
|
||||
@@ -83,13 +83,6 @@ impl sp_runtime::traits::Dispatchable for Call {
|
||||
}
|
||||
}
|
||||
|
||||
// We use this to get the account on Rococo (target) which is derived from Westend's (source)
|
||||
// account.
|
||||
pub fn derive_account_from_westend_id(id: bp_runtime::SourceAccount<AccountId>) -> AccountId {
|
||||
let encoded_id = bp_runtime::derive_account_id(bp_runtime::WESTEND_BRIDGE_INSTANCE, id);
|
||||
AccountIdConverter::convert(encoded_id)
|
||||
}
|
||||
|
||||
/// Name of the `RococoFinalityApi::best_finalized` runtime method.
|
||||
pub const BEST_FINALIZED_ROCOCO_HEADER_METHOD: &str = "RococoFinalityApi_best_finalized";
|
||||
/// Name of the `RococoFinalityApi::is_known_header` runtime method.
|
||||
|
||||
@@ -20,9 +20,7 @@ pub mod millau_headers_to_rialto;
|
||||
pub mod millau_messages_to_rialto;
|
||||
pub mod rialto_headers_to_millau;
|
||||
pub mod rialto_messages_to_millau;
|
||||
pub mod rococo_headers_to_westend;
|
||||
pub mod westend_headers_to_millau;
|
||||
pub mod westend_headers_to_rococo;
|
||||
|
||||
mod millau;
|
||||
mod rialto;
|
||||
@@ -270,7 +268,7 @@ mod rococo_tests {
|
||||
votes_ancestries: vec![],
|
||||
};
|
||||
|
||||
let actual = bp_rococo::BridgeGrandpaWestendCall::submit_finality_proof(header.clone(), justification.clone());
|
||||
let actual = bp_rococo::BridgeGrandpaCall::submit_finality_proof(header.clone(), justification.clone());
|
||||
let expected = millau_runtime::BridgeGrandpaRialtoCall::<millau_runtime::Runtime>::submit_finality_proof(
|
||||
header,
|
||||
justification,
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
// Copyright 2019-2021 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/>.
|
||||
|
||||
//! Rococo-to-Westend headers sync entrypoint.
|
||||
|
||||
use crate::finality_pipeline::{SubstrateFinalitySyncPipeline, SubstrateFinalityToSubstrate};
|
||||
|
||||
use bp_header_chain::justification::GrandpaJustification;
|
||||
use codec::Encode;
|
||||
use relay_rococo_client::{Rococo, SyncHeader as RococoSyncHeader};
|
||||
use relay_substrate_client::{Chain, TransactionSignScheme};
|
||||
use relay_utils::metrics::MetricsParams;
|
||||
use relay_westend_client::{SigningParams as WestendSigningParams, Westend};
|
||||
use sp_core::{Bytes, Pair};
|
||||
|
||||
/// Rococo-to-Westend finality sync pipeline.
|
||||
pub(crate) type RococoFinalityToWestend = SubstrateFinalityToSubstrate<Rococo, Westend, WestendSigningParams>;
|
||||
|
||||
impl SubstrateFinalitySyncPipeline for RococoFinalityToWestend {
|
||||
const BEST_FINALIZED_SOURCE_HEADER_ID_AT_TARGET: &'static str = bp_rococo::BEST_FINALIZED_ROCOCO_HEADER_METHOD;
|
||||
|
||||
type TargetChain = Westend;
|
||||
|
||||
fn customize_metrics(params: MetricsParams) -> anyhow::Result<MetricsParams> {
|
||||
crate::chains::add_polkadot_kusama_price_metrics::<Self>(params)
|
||||
}
|
||||
|
||||
fn transactions_author(&self) -> bp_westend::AccountId {
|
||||
(*self.target_sign.public().as_array_ref()).into()
|
||||
}
|
||||
|
||||
fn make_submit_finality_proof_transaction(
|
||||
&self,
|
||||
transaction_nonce: <Westend as Chain>::Index,
|
||||
header: RococoSyncHeader,
|
||||
proof: GrandpaJustification<bp_rococo::Header>,
|
||||
) -> Bytes {
|
||||
let call = bp_westend::Call::BridgeGrandpaRococo(bp_westend::BridgeGrandpaRococoCall::submit_finality_proof(
|
||||
header.into_inner(),
|
||||
proof,
|
||||
));
|
||||
let genesis_hash = *self.target_client.genesis_hash();
|
||||
let transaction = Westend::sign_transaction(genesis_hash, &self.target_sign, transaction_nonce, call);
|
||||
|
||||
Bytes(transaction.encode())
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
// Copyright 2019-2021 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/>.
|
||||
|
||||
//! Westend-to-Rococo headers sync entrypoint.
|
||||
|
||||
use crate::finality_pipeline::{SubstrateFinalitySyncPipeline, SubstrateFinalityToSubstrate};
|
||||
|
||||
use bp_header_chain::justification::GrandpaJustification;
|
||||
use codec::Encode;
|
||||
use relay_rococo_client::{Rococo, SigningParams as RococoSigningParams};
|
||||
use relay_substrate_client::{Chain, TransactionSignScheme};
|
||||
use relay_utils::metrics::MetricsParams;
|
||||
use relay_westend_client::{SyncHeader as WestendSyncHeader, Westend};
|
||||
use sp_core::{Bytes, Pair};
|
||||
|
||||
/// Westend-to-Rococo finality sync pipeline.
|
||||
pub(crate) type WestendFinalityToRococo = SubstrateFinalityToSubstrate<Westend, Rococo, RococoSigningParams>;
|
||||
|
||||
impl SubstrateFinalitySyncPipeline for WestendFinalityToRococo {
|
||||
const BEST_FINALIZED_SOURCE_HEADER_ID_AT_TARGET: &'static str = bp_westend::BEST_FINALIZED_WESTEND_HEADER_METHOD;
|
||||
|
||||
type TargetChain = Rococo;
|
||||
|
||||
fn customize_metrics(params: MetricsParams) -> anyhow::Result<MetricsParams> {
|
||||
crate::chains::add_polkadot_kusama_price_metrics::<Self>(params)
|
||||
}
|
||||
|
||||
fn transactions_author(&self) -> bp_rococo::AccountId {
|
||||
(*self.target_sign.public().as_array_ref()).into()
|
||||
}
|
||||
|
||||
fn make_submit_finality_proof_transaction(
|
||||
&self,
|
||||
transaction_nonce: <Rococo as Chain>::Index,
|
||||
header: WestendSyncHeader,
|
||||
proof: GrandpaJustification<bp_westend::Header>,
|
||||
) -> Bytes {
|
||||
let call = bp_rococo::Call::BridgeGrandpaWestend(bp_rococo::BridgeGrandpaWestendCall::submit_finality_proof(
|
||||
header.into_inner(),
|
||||
proof,
|
||||
));
|
||||
let genesis_hash = *self.target_client.genesis_hash();
|
||||
let transaction = Rococo::sign_transaction(genesis_hash, &self.target_sign, transaction_nonce, call);
|
||||
|
||||
Bytes(transaction.encode())
|
||||
}
|
||||
}
|
||||
@@ -44,8 +44,6 @@ arg_enum! {
|
||||
MillauToRialto,
|
||||
RialtoToMillau,
|
||||
WestendToMillau,
|
||||
WestendToRococo,
|
||||
RococoToWestend,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,30 +98,6 @@ macro_rules! select_bridge {
|
||||
.into()
|
||||
}
|
||||
|
||||
$generic
|
||||
}
|
||||
InitBridgeName::WestendToRococo => {
|
||||
type Source = relay_westend_client::Westend;
|
||||
type Target = relay_rococo_client::Rococo;
|
||||
|
||||
fn encode_init_bridge(
|
||||
init_data: InitializationData<<Source as ChainBase>::Header>,
|
||||
) -> <Target as Chain>::Call {
|
||||
bp_rococo::Call::BridgeGrandpaWestend(bp_rococo::BridgeGrandpaWestendCall::initialize(init_data))
|
||||
}
|
||||
|
||||
$generic
|
||||
}
|
||||
InitBridgeName::RococoToWestend => {
|
||||
type Source = relay_rococo_client::Rococo;
|
||||
type Target = relay_westend_client::Westend;
|
||||
|
||||
fn encode_init_bridge(
|
||||
init_data: InitializationData<<Source as ChainBase>::Header>,
|
||||
) -> <Target as Chain>::Call {
|
||||
bp_westend::Call::BridgeGrandpaRococo(bp_westend::BridgeGrandpaRococoCall::initialize(init_data))
|
||||
}
|
||||
|
||||
$generic
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,8 +42,6 @@ arg_enum! {
|
||||
MillauToRialto,
|
||||
RialtoToMillau,
|
||||
WestendToMillau,
|
||||
WestendToRococo,
|
||||
RococoToWestend,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,20 +67,6 @@ macro_rules! select_bridge {
|
||||
type Target = relay_millau_client::Millau;
|
||||
type Finality = crate::chains::westend_headers_to_millau::WestendFinalityToMillau;
|
||||
|
||||
$generic
|
||||
}
|
||||
RelayHeadersBridge::WestendToRococo => {
|
||||
type Source = relay_westend_client::Westend;
|
||||
type Target = relay_rococo_client::Rococo;
|
||||
type Finality = crate::chains::westend_headers_to_rococo::WestendFinalityToRococo;
|
||||
|
||||
$generic
|
||||
}
|
||||
RelayHeadersBridge::RococoToWestend => {
|
||||
type Source = relay_rococo_client::Rococo;
|
||||
type Target = relay_westend_client::Westend;
|
||||
type Finality = crate::chains::rococo_headers_to_westend::RococoFinalityToWestend;
|
||||
|
||||
$generic
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user