Skip to content

Fix oracle batch game_id, WebSocket subscription validation/broadcast, and deploy version check - #1870

Merged
yahia008 merged 4 commits into
StellarCheckMate:mainfrom
rasputin2525:drips/1772-1773-1774-1775
Oct 22, 2026
Merged

yahia008 merged 4 commits into
StellarCheckMate:mainfrom
rasputin2525:drips/1772-1773-1774-1775

Conversation

@rasputin2525

Copy link
Copy Markdown
Contributor

Summary

Fix oracle batch game_id, WebSocket subscription validation/broadcast, and deploy version check

What was solved

#1772 — Fix: oracle submit_batch_results silently drops the game_id from the oracle record

Fix the oracle contract's submit_batch_results so the game_id supplied in each batch entry is threaded through the internal settlement path and persisted on the on-chain oracle record, plus a test asserting the stored record contains the supplied game_id.

Addressed:

  • Changed: contracts/escrow/src/tests/batch_submit.rs
  • Thread the game_id from each batch entry through to the oracle record write in submit_batch_results
  • Ensure the stored oracle record includes the supplied game_id instead of an empty value
  • Add a test asserting the stored record includes the supplied game_id

#1773 — Fix: websocket server does not validate subscription match_id is a valid u64

Fix the WebSocket subscription handler so it parses and validates the incoming match_id as a positive u64 before registering an event filter, sends a typed error frame to the client on invalid input instead of letting an unhandled exception close the connection, and adds a test covering the invalid-input path.

Addressed:

  • Changed: README.md
  • Parse match_id from the raw subscription string into a u64 before passing it to the event filter
  • Validate that the parsed match_id is a positive integer (reject zero and non-numeric input)
  • Send a typed error frame to the client when match_id is invalid rather than allowing an unhandled exception to close the connection

#1774 — Deployment: scripts/deploy_testnet.sh does not verify the deployed contract version matches the built WASM

Update scripts/deploy_testnet.sh so that after deploying the escrow contract it invokes get_contract_version on-chain and compares the result to the built package version (CARGO_PKG_VERSION), failing the script on mismatch to catch stale deployments.

Addressed:

  • Changed: scripts/deploy_testnet.sh
  • After a successful deploy, invoke stellar contract invoke ... -- get_contract_version against the deployed contract ID
  • Compare the returned on-chain version to the expected CARGO_PKG_VERSION of the built WASM
  • Exit non-zero (fail the script) when the versions do not match

#1775 — Fix: websocket server sends the full event payload to all subscribers, not just those watching that match

Fix the WebSocket server broadcast loop so events are dispatched only to clients subscribed to the event's match_id, using a match_id → Set subscription map, and add a test with two clients subscribed to different matches.

Addressed:

  • Changed: server/src/websocket.rs, server/src/ws/mod.rs, server/src/ws/subscriptions.rs
  • Maintain a subscription map keyed by match_id mapping to the set of subscribed clients
  • Only dispatch each event to clients subscribed to that event's match_id
  • Add a test with two clients subscribed to different matches verifying isolation

Changes

  • contracts/escrow/src/tests/batch_submit.rs (modify)
  • README.md (modify)
  • server/src/websocket.rs (create)
  • server/src/ws/subscriptions.rs (create)
  • scripts/deploy_testnet.sh (modify)
  • server/src/ws/mod.rs (create)

Approach

  1. Fix: oracle submit_batch_results silently drops the game_id from the oracle record #1772 — Fix: oracle submit_batch_results silently drops the game_id from the oracle record (Changed: contracts/escrow/src/tests/batch_submit.rs)
  2. Fix: websocket server does not validate subscription match_id is a valid u64 #1773 — Fix: websocket server does not validate subscription match_id is a valid u64 (Changed: README.md)
  3. Deployment: scripts/deploy_testnet.sh does not verify the deployed contract version matches the built WASM #1774 — Deployment: scripts/deploy_testnet.sh does not verify the deployed contract version matches the built WASM (Changed: scripts/deploy_testnet.sh)
  4. Fix: websocket server sends the full event payload to all subscribers, not just those watching that match #1775 — Fix: websocket server sends the full event payload to all subscribers, not just those watching that match (Changed: server/src/websocket.rs, server/src/ws/mod.rs, server/src/ws/subscriptions.rs)

Issues

Closes #1772
Closes #1773
Closes #1774
Closes #1775

@yahia008
yahia008 merged commit 054d07d into StellarCheckMate:main Oct 22, 2026
12 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment