refactor: store aggregated payloads in memory#181
Conversation
🤖 Kimi Code ReviewReview SummaryThis PR migrates aggregated payload storage from RocksDB to in-memory HashMaps with Mutex protection. The change is well-motivated for performance but introduces several critical issues. Critical Issues
Security & Consensus Issues
Code Quality Issues
Recommendations
Automated review by Kimi (Moonshot AI) · custom prompt |
🤖 Codex Code Review
I could not run Automated review by OpenAI Codex · custom prompt |
🤖 Claude Code ReviewNow I have enough context to write the review. Let me compile my findings. PR 181 Review: refactor: store aggregated payloads in memorySummaryThe PR replaces two RocksDB column families ( IssuesDead SSZ derives on
#[derive(Debug, Clone, ssz::Encode, ssz::Decode)]
pub struct StoredAggregatedPayload { ... }After this PR, Misleading lock-ordering comment in pruning
// Lock ordering: known before new (field declaration order)
Self::prune_aggregated_payload_map(&self.known_aggregated_payloads, finalized.slot);
Self::prune_aggregated_payload_map(&self.new_aggregated_payloads, finalized.slot);
Method names still use
The doc comments were correctly updated ("Returns all..." instead of "Iterates over..."), but the method names Clone under Mutex lock with potentially large payloads
fn iter_aggregated_payloads_from(
map: &Mutex<AggregatedPayloadMap>,
) -> Vec<(SignatureKey, Vec<StoredAggregatedPayload>)> {
map.lock()
.expect("lock")
.iter()
.map(|(k, v)| (*k, v.clone()))
.collect() // <-- Mutex held for the entire clone
}
A mitigation would be to release the lock before cloning (e.g., collect raw pointers/references, or change callers to work with the guard directly). For the current scope this is acceptable, but the concern scales with proof size × validator count.
All What Works Well
Automated review by Claude (Anthropic) · custom prompt |
No description provided.