-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from paritytech/bkchr-validate_block
Adds first version of `validate_block`
- Loading branch information
Showing
19 changed files
with
3,451 additions
and
1,643 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,2 +1,7 @@ | ||
[workspace] | ||
members = [ "consensus" ] | ||
members = [ | ||
"consensus", | ||
"runtime", | ||
"test/runtime", | ||
"test/client", | ||
] |
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 |
---|---|---|
|
@@ -2,23 +2,23 @@ | |
name = "cumulus-consensus" | ||
description = "Proxy Polkadot's consensus as a consensus engine for Substrate" | ||
version = "0.1.0" | ||
authors = ["Parity Technologies"] | ||
authors = ["Parity Technologies <[email protected]>"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
# substrate deps | ||
substrate-client = { git = "https://github.com/paritytech/substrate" } | ||
substrate-consensus-common = { git = "https://github.com/paritytech/substrate" } | ||
substrate-primitives = { git = "https://github.com/paritytech/substrate" } | ||
sr-primitives = { git = "https://github.com/paritytech/substrate" } | ||
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" } | ||
substrate-consensus-common = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" } | ||
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" } | ||
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" } | ||
|
||
# polkadot deps | ||
polkadot-service = { git = "https://github.com/paritytech/polkadot" } | ||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot" } | ||
polkadot-runtime = { git = "https://github.com/paritytech/polkadot" } | ||
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "bkchr-cumulus-branch" } | ||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "bkchr-cumulus-branch" } | ||
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "bkchr-cumulus-branch" } | ||
|
||
# other deps | ||
futures = "0.1.21" | ||
tokio = "0.1.8" | ||
parity-codec = "3.0" | ||
log = "0.4" | ||
parity-codec = "3.1" | ||
log = "0.4" |
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,44 @@ | ||
[package] | ||
name = "cumulus-runtime" | ||
version = "0.1.0" | ||
authors = ["Parity Technologies <[email protected]>"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
codec = { package = "parity-codec", version = "3.1", default-features = false, features = [ "derive" ] } | ||
rstd = { package = "sr-std", git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" } | ||
runtime-primitives = { package = "sr-primitives", git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" } | ||
primitives = { package = "substrate-primitives", git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" } | ||
rio = { package = "sr-io", git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" } | ||
executive = { package = "srml-executive", git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" } | ||
substrate-trie = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "bkchr-cumulus-branch" } | ||
memory-db = { version = "0.12.2", default-features = false } | ||
hash-db = { version = "0.12.2", default-features = false } | ||
trie-db = { version = "0.12.2", default-features = false } | ||
hashbrown = "0.1" | ||
|
||
[dev-dependencies] | ||
keyring = { package = "substrate-keyring", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" } | ||
primitives = { package = "substrate-primitives", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" } | ||
executor = { package = "substrate-executor", git = "https://github.com/paritytech/substrate", branch = "bkchr-cumulus-branch" } | ||
test-client = { package = "cumulus-test-client", path = "../test/client" } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"codec/std", | ||
"rstd/std", | ||
"rio/std", | ||
"runtime-primitives/std", | ||
"primitives/std", | ||
"executive/std", | ||
"memory-db/std", | ||
"hash-db/std", | ||
"trie-db/std", | ||
"test-client/std", | ||
"substrate-trie/std", | ||
] | ||
wasm = [ | ||
"hashbrown/nightly", | ||
"rio/wasm-nice-panic-message", | ||
] |
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,61 @@ | ||
// Copyright 2019 Parity Technologies (UK) Ltd. | ||
// This file is part of Cumulus. | ||
|
||
// Cumulus 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. | ||
|
||
// Cumulus 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 Cumulus. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
#![cfg_attr(not(feature = "std"), no_std)] | ||
|
||
///! The Cumulus runtime to make a runtime a parachain. | ||
use rstd::vec::Vec; | ||
use codec::{Encode, Decode}; | ||
use runtime_primitives::traits::Block as BlockT; | ||
|
||
#[cfg(not(feature = "std"))] | ||
#[doc(hidden)] | ||
pub use rstd::slice; | ||
|
||
#[macro_use] | ||
pub mod validate_block; | ||
|
||
/// The witness data type. | ||
type WitnessData = Vec<Vec<u8>>; | ||
|
||
/// The parachain block that is created on a collator and validated by a validator. | ||
#[derive(Encode, Decode)] | ||
pub struct ParachainBlockData<B: BlockT> { | ||
/// The header of the parachain block. | ||
header: <B as BlockT>::Header, | ||
/// The extrinsics of the parachain block without the `PolkadotInherent`. | ||
extrinsics: Vec<<B as BlockT>::Extrinsic>, | ||
/// The data that is required to emulate the storage accesses executed by all extrinsics. | ||
witness_data: WitnessData, | ||
witness_data_storage_root: <B as BlockT>::Hash, | ||
} | ||
|
||
impl<B: BlockT> ParachainBlockData<B> { | ||
pub fn new( | ||
header: <B as BlockT>::Header, | ||
extrinsics: Vec<<B as BlockT>::Extrinsic>, | ||
witness_data: WitnessData, | ||
witness_data_storage_root: <B as BlockT>::Hash, | ||
) -> Self { | ||
Self { | ||
header, | ||
extrinsics, | ||
witness_data, | ||
witness_data_storage_root, | ||
} | ||
} | ||
} |
Oops, something went wrong.