Skip to main content

Crate snarkos_node_bft

Crate snarkos_node_bft 

Source

Re-exports§

pub use snarkos_node_bft_events as events;
pub use snarkos_node_bft_ledger_service as ledger_service;
pub use snarkos_node_bft_storage_service as storage_service;

Modules§

helpers

Macros§

spawn_blocking
A helper macro to spawn a blocking task.

Structs§

BFT
Gateway
The gateway maintains connections to other validators. For connections with clients and provers, the Router logic is used.
InnerGateway
Primary
The primary logic of a node. AleoBFT adopts a primary-worker architecture as described in the Narwhal and Tusk paper (Section 4.2).
ProposalTask
Manages batch proposal readiness and drives the batch proposal loop.
Sync
Block synchronization logic for validators.
Worker
A worker’s main role is maintaining a queue of verified (“ready”) transmissions, which will eventually be fetched by the primary when the primary generates a new batch.

Enums§

ProposedBatchState
The state of the primary’s batch proposal.

Constants§

CONTEXT
CREATE_BATCH_INTERVAL
The time a primary waits between attempts to create a new batch (only relevant after MIN_BATCH_DELAY has passed). This only serves as a failsafe in case the task does not get woken up through other means. Lowering it too much would be wasteful.
MAX_BATCH_DELAY
The maximum time to wait before proposing a batch.
MAX_FETCH_TIMEOUT
The maximum time to wait before timing out on a fetch. TODO(kaimast): directy multiply by constant once the const_trait_impl feature is stable.
MAX_LEADER_CERTIFICATE_DELAY
The maximum time allowed for the leader to send their certificate. After this time, the node will consider the leader as failed and try to advance the round without it.
MAX_TIMESTAMP_DELTA
The maximum difference allowed between our local time and a certificate’s timestamp, for the node to sign the certificate. This prevents malicious actors from proposing certificates with timestamps that are too log or too far in the future) w
MAX_VALIDATORS_TO_SEND
The maximum number of validators to send in a validators response event.
MAX_WORKERS
The maximum number of workers that can be spawned.
MEMORY_POOL_PORT
The port on which the memory pool listens for incoming connections.
MIN_BATCH_DELAY
The minimum time that needs to elapse between two consecutive batch proposals. This creates a lower bound on the block interval, and ensures the network will not be overwhelmed with too many blocks/certificates.
PRIMARY_PING_INTERVAL
The interval at which each primary broadcasts a ping to every other node. Note: If this is updated, be sure to update MAX_BLOCKS_BEHIND to correspond properly.
WORKER_PING_INTERVAL
The interval at which each worker broadcasts a ping to every other node.

Traits§

PrimaryCallback
This callback trait allows listening to changes in the Primary, such as round advancement. This is implemented by [BFT].
SyncCallback
This callback trait allows listening to synchronization updates, such as discorvering new BatchCertificates. This is currently used by BFT.
Transport
Part of the Gateway API that deals with networking. This is a separate trait to allow for easier testing/mocking.

Type Aliases§

ProposedBatch
A helper type to keep track of the state of the primary’s batch proposal.