pub enum Scheme<P: PublicKey, V: Variant> {
Signer {
participants: OrderedAssociated<P, V::Public>,
identity: V::Public,
share: Share,
},
Verifier {
participants: OrderedAssociated<P, V::Public>,
identity: V::Public,
},
CertificateVerifier {
identity: V::Public,
},
}Expand description
BLS12-381 threshold implementation of the Scheme trait.
It is possible for a node to play one of the following roles: a signer (with its share), a verifier (with evaluated public polynomial), or an external verifier that only checks recovered certificates.
Variants§
Signer
Fields
participants: OrderedAssociated<P, V::Public>Participants in the committee.
Local share used to generate partial signatures.
Verifier
Fields
participants: OrderedAssociated<P, V::Public>Participants in the committee.
CertificateVerifier
Implementations§
Source§impl<P: PublicKey, V: Variant> Scheme<P, V>
impl<P: PublicKey, V: Variant> Scheme<P, V>
Sourcepub fn new(
participants: Ordered<P>,
polynomial: &Public<V>,
share: Share,
) -> Self
pub fn new( participants: Ordered<P>, polynomial: &Public<V>, share: Share, ) -> Self
Constructs a signer instance with a private share and evaluated public polynomial.
The participant identity keys are used for committee ordering and indexing. The polynomial can be evaluated to obtain public verification keys for partial signatures produced by committee members.
If the provided share does not match the polynomial evaluation at its index, the instance will act as a verifier (unable to sign votes).
participants- ordered set of participant identity keyspolynomial- public polynomial for threshold verificationshare- local threshold share for signing
Sourcepub fn verifier(participants: Ordered<P>, polynomial: &Public<V>) -> Self
pub fn verifier(participants: Ordered<P>, polynomial: &Public<V>) -> Self
Produces a verifier that can authenticate votes but does not hold signing state.
The participant identity keys are used for committee ordering and indexing. The polynomial can be evaluated to obtain public verification keys for partial signatures produced by committee members.
participants- ordered set of participant identity keyspolynomial- public polynomial for threshold verification
Sourcepub fn certificate_verifier(identity: V::Public) -> Self
pub fn certificate_verifier(identity: V::Public) -> Self
Creates a verifier that only checks recovered certificates.
This lightweight verifier can authenticate recovered threshold certificates but cannot verify individual votes or partial signatures.
identity- public identity of the committee (constant across reshares)
Sourcepub fn participants(&self) -> &Ordered<P>
pub fn participants(&self) -> &Ordered<P>
Returns the ordered set of participant public identity keys in the committee.
Sourcepub fn identity(&self) -> &V::Public
pub fn identity(&self) -> &V::Public
Returns the public identity of the committee (constant across reshares).
Returns the local share if this instance can generate partial signatures.
Sourcepub fn polynomial(&self) -> &[V::Public]
pub fn polynomial(&self) -> &[V::Public]
Returns the evaluated public polynomial for validating partial signatures produced by committee members.
Trait Implementations§
Source§impl<P: PublicKey, V: Variant + Send + Sync> Scheme for Scheme<P, V>
impl<P: PublicKey, V: Variant + Send + Sync> Scheme for Scheme<P, V>
Source§type PublicKey = P
type PublicKey = P
Source§type Certificate = Signature<V>
type Certificate = Signature<V>
Source§fn me(&self) -> Option<u32>
fn me(&self) -> Option<u32>
None if the scheme is a verifier-only instance.Source§fn participants(&self) -> &Ordered<Self::PublicKey>
fn participants(&self) -> &Ordered<Self::PublicKey>
Source§fn sign_vote<D: Digest>(
&self,
namespace: &[u8],
context: VoteContext<'_, D>,
) -> Option<Vote<Self>>
fn sign_vote<D: Digest>( &self, namespace: &[u8], context: VoteContext<'_, D>, ) -> Option<Vote<Self>>
None if the scheme cannot sign (e.g. it’s a verifier-only instance).Source§fn assemble_certificate<I>(&self, votes: I) -> Option<Self::Certificate>where
I: IntoIterator<Item = Vote<Self>>,
fn assemble_certificate<I>(&self, votes: I) -> Option<Self::Certificate>where
I: IntoIterator<Item = Vote<Self>>,
None if the quorum is not met. Read moreSource§fn verify_vote<D: Digest>(
&self,
namespace: &[u8],
context: VoteContext<'_, D>,
vote: &Vote<Self>,
) -> bool
fn verify_vote<D: Digest>( &self, namespace: &[u8], context: VoteContext<'_, D>, vote: &Vote<Self>, ) -> bool
Source§fn verify_votes<R, D, I>(
&self,
_rng: &mut R,
namespace: &[u8],
context: VoteContext<'_, D>,
votes: I,
) -> VoteVerification<Self>
fn verify_votes<R, D, I>( &self, _rng: &mut R, namespace: &[u8], context: VoteContext<'_, D>, votes: I, ) -> VoteVerification<Self>
Source§fn verify_certificate<R: Rng + CryptoRng, D: Digest>(
&self,
_rng: &mut R,
namespace: &[u8],
context: VoteContext<'_, D>,
certificate: &Self::Certificate,
) -> bool
fn verify_certificate<R: Rng + CryptoRng, D: Digest>( &self, _rng: &mut R, namespace: &[u8], context: VoteContext<'_, D>, certificate: &Self::Certificate, ) -> bool
Source§fn verify_certificates<'a, R, D, I>(
&self,
_rng: &mut R,
namespace: &[u8],
certificates: I,
) -> boolwhere
R: Rng + CryptoRng,
D: Digest,
I: Iterator<Item = (VoteContext<'a, D>, &'a Self::Certificate)>,
fn verify_certificates<'a, R, D, I>(
&self,
_rng: &mut R,
namespace: &[u8],
certificates: I,
) -> boolwhere
R: Rng + CryptoRng,
D: Digest,
I: Iterator<Item = (VoteContext<'a, D>, &'a Self::Certificate)>,
false at the first failure.Source§fn seed(
&self,
round: Round,
certificate: &Self::Certificate,
) -> Option<Self::Seed>
fn seed( &self, round: Round, certificate: &Self::Certificate, ) -> Option<Self::Seed>
Source§fn is_attributable(&self) -> bool
fn is_attributable(&self) -> bool
Source§fn certificate_codec_config(&self) -> <Self::Certificate as Read>::Cfg
fn certificate_codec_config(&self) -> <Self::Certificate as Read>::Cfg
Source§fn certificate_codec_config_unbounded() -> <Self::Certificate as Read>::Cfg
fn certificate_codec_config_unbounded() -> <Self::Certificate as Read>::Cfg
Auto Trait Implementations§
impl<P, V> Freeze for Scheme<P, V>
impl<P, V> RefUnwindSafe for Scheme<P, V>
impl<P, V> Send for Scheme<P, V>
impl<P, V> Sync for Scheme<P, V>
impl<P, V> Unpin for Scheme<P, V>
impl<P, V> UnwindSafe for Scheme<P, V>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more