Expand description
A bounded cache of shielded bundle verifications that have already succeeded.
Zebra verifies a transaction’s shielded proofs and signatures when the transaction arrives
over mempool gossip, and again when it arrives in a block. This service skips the second
verification. The Halo2 Orchard and Ironwood verifiers (super::halo2) and the Sapling
verifier (super::sapling) share it, and key their entries the same way.
§Why this is not the mempool bypass
Zebra once skipped whole-transaction verification for transactions already in the mempool, and removed it as a security fix (PR #10494). Transaction validity depends on height, block time and spent outputs, and that cache’s key named none of them.
This cache remembers successful bundle verification by transaction ID, sighash and shielded
pool. A hit still runs the whole transaction verifier against the block’s height, time and
spent outputs, and skips only the proof and signature checks. Each Orchard circuit era has its
own cache, which binds an entry to its verifying key (see super::halo2::orchard_v5_verifier_for);
Sapling has one verifying key pair for all of history, so one cache covers it.
Only Ok results are cached. A batch error is not per-item evidence, because
Fallback re-verifies failures singly, and it may not be a verdict
at all — a shut-down batch worker reports the same way. Caching it would reject a valid block.
Structs§
- Cache
Key 🔒 - A transaction, sighash and shielded pool whose bundle has verified.
- Cache
Metrics 🔒 - Metric handles registered once when a cache is created.
- Cached 🔒
- A service that skips inner verification for items whose bundle has already verified.
- Insert
Outcome 🔒 - What one
VerifiedBundles::insertdid, so the caller can report it after releasing the lock. - Verified
Bundles 🔒 - A bounded set of keys for bundles that have already verified successfully.
Enums§
- Shielded
Pool 🔒 - The shielded bundle slot a cache entry was verified for.
Constants§
- CACHE_
CAPACITY 🔒 - The number of verified-bundle keys retained per cache.
- CACHE_
EVICT 🔒 - Counts keys dropped to stay within a cache’s capacity.
- CACHE_
HIT 🔒 - Counts verifications answered from a cache.
- CACHE_
INSERT 🔒 - Counts keys recorded as verified.
- CACHE_
MISS 🔒 - Counts verifications that reached a cache’s inner service.
- CACHE_
SIZE 🔒 - Reports how many keys a cache currently remembers.
- VERIFIER_
LABEL 🔒 - The label naming which verifier’s cache a metric belongs to.
Traits§
- Cached
Item 🔒 - An item whose successful verification can be remembered.