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

Commit

Permalink
Adds AuraConsensusDataProvider (#10503)
Browse files Browse the repository at this point in the history
* adds support for parachains to test-runner

* adds file header

* Apply suggestions from code review

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* proper docs, remove unused _client

* fixes

* Update client/consensus/manual-seal/src/consensus/timestamp.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Update client/consensus/manual-seal/src/consensus/timestamp.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* pr fixes

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
  • Loading branch information
seunlanlege and kianenigma authored Jan 10, 2022
1 parent 15b154a commit 2cfd235
Show file tree
Hide file tree
Showing 17 changed files with 278 additions and 1,368 deletions.
69 changes: 2 additions & 67 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ members = [
"bin/node-template/runtime",
"bin/node/bench",
"bin/node/cli",
"bin/node/test-runner-example",
"bin/node/executor",
"bin/node/primitives",
"bin/node/rpc",
Expand Down Expand Up @@ -200,7 +199,6 @@ members = [
"test-utils/runtime",
"test-utils/runtime/client",
"test-utils/runtime/transaction-pool",
"test-utils/test-runner",
"test-utils/test-crate",
"utils/build-script-utils",
"utils/fork-tree",
Expand Down
29 changes: 0 additions & 29 deletions bin/node/test-runner-example/Cargo.toml

This file was deleted.

132 changes: 0 additions & 132 deletions bin/node/test-runner-example/src/lib.rs

This file was deleted.

15 changes: 13 additions & 2 deletions client/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,24 +490,34 @@ fn aura_err<B: BlockT>(error: Error<B>) -> Error<B> {
error
}

/// Aura Errors
#[derive(derive_more::Display, Debug)]
enum Error<B: BlockT> {
pub enum Error<B: BlockT> {
/// Multiple Aura pre-runtime headers
#[display(fmt = "Multiple Aura pre-runtime headers")]
MultipleHeaders,
/// No Aura pre-runtime digest found
#[display(fmt = "No Aura pre-runtime digest found")]
NoDigestFound,
/// Header is unsealed
#[display(fmt = "Header {:?} is unsealed", _0)]
HeaderUnsealed(B::Hash),
/// Header has a bad seal
#[display(fmt = "Header {:?} has a bad seal", _0)]
HeaderBadSeal(B::Hash),
/// Slot Author not found
#[display(fmt = "Slot Author not found")]
SlotAuthorNotFound,
/// Bad signature
#[display(fmt = "Bad signature on {:?}", _0)]
BadSignature(B::Hash),
/// Client Error
Client(sp_blockchain::Error),
/// Unknown inherent error for identifier
#[display(fmt = "Unknown inherent error for identifier: {}", "String::from_utf8_lossy(_0)")]
UnknownInherentError(sp_inherents::InherentIdentifier),
#[display(fmt = "Inherent error: {}", _0)]
/// Inherents Error
Inherent(sp_inherents::Error),
}

Expand All @@ -517,7 +527,8 @@ impl<B: BlockT> std::convert::From<Error<B>> for String {
}
}

fn find_pre_digest<B: BlockT, Signature: Codec>(header: &B::Header) -> Result<Slot, Error<B>> {
/// Get pre-digests from the header
pub fn find_pre_digest<B: BlockT, Signature: Codec>(header: &B::Header) -> Result<Slot, Error<B>> {
if header.number().is_zero() {
return Ok(0.into())
}
Expand Down
2 changes: 2 additions & 0 deletions client/consensus/manual-seal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ async-trait = "0.1.50"
sc-client-api = { path = "../../api", version = "4.0.0-dev" }
sc-consensus = { version = "0.10.0-dev", path = "../../consensus/common" }
sc-consensus-babe = { path = "../../consensus/babe", version = "0.10.0-dev" }
sc-consensus-aura = { path = "../../consensus/aura", version = "0.10.0-dev" }
sc-consensus-epochs = { path = "../../consensus/epochs", version = "0.10.0-dev" }
sp-consensus-babe = { path = "../../../primitives/consensus/babe", version = "0.10.0-dev" }
sp-consensus-aura = { path = "../../../primitives/consensus/aura", version = "0.10.0-dev" }

sc-transaction-pool = { path = "../../transaction-pool", version = "4.0.0-dev" }
sp-blockchain = { path = "../../../primitives/blockchain", version = "4.0.0-dev" }
Expand Down
2 changes: 2 additions & 0 deletions client/consensus/manual-seal/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ use sc_consensus::BlockImportParams;
use sp_inherents::InherentData;
use sp_runtime::{traits::Block as BlockT, Digest};

pub mod aura;
pub mod babe;
pub mod timestamp;

/// Consensus data provider, manual seal uses this trait object for authoring blocks valid
/// for any runtime.
Expand Down
Loading

0 comments on commit 2cfd235

Please sign in to comment.