Register-parachain subcommand of substrate-relay (#1170)

* register parachain relay subcommand

* revert cargo patch

* added basic test

* fmt
This commit is contained in:
Svyatoslav Nikolsky
2021-10-08 12:54:39 +03:00
committed by Bastian Köcher
parent 4b525f4fe1
commit a635048b8a
15 changed files with 732 additions and 62 deletions
@@ -0,0 +1,21 @@
[package]
name = "relay-rialto-parachain-client"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
relay-substrate-client = { path = "../client-substrate" }
relay-utils = { path = "../utils" }
# Bridge dependencies
bp-rialto = { path = "../../primitives/chain-rialto" }
rialto-parachain-runtime = { path = "../../bin/rialto-parachain/runtime" }
# Substrate Dependencies
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master" }
@@ -0,0 +1,51 @@
// 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/>.
//! Types used to connect to the Rialto-Substrate chain.
use relay_substrate_client::{Chain, ChainBase};
use std::time::Duration;
/// Rialto header id.
pub type HeaderId =
relay_utils::HeaderId<rialto_parachain_runtime::Hash, rialto_parachain_runtime::BlockNumber>;
/// Rialto parachain definition
#[derive(Debug, Clone, Copy)]
pub struct RialtoParachain;
impl ChainBase for RialtoParachain {
type BlockNumber = rialto_parachain_runtime::BlockNumber;
type Hash = rialto_parachain_runtime::Hash;
type Hasher = rialto_parachain_runtime::Hashing;
type Header = rialto_parachain_runtime::Header;
type AccountId = rialto_parachain_runtime::AccountId;
type Balance = rialto_parachain_runtime::Balance;
type Index = rialto_parachain_runtime::Index;
type Signature = rialto_parachain_runtime::Signature;
}
impl Chain for RialtoParachain {
const NAME: &'static str = "RialtoParachain";
const AVERAGE_BLOCK_INTERVAL: Duration = Duration::from_secs(5);
const STORAGE_PROOF_OVERHEAD: u32 = bp_rialto::EXTRA_STORAGE_PROOF_SIZE;
const MAXIMAL_ENCODED_ACCOUNT_ID_SIZE: u32 = bp_rialto::MAXIMAL_ENCODED_ACCOUNT_ID_SIZE;
type SignedBlock = rialto_parachain_runtime::SignedBlock;
type Call = rialto_parachain_runtime::Call;
type WeightToFee = bp_rialto::WeightToFee;
}