pub struct RingtailConsensus { /* private fields */ }Expand description
Ringtail-compatible consensus for ZAP agents
Implements threshold lattice-based signing with the following protocol:
- Setup: Trusted dealer generates secret shares and MAC keys
- Round 1: Each party generates commitment D_i and MACs
- Round 2: Verify MACs, compute response share z_i
- Finalize: Combiner aggregates into signature (c, z, Delta)
Implementations§
Source§impl RingtailConsensus
impl RingtailConsensus
Sourcepub fn new(party_id: usize, parties: usize, threshold: usize) -> Self
pub fn new(party_id: usize, parties: usize, threshold: usize) -> Self
Create a new Ringtail consensus party
Sourcepub fn has_quorum(&self) -> bool
pub fn has_quorum(&self) -> bool
Check if connected to minimum peers for signing
Set secret key share from trusted dealer
Sourcepub fn set_mac_keys(&mut self, keys: HashMap<usize, [u8; 32]>)
pub fn set_mac_keys(&mut self, keys: HashMap<usize, [u8; 32]>)
Set MAC keys for peer authentication
Sourcepub fn set_public_params(&mut self, a: PolyMatrix, b: PolyVector)
pub fn set_public_params(&mut self, a: PolyMatrix, b: PolyVector)
Set public parameters
Sourcepub fn set_lambda(&mut self, lambda: Poly)
pub fn set_lambda(&mut self, lambda: Poly)
Set Lagrange coefficient
Sourcepub async fn connect_peers(&mut self, addresses: Vec<String>) -> Result<()>
pub async fn connect_peers(&mut self, addresses: Vec<String>) -> Result<()>
Connect to peer network
Sourcepub async fn disconnect(&mut self)
pub async fn disconnect(&mut self)
Disconnect from peers
Sourcepub async fn sign_round1(&mut self, message: &[u8]) -> Result<Round1Output>
pub async fn sign_round1(&mut self, message: &[u8]) -> Result<Round1Output>
Sign Round 1 - Generate commitment matrix D and MACs
Computes D_i = A * R_i + E_i where R_i, E_i are Gaussian-sampled
Sourcepub async fn sign_round2(
&self,
round1_outputs: Vec<Round1Output>,
) -> Result<Round2Output>
pub async fn sign_round2( &self, round1_outputs: Vec<Round1Output>, ) -> Result<Round2Output>
Sign Round 2 - Verify MACs, compute response share
Verifies all received MACs and computes z_i = R_i * u + s_i * c * lambda_i - mask
Sourcepub async fn finalize(
&self,
round2_outputs: Vec<Round2Output>,
) -> Result<RingtailSignature>
pub async fn finalize( &self, round2_outputs: Vec<Round2Output>, ) -> Result<RingtailSignature>
Finalize - Combine shares into final signature (combiner only)
Aggregates all z_i shares and computes Delta correction
Auto Trait Implementations§
impl Freeze for RingtailConsensus
impl RefUnwindSafe for RingtailConsensus
impl Send for RingtailConsensus
impl Sync for RingtailConsensus
impl Unpin for RingtailConsensus
impl UnwindSafe for RingtailConsensus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more