forked from paritytech/polkadot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Substrate relay stub (paritytech#376)
* substrate-relay: initial commit * MillauHeaderApi and RialtoHeaderApi * post-merge fixes + TODOs + compilation
- Loading branch information
Showing
22 changed files
with
652 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
name = "bp-millau" | ||
description = "Primitives of Millau runtime." | ||
version = "0.1.0" | ||
authors = ["Parity Technologies <admin@parity.io>"] | ||
edition = "2018" | ||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" | ||
|
||
[dependencies] | ||
|
||
# Substrate Based Dependencies | ||
sp-api = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", tag = 'v2.0.0', default-features = false } | ||
sp-core = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", tag = 'v2.0.0', default-features = false } | ||
sp-std = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", tag = 'v2.0.0', default-features = false } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"sp-api/std", | ||
"sp-core/std", | ||
"sp-std/std", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2019-2020 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/>. | ||
|
||
#![cfg_attr(not(feature = "std"), no_std)] | ||
// RuntimeApi generated functions | ||
#![allow(clippy::too_many_arguments)] | ||
// Runtime-generated DecodeLimit::decode_all_With_depth_limit | ||
#![allow(clippy::unnecessary_mut_passed)] | ||
|
||
use sp_std::prelude::*; | ||
|
||
/// Block number type used in Millau. | ||
pub type BlockNumber = u32; | ||
|
||
/// Hash type used in Millau. | ||
pub type Hash = sp_core::H256; | ||
|
||
sp_api::decl_runtime_apis! { | ||
/// API for querying information about Millau headers from the Bridge Pallet instance. | ||
/// | ||
/// This API is implemented by runtimes that are bridging with Millau chain, not the | ||
/// Millau runtime itself. | ||
pub trait MillauHeaderApi { | ||
/// Returns number and hash of the best block known to the bridge module. | ||
/// | ||
/// The caller should only submit an `import_header` transaction that makes | ||
/// (or leads to making) other header the best one. | ||
fn best_block() -> (BlockNumber, Hash); | ||
/// Returns number and hash of the best finalized block known to the bridge module. | ||
fn finalized_block() -> (BlockNumber, Hash); | ||
/// Returns numbers and hashes of headers that require finality proofs. | ||
fn incomplete_headers() -> Vec<(BlockNumber, Hash)>; | ||
/// Returns true if header is known to the runtime. | ||
fn is_known_block(hash: Hash) -> bool; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
name = "bp-rialto" | ||
description = "Primitives of Rialto runtime." | ||
version = "0.1.0" | ||
authors = ["Parity Technologies <admin@parity.io>"] | ||
edition = "2018" | ||
license = "GPL-3.0-or-later WITH Classpath-exception-2.0" | ||
|
||
[dependencies] | ||
|
||
# Substrate Based Dependencies | ||
sp-api = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", tag = 'v2.0.0', default-features = false } | ||
sp-core = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", tag = 'v2.0.0', default-features = false } | ||
sp-std = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", tag = 'v2.0.0', default-features = false } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"sp-api/std", | ||
"sp-core/std", | ||
"sp-std/std", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2019-2020 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/>. | ||
|
||
#![cfg_attr(not(feature = "std"), no_std)] | ||
// RuntimeApi generated functions | ||
#![allow(clippy::too_many_arguments)] | ||
// Runtime-generated DecodeLimit::decode_all_With_depth_limit | ||
#![allow(clippy::unnecessary_mut_passed)] | ||
|
||
use sp_std::prelude::*; | ||
|
||
/// Block number type used in Rialto. | ||
pub type BlockNumber = u32; | ||
|
||
/// Hash type used in Rialto. | ||
pub type Hash = sp_core::H256; | ||
|
||
sp_api::decl_runtime_apis! { | ||
/// API for querying information about Rialto headers from the Bridge Pallet instance. | ||
/// | ||
/// This API is implemented by runtimes that are bridging with Rialto chain, not the | ||
/// Rialto runtime itself. | ||
pub trait RialtoHeaderApi { | ||
/// Returns number and hash of the best block known to the bridge module. | ||
/// | ||
/// The caller should only submit an `import_header` transaction that makes | ||
/// (or leads to making) other header the best one. | ||
fn best_block() -> (BlockNumber, Hash); | ||
/// Returns number and hash of the best finalized block known to the bridge module. | ||
fn finalized_block() -> (BlockNumber, Hash); | ||
/// Returns numbers and hashes of headers that require finality proofs. | ||
fn incomplete_headers() -> Vec<(BlockNumber, Hash)>; | ||
/// Returns true if header is known to the runtime. | ||
fn is_known_block(hash: Hash) -> bool; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.