Skip to content

ADR 003: Channel ID nonce source and pre-computation undefined #66

Closed

Description

@thiras

Category: Missing Specification

Severity: HIGH

File: adr/003-payments.md (~line 309)

Channel ID is computed as:

channelId = keccak256(abi.encodePacked(client, provider, nonce))

But "nonce" is never defined:

  1. Is it a per-client counter? Per-provider counter? Global counter?
  2. How does a client know the nonce value when opening a channel?
  3. If it's auto-incremented by the contract, how does the client compute the channelId before the transaction is confirmed?
  4. Can two channels between the same client-provider pair exist simultaneously (different nonces)?

Impact:
Without this spec, off-chain voucher signing cannot reference the correct channelId, and clients cannot predict their channel ID for pre-signing workflows.

Recommendation:
Specify a contract-maintained per-pair counter:

mapping(bytes32 => uint256) public pairNonce; // keccak256(client, provider) => next nonce

The client reads pairNonce before calling openChannel, and the contract increments it atomically.

ADRs affected

  • ADR 003 (Payment Model)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

design:missing-decision

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions