Skip to content

fix(incentive,contracts)!: pin EIP-712 type-hash digests and adopt ADR 014's poolId naming - #1860

Merged
alpergundogdu merged 2 commits into
mainfrom
claude/type-hash-digest-adr-014-xzif6m
Aug 27, 2026
Merged

alpergundogdu merged 2 commits into
mainfrom
claude/type-hash-digest-adr-014-xzif6m

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Closes #1843 (parts 2 and 3 — part 1, redeploying SlashJudge on Arbitrum Sepolia and re-mirroring the manifests, is handled separately under #1083).

Part 2 — cross-language digest pin in default CI

The StreamResponse/ProbeResponse EIP-712 type strings existed in five hand-written copies with nothing in default CI pinning the Rust side to the Solidity side. Both sides now assert the same hard-coded keccak256 digests:

  • Rust: decdn_incentive gains public PROBE_RESPONSE_TYPEHASH and STREAM_RESPONSE_TYPEHASH constants. The existing *_type_hash_matches_adr_014 lock tests now assert both that the ADR 014 type-string literal hashes to the pinned digest and that the sol!-derived type hash equals it. signing_hash_matches_eip712_canonical builds its independent digest reconstruction on the pinned constant.
  • Solidity: SlashJudge.t.sol gains test_eip712Typehashes_pinnedAcrossLanguages, asserting judge.PROBE_RESPONSE_TYPEHASH() and judge.STREAM_RESPONSE_TYPEHASH() against the same two hex literals.

A one-sided edit of either side's type string (or of the sol! structs) now fails default cargo test + forge test, which would also have caught the drift that motivated part 1. The g_node_04 e2e drops its own hand-written probe type-string copy in favor of the shared constant.

Part 3 — channelId → poolId, reconciled with ADR 014

ADR 014 publishes bytes32 poolId in the StreamResponse type string while every implementation signed channelId, so a verifier built from the ADR computed a different digest — and the Rust lock test's "exact ADR 014 wording" docstring was false. Per the issue's lean, poolId wins: it matches ADR 014 as published and the wire field StreamResponseBody.pool_id. Renamed in the sol! signer struct, SlashJudge.sol (type string, StreamMsg, abi.encode), both Solidity test suites, the StreamMsg ABI mirror in slash_judge.rs, and the e2e fixtures; StreamSlashData.channel_id follows as pool_id. Every copy of the type string is now byte-identical to ADR 014's. No ADR edit was needed.

Note for #1083

The rename changes the stream digest from post-#1842 0x83681d56… to:

STREAM_RESPONSE_TYPEHASH = 0xc6d9e65c3527b52698988cae3aea61d5d8df64b415de933cc7e9762bc600eb3e
PROBE_RESPONSE_TYPEHASH  = 0x4638cb019b77f8677ac7015556f19e56f0be5a6a0d9392006a7fb5b8acd587e5

The SlashJudge redeploy should confirm cast call … "STREAM_RESPONSE_TYPEHASH()(bytes32)" returns 0xc6d9e65c…. Pre-launch, so no compatibility shims: every side changes in this PR.

Validation

  • cargo test -p decdn-incentive -p decdn-client-pull — all pass (255 + 217).
  • cargo clippy --workspace --all-targets (and -p decdn-e2e --features anvil-e2e) — clean.
  • cargo fmt -- --check — clean.
  • forge test (foundry v1.7.1, the CI pin) — 844 passed, 0 failed.
  • FOUNDRY_PROFILE=ci forge build --sizes --deny warnings and forge fmt --check — clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_019GvTLBADGNFT15wZSC2xNz


Generated by Claude Code

…014's poolId naming

Closes the default-CI gap between the Rust and Solidity EIP-712 type
strings (#1843 parts 2+3; part 1, the SlashJudge redeploy, is tracked in
#1083):

- Pin the keccak256 digests of both type strings as shared magic
  constants. `decdn_incentive::{PROBE,STREAM}_RESPONSE_TYPEHASH` are
  asserted by the Rust lock tests, and
  `SlashJudge.t.sol::test_eip712Typehashes_pinnedAcrossLanguages`
  asserts the contract constants against the same numbers — so a
  one-sided edit of either side's type string now fails default
  `cargo test` + `forge test`.
- Rename the `StreamResponse` EIP-712 field `channelId` to `poolId`
  everywhere (sol! signer struct, SlashJudge.sol, both Solidity test
  suites, the StreamMsg ABI mirror, e2e fixtures), matching ADR 014's
  published type string and the wire field
  `StreamResponseBody.pool_id`. `StreamSlashData.channel_id` follows
  as `pool_id`. Every copy of the type string is now byte-identical
  to ADR 014.
- The g_node_04 e2e drops its hand-written probe type-string copy in
  favor of the pinned constant.

The rename changes STREAM_RESPONSE_TYPEHASH to
0xc6d9e65c3527b52698988cae3aea61d5d8df64b415de933cc7e9762bc600eb3e —
the digest the #1083 redeploy must land on-chain.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019GvTLBADGNFT15wZSC2xNz
Copilot AI lite review requested due to automatic review settings August 27, 2026 16:11
@alpergundogdu alpergundogdu changed the title Pin the EIP-712 type-hash digests in both default suites and adopt ADR 014's poolId naming fix(incentive,contracts)!: pin EIP-712 type-hash digests and adopt ADR 014's poolId naming Aug 27, 2026
@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 89.85% (2575/2866 lines)
▲ +0.16pp vs base (89.69% → 89.85%)
Run: 33092137613

@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

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

This PR aligns the EIP-712 ProbeResponse and StreamResponse type-hashes across Rust and Solidity by pinning shared keccak256 digests in default CI, and reconciles naming with ADR 014 by renaming channelId → poolId throughout the signed StreamResponse surface.

Changes:

  • Add public, pinned Rust constants PROBE_RESPONSE_TYPEHASH and STREAM_RESPONSE_TYPEHASH, and strengthen Rust lock tests to assert both the ADR 014 type-string hash and the sol!-derived type-hash equal the pinned digest.
  • Rename the signed StreamResponse field channelId → poolId across Rust (sol! struct + signed data), Solidity (SlashJudge + tests), and e2e fixtures.
  • Add a Solidity test that pins SlashJudge.{PROBE,STREAM}_RESPONSE_TYPEHASH() to the same digests to ensure one-sided drift fails in default CI.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/incentive/src/stream_sig.rs Pins STREAM_RESPONSE_TYPEHASH, switches signed field naming to pool_id, and updates digest-lock + canonical EIP-712 reconstruction test.
crates/incentive/src/slash_judge.rs Updates the ABI-mirror StreamMsg struct field from channelId to poolId.
crates/incentive/src/probe_sig.rs Pins PROBE_RESPONSE_TYPEHASH and updates the ADR/type-hash lock test to assert against the pinned digest.
crates/incentive/src/lib.rs Re-exports the new pinned type-hash constants as part of the crate’s public API.
crates/e2e/tests/g_node_04_blacklist_compliance.rs Removes the local probe type-string copy and uses PROBE_RESPONSE_TYPEHASH for struct-hash reconstruction.
crates/e2e/src/chain.rs Renames stream evidence field usage to pool_id / poolId for cross-layer challenge submission.
contracts/test/SlashJudge.t.sol Renames StreamMsg field to poolId and adds a test pinning both typehash constants to the cross-language digests.
contracts/test/CapacityBondRegionE2E.t.sol Updates stream evidence construction and struct-hash encoding to use poolId.
contracts/src/SlashJudge.sol Updates the canonical stream type string and StreamMsg field to poolId and uses it in the stream struct-hash computation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown

Coverage report

Total: 82.04% (was 82.08%, ▼ 0.04%) — 68013/82899 lines

File Coverage Lines Δ
crates/e2e/src/chain.rs 13.72% 229/1669 ▲ +0.22%
crates/incentive/src/probe_sig.rs 97.47% 231/237 ▲ +0.01%
crates/incentive/src/stream_sig.rs 97.66% 209/214 ● 0.00%
History
Commit Total Δ vs base
e4684d8 (HEAD) 82.04% ▼ 0.04%

@alpergundogdu
alpergundogdu merged commit acd03e4 into main Aug 27, 2026
25 checks passed
@alpergundogdu
alpergundogdu deleted the claude/type-hash-digest-adr-014-xzif6m branch August 27, 2026 19:12
alpergundogdu pushed a commit that referenced this pull request Aug 27, 2026
Regenerate contracts/.gas-snapshot over the merged tree (both sides
moved gas: minDeposit read in openPool here, EIP-712 type-hash pinning
from #1860 on main).

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_01DnUKUTEJ9JHp1fQ2V9chx2
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.

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

3 participants