Repository navigation
test(incentive,contracts): pin cooperative-close EIP-712 waiver parity vector (#1009) - #1010
Conversation
…y vector (#1009) The cooperative-close waiver (PRs #948/#949/#957/#973) is signed off-chain in Rust and verified on-chain by PaymentChannel, with the EIP-712 type and domain hand-duplicated on each side. Nothing pinned the full typed-data digest across both, so a drift in the domain (name/version) or struct encoding would produce unsettleable waivers with no test failure — the existing coverage only pinned the typehash string (Rust) and round-tripped sign/recover within each language. Commit one canonical parity vector and assert it from both sides: - Rust: EXPECTED_COOP_CLOSE_DIGEST + cooperative_close_digest_matches_committed_vector asserting sample_close().signing_hash(sample_domain()) equals it. - Solidity: test_cooperativeClose_digestMatchesVector recomputes the digest with the contract's public COOPERATIVE_CLOSE_TYPEHASH and the fixed domain, and test_cooperativeClose_domainMatchesVector ties the deployed contract's ERC-5267 eip712Domain() name/version to the vector. Verified the vector catches the drift class: bumping the domain version on either side fails the corresponding test. Test-only; no production code changed. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughAdds committed cooperative-close EIP-712 digest vectors and verification tests in Rust and Solidity, and refreshes the gas snapshot values for affected test cases. ChangesCross-language cooperative-close parity
Gas snapshot refresh
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Contracts coverageLine coverage: 89.96% (2160/2401 lines) |
Gas snapshotNo gas changes vs base. |
There was a problem hiding this comment.
Code Review
This pull request introduces cross-language EIP-712 parity tests between the Solidity smart contracts and the off-chain Rust signer. It adds a canonical test vector and corresponding tests in both Solidity (PaymentChannel.t.sol) and Rust (cooperative_close.rs) to ensure that the computed cooperative-close digests match, preventing silent encoding or domain drift. I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
Pins a single canonical EIP-712 typed-data digest test vector for the cooperative-close waiver and asserts it from both the off-chain Rust signer (crates/incentive) and the on-chain Solidity verifier (PaymentChannel tests), preventing silent cross-language drift in domain/type/encoding.
Changes:
- Add a committed Rust-side
EXPECTED_COOP_CLOSE_DIGESTand a test assertingsample_close().signing_hash(sample_domain())matches it. - Add Solidity-side parity vector fixtures and tests that (a) recompute the digest using the contract’s live
COOPERATIVE_CLOSE_TYPEHASH()and (b) assert the deployed contract’seip712Domain()name/version match the vector.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/incentive/src/cooperative_close.rs | Adds a pinned digest constant and a Rust test asserting the signer’s EIP-712 digest matches the committed vector. |
| contracts/test/PaymentChannel.t.sol | Adds matching vector fixtures plus Solidity tests that recompute the digest and pin the contract’s EIP-712 domain name/version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage reportTotal: 83.09% (was 83.09%, ● 0.00%) — 41838/50351 lines
History
|
…ests The #1010 vector tests add two functions plus fixtures to PaymentChannel.t.sol, enlarging that suite's test-contract bytecode and shifting per-test deployment gas across PaymentChannelTest, plus the two new entries (test_cooperativeClose_digestMatchesVector, test_cooperativeClose_domainMatchesVector). Regenerated via `FOUNDRY_PROFILE=ci forge snapshot --snap .gas-snapshot`; non-reproducible fuzz `runs:` lines left at committed values (the CI gate strips them). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
What
Closes #1009. Test-only change pinning a committed EIP-712 parity vector for the cooperative-close waiver across the off-chain Rust signer (
crates/incentive) and the on-chain Solidity verifier (PaymentChannel).Why
The cooperative-close path (#948/#949/#957/#973) signs the waiver off-chain in Rust and verifies it on-chain, with the EIP-712 type and domain hand-duplicated on each side and no shared source. Nothing pinned the full typed-data digest across both languages, so a drift in the domain (
name/version) or struct encoding would produce unsettleable waivers with no test failure — the prior coverage only pinned the typehash string (Rust) and round-tripped sign/recover within each language.Change
One canonical vector, asserted from both sides:
EXPECTED_COOP_CLOSE_DIGEST+cooperative_close_digest_matches_committed_vector:sample_close().signing_hash(sample_domain())must equal the pinned digest (full realsol!impl).test_cooperativeClose_digestMatchesVectorrecomputes the digest with the contract's liveCOOPERATIVE_CLOSE_TYPEHASH()and the vector's fixed domain;test_cooperativeClose_domainMatchesVectorties the deployed contract's ERC-5267eip712Domain()name/version to the vector.The single committed digest
0x680080f3…d8d627is byte-identical in both files; either side drifting breaks its test.Verification
cargo nextest run -p decdn-incentive cooperative_close(6/6);clippy --all-targetsclean.PaymentChannelsuite (98/98);forge fmt --check+FOUNDRY_PROFILE=ci forge build --deny warningsclean.versionon each side fails exactly the intended test (then reverted), proving the vector catches the drift class node: cooperative-close EIP-712 waiver typehash and domain are not asserted against a committed test vector, allowing silent drift between off-chain signer and on-chain verifier #1009 describes.castduring review — exact match.Reviewed via pr-review-toolkit (code / tests / comments); no critical issues. Comment-precision feedback folded in.
🤖 Generated with Claude Code
Summary by CodeRabbit