Struct diem_types::trusted_state::TrustedState [−][src]
pub struct TrustedState { /* fields omitted */ }
Expand description
TrustedState
keeps track of our latest trusted state, including the latest
verified version and the latest verified validator set.
Implementations
impl TrustedState
[src]
impl TrustedState
[src]pub fn version(&self) -> Version
[src]
pub fn waypoint(&self) -> Waypoint
[src]
pub fn verify_and_ratchet<'a>(
&self,
latest_li: &'a LedgerInfoWithSignatures,
epoch_change_proof: &'a EpochChangeProof
) -> Result<TrustedStateChange<'a>>
[src]
pub fn verify_and_ratchet<'a>(
&self,
latest_li: &'a LedgerInfoWithSignatures,
epoch_change_proof: &'a EpochChangeProof
) -> Result<TrustedStateChange<'a>>
[src]Verify and ratchet forward our trusted state using a EpochChangeProof
(that moves us into the latest epoch) and a LedgerInfoWithSignatures
inside that epoch.
For example, a client sends a GetStateProof
request to an upstream
FullNode and receives some epoch change proof along with a latest
ledger info inside the StateProof
response. This function
verifies the change proof and ratchets the trusted state version forward
if the response successfully moves us into a new epoch or a new latest
ledger info within our current epoch.
-
If there was a validation error, e.g., the epoch change proof was invalid, we return an
Err
. -
If the message was well formed but stale (i.e., the returned latest ledger is behind our trusted version), we also return an
Err
since stale responses should always be rejected. -
If the response is fresh and there is no epoch change, we just ratchet our trusted version to the latest ledger info and return
Ok(TrustedStateChange::Version { .. })
. -
If there is a new epoch and the server provides a correct proof, we ratchet our trusted version forward, update our verifier to contain the new validator set, and return
Ok(TrustedStateChange::Epoch { .. })
.
Trait Implementations
impl Clone for TrustedState
[src]
impl Clone for TrustedState
[src]fn clone(&self) -> TrustedState
[src]
fn clone(&self) -> TrustedState
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for TrustedState
[src]
impl Debug for TrustedState
[src]impl<'de> Deserialize<'de> for TrustedState
[src]
impl<'de> Deserialize<'de> for TrustedState
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl From<Waypoint> for TrustedState
[src]
impl From<Waypoint> for TrustedState
[src]impl PartialEq<TrustedState> for TrustedState
[src]
impl PartialEq<TrustedState> for TrustedState
[src]fn eq(&self, other: &TrustedState) -> bool
[src]
fn eq(&self, other: &TrustedState) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &TrustedState) -> bool
[src]
fn ne(&self, other: &TrustedState) -> bool
[src]This method tests for !=
.
impl Serialize for TrustedState
[src]
impl Serialize for TrustedState
[src]impl TryFrom<&'_ LedgerInfo> for TrustedState
[src]
impl TryFrom<&'_ LedgerInfo> for TrustedState
[src]impl Eq for TrustedState
[src]
impl StructuralEq for TrustedState
[src]
impl StructuralPartialEq for TrustedState
[src]
Auto Trait Implementations
impl RefUnwindSafe for TrustedState
impl Send for TrustedState
impl Sync for TrustedState
impl Unpin for TrustedState
impl UnwindSafe for TrustedState
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> TestOnlyHash for T where
T: Serialize + ?Sized,
[src]
impl<T> TestOnlyHash for T where
T: Serialize + ?Sized,
[src]pub fn test_only_hash(&self) -> HashValue
[src]
pub fn test_only_hash(&self) -> HashValue
[src]Generates a hash used only for tests.
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,