Move Chain trait to runtime primitives (#403)

* extract ChainBase to bp-runtime

* post-merge fixes

* cargo fmt --all

* compilation fixes

* reexport BlockNumberOf, HashOf, HeaderOf
This commit is contained in:
Svyatoslav Nikolsky
2020-10-07 22:50:43 +03:00
committed by Bastian Köcher
parent ddeb59d336
commit 9e9ac8df3c
17 changed files with 238 additions and 171 deletions
+12 -4
View File
@@ -8,15 +8,23 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
# Bridge Dependencies
bp-runtime = { path = "../runtime", default-features = false }
# Substrate Based Dependencies
sp-api = { version = "2.0.0", default-features = false }
sp-core = { version = "2.0.0", default-features = false }
sp-runtime = { version = "2.0.0", default-features = false }
sp-std = { version = "2.0.0", default-features = false }
frame-support = { version = "2.0", default-features = false }
sp-api = { version = "2.0", default-features = false }
sp-core = { version = "2.0", default-features = false }
sp-runtime = { version = "2.0", default-features = false }
sp-std = { version = "2.0", default-features = false }
[features]
default = ["std"]
std = [
"bp-runtime/std",
"frame-support/std",
"sp-api/std",
"sp-core/std",
"sp-runtime/std",
+13
View File
@@ -20,6 +20,8 @@
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
#![allow(clippy::unnecessary_mut_passed)]
use bp_runtime::Chain;
use frame_support::RuntimeDebug;
use sp_core::Hasher as HasherT;
use sp_runtime::traits::BlakeTwo256;
use sp_std::prelude::*;
@@ -36,6 +38,17 @@ pub type Hasher = BlakeTwo256;
/// The header type used by Rialto.
pub type Header = sp_runtime::generic::Header<BlockNumber, Hasher>;
/// Rialto chain.
#[derive(RuntimeDebug)]
pub struct Rialto;
impl Chain for Rialto {
type BlockNumber = BlockNumber;
type Hash = Hash;
type Hasher = Hasher;
type Header = Header;
}
sp_api::decl_runtime_apis! {
/// API for querying information about Rialto headers from the Bridge Pallet instance.
///