Skip to main content

CachedItem

Trait CachedItem 

Source
pub(super) trait CachedItem {
    // Required method
    fn cache_key(&self) -> Option<CacheKey>;
}
Expand description

An item whose successful verification can be remembered.

Items without a key are verified normally and never cached, which is how a caller that has no transaction identity to offer stays correct.

§Correctness

An implementer promises that the returned key determines every input the item’s verification reads: the bundle, and the sighash it is checked against. Cached answers any later item with an equal key from the remembered Ok without verifying it, so a key that two different bundles can share accepts a bundle this node never checked. An implementer that cannot offer a complete key returns None, and the item is verified every time.

Required Methods§

Source

fn cache_key(&self) -> Option<CacheKey>

Returns the key this item’s successful verification is remembered under, or None if the item must always be verified.

The key is a pure function of the item: two calls on one item return the same key, and two items with equal keys have identical verification inputs. CacheKey derives why a transaction ID, a sighash and a shielded pool are enough.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl CachedItem for zebra_consensus::halo2::Item

Source§

impl CachedItem for zebra_consensus::primitives::sapling::Item