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

sketch for auto suspension #1258

Closed
wants to merge 2 commits into from
Closed

sketch for auto suspension #1258

wants to merge 2 commits into from

Conversation

drsk0
Copy link
Contributor

@drsk0 drsk0 commented Nov 19, 2024

Purpose

Discuss how to trigger suspension at snapshot. I filled in most of the missing pieces, but would like to be sure, that processSuspensions is doing the right thing.

Changes

_Describe the changes that were needed.

Checklist

  • My code follows the style of this project.
  • The code compiles without warnings.
  • I have performed a self-review of the changes.
  • I have documented my code, in particular the intent of the
    hard-to-understand areas.
  • (If necessary) I have updated the CHANGELOG.

CLA acceptance

_Remove if not applicable.

By submitting the contribution I accept the terms and conditions of the
Contributor License Agreement v1.0

@drsk0 drsk0 requested a review from td202 November 19, 2024 11:44
@drsk0 drsk0 force-pushed the primed_for_suspension branch from 267725c to 279a226 Compare November 19, 2024 17:52
Comment on lines 37 to 40
putBool finalizationAwake
mapM_ putWord64be missedRounds
putBool suspensionPrimed
Copy link
Contributor

Choose a reason for hiding this comment

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

Could combine the boolean flags with a bitmap.

@drsk0 drsk0 force-pushed the primed_for_suspension branch 7 times, most recently from 6f62054 to fc68e0c Compare November 26, 2024 14:30
@drsk0 drsk0 requested a review from td202 November 26, 2024 14:37
@drsk0 drsk0 force-pushed the primed_for_suspension branch 3 times, most recently from 15db203 to ca98f6d Compare November 26, 2024 18:11
Copy link
Contributor

@td202 td202 left a comment

Choose a reason for hiding this comment

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

This is looking good. I think it would be helpful to refine what the missed block count and primed for suspension actually mean.

  • Missed block count: rounds that a validator won but failed to bake a block since the last round that a validator contributed to as a baker or finalizer, since it most recently became a (non-suspended) member of the validator committee.
  • Primed for suspension: should be set on a payday when the missed block count exceeds the threshold. Should be cleared when the validator contributes again. At the snapshot epoch, validators that are primed will not be included in the next committee and will be set as suspended (if still an active validator).

If the payday length is 1 epoch, then each payday transition is also the snapshot for the next payday. For this to make sense, we need to determine the set of validators that should get suspended (i.e. the ones that are already marked as primed) before marking any validators as primed. I think this is consistent with the order of operations discussed elsewhere in this review.

Comment on lines 232 to 233
(theState9, isSnapshot) <-
if newEpoch + 1 == newNextPayday
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
(theState9, isSnapshot) <-
if newEpoch + 1 == newNextPayday
let isSnapshot = newEpoch + 1 == newNextPayday
theState9 <-
if isSnapshot

Copy link
Contributor

Choose a reason for hiding this comment

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

Here, we're calculating the the validators for the next payday, so we should take into account which validators are going to be suspended here and exclude them. (Not just the ones that are already suspended.) I would suggest we should calculate the validators that are going to be suspended (i.e. check which ones are primed) here, exclude them from the calculation in computeBakerStakesAndCapital, and then return this set which is then passed on to processSuspensions to actually suspend them in the epilogue.

@drsk0 drsk0 force-pushed the primed_for_suspension branch 5 times, most recently from 41edd01 to 69ff933 Compare December 2, 2024 14:05
@drsk0 drsk0 force-pushed the primed_for_suspension branch from 69ff933 to d4d31bf Compare December 2, 2024 14:48
@drsk0
Copy link
Contributor Author

drsk0 commented Dec 2, 2024

This has been fully implemented now. I'll open two separate PR to bring the changes in. First one is #1264. This are only the new data structures. The second one will contain the implementation.

@drsk0 drsk0 closed this Dec 2, 2024
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.

2 participants