Enum pyth_min::price_update::VerificationLevel
source · pub enum VerificationLevel {
Partial {
num_signatures: u8,
},
Full,
}
Expand description
Pyth price updates are bridged to all blockchains via Wormhole. Using the price updates on another chain requires verifying the signatures of the Wormhole guardians. The usual process is to check the signatures for two thirds of the total number of guardians, but this can be cumbersome on Solana because of the transaction size limits, so we also allow for partial verification.
This enum represents how much a price update has been verified:
- If
Full
, we have verified the signatures for two thirds of the current guardians. - If
Partial
, onlynum_signatures
guardian signatures have been checked.
§Warning
Using partially verified price updates is dangerous, as it lowers the threshold of guardians that need to collude to produce a malicious price update.
Variants§
Implementations§
source§impl VerificationLevel
impl VerificationLevel
sourcepub fn gte(&self, other: VerificationLevel) -> bool
pub fn gte(&self, other: VerificationLevel) -> bool
Compare two VerificationLevel
.
Full
is always greater than Partial
, and Partial
with more signatures is greater than Partial
with fewer signatures.
sourcepub fn get_verification_from_bytes(v: &[u8]) -> VerificationLevel
pub fn get_verification_from_bytes(v: &[u8]) -> VerificationLevel
Get a VerificationLevel
from bytes. Expects exactly one or two bytes.
The first byte indicates the verification level type:
- 0x00 for
Partial
, followed by the number of signatures as the second byte. - 0x01 for
Full
, with no additional bytes required.
If the VerificationLevel level is Full, this will be one byte. If Partial, two bytes.
Trait Implementations§
source§impl Clone for VerificationLevel
impl Clone for VerificationLevel
source§fn clone(&self) -> VerificationLevel
fn clone(&self) -> VerificationLevel
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for VerificationLevel
impl Debug for VerificationLevel
source§impl PartialEq for VerificationLevel
impl PartialEq for VerificationLevel
source§fn eq(&self, other: &VerificationLevel) -> bool
fn eq(&self, other: &VerificationLevel) -> bool
self
and other
values to be equal, and is used
by ==
.