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

Make BlockImport and Verifier async #8472

Merged
31 commits merged into from
Mar 30, 2021
Merged

Conversation

bkchr
Copy link
Member

@bkchr bkchr commented Mar 27, 2021

This pr makes both traits BlockImport and Verifier async traits. This change enables us to use futures in block import and verifier.

polkadot companion: paritytech/polkadot#2759

@bkchr bkchr added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels Mar 27, 2021
@bkchr bkchr requested review from andresilva and octol March 27, 2021 22:35
@bkchr bkchr added the D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit label Mar 28, 2021
@bkchr bkchr requested a review from a team as a code owner March 28, 2021 14:57
Copy link

@lovelaced lovelaced left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving on behalf of CI

bkchr added a commit to paritytech/polkadot that referenced this pull request Mar 29, 2021
Copy link
Contributor

@andresilva andresilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just minor nits.

client/consensus/common/src/shared_data.rs Outdated Show resolved Hide resolved
client/consensus/common/src/shared_data.rs Outdated Show resolved Hide resolved
client/consensus/common/src/shared_data.rs Outdated Show resolved Hide resolved
client/consensus/common/src/shared_data.rs Outdated Show resolved Hide resolved
client/consensus/common/src/shared_data.rs Outdated Show resolved Hide resolved
client/consensus/babe/src/tests.rs Outdated Show resolved Hide resolved
client/consensus/babe/src/tests.rs Outdated Show resolved Hide resolved
@@ -315,7 +320,7 @@ where
let is_descendent_of = is_descendent_of(&*self.inner, Some((hash, parent_hash)));

let mut guard = InnerGuard {
guard: Some(self.authority_set.inner().write()),
guard: Some(self.authority_set.inner_locked()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically we don't need to lock here as we won't be releasing the outer lock (there's no await boundary below).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, not here, but in the outer context that is calling this function and that requires that the set stays locked.


impl<'a, T> SharedDataLocked<'a, T> {
/// Release the mutex, but keep the shared data locked.
pub fn release_mutex(mut self) -> SharedDataLockedUpgradable<T> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to get a better name for this, but I have no suggestions 🙈

@bkchr
Copy link
Member Author

bkchr commented Mar 30, 2021

bot merge

@ghost
Copy link

ghost commented Mar 30, 2021

Trying merge.

@ghost ghost merged commit d3f2044 into master Mar 30, 2021
@ghost ghost deleted the bkchr-block-import-verifier-async branch March 30, 2021 09:19
bkchr added a commit to paritytech/polkadot that referenced this pull request Mar 30, 2021
* Companion for Substrate#8472

paritytech/substrate#8472

* update Substrate

Co-authored-by: parity-processbot <>
ordian added a commit that referenced this pull request Mar 31, 2021
* master: (84 commits)
  Duplicate logging to stdout (#8495)
  Fix sync restart (#8497)
  client: fix justifications migration (#8489)
  helper macro to create storage types on the fly (#8456)
  Make `BlockImport` and `Verifier` async (#8472)
  Get rid of `test-helpers` feature in sc-consensus-babe (#8486)
  Enhancement on Substrate Node Template (#8473)
  Add Social Network (#8065)
  Prepare UI tests for Rust 1.51 & new CI image (#8474)
  Benchmarking pallet-example (#8301)
  Use pathbuf for remote externalities (#8480)
  Bring back the on_finalize weight of staking. (#8463)
  Implement `fungible::*` for Balances (#8454)
  make types within `generate_solution_type` macro explicit (#8447)
  [pallet-staking] Refund unused weight for `payout_stakers` (#8458)
  Use `async_trait` in sc-consensus-slots (#8461)
  Repot frame_support::traits; introduce some new currency stuff (#8435)
  Fix &mut self -> &self in add_known_address (#8468)
  Add NetworkService::add_known_address (#8467)
  Fix companion check (#8464)
  ...
hirschenberger pushed a commit to hirschenberger/substrate that referenced this pull request Apr 14, 2021
* Make grandpa work

* Introduce `SharedData`

* Add test and fix bugs

* Switch to `SharedData`

* Make grandpa tests working

* More Babe work

* Make it async

* Fix fix

* Use `async_trait` in sc-consensus-slots

This makes the code a little bit easier to read and also expresses that
there can always only be one call at a time to `on_slot`.

* Make grandpa tests compile

* More Babe tests work

* Fix network test

* Start fixing service test

* Finish service-test

* Fix sc-consensus-aura

* Fix fix fix

* More fixes

* Make everything compile *yeah*

* Fix build when we have Rust 1.51

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/babe/src/tests.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/babe/src/tests.rs

Co-authored-by: André Silva <[email protected]>

* Fix warning

Co-authored-by: André Silva <[email protected]>
jordy25519 pushed a commit to cennznet/substrate that referenced this pull request Sep 17, 2021
* Make grandpa work

* Introduce `SharedData`

* Add test and fix bugs

* Switch to `SharedData`

* Make grandpa tests working

* More Babe work

* Make it async

* Fix fix

* Use `async_trait` in sc-consensus-slots

This makes the code a little bit easier to read and also expresses that
there can always only be one call at a time to `on_slot`.

* Make grandpa tests compile

* More Babe tests work

* Fix network test

* Start fixing service test

* Finish service-test

* Fix sc-consensus-aura

* Fix fix fix

* More fixes

* Make everything compile *yeah*

* Fix build when we have Rust 1.51

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/babe/src/tests.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/babe/src/tests.rs

Co-authored-by: André Silva <[email protected]>

* Fix warning

Co-authored-by: André Silva <[email protected]>
jordy25519 added a commit to cennznet/substrate that referenced this pull request Sep 17, 2021
jordy25519 pushed a commit to cennznet/substrate that referenced this pull request Sep 20, 2021
* Make grandpa work

* Introduce `SharedData`

* Add test and fix bugs

* Switch to `SharedData`

* Make grandpa tests working

* More Babe work

* Make it async

* Fix fix

* Use `async_trait` in sc-consensus-slots

This makes the code a little bit easier to read and also expresses that
there can always only be one call at a time to `on_slot`.

* Make grandpa tests compile

* More Babe tests work

* Fix network test

* Start fixing service test

* Finish service-test

* Fix sc-consensus-aura

* Fix fix fix

* More fixes

* Make everything compile *yeah*

* Fix build when we have Rust 1.51

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/common/src/shared_data.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/babe/src/tests.rs

Co-authored-by: André Silva <[email protected]>

* Update client/consensus/babe/src/tests.rs

Co-authored-by: André Silva <[email protected]>

* Fix warning

Co-authored-by: André Silva <[email protected]>
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants