Skip to content

feat(client): count each lane's wire bytes and report them in the bundle pull summary - #2788

Merged
yigitdot merged 4 commits into
mainfrom
fix/2444-bundle-pull-wire-bytes
Oct 31, 2026
Merged

yigitdot merged 4 commits into
mainfrom
fix/2444-bundle-pull-wire-bytes

Conversation

@yigitdot

@yigitdot yigitdot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

paid_bytes (#2443) counts what the vouchers and hash-chain reveals paid for. Payment follows verification, so bytes that arrive and never verify — frames past a steal split, or past the verified frontier before a lane fault — showed up in no figure. They cost bandwidth and time, not USDC.

  • PoolLedger counts the ChunkData wire bytes its streams read, before any verification: every frame UpstreamPull takes in (in next_chunk and in the frames stop() reads past a split), and every frame it reads and drops (the frames it skips to reach the terminal message after a failed voucher write, and a frame past a ceiling). One helper grows the stream's received total and the lane count together, so they cannot drift; a dropped frame counts on the lane alone.
  • LaneLedgers::wire_bytes sums the lanes; PullCtx::run takes the pull's share exactly as it does for paid_bytes, second pool-replacement pass included, into BundleReport::wire_bytes.
  • decdn bundle pull --json carries wire_bytes. The human summary adds received W on the wire, U more than paid for only when wire_bytes is above paid_bytes. U is net: verified bytes a leg left unpaid count in it too, and a voucher armed before the pull can confirm during it.
  • ADR appendix-bundles describes the figure; the public-API snapshot gains BundleReport::wire_bytes and PoolLedger::wire_bytes.
  • Tests pin both counting paths exactly: loopback tests for the frames a stop reads past a split and the frames a drive skips after a failed voucher write, exact wire on clean and rejected legs, and an e2e one-lane pull that reads exactly the wire it pays for.

Naming: the issue proposed received_bytes, but the dashboard activity record already uses received_bytes for verified content bytes, so this field is wire_bytes.

No BlobSource or drive signature changes; node and gateway upstream pulls count too but do not read the figure.

Closes #2444

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 30, 2026 22:45

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-code-quality

github-code-quality Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main 4037280 fix/2444-bundle-pull... cf23764 +/-
77% 77% 0%
View coverage of the 7 most impacted files.
File main 4037280 fix/2444-bundle-pull... cf23764 +/-
crates/client/src/lib.rs 89% 89% 0%
crates/cli/src/.../bundle_pull.rs 63% 63% 0%
crates/client/s...undle/engine.rs 65% 65% 0%
crates/node/src...s/client/mod.rs 91% 91% 0%
crates/client/src/ledger.rs 98% 98% 0%
crates/client/src/ledgers.rs 100% 100% 0%
crates/protocol/src/framing.rs 92% 93% +1%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 31, 2026 16:00 UTC

@yigitdot
yigitdot requested a review from thiras October 31, 2026 15:10
@thiras
thiras requested a balanced review from Copilot October 31, 2026 15:35

Copilot AI 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.

🟡 Changes recommended

The new stop test can pass even if the overrun-frame count is omitted; a deterministic case asserting wire == honest + over is needed to cover the read-and-drop path.

1 open issue

Review effort: Balanced

Comment thread crates/client/src/lib.rs Resolved
…nd count is exact

The stop test bounded the wire count to a range that also held when the
frame past the promised length went uncounted. The lying server now
signals once the buyer acknowledges every byte it wrote; the test stops
after that signal and asserts the honest wire plus the one over-sent frame.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@yigitdot
yigitdot merged commit d90a221 into main Oct 31, 2026
38 checks passed
@yigitdot
yigitdot deleted the fix/2444-bundle-pull-wire-bytes branch October 31, 2026 16:04
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.

bundle pull: count wire bytes received per lane so arrived-but-unverified bytes show in the summary

3 participants