[−][src]Struct solana_libra_types::validator_verifier::ValidatorVerifier
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]
address_to_validator_info: HashMap<AccountAddress, ValidatorInfo<PublicKey>>
) -> Self
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]
address_to_validator_info: HashMap<AccountAddress, ValidatorInfo<PublicKey>>,
quorum_voting_power: u64
) -> Result<Self>
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]
&self,
author: AccountAddress,
hash: HashValue,
signature: &PublicKey::SignatureMaterial
) -> Result<(), VerifyError>
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]
&self,
hash: HashValue,
aggregated_signature: &HashMap<AccountAddress, T>
) -> Result<(), VerifyError> where
T: Into<PublicKey::SignatureMaterial> + Clone,
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]
&self,
hash: HashValue,
aggregated_signature: &HashMap<AccountAddress, T>
) -> Result<(), VerifyError> where
T: Into<PublicKey::SignatureMaterial> + Clone,
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]
&self,
authors: impl Iterator<Item = &'a AccountAddress>
) -> Result<(), VerifyError>
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]
fn clone(&self) -> ValidatorVerifier<PublicKey>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl<PublicKey> Send for ValidatorVerifier<PublicKey> where
PublicKey: Send,
PublicKey: Send,
impl<PublicKey> Sync for ValidatorVerifier<PublicKey> where
PublicKey: Sync,
PublicKey: Sync,
impl<PublicKey> Unpin for ValidatorVerifier<PublicKey> where
PublicKey: Unpin,
PublicKey: Unpin,
impl<PublicKey> UnwindSafe for ValidatorVerifier<PublicKey> where
PublicKey: UnwindSafe,
PublicKey: UnwindSafe,
impl<PublicKey> RefUnwindSafe for ValidatorVerifier<PublicKey> where
PublicKey: RefUnwindSafe,
PublicKey: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
T: Send + Sync + UnwindSafe + ?Sized,