[][src]Module tendermint::lite::verifier

Main verification functions that can be used to implement a light client.

Examples

// TODO: add a proper example maybe showing how a `can_trust_bisection`
// looks using the types and methods in this crate/module.

Functions

is_within_trust_period

Returns an error if the header has expired according to the given trusting_period and current time. If so, the verifier must be reset subjectively.

verify_and_update_bisection

Attempt to update the store to the given untrusted height by requesting the necessary data (signed headers and validators). Returns an error if: - we're already at or past that height - our latest state expired - any requests fail - requested data is inconsistent (eg. vals don't match hashes in header) - validators did not correctly commit their blocks This function is recursive: it uses a bisection algorithm to request data for intermediate heights as necessary. Ensures our last trusted header hasn't expired yet, and that data from the untrusted height can be verified, possibly using data from intermediate heights. This function is primarily for use by a light node.

verify_and_update_single

Attempt to update the store to the given untrusted header. Ensures our last trusted header hasn't expired yet, and that the untrusted header can be verified using only our latest trusted state from the store. This function is primarily for use by IBC handlers.

verify_commit_full

Verify that +2/3 of the correct validator set signed this commit. NOTE: These validators are expected to be the correct validators for the commit, but since we're using voting_power_in, we can't actually detect if there's votes from validators not in the set.

verify_commit_trusting

Verify that +1/3 of the given validator set signed this commit. NOTE the given validators do not necessarily correspond to the validator set for this commit, but there may be some intersection. The trust_level parameter allows clients to require more than +1/3 by implementing the TrustLevel trait accordingly.

verify_single