Skip to content

Crate vyrn consensus

Amp edited this page Nov 18, 2026 · 1 revision

vyrn-consensus

crates/vyrn-consensus · layer 4 of spec 11 §1.4 · not pinned (11 §1.3)

Purpose

Simplex on Commonware. It orders blocks that vyrn-log builds and never calls the matching engine. In the words of 07, "BFT finalizes the order, not the state". The crate defines four boundary contracts: the block source, the proposal, the committee and the finality certificate. It wires them into commonware-consensus Simplex for one voter, and it detects a silent sequencer.

Spec sections it implements

  • 07 §6.3 (Simplex mapping, REP_Proposal)
  • 07 §6.4 (the vote rule INV-REP-4): item 1 here, items 2–5 through BlockSource::check_body
  • 07 §6.5 (REP_FinalityCert, INV-QUORUM of 01 §7)
  • 07 §9.1–§9.2 (silence detection, deposition count)
  • 07 §13.1 and 01 §14.4 (who votes; the sequencer never votes)

Main public types

Type Role
BlockSource (trait), Verdict What consensus asks the log: header, and Valid / Invalid / Pending for the rest of a block
LogSource, Genesis The BlockSource backed by a vyrn-log BlockStore, and its anchor
Proposal, ProposalKind REP_Proposal, 85 bytes: Headers or Seal
Committee The voters of REP_Membership. Refuses any seq_key among the voters
FinalityCert, verify_finality_cert The certificate, and the one offline check of it
voter::App, voter::config, VoterConfig Simplex Automaton / Relay / Reporter wiring for one voter
voter::Finalized Reporter that turns every finalization into a FinalityCert
silence::Frames, Suspicion, Deposition Frame-arrival clock, silence suspicion, and the deposition count

Status on main (a9f0d61)

Implemented (partial)

  • Proposal codec, committee, certificate check, block-source split and a Simplex voter are implemented. Conformance vectors are in vectors/finality_cert.txt.
  • silence.rs: "The signed Silence message and its TailReport (07 §9.3) are not in this crate yet".
  • proposal.rs, on ProposalKind::Seal (07 §9.4): "Encoded and decoded here; this crate does not yet propose or vote for one."
  • voter.rs: the Elector is RoundRobin ("see the follow-up on its order in the PR").
  • Tests: 24 #[test], all in src/: tests.rs 4, cert.rs 4, proposal.rs 3, membership.rs 3, silence.rs 3, voter.rs 3, source.rs 2, conformance.rs 2.

Depends on

Crates
Code (Cargo.toml) vyrn-types, vyrn-crypto, vyrn-log; Commonware consensus, p2p, runtime, cryptography, codec, utils, parallel, actor; tokio
11 §1.4 vyrn-log, Commonware (consensus, p2p, runtime, cryptography, storage, codec)

The internal dependencies match. 11 §1.4 lists Commonware storage, and the crate does not depend on it. It also uses three Commonware crates that §1.4 does not name: utils, parallel and actor.

Links

Clone this wiki locally