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
impl CoreVerifier
sourcepub fn setup(public_signers: &[(VerificationKey, Stake)]) -> Self
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.
sourcepub fn dedup_sigs_for_indices(
total_stake: &Stake,
params: &StmParameters,
msg: &[u8],
sigs: &[StmSigRegParty],
) -> Result<Vec<StmSigRegParty>, AggregationError>
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.
sourcepub fn verify(
&self,
signatures: &[StmSig],
parameters: &StmParameters,
msg: &[u8],
) -> Result<(), CoreVerifierError>
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.