Skip to content

Add ADR-0005 audit-report wire types for earned reward eligibility#19

Open
grumbach wants to merge 2 commits into
WithAutonomi:mainfrom
grumbach:adr-0005-earned-reward-eligibility
Open

Add ADR-0005 audit-report wire types for earned reward eligibility#19
grumbach wants to merge 2 commits into
WithAutonomi:mainfrom
grumbach:adr-0005-earned-reward-eligibility

Conversation

@grumbach

@grumbach grumbach commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

What

The shared wire contract for ADR-0005: earned reward eligibility. ADR-0004 left open that a node identity is a free keypair, so "drop in, grab rewards, drop out" costs nothing to repeat. ADR-0005 makes a node earn its place: roughly a week of audited storage at the size it wants to charge for, before a client will pay it. This PR is just the protocol-level types both node and client must agree on; the node-side tally and the client-side gate land in their own PRs.

Changes

  • payment/audit_report.rs (new)AuditReport / AuditReportRow / AuditReportDay, the canonical signed-payload builder, and verify_audit_report. Signatures are ML-DSA-65, nonce-bound, and the byte cap is enforced by the caller before decode (documented as a load-bearing precondition on the verifier).
  • chunk.rs — both quote-request types now carry a client-generated report_nonce; the quote response carries an optional serialized audit_report bound to that nonce, so a report cannot be precomputed or replayed. Adds a MerkleCandidateQuoteRequest::new constructor mirroring ChunkQuoteRequest::new.
  • commitment.rs — corrects the ML-DSA-65 signature-size figures in the docs (3293 to 3309).

Wire compatibility

report_nonce and the response audit_report are postcard hard-cutover fields, same as the ADR-0004 commitment field they sit beside.

Testing

cargo test --lib (85 pass), cargo clippy --all-targets --all-features -D warnings clean, cargo fmt --check clean, all against the published evmlib / saorsa-* deps.

Introduce the signed audit-report type shared by node and client so a
client can decide, at quote collection, whether a quoter has earned the
right to be paid (a clean audited week at the quoted size).

- audit_report: AuditReport / AuditReportRow / AuditReportDay, the
  canonical signed payload builder, and verify_audit_report (ML-DSA-65,
  nonce-bound, size-capped by the caller).
- chunk: carry a client report_nonce on both quote-request types and an
  optional serialized audit_report on the quote response, bound to the
  nonce so a report cannot be precomputed or replayed. Add a
  MerkleCandidateQuoteRequest::new constructor mirroring ChunkQuoteRequest.
- commitment: correct the ML-DSA-65 signature-size figures in the docs.
The ADR-0005 quote request/response gain required postcard fields
(report_nonce, audit_report). Because ChunkMessage is postcard-encoded
and non-self-describing, old and new peers cannot interoperate, so bump
CHUNK_PROTOCOL_ID to v2 and PROTOCOL_VERSION to 2 to make the cutover
explicit, and the crate to 3.0.0 (major: wire change) so consumers pin a
distinct version rather than a mutable branch.

Also reconcile the AuditReportRow.convicted doc with the node's actual
sticky-for-a-dues-period behaviour (it does not clear on the next pass),
and fix a broken intra-doc link that failed the Documentation CI check.
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.

1 participant