Sigil documentation
ReferenceRust referencesigil-consensus

sigil-consensus · error

Source declarations, signatures and documentation for error.

Source: sigil/node/sigil-consensus/src/error.rs. SHA-256: 9eb0f1f601109ee559977aef680da78d8667ca8be59caec6ff223b645d363cfe.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

error::ConsensusError

Errors that can occur during consensus operations.

#[derive(Debug, Clone, thiserror::Error)]
pub enum ConsensusError {
    /// The proposed block comes from an invalid proposer.
    #[error("invalid proposer: {0}")]
    InvalidProposer(String),

    /// The proposed block is structurally or semantically invalid.
    #[error("invalid block: {0}")]
    InvalidBlock(String),

    /// A signature failed verification.
    #[error("invalid signature: {0}")]
    InvalidSignature(String),

    /// Not enough stake has voted to reach quorum.
    #[error("quorum not reached: received {received}, required {required}")]
    QuorumNotReached {
        /// Stake that has voted so far.
        received: u64,
        /// Stake required for quorum (2/3 + 1).
        required: u64,
    },

    /// A validator has already cast a vote in this phase.
    #[error("duplicate vote from validator: {validator_did}")]
    DuplicateVote {
        /// The DID of the validator that voted twice.
        validator_did: String,
    },

    /// The validator is not in the current active validator set.
    #[error("not in validator set: {0}")]
    NotInValidatorSet(String),

    /// The consensus round is in an unexpected phase.
    #[error("wrong phase: expected {expected}, actual {actual}")]
    WrongPhase {
        /// The expected phase.
        expected: ConsensusPhase,
        /// The actual current phase.
        actual: ConsensusPhase,
    },

    /// A view change is currently in progress; normal operations are paused.
    #[error("view change in progress")]
    ViewChangeInProgress,

    /// An error occurred during epoch transition.
    #[error("epoch transition error: {0}")]
    EpochTransitionError(String),

    /// A semantic validation module rejected the transaction.
    #[error("semantic validation failed in module '{module}': {reason}")]
    SemanticValidationFailed {
        /// The name of the semantic validator module.
        module: String,
        /// The reason for rejection.
        reason: String,
    },

    /// A phase timeout has expired without quorum.
    #[error("timeout expired")]
    TimeoutExpired,
}

Source line: 7.

error::ConsensusPhase

The four phases of the MACA BFT consensus protocol.

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub enum ConsensusPhase {
    /// Leader proposes a block.
    Propose,
    /// Validators issue pre-votes on the proposed block.
    PreVote,
    /// Validators issue pre-commits after seeing 2/3+ pre-votes.
    PreCommit,
    /// The block is finalized after 2/3+ pre-commits.
    Finalize,
}

Source line: 73.

error::ConsensusPhase::next

Returns the next phase in the round progression.

Returns None if the current phase is Finalize (terminal).

pub fn next(self) -> Option<Self>;

Source line: 99.

On this page