Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadcast produced transition immediately #13551

Conversation

georgeee
Copy link
Member

@georgeee georgeee commented Jul 10, 2023

This PR addresses two conditions related to block processing/production.

First problem is that after block is produced, it is scheduled for broadcast only in next cycle (or even in the cycle after next). If some long async job appears in between (and this is what happens in Berkeley now), broadcast will be delayed, potentially causing block to appear later-than-needed on other nodes (especially on clusters using block window below 1 minute).

Second problem appears when node goes to bootstrap while a block is being processed in add_and_finalize. It happens very infrequently, but shuts the node down when happens.

Solution: broadcast produced transition immediately after it's added to frontier and check for pipe not being closed before writing to it.

Explain how you tested your changes:

  • Tested on a private cluster (45s block window, epoch length 288, k=12), monitoring long async cycles and ensuring cluster's health

Checklist:

  • Dependency versions are unchanged
    • Notify Velocity team if dependencies must change in CI
  • Modified the current draft of release notes with details on what is completed or incomplete within this project
  • Document code purpose, how to use it
    • Mention expected invariants, implicit constraints
  • Tests were added for the new behavior
    • Document test purpose, significance of failures
    • Test names should reflect their purpose
  • All tests pass (CI will check this if you didn't)
  • Serialized types are in stable-versioned modules
  • Does this close issues?

Closes #13508 with the help of #13550

@georgeee georgeee requested a review from a team as a code owner July 10, 2023 16:28
@georgeee georgeee force-pushed the georgeee/broadcast-transition-immediately-upon-finalization branch 2 times, most recently from 4cb69af to 615d11b Compare July 12, 2023 22:32
@georgeee
Copy link
Member Author

!ci-build-me

@@ -2056,9 +2056,6 @@ let create ?wallets (config : Config.t) =
valid_cb
| `Internal ->
(*Send callback to publish the new block. Don't log rebroadcast message if it is internally generated; There is a broadcast log*)
don't_wait_for
(Mina_networking.broadcast_state net
(Mina_block.Validated.forget transition) ) ;
Option.iter
~f:
(Fn.flip
Copy link
Member

Choose a reason for hiding this comment

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

isn't the broadcast blocked by this validation callback? Like whatever was causing the delay to get to here, wouldn't that still affect block broadcasts?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, because there is no validation callback for internal blocks. This code does nothing. I rewrote it subtantially in Bitswap branch, but here attempted to keep the code change minimal

georgeee added 2 commits July 13, 2023 13:09
Problem: after block is produced, it is scheduled for broadcast only in
next cycle (or even in the cycle after next). If some long async job
appears in between (and this is what happens in Berkeley now), broadcast
will be delayed, potentially causing block to appear later-than-needed
on other nodes (especially on clusters using block window below 1
minute).

Solution: broadcast produced transition immediately after it's added to
frontier.
@georgeee georgeee force-pushed the georgeee/broadcast-transition-immediately-upon-finalization branch from 615d11b to 2b89556 Compare July 13, 2023 11:09
@georgeee
Copy link
Member Author

!ci-build-me

@nholland94 nholland94 merged commit c12d020 into berkeley Jul 13, 2023
@nholland94 nholland94 deleted the georgeee/broadcast-transition-immediately-upon-finalization branch July 13, 2023 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants