mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 02:51:01 +00:00
Westend<>Rococo Headers Relay (#875)
* Add modules for Rococo<>Westend header sync * Use mock Westend and Rococo finaltiy tx calls * Add Westend<>Rococo variants to `init_bridge` * Add Westend<>Rococo variants to `relay_headers` * Simplify the Rococo and Westend signing params * Add `submit_finality_proof` mock Call variant * Add note to more closely match `initialize` Call variant * Accidentally committed `cargo-expand`ed code 🤦 * Add `initialize` Call variant to Rococo mock * Fix call enums. * Add explainatory comment. * clippy. * Add issue number. * De-duplicate metrics customisation. * Add comments to Rococo/Westend runtimes. * Add scale-encoding compatibility test. * Fix tests. * Clippy. Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
This commit is contained in:
committed by
Bastian Köcher
parent
a69026af44
commit
bca83fd020
@@ -15,9 +15,9 @@
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::cli::{SourceConnectionParams, TargetConnectionParams, TargetSigningParams};
|
||||
use bp_header_chain::InitializationData;
|
||||
use bp_runtime::Chain as ChainBase;
|
||||
use codec::Encode;
|
||||
use pallet_bridge_grandpa::InitializationData;
|
||||
use relay_substrate_client::{Chain, TransactionSignScheme};
|
||||
use sp_core::{Bytes, Pair};
|
||||
use structopt::{clap::arg_enum, StructOpt};
|
||||
@@ -44,6 +44,8 @@ arg_enum! {
|
||||
MillauToRialto,
|
||||
RialtoToMillau,
|
||||
WestendToMillau,
|
||||
WestendToRococo,
|
||||
RococoToWestend,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +100,30 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,6 +373,7 @@ macro_rules! declare_chain_options {
|
||||
/// Parse signing params into chain-specific KeyPair.
|
||||
pub fn to_keypair<Chain: CliChain>(&self) -> anyhow::Result<Chain::KeyPair> {
|
||||
use sp_core::crypto::Pair;
|
||||
|
||||
Chain::KeyPair::from_string(
|
||||
&self.[<$chain_prefix _signer>],
|
||||
self.[<$chain_prefix _signer_password>].as_deref()
|
||||
|
||||
@@ -42,6 +42,8 @@ arg_enum! {
|
||||
MillauToRialto,
|
||||
RialtoToMillau,
|
||||
WestendToMillau,
|
||||
WestendToRococo,
|
||||
RococoToWestend,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +69,20 @@ macro_rules! select_bridge {
|
||||
type Target = relay_millau_client::Millau;
|
||||
type Finality = crate::rialto_millau::westend_headers_to_millau::WestendFinalityToMillau;
|
||||
|
||||
$generic
|
||||
}
|
||||
RelayHeadersBridge::WestendToRococo => {
|
||||
type Source = relay_westend_client::Westend;
|
||||
type Target = relay_rococo_client::Rococo;
|
||||
type Finality = crate::rialto_millau::westend_headers_to_rococo::WestendFinalityToRococo;
|
||||
|
||||
$generic
|
||||
}
|
||||
RelayHeadersBridge::RococoToWestend => {
|
||||
type Source = relay_rococo_client::Rococo;
|
||||
type Target = relay_westend_client::Westend;
|
||||
type Finality = crate::rialto_millau::rococo_headers_to_westend::RococoFinalityToWestend;
|
||||
|
||||
$generic
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user