Skip to content

refactor(network): align header range records internally#309

Merged
p0mvn merged 3 commits into
mainfrom
refactor/header-sync-aligned-ranges-v7
Jul 21, 2026
Merged

refactor(network): align header range records internally#309
p0mvn merged 3 commits into
mainfrom
refactor/header-sync-aligned-ranges-v7

Conversation

@p0mvn

@p0mvn p0mvn commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Header-sync responses still cross internal async boundaries as separate header, body-size, and root vectors after v7 decoding. Keeping those vectors independent makes trimming and buffering vulnerable to per-height misalignment even though the wire payload has already been validated.

Solution

  • introduce HeaderRangeEntry to bind one header to its body-size hint and optional roots
  • convert v7 parallel vectors into entries immediately after decoding
  • store and trim one entry vector in HeaderRangePayload
  • carry the existing HeaderSyncWireRequestIdentity through WireHeaders
  • keep HeaderSyncMessage, the v7 byte layout, and stream version unchanged

Testing

  • cargo fmt --all
  • cargo test -p zakura-network --lib zakura::header_sync (165 passed)
  • cargo clippy -p zakura-network --lib --tests -- -D warnings
  • IDE diagnostics: clean

Specifications & References

Follow-up Work

A stacked v8 PR will make correlated wire messages self-contained and serialize aligned entries atomically.

Bind each delivered header to its size and roots immediately after v7 decode so internal trimming and buffering cannot misalign per-height data.
@v12-auditor

v12-auditor Bot commented Jul 20, 2026

Copy link
Copy Markdown

Note

Complete: Audit complete. V12 did not find any issues that need review.

Open the full results here.

Analyzed 10 files, diff a0a9f59...d85231b.

@evan-forbes evan-forbes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lfg

Comment thread zakura-network/src/zakura/header_sync/range.rs
@evan-forbes evan-forbes added headersync anything relevant for headersync v2 p2p everything that touch the new p2p stack network breaking something that must be included with a version upgrade to a networking component such as a reactor labels Jul 20, 2026
p0mvn added 2 commits July 20, 2026 18:20
Make each aligned record carry its authoritative height so trimming and root validation preserve exact per-height identity without a separate range source of truth.
Use the conventional InvalidRange name now that checked range construction makes the rejected condition clear at each call site.
@p0mvn
p0mvn marked this pull request as ready for review July 21, 2026 00:47
@p0mvn

p0mvn commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

@cursor review

@p0mvn p0mvn removed the network breaking something that must be included with a version upgrade to a networking component such as a reactor label Jul 21, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 3534566. Configure here.

@p0mvn
p0mvn merged commit ea979e1 into main Jul 21, 2026
76 of 82 checks passed
@p0mvn
p0mvn deleted the refactor/header-sync-aligned-ranges-v7 branch July 21, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

headersync anything relevant for headersync v2 p2p everything that touch the new p2p stack

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants