Expand description
Byzantine fault tolerance models for consensus protocols.
This module provides abstractions over quorum calculations for different BFT fault models. The two primary models are:
N3f1: Fault model requiringn >= 3f + 1participantsN5f1: Fault model requiringn >= 5f + 1participants
f denotes the maximum number of faults that can be tolerated.
§Example
use commonware_utils::{Faults, N3f1, N5f1};
// n >= 3f+1
let n = 10;
assert_eq!(N3f1::max_faults(n), 3); // f = (n-1)/3 = 3
assert_eq!(N3f1::quorum(n), 7); // q = n - f = 7
// n >= 5f+1
assert_eq!(N5f1::max_faults(n), 1); // f = (n-1)/5 = 1
assert_eq!(N5f1::quorum(n), 9); // q = n - f = 9
// Works with any integer type
let n_i32: i32 = 10;
assert_eq!(N3f1::max_faults(n_i32), 3);
assert_eq!(N3f1::quorum(n_i32), 7);Structs§
- N3f1
- Fault model requiring
n >= 3f + 1participants. - N5f1
- Fault model requiring
n >= 5f + 1participants.
Traits§
- Faults
- A Byzantine fault tolerance model that defines quorum calculations.