This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 371
Adds first version of validate_block
#3
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ecbf2c4
Adds `validate_block` support for `runtime`
bkchr 68100e7
Adds `test-runtime` to start working on tests
bkchr 86fc199
Make the tests pass
bkchr 80b222c
Update to latest polkadot/substrate
bkchr 2c6bf07
Start using trie db
bkchr 101d338
Adapt to latest changes in the specification
bkchr 815e466
Trying to get the tests back working
bkchr f213d5e
Fixes simple test
bkchr cbaef32
Implement test that executes extrinsics
bkchr 4fa5d35
Some docs
bkchr 391792f
Some fixes
bkchr 092f9ac
Forget the correct value
bkchr f124354
Fix review comments
bkchr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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)] | ||
bkchr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ///! 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this
wasmfeature something native or something that require some feature declaration?(I remember that I wanted to use hashbrown but use hasmap_core in trie because it felt easier to manage with 'std' substrate feature, just thinking let's wait for hashbrown to be std and see if at some point it makes it to alloc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This requires a feature declaration.