fix(rpc): two-slot coinbase cache prevents eviction between fake and real coinbase#10954
fix(rpc): two-slot coinbase cache prevents eviction between fake and real coinbase#10954oxarbitrage wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the RPC coinbase cache to retain fake and real-fee coinbases simultaneously, avoiding repeated shielded proof generation.
Changes:
- Replaces the single cache slot with a bounded
HashMap. - Adds coexistence and height-eviction tests.
- No consensus or serialization impact.
The cache-cap logic has an off-by-one eviction issue, and test descriptions remain outdated. The PR description also lacks test-execution evidence.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
zebra-rpc/src/methods/types/get_block_template.rs |
Implements the multi-entry coinbase cache. |
zebra-rpc/src/methods/types/get_block_template/tests.rs |
Tests dual entries and height eviction. |
|
Reviewed and tested head The One edge remains: Suggested adjustment:
Hermetic unit test only. No funds, mainnet activity, or live miner calls. I'll rerun against the updated head. |
715fa1c to
9b11aa6
Compare
|
Thanks for the review and test run! All three suggestions addressed in 9b11aa6:
|
Summary
getblocktemplatecall needs two cached coinbases at the same height: a zero-fee fake one for ZIP-317 weight estimation and the real one with actual feesCoinbaseCacheevicts one when storing the other, so zebrad rebuilds both shielded proofs (Sapling/Orchard) on every short-poll when the mempool has fee-paying transactionsOptionslot with aHashMapkeyed on(height, fee)so both entries coexist, eliminating redundant proof workCloses #10907
@Zk-nd3r could you review/test this when you get a chance?