Skip to content

ibd: cut pre-milestone CPU (fence Arc, densify watermark, v2 decode, MTP ring) - #245

Merged
reardencode merged 7 commits into
masterfrom
ibd/algo-cpu
Aug 25, 2026
Merged

ibd: cut pre-milestone CPU (fence Arc, densify watermark, v2 decode, MTP ring)#245
reardencode merged 7 commits into
masterfrom
ibd/algo-cpu

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Why

Default mainnet IBD (--milestone 840000) skips scripts and mempool relay. algo-review still had four CPU cliffs on that path:

  • leftover TipOnly cloned the height fence (~15 MiB memcpy/wave)
  • densify assign rescanned up to 65 536 already-queued heights every tick
  • every BIP324 block hashed a synthetic checksum and rebuilt a v1 frame
  • every sequential MTP re-read 11 confirmed headers

What

  • P7: HeightFence runs are Arc; leftover snapshot is O(1); extend/pop COW.
  • P10: densify_scan_lo skips BQ-ready / inflight / archived prefix. Pending is still walked so zombies demote. Tip-hole cover unchanged.
  • P8: parse_v2_contents does not sha256d. FramedMessage::decode is command+payload (checksum unused zeros).
  • P16: fence-tip BIP113 window is an 11-slot ring on extend; pop rebuilds from confirmed; historical heights keep the 11-read path.

Closes algo-review P7, P8, P10, P16 in the same PR. Soft densify remains request-limited only. No store lock across leftover IO. No uring flatten.

Test plan

  • cargo test -p rbitcoin-store --lib height_fence
  • cargo test -p rbitcoin-net --lib densify_ / codec / v2
  • cargo test -p rbitcoin-consensus --lib median_time_past
  • required CI (fmt, deny, clippy, test, multinode, coverage, ast-grep)

rearden-grok Bot pushed a commit that referenced this pull request Aug 25, 2026
rbitcoin-grok added 7 commits August 25, 2026 13:21
Leftover TipOnly cloned O(blocks) runs on every get_fk_by_txid_batch.
runs is Arc; clone is pointer-sized. extend/pop COW via make_mut so a
live leftover snapshot does not block fence updates.
collect_height_band restarted at path_lo every assign tick (up to 65k
heights). Advance densify_scan_lo over claim-ready / inflight /
archived; pending is still walked so zombies demote. Tip shrink resets.
BIP324 plaintext is command+payload. Hashing a synthetic checksum and
rebuilding a v1 frame ran sha256d twice plus a 4 MB copy per block.
Dispatch Decodable on the payload; checksum is unused zeros.
Sequential confirm re-read 11 headers for every MTP. Push timestamp
on height_fence_extend; pop rebuilds from confirmed. Historical and
cold-ring heights keep the 11-read path.
Fence snapshot is Arc, densify skips the BQ-ready prefix, v2 decode
skips checksum reframe, and tip MTP is an 11-slot ring. ibd-memory
and CHANGELOG note the same.
v2 decode no longer hashes or verifies a checksum. The leftover field
failed -D warnings on production builds.
@reardencode
reardencode merged commit 1576a03 into master Aug 25, 2026
13 checks passed
@rearden-grok
rearden-grok Bot deleted the ibd/algo-cpu branch August 25, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant