Repository navigation
docs: fix clock-skew vulnerability in 30-second rate manipulation window - #50
Conversation
…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]>
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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_usrequester-generated (echoed fromStreamRequest.timestamp_us) to match the existingProbeResponsetimestamp 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.
- 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]>
Summary
StreamResponse.timestamp_usrequester-generated (echoed fromStreamRequest) instead of node-generated, mirroring the existingProbeResponsepattern — both timestamps now come from a single clock, eliminating the clock-skew attack vectorstream_response.timestamp_us - probe_response.timestamp_us < 30_000_000in ADR 003 (rate bait-and-switch, phantom blob) and ADR 005 (wire protocol signatures)Closes #13
Test plan
🤖 Generated with Claude Code