refactor(network): make the resident gate the single block-sync memory authority#154
Conversation
And three more auto-invalidated findings. Analyzed 17 files, diff |
832870e to
19e0721
Compare
19e0721 to
63119fc
Compare
evan-forbes
left a comment
There was a problem hiding this comment.
very very minor non blocking comment, otherwise this is super dope!
5 spots still reference the deleted Held state / settle_active_reserved_height / FundFloorReservation — peer_routine.rs:931-934, :1181-1186, :1750, sequencer_task.rs:746-748, guard.rs:125-130. A future fix reading these could re-break the balance.
Motivation
Zakura block sync currently has two overlapping memory ceilings with different units and lifecycles: the wire-byte
ByteBudgetand the resident look-ahead gate. Retained bodies are represented in both, which duplicates accounting and requires an asynchronous shed-and-fund path to preserve floor progress.This ports valargroup/zebra#415 onto current Zakura
mainso retained-memory admission has one authority and request pacing remains independent of commit speed.Refs ZCA-742.
Solution
ByteBudgetto outstanding request reservations and release each reservation when its body arrives.max_inflight_block_bytesfrom retained-memory configuration and preserve the checkpoint-range floor on the resident budget.Port notes
The source branch did not apply cleanly because Zakura
mainhas diverged since the original PR:Heldledger state to release-at-receipt semantics.The final port is intentionally squashed to one commit and omits unrelated diagnostic/comment churn from the source branch.
Tests
Passed:
cargo fmt --all -- --checkmarkdownlint CHANGELOG.md zakura-network/src/zakura/block_sync/README.md --config .trunk/configs/.markdownlint.yamlcargo clippy -p zakura-network --all-targets -- -D warningscargo test -p zakura-network zakura::block_sync— 222 passedEarlier local broad runs were partially blocked on macOS loopback binding and long-running node integration tests. The initial PR head passed the complete Linux CI unit-test shards, network-dependent acceptance tests, Clippy, MSRV, crate builds, and Zakura E2E gate; CI will rerun against this cleaned head.
The source PR also reports three alternating 100K-mainnet A/B runs with no measurable throughput or RSS regression and a deep-chain soak through approximately height 980K.
Specifications & References
Follow-up Work
AI Disclosure
PR Checklist
type(scope): description