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

Qbft tests #94

Merged
merged 11 commits into from
Jan 20, 2025
Merged

Qbft tests #94

merged 11 commits into from
Jan 20, 2025

Conversation

Zacholme7
Copy link
Member

@Zacholme7 Zacholme7 commented Jan 13, 2025

Issue Addressed

#36

Proposed Changes

Few changes here

  • Added more unit tests to ensure proper functionality
  • Bugfix to prevent case where ROUNDCHANGE never reached quorum
  • Track the number of nodes that reached consensus for testing
  • Add the ability to stop and restart nodes in the qbft instance. This simulates nodes going down and rejoining.

Update

Todo

  • The qbft manager drives round changes so there should be more rigorous end to end testing using that. This should be a separate issue to test both the ROUNDCHANGE and the manager.

@Zacholme7 Zacholme7 added the QBFT label Jan 13, 2025
jking-aus
jking-aus previously approved these changes Jan 13, 2025
Copy link
Contributor

@jking-aus jking-aus left a comment

Choose a reason for hiding this comment

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

nice catch zac -- good extension to tests as well

@Zacholme7 Zacholme7 marked this pull request as ready for review January 14, 2025 16:27
@Zacholme7 Zacholme7 added the ready-for-review This PR is ready to be reviewed label Jan 14, 2025

// Remove round change messages that would be for previous rounds
self.round_change_messages
.retain(|&round, _value| round >= self.current_round);

// We are waiting for consensus on a round change, do not start the round yet
if matches!(self.state, InstanceState::SentRoundChange) {

Choose a reason for hiding this comment

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

What happens to the caller(s) in this case?

Copy link
Member Author

Choose a reason for hiding this comment

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

If we hit this state, that means that we have received some round change messages but have not received a quorum yet, so nothing happens until the node reaches a round change quorum and can start the next round.

Choose a reason for hiding this comment

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

I guess I'm just wondering about the API. In this case, we call start_roundbut nothing happens and it's not communicated to the caller.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh got it good point. I dont think it really matters. The caller can assume that when it makes some call to qbft, if there is a message that has to be sent it will receive it. In this case, we have no message to send since there is no progress to be made. here it just spins. I will think more on this.

Choose a reason for hiding this comment

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

It somehow feels strange to call start_round, nothing happens, and there's no error. Does the caller find out about it in another way? Does it call it again later?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep I get what you are saying. Calling start_round makes it seem like the round will start. Maybe try_start_round is better? Im hesitant to call this an error because it is functioning correctly, it just cant make any progress. Maybe it is better try to put this logic into the proposal code.

The caller will keep calling it until there is a quorum of round change messages and it can make progress, or right away when it is round 0. There should be errors added so that the caller can handle clear errors such as incorrect messages, but in this case there is really nothing for the caller to do. All that can be done is to wait for more round change messages to reach quorum.

Copy link
Contributor

@jking-aus jking-aus left a comment

Choose a reason for hiding this comment

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

great work mate

@jking-aus jking-aus merged commit 0232bf5 into sigp:unstable Jan 20, 2025
10 checks passed
@Zacholme7 Zacholme7 deleted the qbft-tests branch January 24, 2025 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QBFT ready-for-review This PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants