Skip to content

Commit

Permalink
Hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
bkchr committed Feb 19, 2021
1 parent 8f68e4b commit cfffad8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/basic-authorship/src/basic_authorship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl<A, B, Block, C> sp_consensus::Proposer<Block> for
inherent_data,
inherent_digests,
deadline,
record_proof,
true.into(),
).await;
if tx.send(res).is_err() {
trace!("Could not send block production result to proposer!");
Expand Down
2 changes: 1 addition & 1 deletion client/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub fn start_aura<B, C, SC, E, I, P, SO, CAW, BS, Error, IDP>(
/// Build and return the aura worker.
///
/// The caller is responsible for running the returned worker.
pub fn build_aura_worker<B, C, E, I, P, SO, BS, Error>(
pub fn build_aura_worker<P, B, C, E, I, SO, BS, Error>(
client: Arc<C>,
block_import: I,
env: E,
Expand Down
8 changes: 5 additions & 3 deletions client/consensus/slots/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,15 @@ pub trait SimpleSlotWorker<B: BlockT> {

proposal_work.and_then(move |(proposal, claim)| async move {
let (block, storage_proof) = (proposal.block, proposal.proof);
let (header, body) = block.clone().deconstruct();
let (header, body) = block.deconstruct();
let header_num = *header.number();
let header_hash = header.hash();
let parent_hash = *header.parent_hash();

let block_import_params = block_import_params_maker(
header,
&header_hash,
body,
body.clone(),
proposal.storage_changes,
claim,
epoch_data,
Expand All @@ -378,6 +378,8 @@ pub trait SimpleSlotWorker<B: BlockT> {
"hash_previously" => ?header_hash,
);

let post_header = block_import_params.post_header();

if let Err(err) = block_import.lock().import_block(block_import_params, Default::default()) {
warn!(
target: logging_target,
Expand All @@ -393,7 +395,7 @@ pub trait SimpleSlotWorker<B: BlockT> {
);
}

Ok(SlotResult { block, storage_proof })
Ok(SlotResult { block: B::new(post_header, body), storage_proof })
}).then(|r| async move {
r.map_err(|e| warn!(target: "slots", "Encountered consensus error: {:?}", e)).ok()
}).boxed()
Expand Down
2 changes: 1 addition & 1 deletion frame/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ where
}

// any final checks
Self::final_checks(&header);
// Self::final_checks(&header);
} };
}

Expand Down
8 changes: 8 additions & 0 deletions primitives/consensus/common/src/block_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,14 @@ impl<Block: BlockT, Transaction> BlockImportParams<Block, Transaction> {
}
}

pub fn post_header(&self) -> Block::Header {
let mut hdr = self.header.clone();
for digest_item in &self.post_digests {
hdr.digest_mut().push(digest_item.clone());
}
hdr
}

/// Auxiliary function for "converting" the transaction type.
///
/// Actually this just sets `storage_changes` to `None` and makes rustc think that `Self` now
Expand Down

0 comments on commit cfffad8

Please sign in to comment.