Use sign_with in consensus (#6008)

* Add derive_more to sp_core

* Convert Vec to Signature

* Use sign_with in AURA and BABE

* Signing errors

* Update slots to return consensus result

* Fix use

* Clone public key

* Match block_params

* WIP

* Use to_public_crypto_pair

* Pass public key only to block import params

* Address PR review

* Fix consensus RPC

* Fix babe tests

* adjust uses

* Fix line widths
This commit is contained in:
Rakan Alhneiti
2020-05-15 17:03:52 +02:00
committed by GitHub
parent 7a8d59199e
commit f36f57b0bf
12 changed files with 115 additions and 50 deletions
+11 -6
View File
@@ -121,11 +121,10 @@ pub trait SimpleSlotWorker<B: BlockT> {
StorageChanges<<Self::BlockImport as BlockImport<B>>::Transaction, B>,
Self::Claim,
Self::EpochData,
) -> sp_consensus::BlockImportParams<
B,
<Self::BlockImport as BlockImport<B>>::Transaction
>
+ Send
) -> Result<
sp_consensus::BlockImportParams<B, <Self::BlockImport as BlockImport<B>>::Transaction>,
sp_consensus::Error
> + Send + 'static
>;
/// Whether to force authoring if offline.
@@ -273,7 +272,7 @@ pub trait SimpleSlotWorker<B: BlockT> {
let block_import = self.block_import();
let logging_target = self.logging_target();
Box::pin(proposal_work.map_ok(move |(proposal, claim)| {
Box::pin(proposal_work.and_then(move |(proposal, claim)| {
let (header, body) = proposal.block.deconstruct();
let header_num = *header.number();
let header_hash = header.hash();
@@ -288,6 +287,11 @@ pub trait SimpleSlotWorker<B: BlockT> {
epoch_data,
);
let block_import_params = match block_import_params {
Ok(params) => params,
Err(e) => return future::err(e),
};
info!(
"🔖 Pre-sealed block for proposal at {}. Hash now {:?}, previously {:?}.",
header_num,
@@ -312,6 +316,7 @@ pub trait SimpleSlotWorker<B: BlockT> {
"hash" => ?parent_hash, "err" => ?err,
);
}
future::ready(Ok(()))
}))
}
}