Add explicit domain separation to state-channel signature scheme - #1051
Merged
ayomideadeniran merged 3 commits intoAug 2, 2026
Merged
Conversation
…llarDevHub#917) The signed state-channel payload already had real ed25519 verification and nonce-based replay protection, but domain separation was only implicit in the field encoding. Prepend a fixed DOMAIN_TAG to the hashed payload so a signature can't be replayed across contracts or future message-layout versions that happen to encode to the same bytes. Also fix state_channel_tests.rs, which was never wired into the crate (wrong `mod` path, and referenced a client type name that doesn't exist) so its 20 existing tests were silently never compiled or run.
|
@Junirezz is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Junirezz Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Pr under review |
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 #917
Summary
The state-channel signature verification acceptance criteria (real
ed25519_verify, replay protection via nonce, invalid/replayed signatures fail, valid multi-party transitions pass) were already implemented incontracts/src/state_channel.rs— but domain separation was only implicit in the field encoding, and the 20 tests proving all of this (state_channel_tests.rs) were never actually compiled or run, because the file was never wired into the module tree (wrongmodpath, and it referenced a client type name —StateChannelClient— that doesn't exist; the real generated type isStateChannelContractClient).This PR:
DOMAIN_TAG("YVSC_STATE_V1") prepended to the hashed state payload, so a signature can't be replayed across contracts or a future message-layout version that happens to encode to the same bytes.state_channel_tests.rs's 20 tests actually compile and run (#[path = "state_channel_tests.rs"] mod state_channel_tests;).test_domain_tag_changes_hash_output(proves the tag is actually mixed in) andtest_signature_over_untagged_payload_rejected(proves a pre-domain-tag signature can't be replayed against the current contract).Test plan
cargo testincontracts/— all 22state_channeltests passcargo fmt --check/cargo clippyclean