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

Unable to join game #135

Open
eviterin opened this issue Mar 15, 2024 · 6 comments
Open

Unable to join game #135

eviterin opened this issue Mar 15, 2024 · 6 comments

Comments

@eviterin
Copy link
Collaborator

eviterin commented Mar 15, 2024

Issue:
Player is unable to join a new game.

Build:
5080439

Steps to reproduce:

  1. clone fresh
  2. run make setup, make anvil, make webdev, make deploy, make circuits
  3. navigate to http://localhost:3000/?index=1 and mint deck
  4. navigate to http://localhost:3000/?index=2 and mint deck
  5. from index=1: create game (game index = 1)
  6. from index=2: join game (game index = 1)

Expected:
Player 2 can join game of player 1.

Reality:
Modal displays the following error message:
"SyntaxError: Cannot convert #bigint.20826557750498812955920791981733214788339539821236692591183101691377953231916 to a BigInt"

@eviterin
Copy link
Collaborator Author

Just found this and have not had the time yet to investigate.

@eviterin
Copy link
Collaborator Author

Console points to contract:
setting error modal: {"title":"Contract execution error","message":"SyntaxError: Cannot convert #bigint.20826557750498812955920791981733214788339539821236692591183101691377953231916 to a BigInt","buttons":[{"text":"Dismiss"}]}

@norswap
Copy link
Member

norswap commented Mar 20, 2024

Hhm, so the error message points at the serialization we use to persist bigints in the browser storage. It seems like the string representing the bigint is not parsed correctly and is being fed directly to the contract instead of a bigint.

We override the JSON.stringify and JSON.parse logic in the setup.ts file.

I think we should try to pinpoint in which scenarios this happens. Clearly it doesn't happen if we don't mint and use users 0 and 1, right?

The standard deployment script should mint decks to index 0 and index 1, so I'm already surprised you manage to mint a deck to index 1? Okay lmao, we never set the claimed flag here: https://github.com/0xFableOrg/0xFable/blob/master/packages/contracts/src/DeckAirdrop.sol — that shouldn't be causing this issue though, but worth trying anyway.

Can you pinpoint the transaction in which this happens? joinGame, or drawInitialHand (you should be able to tell by the changing modal text, if not by the console). Mostly likely it's joinGame and the culprit is the gameID ... not sure what could have changed to make that into a parsed string though... so maybe not.

Good debugging exercise in perspective :D

@ultraviolet10
Copy link
Collaborator

ultraviolet10 commented Mar 21, 2024

The culprit here is the saltHash param in the doJoinGameTransaction. The function expects a bigint but is being fed a string, from PrivateInfo.saltHash.

Screenshot 2024-03-21 at 8 52 54 PM

@eviterin eviterin mentioned this issue Mar 26, 2024
4 tasks
Copy link

onlydustapp bot commented Aug 23, 2024

Hey @ShantelPeters!
Thanks for showing interest.
We've created an application for you to contribute to 0xFable.
Go check it out on OnlyDust!

@norswap
Copy link
Member

norswap commented Aug 23, 2024

Hey Shantel, we have a pretty good idea of how to fix this, but 0xFable's development is currently paused!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants