GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — test(id): PoC — game-post with async turn passing on tic-tac-toe (#2266) by dezren39 · Pull Request #2755 · developing-today/code Conversation
|
| Point | What the test does |
|---|---|
| 1. game-post object | game.post names the package by hash + version (sha256 of examples/tic-tac-toe/tic-tac-toe.wasm, 0.1.0), mode: async-turns, both player IDs, attestation: concession, and a genesis frontier. Signed by the poster. |
| 2. challenge flow | challenge.accept by the second player names the post hash; then alternating game.turn objects, each naming the prev_frontier its author saw. Turns are folded by the real Wasm guest (Sandbox → restore(frontier) → update(participant, move) → snapshot()), so the state is recomputable by anyone holding the journal. No session, no server, nothing live. |
| 3. concession result | At game end both players sign a match.result claim over the same frontier. agreed is Some(outcome) only when both signatures verify, both name the same instance and frontier, and both say the same outcome; disagreement or a frontier mismatch yields None (the dispute is visible, not resolved by fiat). |
| 4. save point + fork | A save.point over a mid-game frontier; a third ID publishes save.fork naming that save point, the origin instance, the origin author and the origin frontier, and plays on from the same frontier. Both lines replay independently; the original is untouched. |
Structural turn enforcement is exercised too: a turn signed by the wrong player, and a turn naming a frontier the line is not at, are both refused.
The last test (object_shapes_are_documented) emits the full signed objects as one JSON document and re-verifies every one of them after a round-trip; run it with --nocapture to print them. Envelope used throughout, local to the PoC:
{ "kind": "game.post | challenge.accept | game.turn | match.result | save.point | save.fork",
"author": "<hex ed25519 public key>",
"hash": "<hex sha256 over canonical (kind, body)>",
"signature": "<hex ed25519 signature over the same bytes>",
"body": { "...kind-specific fields..." } }Deliberate difference from artifact::SignedArtifact: the chain fields (seq/prev/after) are replaced by explicit lineage references inside the body (instance, prev_frontier), because a turn is ordered by the game's frontier, not by the author's per-key sequence. That is a finding, not an oversight — see the note on #2266.
cargo test --test game_post_async_turns_poc
# 3 passed
Also rustfmt --edition 2024 --check on the new file is clean. cargo clippy could not run in this environment (host clippy-driver 0.1.99 vs the prebuilt dep artifacts on 1.98 — E0514), so clippy is left to CI.
witnessed attestation, no handoff/acceptance chain (that is the succession mode, id: design: ID boards v1 #2054's).Closes nothing; relates to #2266, #2053, #2037, #2056.
Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Demonstrates the #2053 game-post model's async-turns mode against the real tic-tac-toe guest (examples/tic-tac-toe/tic-tac-toe.wasm), as a self-contained integration test. PoC only: objects are modelled locally, nothing is wired into the event store, CLI, or board UI. - game-post object naming package hash+version, mode async-turns, two players, attestation concession - challenge acceptance + alternating signed turns, each naming the frontier it builds on, folded through the real Wasm guest; wrong author and stale frontier are refused - paired signed result claims; agreeing claims compute agreed, disagreement and frontier mismatch do not - mid-game save point forked by a third ID; both lines replay independently and the fork object preserves attribution
There was an error while loading. Please reload this page.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 36 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: e69d592b44
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| for claim in claims { | ||
| claim.verify()?; | ||
| if claim.field("instance")? != post.field("instance")? { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Require result claims from both distinct posted players
If the same player's claim is supplied twice, agreed returns Some(outcome) because it verifies signatures without checking their authors against post.body.players or requiring distinct signers. Two outsiders' matching claims also pass. This makes the PoC's concession calculation report agreement without either opponent consenting. Require exactly one verified claim from each posted player and add negative assertions for duplicate and unrelated signers.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| candidate.field("prev_frontier")? | ||
| )); | ||
| } | ||
| line.push(candidate); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Reject no-op moves before advancing the signer rotation
When a correctly signed turn targets an occupied cell, this append advances the expected signer even though the tic-tac-toe guest silently leaves its board and play count unchanged (examples/tic-tac-toe/main.roc:27–28). For example, X plays 0, O plays occupied 0, then X plays 1: all three turns are accepted, but X's last turn places an O because the guest selects marks by successful play count while this validator selects signers by journal length. Validate the candidate transition before appending and reject illegal/no-op moves so they cannot switch control of the marks.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| let next = turn(&forked_players[0], &post, 0, 4, "8", &mid); | ||
| accept_turn(&mut forked_line, next, &forked_players).unwrap(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Bind fork continuation turns to the new instance
The continuation passes the original post to turn, so its signed instance is the original game's instance rather than the new instance named by branch. Neither construction nor validation of this continuation uses the fork record; the assertions therefore pass while demonstrating only a copied journal with another turn attributed to the original game. Construct the continuation using the fork's instance and assert that its signed instance matches branch.instance, so the PoC actually exercises the claimed independent lineage.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.