## Intro:
This report marks the seccond milestone of our research proposal on [NRG 2](https://github.com/orgs/noir-lang/discussions/6359), where we explore a cryptographic approach using multiparty computation (MPC) and zero-knowledge proofs (ZKPs) to enable verifiable interactions without revealing sensitive information.
Through this report we will expand over the advances developing the Web UI, communication relay server, client modules and adaptation of the circuits to be compatible in a Web context.
Also we will go over some issues we have found in Aztec libs beeing used for this project.
## Advances:
+ Readapted project structure to avoid using recursion, since UltraHonk proof agreggation is not implemented on Barretengberg backend, and it appears not to be a priority "since Aztec will be using mostly folding" (from a comment on Discord). (This drops the possibility to precompute some proofs offline, to speed-up online game interactions.)
+ Adapted circuits inputs to better match web context, and locally implemented proof flow, using multithreaded UltraHonk WASM. Runs on both node and browser context (using vite). (This is the core of the web proofs frontend module.) (Lastest benchmarks: ~2 minutes per turn, 8 GB mem, 8 threads, all proofs included, linux system).
+ Started developing graphical frontend module, with clickable board pieces and game event logs.
https://casiojapi.github.io/terry-escape-ui/
+ Started implementing core structure of communications relay server and client modules, to handle game web lobby and brodcasting of player messages. (Non-relay-dependant asynchronus peer-to-peer game communications could be possible, but would be overengineering out of the project scope).
## Current tracks:
+ Continue graphical frontend module development.
+ Continue communications modules development.
+ Adapt circuits to latest version of BigNum. (Breaking change on v6.0 modifying limbs type.)
+ Adapt utilities to latest version of BigNum paramgen crate. (Modified to match latest BigNum refactors.)
+ Game logic module for frontend client, that manages submodules coordination (proof, messaging, graphical UI).
+ User-facing game mechanichs explainer.
Recent updates:
---------------------------------------
+ BigNum bug:
There was a failure in division proving caused by the parity of most significant limbs, got fixed accidentally [here](https://github.com/noir-lang/noir-bignum/pull/120/commits/bb93fcafbeeda2db5d313e0928b4e9f6101e0d74#diff-039050b8c816a399c4a28cbff4e3ab89256de80e9ff0410739213123baa91c46R461)
+ UltraHonk failure:
Under specific circumstances, UltraHonk fails when proving (UltraPlonk does prove successfully on the same circuit).
(An issue was opened: https://github.com/AztecProtocol/aztec-packages/issues/13062)
- Private output in noir_js:
To avoid logic duplication on the codebase, part of the game flow was dependent on nargo cli outputing private computed values.
When porting to noir_js, execution prints are not available, so this got workarround using empty-type returning oracles.
Since the oracles responses are not required for circuit logic, this preserves compatibility with nargo cli, for testing purposes.
(There is already a feature request on the same topic here: https://github.com/noir-lang/noir/issues/4532. And when an use case appeared back in 2023, the same solution we hacked out (using oracles) was given
https://github.com/noir-lang/noir/issues/688#issuecomment-1637124680)
(Example relevant code snippets at:
https://github.com/fatlabsxyz/terry-escape/blob/main/packages/noir/web/full-flow.js#L43
https://github.com/fatlabsxyz/terry-escape/blob/main/packages/noir/circuits/answers_updates/src/main.nr#L17)
+ Time per turn:
Trimmed down from ~5 to ~2 minutes (or less, by using webworkers to precompute some proofs offline)
Updated benchmakrs:
(8 cores, 8 GiB, UltraHonk, seconds, noir_js, firefox, linux)
| Circuit | prove(s) | verify(s) | | bb (gates) |
| - | - | - | - | - |
| π_deploys | 2.5 | 1.9 | | 8,339 |
| - | -| - | | - |
| π_queries | 77.2 | 30.7 | | 17,007 * 16 + 13,218 |
| π_answers | 11.1 | 3.1 | | 83,857 |
| π_updates | 9.2 | 2.6 | | 28,223 |
| π_reports | 5.0 | 1.5 | | 24,748 |
Total per turn: 2 minutes and 23 seconds
Resources:
---------------------------------------
+ [Initial Proposal](https://github.com/orgs/noir-lang/discussions/6359)
+ [Previous Report - Milestone 1](https://hackmd.io/@FATSOLUTIONS/rJvWjq0uJx)
+ [Github Repo](https://github.com/fatlabsxyz/terry-escape)