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

Commit

Permalink
Split NetworkBridge and break cycles with Unbounded (#2736)
Browse files Browse the repository at this point in the history
* overseer: pass messages directly between subsystems

* test that message is held on to

* Update node/overseer/src/lib.rs

Co-authored-by: Peter Goodspeed-Niklaus <[email protected]>

* give every subsystem an unbounded sender too

* remove metered_channel::name

1. we don't provide good names
2. these names are never used anywhere

* unused mut

* remove unnecessary &mut

* subsystem unbounded_send

* remove unused MaybeTimer

We have channel size metrics that serve the same purpose better now and the implementation of message timing was pretty ugly.

* remove comment

* split up senders and receivers

* update metrics

* fix tests

* fix test subsystem context

* use SubsystemSender in jobs system now

* refactor of awful jobs code

* expose public `run` on JobSubsystem

* update candidate backing to new jobs & use unbounded

* bitfield signing

* candidate-selection

* provisioner

* approval voting: send unbounded for assignment/approvals

* async not needed

* begin bridge split

* split up network tasks into background worker

* port over network bridge

* Update node/network/bridge/src/lib.rs

Co-authored-by: Andronik Ordian <[email protected]>

* rename ValidationWorkerNotifications

Co-authored-by: Peter Goodspeed-Niklaus <[email protected]>
Co-authored-by: Andronik Ordian <[email protected]>
  • Loading branch information
3 people committed Mar 28, 2021
1 parent e99cda2 commit bcad733
Show file tree
Hide file tree
Showing 16 changed files with 1,155 additions and 1,310 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions node/core/approval-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,10 @@ async fn handle_actions(
let block_hash = indirect_cert.block_hash;
let validator_index = indirect_cert.validator;

ctx.send_message(ApprovalDistributionMessage::DistributeAssignment(
ctx.send_unbounded_message(ApprovalDistributionMessage::DistributeAssignment(
indirect_cert,
candidate_index,
).into()).await;
).into());

launch_approval(
ctx,
Expand Down Expand Up @@ -694,7 +694,7 @@ async fn handle_background_request(
) -> SubsystemResult<Vec<Action>> {
match request {
BackgroundRequest::ApprovalVote(vote_request) => {
issue_approval(ctx, state, metrics, vote_request).await
issue_approval(ctx, state, metrics, vote_request)
}
BackgroundRequest::CandidateValidation(
validation_data,
Expand Down Expand Up @@ -1701,7 +1701,7 @@ async fn launch_approval(

// Issue and import a local approval vote. Should only be invoked after approval checks
// have been done.
async fn issue_approval(
fn issue_approval(
ctx: &mut impl SubsystemContext,
state: &State<impl DBReader>,
metrics: &Metrics,
Expand Down Expand Up @@ -1807,12 +1807,14 @@ async fn issue_approval(
metrics.on_approval_produced();

// dispatch to approval distribution.
ctx.send_message(ApprovalDistributionMessage::DistributeApproval(IndirectSignedApprovalVote {
block_hash,
candidate_index: candidate_index as _,
validator: validator_index,
signature: sig,
}).into()).await;
ctx.send_unbounded_message(
ApprovalDistributionMessage::DistributeApproval(IndirectSignedApprovalVote {
block_hash,
candidate_index: candidate_index as _,
validator: validator_index,
signature: sig,
}
).into());

Ok(actions)
}
Expand Down
Loading

0 comments on commit bcad733

Please sign in to comment.