Skip to content

docs: clarify voucher wire format vs on-chain format in ADR 003/005 - #40

Merged
thiras merged 2 commits into
mainfrom
docs/clarify-voucher-wire-format
Mar 29, 2026
Merged

thiras merged 2 commits into
mainfrom
docs/clarify-voucher-wire-format

Conversation

@thiras

@thiras thiras commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a note to ADR 005 explaining that Voucher {sig, amt} in the chunk loop diagram is shorthand — only signature and amount are transmitted on the wire, with channelId, nonce, and stablecoin derived from stream context
  • Adds a cross-reference from ADR 003's voucher format section to ADR 005 for wire protocol details
  • Contrasts with watchtower VoucherUpdate which sends all fields (no stream context)

Closes #10

Test plan

  • Verify cross-reference links resolve correctly (003-payments.md ↔ 005-protocol.md)
  • Read both notes in context to confirm they're clear and consistent

🤖 Generated with Claude Code

)

The chunk loop diagram in ADR 005 shows `Voucher {sig, amt}` while ADR 003
defines the full EIP-712 structure as `{channelId, amount, nonce, stablecoin,
signature}`. Add notes explaining that only signature and amount are sent on
the wire (other fields derived from stream context), with cross-references
between the two ADRs.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings March 29, 2026 18:45

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request clarifies the voucher wire format in ADR 003 and ADR 005, specifying that only the signature and amount are transmitted over the wire while other fields are derived from the stream context. A correction was suggested for the description of the watchtower VoucherUpdate to accurately reflect which fields are included, as the stablecoin field is omitted.

Comment thread adr/005-protocol.md Resolved

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.

Pull request overview

Clarifies that the voucher representation in the wire-protocol ADR is shorthand, and cross-links ADR 003 ↔ ADR 005 so readers understand the relationship between the on-chain EIP-712 voucher structure and the fields actually transmitted during streaming.

Changes:

  • Add an explicit note in ADR 005 explaining Voucher {sig, amt} is a wire shorthand with other fields derived from context.
  • Add a cross-reference note in ADR 003 pointing to ADR 005 for wire-format details.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
adr/005-protocol.md Adds a “Voucher wire format” clarification under the cdn/client/v1 chunk/voucher loop diagram.
adr/003-payments.md Adds a pointer from the voucher format section to ADR 005 for on-the-wire field details.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread adr/005-protocol.md Resolved
Comment thread adr/005-protocol.md Resolved
VoucherUpdate is {channel_id, amount, nonce, signature} — it does not
include stablecoin. Reword to state which fields are explicitly included
rather than claiming "all fields".

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@thiras
thiras merged commit 2d716b3 into main Mar 29, 2026
@thiras
thiras deleted the docs/clarify-voucher-wire-format branch March 29, 2026 18:50
thiras added a commit that referenced this pull request Oct 21, 2026
* fix(sponsord): re-send a hashless topUp once its nonce is vacant (#2572)

The keeper held further top-ups for a `topUp` whose submit returned no
tx hash until the treasury's confirmed nonce passed the nonce it was
sent with. When the transaction was never broadcast, or was dropped,
nothing fills that nonce, so the hold lasted until an operator sent
0-value self-transfers, and the pool could drain meanwhile.

`settle` now reads the pending nonce too for a hashless hold. When the
confirmed and pending nonces both equal the top-up's nonce, no
transaction holds it, so the keeper re-sends `topUp` at that nonce
through `decdn_client::buyer_pool::send_top_up_at`, records the hash
on the hold, and settles it by that receipt. Two transactions at one
nonce cannot both mine, so the re-send cannot escrow twice. A re-send
that reverts `PoolNotOpen` ends the hold; any other failure waits for
the next sweep. This is the node daemon's vacant-nonce rule.

`PoolChain` gains `pending_nonce` and `send_top_up_at`; `ChainPool`
re-attaches the `PoolNotOpen` marker through its redaction. `FakePool`
scripts the pending count and the re-send's outcome.

Closes #2572

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* docs(sponsord): point at the migrated issues and describe the hashless hold

The archived decdn/sponsord repository's issues 22 to 26 were deleted
after their migration here, so the docs' links to them resolved to
nothing. They now point at #2546 to #2550. Bare `(#38)` and `(#40)`
references in the sponsord crates named issues of that repository;
they now say so, since the same numbers name unrelated issues here.

security.md said a top-up whose response was lost is not held. The
keeper holds it, and re-sends it once its nonce is vacant.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* fix(sponsord): re-send a held topUp the node does not know under the same rule

A held `topUp` whose hash the RPC node does not know stood where a
hashless one did: its hold lasted until the nonce was used, so a
re-send the node dropped in turn was held for an operator. The vacancy
rule now covers both: when the node shows no transaction of the top-up
and its nonce is next with nothing holding it, the keeper re-sends.

The pending nonce is read only then; a queued top-up (an earlier nonce
unfilled) gets its own log line instead of sharing the mempool-held
one. A re-send that reverts `PoolNotOpen` counts as a failure, as the
same revert on the first send does.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* fix(sponsord): keep earlier hashes on a hold and correct the stuck-nonce remedy

A re-send replaced the hold's hash, so a first send that mined after
it went uncounted and the log named a hash that never mined. The hold
keeps the earlier hashes, and a used nonce is checked against each
before the top-up counts as unknown.

The operator remedy for a held nonce said to send 0-value
self-transfers; those take the pending nonce and queue behind the
stuck transaction. The logs and the operator guide now say to replace
it at that nonce with a higher fee, and the queued case says which
nonces to fill. A re-send answered as possibly broadcast is told from
a rejection (`ChainPool` attaches `TopUpUnconfirmed`), an allowance
shortfall names its remedy, and every other re-send failure logs at
error with the hold's age and what to check. The pending-nonce read
failure has its own line, and `FakePool` can fail it alone.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* refactor(sponsord): count top-ups and record re-sends in one place

`KeeperStatus::record_topup` replaces the three copies of the counter
and timestamp update; `Unconfirmed::record_resend` keeps the earlier
hash cap beside the field it bounds. `FakePool::fail_resends` takes a
`ResendFailure` in place of four switches that were never combined.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
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.

ADR 003/005: Clarify voucher wire format vs on-chain format

2 participants