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, only num_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§

§

Partial

Fields

§num_signatures: u8
§

Full

Implementations§

source§

impl VerificationLevel

source

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.

source

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

source§

fn clone(&self) -> VerificationLevel

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for VerificationLevel

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for VerificationLevel

source§

fn eq(&self, other: &VerificationLevel) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for VerificationLevel

source§

impl StructuralPartialEq for VerificationLevel

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.