Skip to content

confirm: homogeneous Class A kind per load/write batch - #267

Merged
reardencode merged 5 commits into
masterfrom
confirm/encode-batch-invariant
Aug 26, 2026
Merged

confirm: homogeneous Class A kind per load/write batch#267
reardencode merged 5 commits into
masterfrom
confirm/encode-batch-invariant

Conversation

@rearden-grok

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

Copy link
Copy Markdown
Contributor

Summary

Encode-at-write stays a straight zip of packed vs prepared. A crash leftover somenone (header_txs.has_body prefix already archived, suffix still needs Class A) is two homogeneous batches, not one mixed write and not a fill-time skip.

  • Lookup splits LoadBatches at a has_body kind change (in addition to 8000-input / 144-block caps).
  • Write drain append_contiguous stops when archive_plan polarity differs (Some vs None); leftover is the next meta-batch.
  • Write vs tip is all-old (Ok([])), all-new (fill the whole batch), or Corrupt("invariant: write batch spans tip") — no prefix strip.
  • Stamp: mixed need_fks is Corrupt("invariant: confirm batch mixed archived"). plan=Some no longer hitchhikes get_list for already-bodied rows. One-shot mixed confirm_wire_load fails closed (call twice).

Test plan

  • cargo test -p rbitcoin-net split_wave_into_load_batches -- --test-threads=1
  • cargo test -p rbitcoin-consensus write_idempotent -- --test-threads=1
  • Required Actions: fmt, deny, clippy, ast-grep, test, windows, macos, multinode, coverage

Made with Cursor

rbitcoin-grok and others added 5 commits August 25, 2026 21:51
Lookup may decode a mixed BQ prefix after crash recovery. Loadq chunks
must be one kind so stamp never plans a subset of the prepared heights.

Co-authored-by: Cursor <cursoragent@cursor.com>
Crash recovery some→none is two meta-batches. Write drain already keeps
leftover; mixed polarity must not glue packed onto extra prepared heights.

Co-authored-by: Cursor <cursoragent@cursor.com>
Prefix-stripping a mixed keep-list left packed/prepared misaligned.
A homogeneous batch is either fully at-or-below tip (no-op) or fully
above (zip the whole batch). Spanning tip is an invariant break.

Co-authored-by: Cursor <cursoragent@cursor.com>
After need-body filter, a proper subset means lookup sent mixed
has_body kinds. Fail closed instead of planning some headers and
get_list-filling the rest. plan=Some has no hitchhiker rows.

Co-authored-by: Cursor <cursoragent@cursor.com>
S3 is two lookup/write batches split at has_body / plan polarity,
not one mixed write. Write vs tip is all-or-nothing.

Co-authored-by: Cursor <cursoragent@cursor.com>
@reardencode
reardencode merged commit 658999c into master Aug 26, 2026
13 checks passed
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