[][src]Struct solana_libra_types::validator_verifier::ValidatorVerifier

pub struct ValidatorVerifier<PublicKey> { /* fields omitted */ }

Supports validation of signatures for known authors with individual voting powers. This struct can be used for all signature verification operations including block and network signature verification, respectively.

Methods

impl<PublicKey: VerifyingKey> ValidatorVerifier<PublicKey>[src]

pub fn new(
    address_to_validator_info: HashMap<AccountAddress, ValidatorInfo<PublicKey>>
) -> Self
[src]

Initialize with a map of account address to validator info and set quorum size to default (2f + 1) or zero if address_to_validator_info is empty.

pub fn new_with_quorum_voting_power(
    address_to_validator_info: HashMap<AccountAddress, ValidatorInfo<PublicKey>>,
    quorum_voting_power: u64
) -> Result<Self>
[src]

Initializes a validator verifier with a specified quorum voting power.

pub fn new_single(author: AccountAddress, public_key: PublicKey) -> Self[src]

Helper method to initialize with a single author and public key with quorum voting power 1.

pub fn verify_signature(
    &self,
    author: AccountAddress,
    hash: HashValue,
    signature: &PublicKey::SignatureMaterial
) -> Result<(), VerifyError>
[src]

Verify the correctness of a signature of a hash by a known author.

pub fn verify_aggregated_signature<T>(
    &self,
    hash: HashValue,
    aggregated_signature: &HashMap<AccountAddress, T>
) -> Result<(), VerifyError> where
    T: Into<PublicKey::SignatureMaterial> + Clone
[src]

This function will successfully return when at least quorum_size signatures of known authors are successfully verified. Also, an aggregated signature is considered invalid if any of the attached signatures is invalid or it does not correspond to a known author. The latter is to prevent malicious users from adding arbitrary content to the signature payload that would go unnoticed.

pub fn batch_verify_aggregated_signature<T>(
    &self,
    hash: HashValue,
    aggregated_signature: &HashMap<AccountAddress, T>
) -> Result<(), VerifyError> where
    T: Into<PublicKey::SignatureMaterial> + Clone
[src]

This function will try batch signature verification and falls back to normal iterated verification if batching fails.

pub fn check_voting_power<'a>(
    &self,
    authors: impl Iterator<Item = &'a AccountAddress>
) -> Result<(), VerifyError>
[src]

Ensure there is at least quorum_voting_power in the provided signatures and there are only known authors. According to the threshold verification policy, invalid public keys are not allowed.

pub fn get_public_key(&self, author: &AccountAddress) -> Option<PublicKey>[src]

Returns the public key for this address.

pub fn get_voting_power(&self, author: &AccountAddress) -> Option<u64>[src]

Returns the voting power for this address.

pub fn get_ordered_account_addresses(&self) -> Vec<AccountAddress>[src]

Returns a ordered list of account addresses from smallest to largest.

pub fn len(&self) -> usize[src]

Returns the number of authors to be validated.

pub fn is_empty(&self) -> bool[src]

Is there at least one author?

pub fn quorum_voting_power(&self) -> u64[src]

Returns quorum voting power.

Trait Implementations

impl<PublicKey: Clone> Clone for ValidatorVerifier<PublicKey>[src]

Auto Trait Implementations

impl<PublicKey> Send for ValidatorVerifier<PublicKey> where
    PublicKey: Send

impl<PublicKey> Sync for ValidatorVerifier<PublicKey> where
    PublicKey: Sync

impl<PublicKey> Unpin for ValidatorVerifier<PublicKey> where
    PublicKey: Unpin

impl<PublicKey> UnwindSafe for ValidatorVerifier<PublicKey> where
    PublicKey: UnwindSafe

impl<PublicKey> RefUnwindSafe for ValidatorVerifier<PublicKey> where
    PublicKey: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized