Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating on the game help text #45

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions apps/web/src/components/GameHelpPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ export default function GameHelpPopover({ displayText }: { displayText: string }
<PopoverCloseButton />
<PopoverBody>
<Text fontSize="sm" pb={4}>
In this game, the goal of each player is to guess closest to the mean of submissions
from all participating players. Each game is divided into multiple rounds. In each
round, players first pick a commitment value from <b>{GameConfig.MIN_NUM}</b> to{" "}
<b>{GameConfig.MAX_NUM}</b>. The value is processed through a zk-SNARK circuit on the
client-side and the proof is submitted on-chain.
In this game, the goal of each player is to guess the closest to the mean of submissions
from all participating players. Each game is divided into multiple rounds. Players first
commit to a guess from <b>{GameConfig.MIN_NUM}</b> to <b>{GameConfig.MAX_NUM}</b>. The
guess value is processed through a zk-SNARK circuit on the client side, and the
commitment is submitted on-chain.
</Text>
<Text fontSize="sm" pb={4}>
After all players submit commitment proofs, they then open and reveal their committment
values. When all players have opened their commitments, the game host concludes the
round and the mean will be computed on-chain. The one closest to the mean will win the
round.
After all players have submitted commitments and proofs, they open and reveal their
guesses. When all players have opened their guesses, the game host concludes the round.
The mean of all guesses will be computed, and the player who submitted the guess closest
to the mean will win the round.
</Text>
<Text fontSize="sm" pb={4}>
The player who win <b>{GameConfig.ROUNDS_TO_WIN}</b> rounds first win the game.
Expand All @@ -58,24 +58,25 @@ export default function GameHelpPopover({ displayText }: { displayText: string }

<OrderedList spacing={3} mt={3}>
<ListItem fontSize="sm">
When a player first submit a value, a nullifier is randomly generated and gone through
a zk-SNARK circuit. The circuit performs range check ({GameConfig.MIN_NUM} -{" "}
{GameConfig.MAX_NUM}) and returns{" "}
<MyCode>[Poseidon(value, nullifier), Poseidon(nullifier)]</MyCode>. These two hashes
are stored on-chain and preserve players&apos; privacy.
When a player submit a guess, a nullifier is randomly generated, and both values are
passed into a zk-SNARK circuit. The circuit performs range check on the guess (
{GameConfig.MIN_NUM} - {GameConfig.MAX_NUM}) and returns{" "}
<MyCode>[Poseidon(guess, nullifier), Poseidon(nullifier)]</MyCode>. These two hashes
are stored on-chain, committing players to their guesses yet preserving their privacy.
</ListItem>
<ListItem fontSize="sm">
Player chosen value and nullifier are saved in client local storage and thus are not
prompted again when opening. By toggling &quot;Advanced Mode&quot;, you can manually
change the value and nullifier upon opening and see what happen in the on-chain
verification.
Player guess and nullifier are saved in client local storage and thus are not prompted
again during the opening phase. By toggling &quot;Advanced Mode&quot;, player can
manually change the value and nullifier upon opening (and check that the value will
indeed be rejected by the verifier on-chain 😏).
</ListItem>
<ListItem fontSize="sm">
When a round is concluded, the winner submission, <b>NOT the actual mean</b>, is
When a round is concluded, the winner's guess, <b>NOT the actual mean</b>, is
revealed. I think this will make the game a bit more interesting. But all the opening
values are stored on-chain, so players can still compute the mean by inspecting the
on-chain storage. Further work can be done to explore how to hide those openings but
still being able to compute the mean and determine a round winner.
values are stored on-chain in plain values, so players can still inspect the smart
contract storage on-chain and compute the mean off-chain. Further work can be done to
explore how to hide those openings but still being able to compute the mean and
distances from players' guesses.
</ListItem>
</OrderedList>
</PopoverBody>
Expand Down