Clean up the basic-authorship crate (#3206)

* Switch consensus-common to new futures

* Fix tests

* More tests fixing

* Make Proposer, OnSlot and SyncOracle mut

* Make the Environment mut as well

* Fix test

* Fix Babe tests

* Babe fixes

* Fix CLI service tests

* Fix Babe tests

* Remove unnecessary trait bound

* Inline the code of BlockBuilder and AuthoringApi

* Remove warning lint

* Bounds simplification

* Imports simplification

* Don't panic on bad generated block

* Code style

* Add doc example

* Remove dependency on aura

* Order dependencies alphabetically

* Minor style
This commit is contained in:
Pierre Krieger
2019-07-28 02:24:51 +02:00
committed by DemiMarie-parity
parent ba55d31d44
commit 9370a4a6b6
13 changed files with 203 additions and 219 deletions
+5 -5
View File
@@ -52,7 +52,7 @@ impl Environment<TestBlock> for DummyFactory {
type Proposer = DummyProposer;
type Error = Error;
fn init(&self, parent_header: &<TestBlock as BlockT>::Header)
fn init(&mut self, parent_header: &<TestBlock as BlockT>::Header)
-> Result<DummyProposer, Error>
{
Ok(DummyProposer(parent_header.number + 1, self.0.clone()))
@@ -64,7 +64,7 @@ impl Proposer<TestBlock> for DummyProposer {
type Create = future::Ready<Result<TestBlock, Error>>;
fn propose(
&self,
&mut self,
_: InherentData,
digests: DigestFor<TestBlock>,
_: Duration,
@@ -199,7 +199,7 @@ fn run_one_test() {
let mut runtime = current_thread::Runtime::new().unwrap();
for (peer_id, key) in peers {
let client = net.lock().peer(*peer_id).client().as_full().unwrap();
let environ = Arc::new(DummyFactory(client.clone()));
let environ = DummyFactory(client.clone());
import_notifications.push(
client.import_notification_stream()
.take_while(|n| future::ready(!(n.origin != BlockOrigin::Own && n.header.number() < &5)))
@@ -224,7 +224,7 @@ fn run_one_test() {
block_import: client.clone(),
select_chain,
client,
env: environ.clone(),
env: environ,
sync_oracle: DummyOracle,
inherent_data_providers,
force_authoring: false,
@@ -236,7 +236,7 @@ fn run_one_test() {
net.lock().poll();
Ok::<_, ()>(futures01::Async::NotReady::<()>)
}));
runtime.block_on(future::join_all(import_notifications)
.map(|_| Ok::<(), ()>(())).compat()).unwrap();
}