Struct mithril_stm::stm::CoreVerifier

source ·
pub struct CoreVerifier {
    pub eligible_parties: Vec<RegParty>,
    pub total_stake: Stake,
}
Expand description

Full node verifier including the list of eligible signers and the total stake of the system.

Fields§

§eligible_parties: Vec<RegParty>

List of registered parties.

§total_stake: Stake

Total stake of registered parties.

Implementations§

source§

impl CoreVerifier

source

pub fn setup(public_signers: &[(VerificationKey, Stake)]) -> Self

Setup a core verifier for given list of signers. * Collect the unique signers in a hash set, * Calculate the total stake of the eligible signers, * Sort the eligible signers.

source

pub fn dedup_sigs_for_indices( total_stake: &Stake, params: &StmParameters, msg: &[u8], sigs: &[StmSigRegParty], ) -> Result<Vec<StmSigRegParty>, AggregationError>

Given a slice of sig_reg_list, this function returns a new list of sig_reg_list with only valid indices. In case of conflict (having several signatures for the same index) it selects the smallest signature (i.e. takes the signature with the smallest scalar). The function selects at least self.k indexes.

§Error

If there is no sufficient signatures, then the function fails.

source

pub fn verify( &self, signatures: &[StmSig], parameters: &StmParameters, msg: &[u8], ) -> Result<(), CoreVerifierError>

Core verification

Verify a list of signatures with respect to given message with given parameters.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.