Sigil documentation
ReferenceRust referencesigil-node

sigil-node · tower_durable

Source declarations, signatures and documentation for tower_durable.

Source: sigil/node/sigil-node/src/tower_durable.rs. SHA-256: efdbd6312c2e97e03c6160ebeb1c7566e4420d3a2a1a36a06fd28239e4582cb6.

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.

tower_durable::FinalityStateSnapshot

Minimal persisted snapshot of the in-memory FinalityState.

We store only the justified and finalized epoch highwater marks; the full vote set is rebuilt from individual attestation entries on restart.

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct FinalityStateSnapshot {
/// Latest epoch that reached 2/3 supermajority (justified).

pub justified_epoch: u64,
/// Latest epoch that was finalized (justified epoch + 1 also justified).

pub finalized_epoch: u64
}

Source line: 73.

tower_durable::DurableTowerStore

Durable Tower finality store backed by AkashaKV.

Stores validator registry records, per-epoch finality checkpoints, attestations (Casper FFG votes), and justified/finalized epoch markers. All multi-write operations should go through [TowerWriteBatch] + [DurableTowerStore::commit_batch] for crash safety.

pub struct DurableTowerStore {

}

Source line: 195.

tower_durable::DurableTowerStore::open

Open (or create) the store at path. The directory becomes the AkashaKV data root for the Tower subsystem.

pub fn open(path: &Path) -> Result<Self, NodeError>;

Source line: 203.

tower_durable::DurableTowerStore::get_validator

Fetch a validator record by DID. Returns None if not registered.

pub fn get_validator(&self, did: &str) -> Result<Option<ValidatorRecord>, NodeError>;

Source line: 272.

tower_durable::DurableTowerStore::put_validator

Insert or replace a validator record.

pub fn put_validator(&self, record: &ValidatorRecord) -> Result<(), NodeError>;

Source line: 281.

tower_durable::DurableTowerStore::list_all_validators

Return all validator records in the store.

pub fn list_all_validators(&self) -> Result<Vec<ValidatorRecord>, NodeError>;

Source line: 288.

tower_durable::DurableTowerStore::get_evidence

Fetch accepted slashing evidence by evidence hash.

pub fn get_evidence(
        &self,
        evidence_hash: &sigil_core::hash::SigilHash,
    ) -> Result<Option<SlashingEvidence>, NodeError>;

Source line: 299.

tower_durable::DurableTowerStore::put_evidence

Persist accepted slashing evidence.

pub fn put_evidence(&self, evidence: &SlashingEvidence) -> Result<(), NodeError>;

Source line: 310.

tower_durable::DurableTowerStore::get_checkpoint

Fetch a finality checkpoint by epoch. Returns None if not found.

pub fn get_checkpoint(&self, epoch: u64) -> Result<Option<FinalityCheckpoint>, NodeError>;

Source line: 319.

tower_durable::DurableTowerStore::put_checkpoint

Insert or replace a finality checkpoint.

pub fn put_checkpoint(&self, cp: &FinalityCheckpoint) -> Result<(), NodeError>;

Source line: 328.

tower_durable::DurableTowerStore::list_checkpoints

Return all checkpoints ordered by epoch (ascending — big-endian key).

pub fn list_checkpoints(&self) -> Result<Vec<FinalityCheckpoint>, NodeError>;

Source line: 335.

tower_durable::DurableTowerStore::get_finality_state

Fetch the persisted finality state snapshot (justified/finalized epoch highwater marks). Returns None if the node has never committed finality state — callers should initialize from genesis in that case.

pub fn get_finality_state(&self) -> Result<Option<FinalityStateSnapshot>, NodeError>;

Source line: 348.

tower_durable::DurableTowerStore::put_finality_state

Persist the finality state snapshot.

pub fn put_finality_state(&self, snap: &FinalityStateSnapshot) -> Result<(), NodeError>;

Source line: 356.

tower_durable::DurableTowerStore::put_attestation

Store a finality vote for (target_epoch, voter_did). Overwrites any previous vote by the same validator for the same epoch.

pub fn put_attestation(&self, vote: &FinalityVote) -> Result<(), NodeError>;

Source line: 365.

tower_durable::DurableTowerStore::get_attestation

Fetch the attestation cast by voter_did for epoch. Returns None if no vote has been recorded.

pub fn get_attestation(
        &self,
        epoch: u64,
        voter_did: &str,
    ) -> Result<Option<FinalityVote>, NodeError>;

Source line: 373.

tower_durable::DurableTowerStore::list_attestations_for_epoch

Return all attestations cast for epoch.

pub fn list_attestations_for_epoch(&self, epoch: u64) -> Result<Vec<FinalityVote>, NodeError>;

Source line: 386.

tower_durable::DurableTowerStore::mark_justified

Mark epoch as justified.

pub fn mark_justified(&self, epoch: u64) -> Result<(), NodeError>;

Source line: 398.

tower_durable::DurableTowerStore::is_epoch_justified

Returns true if epoch has been marked justified.

pub fn is_epoch_justified(&self, epoch: u64) -> Result<bool, NodeError>;

Source line: 403.

tower_durable::DurableTowerStore::mark_finalized

Mark epoch as finalized.

pub fn mark_finalized(&self, epoch: u64) -> Result<(), NodeError>;

Source line: 408.

tower_durable::DurableTowerStore::is_epoch_finalized

Returns true if epoch has been marked finalized.

pub fn is_epoch_finalized(&self, epoch: u64) -> Result<bool, NodeError>;

Source line: 413.

tower_durable::DurableTowerStore::list_finalized_epochs

Return all epoch numbers that have been marked finalized, in ascending order.

pub fn list_finalized_epochs(&self) -> Result<Vec<u64>, NodeError>;

Source line: 419.

tower_durable::DurableTowerStore::flush

Force a flush of AkashaKV memtables to SSTables. Useful in tests.

pub fn flush(&self) -> Result<(), NodeError>;

Source line: 437.

tower_durable::DurableTowerStore::close

Graceful shutdown — flushes memtables and stops background tasks.

pub fn close(&self) -> Result<(), NodeError>;

Source line: 444.

tower_durable::DurableTowerStore::commit_batch

Apply all operations in batch atomically via a single AkashaKV MVCC transaction.

Atomicity guarantee: if any individual operation fails the transaction is dropped (auto-aborted via Drop) before commit, leaving zero partial state visible. Either every operation in the batch lands or none do.

pub fn commit_batch(&self, batch: &TowerWriteBatch) -> Result<(), NodeError>;

Source line: 459.

tower_durable::DurableTowerStore::namespace_prefix

Test helper: return the namespace prefix used by every Tower key.

pub fn namespace_prefix() -> &'static [u8];

Source line: 511.

tower_durable::ArcTowerStore

Convenience type alias for a shared durable Tower store.

pub type ArcTowerStore = Arc<DurableTowerStore>;

Source line: 517.

tower_durable::TowerBatchOp

An individual operation inside a [TowerWriteBatch].

#[derive(Clone)]
pub enum TowerBatchOp {
    /// Insert or replace a validator record.
    PutValidator(ValidatorRecord),
    /// Persist accepted slashing evidence.
    PutEvidence(SlashingEvidence),
    /// Insert or replace a finality checkpoint.
    PutCheckpoint(FinalityCheckpoint),
    /// Persist the finality state snapshot.
    PutFinalityState(FinalityStateSnapshot),
    /// Record a Casper FFG attestation.
    PutAttestation(FinalityVote),
    /// Mark an epoch as justified.
    MarkJustified(u64),
    /// Mark an epoch as finalized.
    MarkFinalized(u64),
}

Source line: 525.

tower_durable::TowerWriteBatch

Write batch accumulating all mutations for a single Tower consensus step.

Build the batch during the step handler, then call [crate::executor::ExecutionState::commit_tower_tx] at the end to apply all mutations atomically. A crash before commit_tower_tx leaves zero partial state on disk.

#[derive(Default)]
pub struct TowerWriteBatch {

}

Source line: 549.

tower_durable::TowerWriteBatch::new

Create an empty write batch.

pub fn new() -> Self;

Source line: 555.

tower_durable::TowerWriteBatch::put_validator

Queue a validator record write.

pub fn put_validator(&mut self, record: ValidatorRecord);

Source line: 560.

tower_durable::TowerWriteBatch::put_evidence

Queue accepted slashing evidence.

pub fn put_evidence(&mut self, evidence: SlashingEvidence);

Source line: 565.

tower_durable::TowerWriteBatch::put_checkpoint

Queue a finality checkpoint write.

pub fn put_checkpoint(&mut self, cp: FinalityCheckpoint);

Source line: 570.

tower_durable::TowerWriteBatch::put_finality_state

Queue a finality state snapshot write.

pub fn put_finality_state(&mut self, snap: FinalityStateSnapshot);

Source line: 575.

tower_durable::TowerWriteBatch::put_attestation

Queue an attestation write.

pub fn put_attestation(&mut self, vote: FinalityVote);

Source line: 580.

tower_durable::TowerWriteBatch::mark_justified

Queue a justified-epoch marker write.

pub fn mark_justified(&mut self, epoch: u64);

Source line: 585.

tower_durable::TowerWriteBatch::mark_finalized

Queue a finalized-epoch marker write.

pub fn mark_finalized(&mut self, epoch: u64);

Source line: 590.

tower_durable::TowerWriteBatch::len

Number of operations queued.

pub fn len(&self) -> usize;

Source line: 595.

tower_durable::TowerWriteBatch::is_empty

Returns true if no operations have been queued.

pub fn is_empty(&self) -> bool;

Source line: 600.

tower_durable::TowerWriteBatch::into_ops

Consume the batch and return the inner op list.

pub fn into_ops(self) -> Vec<TowerBatchOp>;

Source line: 605.

On this page

tower_durable::FinalityStateSnapshottower_durable::DurableTowerStoretower_durable::DurableTowerStore::opentower_durable::DurableTowerStore::get_validatortower_durable::DurableTowerStore::put_validatortower_durable::DurableTowerStore::list_all_validatorstower_durable::DurableTowerStore::get_evidencetower_durable::DurableTowerStore::put_evidencetower_durable::DurableTowerStore::get_checkpointtower_durable::DurableTowerStore::put_checkpointtower_durable::DurableTowerStore::list_checkpointstower_durable::DurableTowerStore::get_finality_statetower_durable::DurableTowerStore::put_finality_statetower_durable::DurableTowerStore::put_attestationtower_durable::DurableTowerStore::get_attestationtower_durable::DurableTowerStore::list_attestations_for_epochtower_durable::DurableTowerStore::mark_justifiedtower_durable::DurableTowerStore::is_epoch_justifiedtower_durable::DurableTowerStore::mark_finalizedtower_durable::DurableTowerStore::is_epoch_finalizedtower_durable::DurableTowerStore::list_finalized_epochstower_durable::DurableTowerStore::flushtower_durable::DurableTowerStore::closetower_durable::DurableTowerStore::commit_batchtower_durable::DurableTowerStore::namespace_prefixtower_durable::ArcTowerStoretower_durable::TowerBatchOptower_durable::TowerWriteBatchtower_durable::TowerWriteBatch::newtower_durable::TowerWriteBatch::put_validatortower_durable::TowerWriteBatch::put_evidencetower_durable::TowerWriteBatch::put_checkpointtower_durable::TowerWriteBatch::put_finality_statetower_durable::TowerWriteBatch::put_attestationtower_durable::TowerWriteBatch::mark_justifiedtower_durable::TowerWriteBatch::mark_finalizedtower_durable::TowerWriteBatch::lentower_durable::TowerWriteBatch::is_emptytower_durable::TowerWriteBatch::into_ops