Skip to content

Remove dead redirect field from StreamResponse before launch #1838

Closed

Description

@alpergundogdu

Summary

StreamResponseBody.redirect: Option<NodeId> is a dead wire field: no node ever populates it, no client ever follows it, yet it is carried on the wire and folded into the EIP-712 signed set (so it is signed as bytes32(0) on every single StreamResponse, and mirrored in the on-chain SlashJudge type-hash). It should be removed now, while we are pre-launch and wire-breaking changes are free. Carrying it to production locks in the cost of ever removing it, because post-launch it becomes a frozen signed field (a Tier-3 ALPN / on-chain-type break).

Per CLAUDE.md: "Pre-launch: wire-breaking changes are fine. … Change the format, update every side in the same PR, and delete the old shape." This is exactly that.

Why it is dead

  • Designed by ADR 005 as a redirect-follow flow (response names an alternate NodeId; client hops to it, max 3 hops, cycle detection).
  • Forbidden by ADR 041 (adr/041-refuse-to-serve.md:152-156, :296), the later governing decision: a node emits no redirect or route hint, because it is a client-steering attack surface (a node could point at a colluding, expensive peer). A refused client re-routes through its own discovery (ADR 039) instead.
  • Never implemented on the client side (Implement cdn/client/v1 paid delivery protocol (StreamRequest, StreamResponse, ChunkData, vouchers) #317): the requester detects a non-None redirect and hard-bail!s rather than following it.

So the field exists only as a reserved-but-inert shape, and the ADR that made it inert is Accepted. There is no in-between populated case — every non-economic decline goes through NotFound/HashBlacklisted/etc. wire errors, never a redirect.

Evidence (current tree)

Producers — all hardcode None:

  • crates/node/src/handlers/client/dispatch.rs:1074 (success / cache-hit path)
  • crates/node/src/handlers/client/window.rs:258 (attach/own/mixed fill success)
  • crates/node/src/handlers/client/window.rs:528 (origin pull-through success)
  • crates/node/src/handlers/client/wire.rs:164 (respond_error — the sole refuse/error builder)

No Some(...) for redirect exists anywhere in non-test node code.

Consumers — parsed then rejected, never acted on:

  • crates/client-pull/src/lib.rs:1949 and :2473 — if resp.body.redirect.is_some() { bail!("server returned a redirect; following redirects is out of scope (#317)") }
  • Out-of-scope note at crates/client-pull/src/lib.rs:18-21

Signed set (the reason it can't be dropped post-launch):

  • crates/incentive/src/stream_sig.rs:63 (bytes32 redirect;), :92 (pub redirect: B256), :108-113 (from_response_body maps None → B256::ZERO)
  • On-chain mirror: contracts/src/SlashJudge.sol (type-hash string + struct; ~:60, :159, :430)
  • Frozen-field listings: crates/protocol/tests/snapshots/public_api__public_api.snap and adr/013-schema-evolution.md:270

Scope / checklist

Single PR, all sides together (wire + signing + on-chain type must change atomically so the off-chain digest keeps matching what SlashJudge recovers):

  • Remove redirect from StreamResponseBody (crates/protocol/src/client.rs) and its doc comment.
  • Drop the None literal at the four producer sites listed above.
  • Remove the two redirect.is_some() bail! guards in crates/client-pull/src/lib.rs and the out-of-scope note; drop redirect from any test fixtures.
  • Remove redirect from the EIP-712 typed data in crates/incentive/src/stream_sig.rs (struct field, B256 field, from_response_body mapping, related unit tests).
  • Remove redirect from the StreamResponse struct and type-hash string in contracts/src/SlashJudge.sol; re-run forge fmt/forge test and update any gas snapshots.
  • Regenerate the public-API snapshot (crates/protocol/tests/snapshots/...).
  • Update the ADRs to present-tense canon with the field gone: strike the redirect flow and its mention in the signed set from ADR 005 (:110, :120-121, :147, :160-168, :437) and ADR 014 (:33, :37, :39, :49), and remove redirect from the frozen-field list in ADR 013 (:270). ADR 041 already matches the target state — leave it, but it can cite that the redirect field no longer exists rather than "is never emitted."
  • Confirm the EIP-712 digest change is consistent across Rust and Solidity (a signing round-trip test that byte-matches SlashJudge's recovered hash).

Acceptance criteria

  • redirect appears nowhere in crates/ or contracts/ except (optionally) git history.
  • cargo build && cargo clippy && cargo nextest run green; forge fmt --check && FOUNDRY_PROFILE=ci forge build && forge test green.
  • The StreamResponse EIP-712 type is identical between stream_sig.rs and SlashJudge.sol, verified by a cross-checked signing test.
  • ADRs 005/013/014 no longer describe a redirect wire or signed field; present-tense canon holds (no "used to", no changelog voice).

Out of scope

  • The refuse-to-serve / pool-reputation and prepay design work (tracked separately). This issue is purely the dead-field removal.
  • Any replacement redirect/route-hint mechanism — ADR 041 deliberately has none.

Notes

  • Wire-breaking is acceptable pre-launch; do not add a compat shim or dual-format reader (CLAUDE.md).
  • This is a coordinated Rust↔Solidity signed-type change; the e2e fixtures (crates/e2e, anvil-e2e) exercise the real signed path and should be run to confirm the digest change lands cleanly on both sides.

Activity

  1. added
    kind:chore
    status:mainnet-blocking
    on Aug 26, 2026
  2. self-assigned this
    on Aug 26, 2026
  3. moved this from Backlog to Ready in deCDNon Aug 26, 2026
  4. moved this from Ready to In progress in deCDNon Aug 26, 2026
  5. moved this from In progress to Done in deCDNon Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:chorestatus:mainnet-blocking

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions