Skip to content

docs: fix clock-skew vulnerability in 30-second rate manipulation window - #50

Merged
thiras merged 2 commits into
mainfrom
fix/clock-skew-rate-manipulation-window
Mar 30, 2026
Merged

thiras merged 2 commits into
mainfrom
fix/clock-skew-rate-manipulation-window

Conversation

@thiras

@thiras thiras commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make StreamResponse.timestamp_us requester-generated (echoed from StreamRequest) instead of node-generated, mirroring the existing ProbeResponse pattern — both timestamps now come from a single clock, eliminating the clock-skew attack vector
  • Specify the explicit on-chain verification formula stream_response.timestamp_us - probe_response.timestamp_us < 30_000_000 in ADR 003 (rate bait-and-switch, phantom blob) and ADR 005 (wire protocol signatures)
  • Add negative consequence noting the requester clock manipulation risk and its deterrent (challenge bond + 24-hour counter-window)

Closes #13

Test plan

  • Read ADR 003 and ADR 005 end-to-end to confirm internal consistency
  • Verify no stale "within 30 seconds" references remain in rate manipulation context
  • Confirm mermaid diagram field lists match prose descriptions

🤖 Generated with Claude Code

…dow, closes #13

Make StreamResponse.timestamp_us requester-generated (echoed from
StreamRequest) instead of node-generated, mirroring the existing
ProbeResponse pattern. Both timestamps now come from the same clock,
so the on-chain verifier computes the delta without wall-clock
reference or time oracle. Specify the explicit formula
stream_response.timestamp_us - probe_response.timestamp_us < 30_000_000
in ADR 003 (rate bait-and-switch, phantom blob) and ADR 005 (wire
protocol signatures and consequences).

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

@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 updates ADR 003 and ADR 005 to refine the slashing mechanisms for rate manipulation and phantom blob announcements by introducing a 30-second window based on requester-anchored timestamps. The review identifies a critical loophole where a node can avoid slashing for phantom announcements by simply not responding, as the current logic requires a signed StreamResponse to prove the timing. Feedback also points out inconsistencies between the ADRs regarding evidence requirements and suggests that nodes should validate requester-provided timestamps against their local clocks to prevent malicious backdating.

Comment thread adr/003-payments.md Resolved
Comment thread adr/005-protocol.md Resolved
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

Updates protocol/payment ADRs to eliminate a clock-skew attack vector in the 30-second “rate manipulation” (and related) slashing windows by anchoring both relevant timestamps to the requester and defining an explicit on-chain delta formula.

Changes:

  • Make StreamResponse.timestamp_us requester-generated (echoed from StreamRequest.timestamp_us) to match the existing ProbeResponse timestamp pattern.
  • Specify the exact on-chain verification window formula (stream_response.timestamp_us - probe_response.timestamp_us < 30_000_000) in ADR 003 and ADR 005.
  • Document the downside of requester-controlled timestamps and the intended deterrent/counter mechanism.

Reviewed changes

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

File Description
adr/005-protocol.md Updates wire protocol docs/diagrams to include StreamRequest.timestamp_us, clarifies signatures, and specifies the 30-second slashing window computation.
adr/003-payments.md Updates slashing-condition prose to use the explicit timestamp delta formula for rate bait-and-switch and phantom blob cases.

💡 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
Comment thread adr/005-protocol.md Resolved
Comment thread adr/005-protocol.md Resolved
Comment thread adr/003-payments.md Resolved
Comment thread adr/003-payments.md Resolved
Comment thread adr/003-payments.md Resolved
Comment thread adr/005-protocol.md Resolved
- Add timestamp ordering guard (>= precondition) to prevent unsigned
  underflow in all occurrences of the 30-second delta formula
- Distinguish phantom blob evidence paths: signed refusal (ok: false)
  uses two-message on-chain proof; timeout/non-response handled via
  reputation penalties since absence of signed response is unprovable
- Add explicit rate directionality (rate_per_mb >) in ADR 005
  StreamResponse paragraph
- Qualify challenge bond deterrent as production-only, note PoC gap
- Update ADR 010 stale StreamRequest field list reference
- Reject node-side clock validation (reintroduces clock skew)

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@thiras
thiras merged commit 3eaa8fb into main Mar 30, 2026
@thiras
thiras deleted the fix/clock-skew-rate-manipulation-window branch March 30, 2026 20:50
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: Rate manipulation 30-second window is fragile due to clock skew

2 participants