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

Remember a fast block proposal: it remains locked even if re-proposed. #3140

Merged
merged 5 commits into from
Jan 16, 2025

Conversation

afck
Copy link
Contributor

@afck afck commented Jan 15, 2025

Motivation

In the fast round, the validators sign to confirm right away, so the block proposal must count as locked.

However, if the same block is re-proposed in a later round, the proposed field is overwritten and, due to the different round, is now not considered locked anymore.

Proposal

Keep track of the fast round proposal as part of the locked field, too.

Test Plan

The problem was reproduced by extending test_fast_proposal_is_locked.

Release Plan

  • Nothing to do / These changes follow the usual release cycle.

Links

Comment on lines 111 to 112
/// The current locked block: Validators are only allowed to sign any proposal with a different
/// block if they see a `ValidatedBlock` certificate with a higher round.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mean:
Validators are allowed to sign a different block (from the locked block) iff they see a ValidatedBlockCertificate for it with a higher round

if so, consider replacing the comment as my version reads better (IMHO ofc).

@afck afck requested review from ma2bd and bart-linera January 16, 2025 10:28
@afck afck marked this pull request as ready for review January 16, 2025 10:28
linera-chain/src/manager.rs Outdated Show resolved Hide resolved
linera-chain/src/manager.rs Outdated Show resolved Hide resolved
Comment on lines 455 to 460
self.set_proposed(proposal);
self.update_current_round(local_time);
return Ok(None);
};

self.check_proposal_round(&proposal)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

So we check the proposal's vailidity w.r.t. to the round only when we're actively validating? i.e. shouldn't this check be before the let Some(key_pair) = key_pair else { ... } which will return early?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because even if the proposal isn't from the current round, on the client side we still want to add it to the proposed field so that in multi leader rounds we know we shouldn't make a proposal in the same round ourselves. (This partially addresses #2971.)

Copy link
Contributor

Choose a reason for hiding this comment

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

That's confusing TBH. That the logic here is makes these distinction b/c of some hidden requirements (i.e. being invoked on client vs server side).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. As I mentioned on Slack, I think we should make that distinction more explicit. But I think that will be a bigger change, and I'm not sure if it wouldn't make this PR even harder to review. Happy to give it a try, though, if you prefer.

Copy link
Contributor

Choose a reason for hiding this comment

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

No, that's fine. Just maybe leave that part in addition to the comment above (in the else { ... } clause).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I'll also add another check so that we only add the proposal if it's before the single leader rounds. For those we don't need it, and we also shouldn't accept it before the round has begun. Sorry for the confusion! I hope we can separate some of the client vs. validator logic soon, and clarify all of this.

// Record the proposed block, so it can be supplied to clients that request it.
self.proposed.set(Some(proposal));
self.set_proposed(proposal);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this (and line below) to line 452?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, we can't update the current round before checking against the current round.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this was conditional on the acceptance of the previous comment.

@afck afck merged commit bdd63a9 into linera-io:main Jan 16, 2025
22 checks passed
@afck afck deleted the fast-locked branch January 16, 2025 13:25
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.

Fast block proposal is locked, but can be overwritten.
2 participants