Trait diem_types::epoch_change::Verifier
source · pub trait Verifier: Debug + Send + Sync {
// Required methods
fn verify(&self, ledger_info: &LedgerInfoWithSignatures) -> Result<()>;
fn epoch_change_verification_required(&self, epoch: u64) -> bool;
fn is_ledger_info_stale(&self, ledger_info: &LedgerInfo) -> bool;
}
Expand description
The verification of the epoch change proof starts with verifier that is trusted by the client: could be either a waypoint (upon startup) or a known epoch info.
Required Methods§
sourcefn verify(&self, ledger_info: &LedgerInfoWithSignatures) -> Result<()>
fn verify(&self, ledger_info: &LedgerInfoWithSignatures) -> Result<()>
Verify if the ledger_info is trust worthy.
sourcefn epoch_change_verification_required(&self, epoch: u64) -> bool
fn epoch_change_verification_required(&self, epoch: u64) -> bool
Returns true in case the given epoch is larger than the existing verifier can support. In this case the EpochChangeProof should be verified and the verifier updated.
sourcefn is_ledger_info_stale(&self, ledger_info: &LedgerInfo) -> bool
fn is_ledger_info_stale(&self, ledger_info: &LedgerInfo) -> bool
Returns true if the given LedgerInfo
is stale and probably in our
trusted prefix.
For example, if we have a waypoint with version 5, an epoch change ledger info with version 3 < 5 is already in our trusted prefix and so we can ignore it.
Likewise, if we’re in epoch 10 with the corresponding validator set, an epoch change ledger info with epoch 6 can be safely ignored.