Skip to main content

Crate moloch_chain

Crate moloch_chain 

Source
Expand description

Chain operations for Moloch audit chain.

This crate provides chain management without networking:

  • Chain state machine (apply/revert blocks)
  • Validator registry (PoA consensus)
  • Mempool (pending event queue)
  • Block producer (timer-based production)

§Architecture

┌─────────────────────────────────────────────────────────┐
│                    BlockProducer                        │
│  (Timer-based block creation from mempool events)       │
└─────────────────────────────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────┐
│                      Mempool                            │
│  (Pending events: priority queue, dedup, expiration)    │
└─────────────────────────────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────┐
│                    ChainState                           │
│  (Head, height, validator set, apply/revert blocks)     │
└─────────────────────────────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────┐
│                   ValidatorSet                          │
│  (Authorized sealers, round-robin leader selection)     │
└─────────────────────────────────────────────────────────┘

Structs§

ApplyResult
Result of applying a block.
BlockProducer
Block producer that creates blocks from mempool events.
ChainConfig
Chain configuration parameters.
ChainSnapshot
A lightweight snapshot of chain state.
ChainState
Current state of the audit chain.
ConcurrentMempool
Lock-free concurrent mempool for pending audit events.
ConcurrentMempoolConfig
Configuration for the concurrent mempool.
ConcurrentMempoolStats
Statistics for the concurrent mempool.
Mempool
Mempool for pending events.
MempoolConfig
Configuration for the mempool.
MempoolEntry
An entry in the mempool.
ProducerConfig
Configuration for the block producer.
SlashingEvidence
Evidence of validator misbehavior (for slashing).
ValidatorChange
A pending validator set change.
ValidatorSet
A set of validators authorized to produce blocks.

Enums§

ChainError
Errors specific to chain state operations.
MisbehaviorKind
Types of validator misbehavior.
ValidatorChangeKind
Type of validator set change.