Overview of snarkos-node-bft-events
stagingsnarkos-node-bft-events crate provides the event system for a memory pool within the snarkos BFT node architecture. It is used to handle and propagate events related to memory pool operations.repository·staging·Indexed 26 days ago
https://github.com/provablehq/snarkosA decentralized operating system for zero-knowledge applications and the backbone of the Aleo network. Version 4.8.1. It handles transaction verification, encrypted state storage, and BFT-based consensus. The project includes crates for account management (snarkos-account), CLI interaction (snarkos-cli), node display (snarkos-display), and a BFT node architecture featuring a memory pool, ledger services, and a rate-limiting consensus mempool.
snarkos-node-bft-events crate provides the event system for a memory pool within the snarkos BFT node architecture. It is used to handle and propagate events related to memory pool operations.snarkos-node-sync crate provides a synchronization module designed for use within snarkos nodes. It is responsible for managing the synchronization logic required for nodes to maintain state consistency.snarkos-cli crate provides the CLI struct, which serves as the command-line interface for interacting with the snarkos node.The snarkos-node-network crate provides the networking foundation for snarkOS nodes. It is responsible for:
The snarkos-utilities crate provides shared primitives for building Aleo-related node components. It focuses on two main areas:
SignalHandler, SimpleStoppable, and Stoppable to manage graceful shutdowns and system signals.NodeDataDir to assist in locating node-specific configuration files, such as peer caches and proposal caches.snarkos-node-bft-storage-service crate provides a storage service implementation specifically designed for a memory pool within the snarkos BFT node architecture.snarkos-node-sync-communication-service crate provides a communication service implementation specifically designed for use within a synchronization module in the snarkos ecosystem.The snarkos-node-bft crate implements a BFT-based memory pool. The Primary acts as a coordinator responsible for advancing rounds and broadcasting the anchor.
Round advancement follows the Bullshark protocol and occurs once a quorum (n - f) of validators have submitted certificates for that round, subject to these conditions:
MAX_LEADER_CERTIFICATE_DELAY (currently 5 seconds) before advancing without it.f + 1 certificates from the current round must reference the previous even round's leader certificate (availability threshold), or n - f certificates must not (non-leader quorum). If neither is met, the node falls back to the MAX_LEADER_CERTIFICATE_DELAY timeout.The snarkos-node-sync-locators crate provides block locators, which are data structures used by nodes to advertise the blocks they possess to other nodes. This facilitates blockchain synchronization across the network.
A single block locator consists of:
The BlockLocators struct organizes multiple locators into two distinct maps:
checkpoints: A map of block heights to block hashes.recents: A map of block heights to block hashes.This crate also provides functionality to:
The snarkos-node-consensus crate manages a rate-limiting mempool for incoming transmissions (solutions or transactions) and constructs blocks from batches confirmed by the BFT layer. It uses a two-tier architecture to prevent overloading BFT workers:
Incoming transmissions are first placed in inbound queues where they are checked for duplicates but not fully verified:
The BFT layer uses multiple workers, each with its own ready queue. Transmissions in this queue are verified and ready for batch proposals.
Consensus periodically (every MAX_BATCH_DELAY_IN_MS) moves transmissions from inbound queues to workers if:
MAX_TRANSMISSIONS_TOLERANCE unconfirmed transmissions).check_solution_basic() for solutions or check_transaction_basic() for transactions).snarkos-node-router-messages crate defines the specific message types required for communication within the snarkos-node-router crate. Developers building or extending components that interact with the snarkos-node-router should use this crate to ensure message compatibility.snarkos-node-router crate provides the Router struct, which is the core component responsible for routing messages between nodes within the snarkos network.