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
Prev Previous commit
Next Next commit
invalid message
  • Loading branch information
Zacholme7 committed Jan 13, 2025
commit 626d00c36453c2fe781ce40febadf3e0d40d3f85
23 changes: 23 additions & 0 deletions anchor/common/qbft/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,3 +588,26 @@ async fn test_node_recovery() {
let num_consensus = test_instance.wait_until_end().await;
assert!(num_consensus == 5);
}

#[tokio::test]
// Test sending a random invalid message
async fn test_invalid_message() {
let committee_size = 5;
let mut test_instance = TestQBFTCommitteeBuilder::default()
.committee_size(committee_size)
.run(42);

// Try sending invalid, out of order message
let future_round_msg = ConsensusData {
round: Round(5), // Future round
data: 24,
};

test_instance.send_message(
&OperatorId::from(0),
InMessage::Prepare(OperatorId::from(0), future_round_msg),
);

let num_consensus = test_instance.wait_until_end().await;
assert!(num_consensus == 5);
}
Loading