Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Verify header justification during import (#76)
Browse files Browse the repository at this point in the history
* reshuffle consensus libraries

* polkadot-useful type definitions for statement table

* begin BftService

* primary selection logic

* bft service implementation without I/O

* extract out `BlockImport` trait

* allow bft primitives to compile on wasm

* Block builder (substrate)

* take polkadot-consensus down to the core.

* test for preemption

* fix test build

* Fix wasm build

* Bulid on any block

* Test for block builder.

* Block import tests for client.

* Tidy ups

* clean up block builder instantiation

* justification verification logic

* JustifiedHeader and import

* Propert block generation for tests

* Fixed rpc tests
  • Loading branch information
rphmeier authored Feb 16, 2018
1 parent b059bc3 commit 8efd1ea
Show file tree
Hide file tree
Showing 31 changed files with 549 additions and 191 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion polkadot/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ extern crate substrate_state_machine as state_machine;
extern crate error_chain;

use client::backend::Backend;
use client::blockchain::BlockId;
use client::Client;
use polkadot_runtime::runtime;
use polkadot_executor::Executor as LocalDispatch;
use substrate_executor::{NativeExecutionDispatch, NativeExecutor};
use primitives::{AccountId, SessionKey};
use primitives::block::Id as BlockId;
use primitives::parachain::DutyRoster;

error_chain! {
Expand Down
2 changes: 2 additions & 0 deletions polkadot/primitives/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use rstd::vec::Vec;
use codec::{Input, Slicable};
use transaction::UncheckedTransaction;

pub use primitives::block::Id;

/// Used to refer to a block number.
pub type Number = u64;

Expand Down
2 changes: 0 additions & 2 deletions substrate/bft/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ authors = ["Parity Technologies <admin@parity.io>"]

[dependencies]
futures = "0.1.17"
substrate-client = { path = "../client" }
substrate-codec = { path = "../codec" }
substrate-primitives = { path = "../primitives" }
substrate-state-machine = { path = "../state-machine" }
ed25519 = { path = "../ed25519" }
tokio-timer = "0.1.2"
parking_lot = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion substrate/bft/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
error_chain! {
errors {
/// Missing state at block with given Id.
StateUnavailable(b: ::client::BlockId) {
StateUnavailable(b: ::primitives::block::Id) {
description("State missing at given block."),
display("State unavailable at block {:?}", b),
}
Expand Down
7 changes: 7 additions & 0 deletions substrate/bft/src/generic/accumulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ impl<D, S> UncheckedJustification<D, S> {
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Justification<D,S>(UncheckedJustification<D,S>);

impl<D, S> Justification<D, S> {
/// Convert this justification back to unchecked.
pub fn uncheck(self) -> UncheckedJustification<D, S> {
self.0
}
}

impl<D, S> ::std::ops::Deref for Justification<D, S> {
type Target = UncheckedJustification<D, S>;

Expand Down
Loading

0 comments on commit 8efd1ea

Please sign in to comment.