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

Spec - New ValidatorRegistration/ValidatorExit duties stop old ones #317

Closed
wants to merge 28 commits into from

Conversation

GalRogozinski
Copy link
Contributor

Description

Stalling ValidatorRegistration/ValidatorExit duties prevented the execution of new duties. Now when a duty that fits a higher slot comes in it stops the old one.

Affected tests

post_wrong_decided - Deleted. Seems to be a duplicate of post_future_decided. Unclear what "wrong" means in the context.

post_future_decided - renamed to old_slot_duty. Now that we don't support future messages this is a more fitting name. Cases for missing duties added.

Added missing cases to:
consensus_not_started, duplicate_duty_finished, duplicate_duty_not_finished, and finished.

Copy link
Contributor

@MatheusFranco99 MatheusFranco99 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@MatusKysel MatusKysel left a comment

Choose a reason for hiding this comment

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

👍

@@ -234,9 +234,10 @@ func (b *BaseRunner) hasRunningDuty() bool {
}

func (b *BaseRunner) ShouldProcessDuty(duty *types.Duty) error {
if b.QBFTController.Height >= qbft.Height(duty.Slot) && b.QBFTController.Height != 0 {
// assume StartingDuty is not nil if state is not nil
if b.State != nil && b.State.StartingDuty.Slot >= duty.Slot {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just add b.QBFTController != nill check?
Why change it to the above which changes the whole logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While fixing the issue I thought about making things better.

  1. In general each validator duty runner can run only one duty at a time.
  2. There is no real reason to make rule (1) dependent on QBFT controller. If we do separation of concerns and processes it is unclear why the runner has to even have access to the internal state of QBFT controller.
  3. With my current change all duties (including the ones that aren't beacon duties) follow the exact same pattern. Because of the special exemptions we did to duties with no QBFT we ran into this issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added a fallback that uses QBFTController just to get this approved

Copy link
Contributor

Choose a reason for hiding this comment

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

From my perspective, indeed, the change makes module separation better and avoids the problem with the validator registration and exit duties

}
r.BaseRunner.baseSetupForNewDuty(duty)
return r.executeDuty(duty)
return r.BaseRunner.baseStartNewDuty(r, duty)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is r.executeDuty removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

baseStartNewDuty calls it

@GalRogozinski
Copy link
Contributor Author

Replaced by #318

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.

5 participants