feedback.rs

Overview

This file defines the AckiNackiSend struct and its associated functionality for sending acknowledgment (ACK) and negative acknowledgment (NACK) messages related to block states within a distributed network. It handles the cryptographic signing of these messages using BLS signatures, manages the destinations for ACK messages, and broadcasts NACK messages when necessary. The file plays a critical role in the communication protocol between nodes by signaling block acceptance or rejection during consensus or validation phases.

Structs and Main Components

AckiNackiSend

A struct responsible for sending ACK and NACK messages in response to block states.

Fields

Methods

send_ack(&self, block_state: BlockState) -> anyhow::Result<()>

Sends an ACK message to all interested parties (nodes) for a given block state.

Parameters

Returns

Description

Usage Example

let ack_sender = AckiNackiSend::builder()
    .node_id(my_node_id)
    .bls_keys_map(my_bls_keys_map)
    .ack_network_direct_tx(my_ack_sender)
    .nack_network_broadcast_tx(my_nack_sender)
    .build();

ack_sender.send_ack(current_block_state)?;

send_nack(&self, block_state: BlockState, reason: NackReason) -> anyhow::Result<()>

Broadcasts a NACK message indicating rejection of a block state with a specified reason.

Parameters

Returns

Description


get_signer_data(&self, block_state: &BlockState) -> Option<(SignerIndex, Secret)>

Retrieves the signer index and secret key for the current node based on the block state's BK (Byzantine Knowledge) data.

Parameters

Returns

Description


Important Implementation Details


Interaction with Other Parts of the System


Mermaid Diagram: AckiNackiSend Structure and Method Relationships

classDiagram
class AckiNackiSend {
- node_id: NodeIdentifier
- bls_keys_map: Arc<Mutex<HashMap<PubKey, (Secret, RndSeed)>>>
- ack_network_direct_tx: NetDirectSender
- nack_network_broadcast_tx: NetBroadcastSender
+ send_ack()
+ send_nack()
- get_signer_data()
}
AckiNackiSend --> BlockState : Uses
AckiNackiSend --> NetworkMessage : Sends
AckiNackiSend --> BLSSignatureScheme : Uses for signing
AckiNackiSend --> Envelope : Wraps messages
AckiNackiSend --> SHUTDOWN_FLAG : Checks shutdown state