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

Clean up justification #1111

Merged
merged 5 commits into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions core/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,8 @@ impl<B, E, Block, RA> consensus::BlockImport<Block> for Client<B, E, Block, RA>
let ImportBlock {
origin,
header,
external_justification,
post_runtime_digests,
justification,
post_digests,
body,
finalized,
..
Expand All @@ -975,11 +975,11 @@ impl<B, E, Block, RA> consensus::BlockImport<Block> for Client<B, E, Block, RA>
blockchain::BlockStatus::Unknown => return Ok(ImportResult::UnknownParent),
}

let import_headers = if post_runtime_digests.is_empty() {
let import_headers = if post_digests.is_empty() {
PrePostHeader::Same(header)
} else {
let mut post_header = header.clone();
for item in post_runtime_digests {
for item in post_digests {
post_header.digest_mut().push(item);
}
PrePostHeader::Different(header, post_header)
Expand All @@ -994,7 +994,7 @@ impl<B, E, Block, RA> consensus::BlockImport<Block> for Client<B, E, Block, RA>
origin,
hash,
import_headers,
external_justification,
justification,
body,
new_authorities,
finalized,
Expand Down
8 changes: 4 additions & 4 deletions core/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ pub fn start_aura<B, C, E, SO, Error>(
let import_block = ImportBlock {
origin: BlockOrigin::Own,
header,
external_justification: Vec::new(),
post_runtime_digests: vec![item],
justification: Vec::new(),
post_digests: vec![item],
body: Some(body),
finalized: false,
auxiliary: Vec::new(),
Expand Down Expand Up @@ -365,8 +365,8 @@ impl<B: Block, C> Verifier<B> for AuraVerifier<C> where
let import_block = ImportBlock {
origin,
header: pre_header,
external_justification: Vec::new(),
post_runtime_digests: vec![item],
justification: Vec::new(),
post_digests: vec![item],
body,
finalized: false,
auxiliary: Vec::new(),
Expand Down
10 changes: 5 additions & 5 deletions core/consensus/common/src/block_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ pub struct ImportBlock<Block: BlockT> {
///
/// Consensus engines which alter the header (by adding post-runtime digests)
/// should strip those off in the initial verification process and pass them
/// via the `post_runtime_digests` field. During block authorship, they should
/// via the `post_digests` field. During block authorship, they should
/// not be pushed to the header directly.
///
/// The reason for this distinction is so the header can be directly
/// re-executed in a runtime that checks digest equivalence -- the
/// post-runtime digests are pushed back on after.
pub header: Block::Header,
/// Justification provided for this block from the outside:.
pub external_justification: Justification,
pub justification: Justification,
/// Digest items that have been added after the runtime for external
/// work, like a consensus signature.
pub post_runtime_digests: Vec<DigestItemFor<Block>>,
pub post_digests: Vec<DigestItemFor<Block>>,
/// Block's body
pub body: Option<Vec<Block::Extrinsic>>,
/// Is this block finalized already?
Expand All @@ -82,8 +82,8 @@ impl<Block: BlockT> ImportBlock<Block> {
(
self.origin,
self.header,
self.external_justification,
self.post_runtime_digests,
self.justification,
self.post_digests,
self.body,
self.finalized,
self.auxiliary,
Expand Down
4 changes: 2 additions & 2 deletions core/consensus/rhd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,10 @@ impl<B, P, I, InStream, OutSink> Future for BftFuture<B, P, I, InStream, OutSink
let import_block = ImportBlock {
origin: BlockOrigin::ConsensusBroadcast,
header: header,
external_justification: just.into(),
justification: just.into(),
body: Some(body),
finalized: true,
post_runtime_digests: Default::default(),
post_digests: Default::default(),
auxiliary: Default::default()
};

Expand Down
4 changes: 2 additions & 2 deletions core/network/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,8 @@ impl<B: BlockT> Verifier<B> for PassThroughVerifier {
header,
body,
finalized: self.0,
external_justification: justification,
post_runtime_digests: vec![],
justification: justification,
post_digests: vec![],
auxiliary: Vec::new(),
}, None))
}
Expand Down
4 changes: 2 additions & 2 deletions core/test-client/src/client_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ impl<B, E, RA> TestClient for Client<B, E, runtime::Block, RA>
let import = ImportBlock {
origin,
header: block.header,
external_justification: vec![],
post_runtime_digests: vec![],
justification: vec![],
post_digests: vec![],
body: Some(block.extrinsics),
finalized: false,
auxiliary: Vec::new(),
Expand Down
2 changes: 1 addition & 1 deletion node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ mod tests {
let block = proposer.propose().expect("Error making test block");
ImportBlock {
origin: BlockOrigin::File,
external_justification: Vec::new(),
justification: Vec::new(),
internal_justification: Vec::new(),
finalized: true,
body: Some(block.extrinsics),
Expand Down