Conversation
| } | ||
|
|
||
| #[aztec(private)] | ||
| fn joinGame( |
|
| ]); | ||
|
|
||
| expect((await contract.methods.view_game(GAME_ID).view({ from: firstPlayer })) as Game).toMatchObject({ | ||
| players: [ |
|
Honourary CGAM member |
yarn-project/noir-contracts/src/contracts/card_game_contract/Nargo.toml
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| fn compute_deck_strength<N>(cards: [Card; N]) -> Field { | ||
| cards.fold(0, |acc, card: Card| { |
There was a problem hiding this comment.
"Come to noir we have for loops"
we write this
| } | ||
|
|
||
| const cardToField = (card: Card): bigint => { | ||
| return card.strength + card.points * 65536n; |
There was a problem hiding this comment.
side q:
longer term, is this something that should be handled by a generated typescript class?
also i think there is prover system abstraction leaking through (modulus/overflow is proving system dependent?)
There was a problem hiding this comment.
Nah this is only because our macros dont' support arrays of structs yet as arguments to contract functions, when that's updated we don't need to pack the card into a field, we can just pass a card struct
What do you mean about the modulus/overflow? the fact that we can pack the card (32 bits) into a single field? For aztec we can safely assume that we'll always have bn254 I think 🤔
There was a problem hiding this comment.
ahh OK got it!
ohh right for modulus I forgot aztec has the pinned backend vs "regular" noir. i was thinking if points got really big we could maybe have overflow (in some setting besides the test)
dan-aztec
left a comment
There was a problem hiding this comment.
wow a lot more complex than the private token contract!
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-packages: 0.5.2</summary> ## [0.5.2](aztec-packages-v0.5.2...aztec-packages-v0.5.2) (2023-09-08) ### Features * Example card game ([#2135](#2135)) ([9084b89](9084b89)) ### Bug Fixes * **tests:** Increase test timeout ([#2144](#2144)) ([7da9615](7da9615)) ### Miscellaneous * **build:** Updated release please config ([#2142](#2142)) ([e119c4f](e119c4f)) * Release 0.5.2 ([f76b53c](f76b53c)) </details> <details><summary>barretenberg.js: 0.5.2</summary> ## [0.5.2](barretenberg.js-v0.5.2...barretenberg.js-v0.5.2) (2023-09-08) ### Miscellaneous * Release 0.5.2 ([f76b53c](f76b53c)) </details> <details><summary>barretenberg: 0.5.2</summary> ## [0.5.2](barretenberg-v0.5.2...barretenberg-v0.5.2) (2023-09-08) ### Miscellaneous * Release 0.5.2 ([f76b53c](f76b53c)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-packages: 0.5.2</summary> ## [0.5.2](AztecProtocol/aztec-packages@aztec-packages-v0.5.2...aztec-packages-v0.5.2) (2023-09-08) ### Features * Example card game ([#2135](AztecProtocol/aztec-packages#2135)) ([9084b89](AztecProtocol/aztec-packages@9084b89)) ### Bug Fixes * **tests:** Increase test timeout ([#2144](AztecProtocol/aztec-packages#2144)) ([7da9615](AztecProtocol/aztec-packages@7da9615)) ### Miscellaneous * **build:** Updated release please config ([#2142](AztecProtocol/aztec-packages#2142)) ([e119c4f](AztecProtocol/aztec-packages@e119c4f)) * Release 0.5.2 ([f76b53c](AztecProtocol/aztec-packages@f76b53c)) </details> <details><summary>barretenberg.js: 0.5.2</summary> ## [0.5.2](AztecProtocol/aztec-packages@barretenberg.js-v0.5.2...barretenberg.js-v0.5.2) (2023-09-08) ### Miscellaneous * Release 0.5.2 ([f76b53c](AztecProtocol/aztec-packages@f76b53c)) </details> <details><summary>barretenberg: 0.5.2</summary> ## [0.5.2](AztecProtocol/aztec-packages@barretenberg-v0.5.2...barretenberg-v0.5.2) (2023-09-08) ### Miscellaneous * Release 0.5.2 ([f76b53c](AztecProtocol/aztec-packages@f76b53c)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-packages: 0.6.1</summary> ## [0.6.1](aztec-packages-v0.5.2...aztec-packages-v0.6.1) (2023-09-08) ### Features * Example card game ([#2135](#2135)) ([9084b89](9084b89)) ### Bug Fixes * **tests:** Increase test timeout ([#2144](#2144)) ([7da9615](7da9615)) * Work around intermittent wasm webkit issue ([#2140](#2140)) ([a9b0934](a9b0934)) ### Miscellaneous * **build:** Updated release please config ([#2142](#2142)) ([e119c4f](e119c4f)) * **build:** Updated version check ([#2145](#2145)) ([4ed5f05](4ed5f05)) * **master:** Release 0.5.2 ([#2141](#2141)) ([451aad6](451aad6)) * Release 0.5.2 ([f76b53c](f76b53c)) * Release 0.6.1 ([1bd1a79](1bd1a79)) </details> <details><summary>barretenberg.js: 0.6.1</summary> ## [0.6.1](barretenberg.js-v0.5.2...barretenberg.js-v0.6.1) (2023-09-08) ### Miscellaneous * **master:** Release 0.5.2 ([#2141](#2141)) ([451aad6](451aad6)) * Release 0.5.2 ([f76b53c](f76b53c)) * Release 0.6.1 ([1bd1a79](1bd1a79)) </details> <details><summary>barretenberg: 0.6.1</summary> ## [0.6.1](barretenberg-v0.5.2...barretenberg-v0.6.1) (2023-09-08) ### Bug Fixes * Work around intermittent wasm webkit issue ([#2140](#2140)) ([a9b0934](a9b0934)) ### Miscellaneous * **master:** Release 0.5.2 ([#2141](#2141)) ([451aad6](451aad6)) * Release 0.5.2 ([f76b53c](f76b53c)) * Release 0.6.1 ([1bd1a79](1bd1a79)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-packages: 0.6.1</summary> ## [0.6.1](AztecProtocol/aztec-packages@aztec-packages-v0.5.2...aztec-packages-v0.6.1) (2023-09-08) ### Features * Example card game ([#2135](AztecProtocol/aztec-packages#2135)) ([9084b89](AztecProtocol/aztec-packages@9084b89)) ### Bug Fixes * **tests:** Increase test timeout ([#2144](AztecProtocol/aztec-packages#2144)) ([7da9615](AztecProtocol/aztec-packages@7da9615)) * Work around intermittent wasm webkit issue ([#2140](AztecProtocol/aztec-packages#2140)) ([a9b0934](AztecProtocol/aztec-packages@a9b0934)) ### Miscellaneous * **build:** Updated release please config ([#2142](AztecProtocol/aztec-packages#2142)) ([e119c4f](AztecProtocol/aztec-packages@e119c4f)) * **build:** Updated version check ([#2145](AztecProtocol/aztec-packages#2145)) ([4ed5f05](AztecProtocol/aztec-packages@4ed5f05)) * **master:** Release 0.5.2 ([#2141](AztecProtocol/aztec-packages#2141)) ([451aad6](AztecProtocol/aztec-packages@451aad6)) * Release 0.5.2 ([f76b53c](AztecProtocol/aztec-packages@f76b53c)) * Release 0.6.1 ([1bd1a79](AztecProtocol/aztec-packages@1bd1a79)) </details> <details><summary>barretenberg.js: 0.6.1</summary> ## [0.6.1](AztecProtocol/aztec-packages@barretenberg.js-v0.5.2...barretenberg.js-v0.6.1) (2023-09-08) ### Miscellaneous * **master:** Release 0.5.2 ([#2141](AztecProtocol/aztec-packages#2141)) ([451aad6](AztecProtocol/aztec-packages@451aad6)) * Release 0.5.2 ([f76b53c](AztecProtocol/aztec-packages@f76b53c)) * Release 0.6.1 ([1bd1a79](AztecProtocol/aztec-packages@1bd1a79)) </details> <details><summary>barretenberg: 0.6.1</summary> ## [0.6.1](AztecProtocol/aztec-packages@barretenberg-v0.5.2...barretenberg-v0.6.1) (2023-09-08) ### Bug Fixes * Work around intermittent wasm webkit issue ([#2140](AztecProtocol/aztec-packages#2140)) ([a9b0934](AztecProtocol/aztec-packages@a9b0934)) ### Miscellaneous * **master:** Release 0.5.2 ([#2141](AztecProtocol/aztec-packages#2141)) ([451aad6](AztecProtocol/aztec-packages@451aad6)) * Release 0.5.2 ([f76b53c](AztecProtocol/aztec-packages@f76b53c)) * Release 0.6.1 ([1bd1a79](AztecProtocol/aztec-packages@1bd1a79)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Resolves #1463
Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge.