You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(storage): prune stale aggregated payloads on finalization (lambdaclass#389)
## Summary
- Adds `PayloadBuffer::prune(finalized_slot)` and
`Store::prune_stale_aggregated_payloads(finalized_slot)`, mirroring
leanSpec's `prune_stale_attestation_data` for the two aggregated payload
pools.
- Wires the new pruner into `Store::update_checkpoints` next to the
existing `prune_live_chain` / `prune_gossip_signatures` calls, and
includes `pruned_payloads` in the "Pruned finalized data" log line.
- Adds three unit tests: buffer-level prune (drop + noop) and a
store-level test covering both `new_payloads` and `known_payloads`.
## Motivation
ethlambda was missing the equivalent of leanSpec's
`prune_stale_attestation_data`. The new and known aggregated payload
buffers were only bounded by FIFO eviction at 64/512 entries, so
post-finalization entries (target.slot ≤ finalized.slot) could linger
for ~33 min at 1 attestation/slot. Lingering known proofs pollute
`existing_proofs_for_data` lookups: when a fresh gossip-signature batch
happens to collide on the exact stale `data_root`, `build_job` selects
the stale entry as a child and routes through `aggregate_mixed`
recursive aggregation instead of plain XMSS aggregation. Criterion now
matches leanSpec exactly: keep iff `target.slot > finalized.slot`.
## Test plan
- [x] `cargo test -p ethlambda-storage` — 38 tests pass (including the 3
new ones)
- [x] `cargo clippy -p ethlambda-storage --all-targets -- -D warnings`
clean
- [ ] Verify on devnet that the "Pruned finalized data" log line
surfaces non-zero `pruned_payloads` at finalization boundaries
0 commit comments