Repository navigation
fix(node): report each lane's owed amount in admin lanes - #2588
Merged
Merged
Conversation
`build_lane_snapshots` reported `LaneState::last_amount()`, the cumulative of the last signed voucher, as `outstanding_micro_usdc`. A hash-chain lane pays with preimages, which move only the verified frontier, so the figure trailed the lane's claim by up to one chain and read 0 on a lane's first epoch while the node redeemed it. It now reports `LaneState::owed()`, the signed anchor plus the verified frontier: the claim the redeemer submits. `settlement_eligible` follows. The delegated clamp e2e read the same field, so `accepted <= cap` was `0 <= 40` and could never fail. It now requires a non-zero owed figure, checks it against the registered cap, and waits until the on-chain watermark equals what the node reports owed. Docs: `settlement_eligible` is a per-lane bar, not a prediction of the next redemption (the redeemer gates on the unredeemed value per `redeemMany`), and it stays true once reached; the activity clock counts preimages; the e2e helpers' "fsync gap" note names the real gap. Closes #2337 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The narrow reporting correction has focused regression coverage and no identified blocking issues.
No open issues 🎉
What changed in this PR
Fixes #2337 by making the node’s admin lane view include verified hash-chain payments, matching the claim submitted for redemption.
Changes:
- Reports
LaneState::owed()instead of the last signed amount. - Adds regression coverage and strengthens delegated-cap settlement assertions.
- Clarifies cumulative claims, settlement eligibility, and payment activity documentation.
| File | Description |
|---|---|
| crates/node/src/admin/tests.rs | Tests first-epoch and rolled-over chain claims; updates fixtures. |
| crates/node/src/admin.rs | Reports owed amounts in lane snapshots. |
| crates/e2e/tests/node_to_node_coalesce.rs | Corrects claim and polling comments. |
| crates/e2e/tests/coalesce_two_clients.rs | Corrects claim and polling comments. |
| crates/e2e/tests/cli_fetch_multi_source.rs | Clarifies polling comments. |
| crates/e2e/tests/cli_fetch_delegated.rs | Checks nonzero claims, registered caps, and exact settlement. |
| crates/common/src/admin.rs | Clarifies lane DTO and RPC documentation. |
| crates/cli/tests/admin_rpc.rs | Adds a signature to the seeded lane fixture. |
| crates/cli/src/commands/node.rs | Clarifies the activity-clock comment. |
| CHANGELOG.md | Documents the reporting fix. |
Review effort: Balanced
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The admin
lanes()view (decdn node lanes) reported each lane'soutstanding_micro_usdcfromLaneState::last_amount(): the cumulative of the last signed voucher. A hash-chain lane pays with preimages, which move only the verified frontier. So the figure trailed the lane's claim by up to one chain, and it read0on a lane's first epoch while the node redeemed it.settlement_eligiblereadfalseon the same lanes.build_lane_snapshotsnow reportsLaneState::owed(): the signed anchor plus the verified frontier. That is the claim the redeemer submits (payment_settlement.rs,pool_store.rs).The clamp journey in
cli_fetch_delegatedread the same field, so itsaccepted <= registered.capcheck was0 <= 40and could never fail (#2337). It now:Closes #2337
Reviewer notes
crates/node/src/admin.rs(state.owed()). The rest is tests and docs.last_amountwith no signature, a state no production path creates.owed()reads that state as 0, so both now carry a placeholder signature.settlement_eligibleis a per-lane bar. It does not predict the next redemption: the redeemer gates on the unredeemed value summed perredeemMany. It staystrueonce reached.withdrawnAmount.load_allreads the in-memory working set.BuyerLaneSnapshot.last_amount_micro_usdc. It is the buyer's committed figure, notLaneState.Verification
cargo nextest run -p decdn-node -E 'test(build_lane_snapshots) | test(lanes_)': 19 passed. Includes a new regression test with a first-epoch lane (anchor 0) and a rolled-over lane (anchor 100 + frontier).cargo nextest run -p decdn-cli --test admin_rpc: 26 passed.cargo nextest run -p decdn-e2e --features anvil-e2eoncli_fetch_delegated(2 passed; the clamp test then passed 5 more runs), pluscoalesce_two_clients,node_to_node_coalesce,cli_fetch_multi_sourceandcli_bundle_pull_multi_source(4 passed, run before their doc-only edits).last_amount()restored, the new unit test fails and the e2e fails on the non-zero guard.Always:
pre-commit run --all-files: only the commit hooks on changed files ranCARGO_BUILD_WARNINGS=deny cargo clippy --workspace --all-targets --all-features: ran with-D warnings, cleancargo nextest run: targeted runs only (above); left to CI for the full workspaceOnly if touched:
CHANGELOG.mdentry added under FixedCARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-items: clean🤖 Generated with Claude Code