Skip to main content

SignatureScheme

Trait SignatureScheme 

Source
pub trait SignatureScheme {
    type Validator: Validator;
    type Signature: Signature;
    type AggregateSignature: AggregateSignature;

    // Required methods
    fn verify(
        &self,
        validator: &Self::Validator,
        message: impl IntoIterator<Item = impl AsRef<[u8]>>,
        signature: &Self::Signature,
    ) -> bool;
    fn aggregate<'sig>(
        &self,
        message: impl IntoIterator<Item = impl AsRef<[u8]>>,
        signatures: impl IntoIterator<Item = (&'sig Self::Validator, &'sig Self::Signature)>,
    ) -> Self::AggregateSignature
       where Self::Validator: 'sig,
             Self::Signature: 'sig;
    fn verify_aggregate(
        &self,
        message: impl IntoIterator<Item = impl AsRef<[u8]>>,
        aggregate_signature: &Self::AggregateSignature,
    ) -> Result<impl IntoIterator<Item = Self::Validator>, InvalidAggregateSignature>;
}
Expand description

The signature scheme used for consensus.

The implementation MUST inherently provide domain separation such that this can be assumed to never conflict with any other protocol. The messages within the Tendermint process, even across blockchains, will be domain-separated however.

The signature scheme is assumed binding to the validator signing the message.

Required Associated Types§

Source

type Validator: Validator

The type used to identify validators.

Source

type Signature: Signature

The type used to represent signatures.

Source

type AggregateSignature: AggregateSignature

The type used to represent an aggregate signature.

This may be a one-round threshold signature, an aggregated BLS signature, a half-aggregated Schnorr signature (as implemented in the schnorr-signatures crate), a succinct proof, or simply the list of individual signatures (without any actual aggregation). It MUST have the context over both the participating signers and the signatures however.

Required Methods§

Source

fn verify( &self, validator: &Self::Validator, message: impl IntoIterator<Item = impl AsRef<[u8]>>, signature: &Self::Signature, ) -> bool

Verify a signature from the validator in question.

The message is the concatenation of each byte slice yielded by the iterator.

Source

fn aggregate<'sig>( &self, message: impl IntoIterator<Item = impl AsRef<[u8]>>, signatures: impl IntoIterator<Item = (&'sig Self::Validator, &'sig Self::Signature)>, ) -> Self::AggregateSignature
where Self::Validator: 'sig, Self::Signature: 'sig,

Aggregate signatures from a set of validators of sum weight satisfying the threshold.

The message is singular, expected to be consistent across all signatures, and the concatenation of each byte slice yielded by the iterator.

This MAY panic if a validator/signature pair is invalid for the message, or if the validators’ sum weight does not satisfy the threshold.

Source

fn verify_aggregate( &self, message: impl IntoIterator<Item = impl AsRef<[u8]>>, aggregate_signature: &Self::AggregateSignature, ) -> Result<impl IntoIterator<Item = Self::Validator>, InvalidAggregateSignature>

Verify an aggregate signature.

The message is the concatenation of each byte slice yielded by the iterator.

The return result MUST be the set of validators which participated in producing this signature (in any order, without multiple inclusions). If this is a threshold signature where the signing key’s reconstruction threshold is equal to Tendermint’s threshold, this MAY return any set of validators with weight greater than or equal to Tendermint’s threshold, even if that set was not necessarily the set which participated in producing the aggregate signature.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<S: ?Sized + SignatureScheme> SignatureScheme for &S

Source§

type Validator = <S as SignatureScheme>::Validator

Source§

type Signature = <S as SignatureScheme>::Signature

Source§

type AggregateSignature = <S as SignatureScheme>::AggregateSignature

Source§

fn verify( &self, validator: &Self::Validator, message: impl IntoIterator<Item = impl AsRef<[u8]>>, signature: &Self::Signature, ) -> bool

Source§

fn aggregate<'sig>( &self, message: impl IntoIterator<Item = impl AsRef<[u8]>>, signatures: impl IntoIterator<Item = (&'sig Self::Validator, &'sig Self::Signature)>, ) -> Self::AggregateSignature
where Self::Validator: 'sig, Self::Signature: 'sig,

Source§

fn verify_aggregate( &self, message: impl IntoIterator<Item = impl AsRef<[u8]>>, aggregate_signature: &Self::AggregateSignature, ) -> Result<impl IntoIterator<Item = Self::Validator>, InvalidAggregateSignature>

Implementors§