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

Abandon decided blocks #2968

Merged
merged 6 commits into from
Apr 24, 2024
Merged

Abandon decided blocks #2968

merged 6 commits into from
Apr 24, 2024

Conversation

StephenButtolph
Copy link
Contributor

Why this should be merged

This ensures that there will never be any jobs blocking on blocks that failed issuance due to already being decided.

How this works

  • Abandons the delivered block if it is decided.
  • Adds test.

How this was tested

  • Added unit tests.
  • CI

@StephenButtolph StephenButtolph added the consensus This involves consensus label Apr 24, 2024
@StephenButtolph StephenButtolph added this to the v1.11.5 milestone Apr 24, 2024
@StephenButtolph StephenButtolph self-assigned this Apr 24, 2024
// Poll = 0 terminates. This will accept blocks 0 and 1. This will also reject block 3.
// Block = 4 will attempt to be delivered, but because it is effectively rejected due to the acceptance of block 1, it will be dropped.
// Poll = 1 should terminate and block 2 should be repolled.
func TestEngineVoteStallRegression(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

(No action required) Could this behavior be validated in a simpler fashion? While this test may accurately reproduce the failure scenario, it's complexity may complicate future maintenance and may not be the best model for future test additions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is basically a "black box" test of the engine... I wanted to avoid touching the internals (to avoid future maintenance burden).

We could additionally add a "clear box" test of deliver as a very targeted test for this behavior. Would that make sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is basically a "black box" test of the engine... I wanted to avoid touching the internals (to avoid future maintenance burden).

Fair enough, always a balancing act.

We could additionally add a "clear box" test of deliver as a very targeted test for this behavior. Would that make sense?

Ideally every method gets as much coverage as makes sense, but I'm not sure how valuable a whitebox test would be without a refactor due to how dependent it is on state other than the method inputs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah... The engine code is probably always going to have this job queue logic (So there will be some state between calls)... But I do hope that we will be able to significantly improve the testability + readability of the engine in some future PRs.

What I really want this to look like at the end of the day is specifying the "initial" state of the engine (with pending jobs and pending polls) and then verify the "output" state of the engine after some event happens... But that's really a large refactor (which is ongoing, but not for this PR)

@StephenButtolph StephenButtolph added this pull request to the merge queue Apr 24, 2024
Merged via the queue into master with commit 1f5fba9 Apr 24, 2024
19 checks passed
@StephenButtolph StephenButtolph deleted the abandon-decided-blocks branch April 24, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus This involves consensus
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants