trifle-labs / anybody-problem

Anybody Problem simulates the 3-body problem in two dimensions using zk proofs written in circom.
https://anybody.gg
17 stars 4 forks source link

Tournament refactor #372

Closed okwme closed 2 weeks ago

okwme commented 2 weeks ago

In an attempt to address the current invalid position x bug I did a sweep and refactor of ab.js.

Full level data is stored in ab.js now and then sent to the front end after successfully completing a level. This allows the front end to create the proof and hand back the results to ab.js to validate them as matching what we have in the js.

The thinking here is that the invalid position x bug seems to have different outputs from the js and the proof. My guess is that the js is improperly modified when a missile is cancelled at the edge of two chunks resulting in a game that ends a certain way but recorded inputs / missile clicks that result in a game ending a different way. This difference is only seen once the inputs are run in the proof. I think the improper js modification could have come from a mistake in use of referenced objects / arrays, so care has been taken to properly make copies whenever possible.

What's still missing is a plan for how to proceed if/when the bug still exists but it is detected by the new validation system. At worst we can ensure the user replays the level and use the opportunity to collect more info about how they played that caused it to happen, but it's only marginally better than the error experience we currently have.

netlify[bot] commented 2 weeks ago

Deploy Preview for anybody-nft ready!

Name Link
Latest commit ec4864a45e1e496c22b217a2b9f3a7313dec44f6
Latest deploy log https://app.netlify.com/sites/anybody-nft/deploys/672ec616547ad20008c22d89
Deploy Preview https://deploy-preview-372--anybody-nft.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

okwme commented 2 weeks ago

other changes: