Skip to content

Add explicit domain separation to state-channel signature scheme - #1051

Merged
ayomideadeniran merged 3 commits into
StellarDevHub:mainfrom
Junirezz:fix/917-state-channel-domain-tag
Aug 2, 2026
Merged

Add explicit domain separation to state-channel signature scheme#1051
ayomideadeniran merged 3 commits into
StellarDevHub:mainfrom
Junirezz:fix/917-state-channel-domain-tag

Conversation

@Junirezz

Copy link
Copy Markdown
Contributor

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 in contracts/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 (wrong mod path, and it referenced a client type name — StateChannelClient — that doesn't exist; the real generated type is StateChannelContractClient).

This PR:

  • Adds an explicit 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.
  • Fixes the module wiring so state_channel_tests.rs's 20 tests actually compile and run (#[path = "state_channel_tests.rs"] mod state_channel_tests;).
  • Adds two new tests: test_domain_tag_changes_hash_output (proves the tag is actually mixed in) and test_signature_over_untagged_payload_rejected (proves a pre-domain-tag signature can't be replayed against the current contract).

Test plan

  • cargo test in contracts/ — all 22 state_channel tests pass
  • cargo fmt --check / cargo clippy clean

Junirezz added 2 commits July 30, 2026 15:07
…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.
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

@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.

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@ayomideadeniran

Copy link
Copy Markdown
Contributor

Pr under review

@ayomideadeniran
ayomideadeniran merged commit 119d729 into StellarDevHub:main Aug 2, 2026
2 of 5 checks passed
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.

[Smart Contracts] Complete state-channel signature verification

3 participants