filecoin_f3_gpbft/
lib.rs

1// Copyright 2019-2024 ChainSafe Systems
2// SPDX-License-Identifier: Apache-2.0, MIT
3
4//! GPBFT consensus protocol implementation.
5//!
6//! This module provides the core structures and logic for the GPBFT consensus protocol, including:
7//! - Chain and tipset structures for blockchain state representation
8//! - Power table management for validator voting power tracking
9//! - Consensus phases and payload structures
10//! - Justification and verification mechanisms
11//! - Network types such as `ActorId`, `StoragePower`, and `PubKey`
12//!
13//! Key components:
14//! - [`ECChain`]: Represents a chain of tipsets
15//! - [`PowerTable`]: Manages validator voting power
16//! - [`Payload`]: Contains consensus round information
17//! - [`Justification`]: Holds votes and signatures for consensus decisions
18//!
19//! This module enables:
20//! - Building and validating blockchain structures
21//! - Managing validator power and keys
22//! - Progressing through consensus phases
23//! - Creating and verifying consensus decisions
24//!
25//! It provides the foundational types and logic for implementing GPBFT consensus in a blockchain network.
26
27pub mod api;
28pub mod chain;
29mod error;
30pub mod justification;
31pub mod payload;
32pub mod powertable;
33pub mod test_utils;
34mod types;
35
36// re-exports
37pub use fvm_ipld_bitfield::BitField;
38pub use fvm_ipld_encoding::{Error as CborError, to_vec as to_vec_cbor};
39pub use num_bigint::{BigInt, Sign};
40pub use num_traits::Zero;
41
42pub use crate::chain::{Cid, ECChain, Tipset, cid_from_bytes};
43pub use crate::justification::Justification;
44pub use crate::payload::{Payload, Phase, SupplementalData};
45pub use error::GPBFTError;
46pub use powertable::{PowerEntries, PowerEntry, PowerTable, is_strong_quorum};
47pub use types::{ActorId, NetworkName, PubKey, StoragePower};
48
49type Result<T> = std::result::Result<T, GPBFTError>;