Repository navigation
fix(incentive,contracts)!: pin EIP-712 type-hash digests and adopt ADR 014's poolId naming - #1860
Merged
Merged
Conversation
…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
poolId naming
Contracts coverageLine coverage: 89.85% (2575/2866 lines) |
Gas snapshotNo gas changes vs base. |
…d typehash pin test Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019GvTLBADGNFT15wZSC2xNz
There was a problem hiding this comment.
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_TYPEHASHandSTREAM_RESPONSE_TYPEHASH, and strengthen Rust lock tests to assert both the ADR 014 type-string hash and thesol!-derived type-hash equal the pinned digest. - Rename the signed
StreamResponsefieldchannelId→poolIdacross 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.
Coverage reportTotal: 82.04% (was 82.08%, ▼ 0.04%) — 68013/82899 lines
History
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1843 (parts 2 and 3 — part 1, redeploying
SlashJudgeon Arbitrum Sepolia and re-mirroring the manifests, is handled separately under #1083).Part 2 — cross-language digest pin in default CI
The
StreamResponse/ProbeResponseEIP-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:decdn_incentivegains publicPROBE_RESPONSE_TYPEHASHandSTREAM_RESPONSE_TYPEHASHconstants. The existing*_type_hash_matches_adr_014lock tests now assert both that the ADR 014 type-string literal hashes to the pinned digest and that thesol!-derived type hash equals it.signing_hash_matches_eip712_canonicalbuilds its independent digest reconstruction on the pinned constant.SlashJudge.t.solgainstest_eip712Typehashes_pinnedAcrossLanguages, assertingjudge.PROBE_RESPONSE_TYPEHASH()andjudge.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 defaultcargo test+forge test, which would also have caught the drift that motivated part 1. Theg_node_04e2e drops its own hand-written probe type-string copy in favor of the shared constant.Part 3 —
channelId→poolId, reconciled with ADR 014ADR 014 publishes
bytes32 poolIdin theStreamResponsetype string while every implementation signedchannelId, 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,poolIdwins: it matches ADR 014 as published and the wire fieldStreamResponseBody.pool_id. Renamed in thesol!signer struct,SlashJudge.sol(type string,StreamMsg,abi.encode), both Solidity test suites, theStreamMsgABI mirror inslash_judge.rs, and the e2e fixtures;StreamSlashData.channel_idfollows aspool_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:The
SlashJudgeredeploy should confirmcast call … "STREAM_RESPONSE_TYPEHASH()(bytes32)"returns0xc6d9e65c…. 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 warningsandforge fmt --check— clean.🤖 Generated with Claude Code
https://claude.ai/code/session_019GvTLBADGNFT15wZSC2xNz
Generated by Claude Code