Module helpers

Source
Expand description

Helper functions used by any task

StructsΒ§

LeafChainTraversalOutcome
Helper type to give names and to the output values of the leaf chain traversal operation.

FunctionsΒ§

broadcast_event
Helper function to send events and log errors
broadcast_view_change
check_qc_state_cert_correspondence πŸ”’
decide_epoch_root πŸ”’
Handles calling add_epoch_root and sync_l1 on Membership if necessary.
decide_from_proposal
Ascends the leaf chain by traversing through the parent commitments of the proposal. We begin by obtaining the parent view, and if we are in a chain (i.e. the next view from the parent is one view newer), then we begin attempting to form the chain. This is a direct impl from HotStuff section 5:
decide_from_proposal_2
calculate the new decided leaf chain based on the rules of HotStuff 2
fetch_proposal πŸ”’
Trigger a request to the network for a proposal for a view and wait for the response or timeout.
handle_drb_result
parent_leaf_and_state πŸ”’
Gets the parent leaf and state from the parent of a proposal, returning an [utils::anytrace::Error] if not.
transition_qc πŸ”’
update_high_qc πŸ”’
update_metrics πŸ”’
validate_epoch_transition_qc πŸ”’
validate_light_client_state_update_certificate
Validates the light client state update certificate
validate_proposal_safety_and_liveness
Validate the state and safety and liveness of a proposal then emit a QuorumProposalValidated event.
validate_proposal_view_and_certs πŸ”’
Validates, from a given proposal that the view that it is being submitted for is valid when compared to cur_view which is the highest proposed view (so far) for the caller. If the proposal is for a view that’s later than expected, that the proposal includes a timeout or view sync certificate.
validate_qc_and_next_epoch_qc
Validates qc’s signatures and, if provided, validates next_epoch_qc’s signatures and whether it corresponds to the provided high_qc.
wait_for_second_vid_share
Gets the second VID share, the current or the next epoch accordingly, from the shared consensus state; makes sure it corresponds to the given DA certificate; if it’s not yet available, waits for it with the given timeout.