mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 05:11:02 +00:00
Substrate relay stub (#376)
* substrate-relay: initial commit * MillauHeaderApi and RialtoHeaderApi * post-merge fixes + TODOs + compilation
This commit is contained in:
committed by
Bastian Köcher
parent
f9db999a1a
commit
dbb72faa86
@@ -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",
|
||||
]
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user