Skip to content

Pin the StreamResponse EIP-712 type-hash across Rust, Solidity, ADR 014, and the deployed SlashJudge #1843

Closed

Description

@yigitdot

Summary

The StreamResponse EIP-712 type-hash must agree in four places — the Rust signer, the Solidity verifier, ADR 014's published type string, and the contract actually deployed on Arbitrum Sepolia. Default CI checks none of those agreements. #1842 (removing the dead redirect field) made the gap concrete: it is a correct, coordinated change that still leaves the live testnet deployment computing a different digest, with every suite green.

Three parts, one theme.

1. Redeploy SlashJudge on Arbitrum Sepolia and re-mirror both manifests

Verified on-chain today:

$ cast call 0xD647dF488Bf485c1C58AAda6139056d7e9643A0D "STREAM_RESPONSE_TYPEHASH()(bytes32)" \
    --rpc-url https://sepolia-rollup.arbitrum.io/rpc
0x536e77ef17fa75e756739e9759363e94a58d5cbe9e08e0b919f8ed9eb1dd9540   # 7-field, with redirect

$ cast keccak "StreamResponse(bytes32 hash,bool ok,uint64 ratePerMb,uint64 totalBytes,bytes32 channelId,uint64 timestampUs)"
0x83681d565d37ddda19c41f04b6ca37dd4ce9804152a0c284241ab43cd3d53527   # post-#1842

That address is committed in contracts/deployments/421614.json:26 and mirrored in crates/cli/deployments/421614.json, which crates/cli/src/known_chains.rs:49 compiles into the decdn binary via include_str! and hands to decdn config init.

Once nodes sign the 6-field digest, every stream-leg challenge — submitRateChallenge, and submitBlacklistChallenge with isStreamResponse: true — reverts on signature recovery against the deployed contract. Stream-evidence slashing is silently dead on that testnet.

Nothing catches it: the anvil-e2e fixtures deploy fresh contracts from source, and the deployment-manifest-mirror pre-commit hook does not fire because #1842 touches neither manifest.

  • Redeploy SlashJudge (and re-wire its peer roles).
  • Refresh contracts/deployments/421614.json and crates/cli/deployments/421614.json.
  • Confirm cast call <new address> "STREAM_RESPONSE_TYPEHASH()(bytes32)" returns 0x83681d56….

2. Add a default-CI pin between the Rust and Solidity type strings

The type string exists in five hand-written copies:

  1. crates/incentive/src/stream_sig.rs — the sol! struct (generates the string)
  2. stream_sig.rs — literal in stream_response_type_hash_matches_adr_014
  3. stream_sig.rs — literal in signing_hash_matches_eip712_canonical
  4. contracts/src/SlashJudge.sol:58
  5. contracts/test/SlashJudge.t.sol:163

plus a sixth field-list copy in crates/incentive/src/slash_judge.rs (StreamMsg, the ABI-decode payload) mirroring contracts/src/SlashJudge.sol.

The Rust suite pins 1↔2↔3. The Solidity suite pins 4↔5 (implicitly — SlashJudge.t.sol signs with its own literal and the contract recovers with its constant, so drift breaks ecrecover). Nothing in default CI pins {1,2,3} ↔ {4,5}, or slash_judge.rs::StreamMsg ↔ SlashJudge.sol::StreamMsg.

The only cross-side proof is real_node_responses_are_valid_on_chain_evidence (crates/e2e/tests/g_gov_03_real_evidence.rs), which is behind the anvil-e2e feature and off by default. A one-sided edit leaves both suites green while every daemon signature becomes unverifiable on-chain and every challenge reverts on abi.decode — a silent break of the whole slashing path. crates/incentive/src/slash_judge.rs has zero tests.

Cheap fix, roughly four lines per side: hard-code the keccak digest as a shared magic constant, assert it in stream_response_type_hash_matches_adr_014, and add assertEq(judge.STREAM_RESPONSE_TYPEHASH(), 0x83681d56…) to SlashJudge.t.sol. Both suites then pin to one number and a one-sided edit fails in default CI. Note this pin would also have surfaced part 1 automatically.

Also worth an explicit assertEq for PROBE_RESPONSE_TYPEHASH, which has the same shape and the same missing pin.

3. Reconcile ADR 014's published type string

adr/014-on-chain-verification.md:49 publishes:

"StreamResponse(bytes32 hash,bool ok,uint64 ratePerMb,uint64 totalBytes,bytes32 poolId,uint64 timestampUs)"

Every implementation uses channelId, not poolId. Anyone building a verifier from the ADR computes a different keccak256 than the contract. This is pre-existing and was correctly preserved by #1842 — but crates/incentive/src/stream_sig.rs docstrings its lock test as "Lock the EIP-712 type hash to the exact ADR 014 wording" directly above a literal that is not ADR 014's wording, so the test's stated contract is false.

Pick one name and make all four surfaces agree (ADR 014, stream_sig.rs, SlashJudge.sol, SlashJudge.t.sol). Note the wire field is StreamResponseBody.pool_id, so poolId is arguably the honest choice and channelId the historical one.

Acceptance criteria

  • Default cargo nextest run + forge test fail if either side's StreamResponse or ProbeResponse type string is edited alone.
  • ADR 014's published type string is byte-identical to the one every implementation uses.
  • cast call against the manifest's SlashJudge address returns the type-hash the current tree signs, and both manifests carry that address.

Context

Found while reviewing #1842. Out of that PR's scope — filed rather than bundled.

Activity

  1. added a commit that references this issue on Aug 26, 2026
  2. added
    area:contracts
    kind:security
    kind:test
    design:adr
    prio:high
    on Aug 26, 2026
  3. moved this from Backlog to Ready in deCDNon Aug 27, 2026
  4. moved this from Ready to In progress in deCDNon Aug 27, 2026
  5. moved this from In progress to Done in deCDNon Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:contractsdesign:adrkind:securitykind:testprio:high

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions