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

XState-Wallet not calling ValidTransition #1

Open
andrewgordstewart opened this issue Jan 23, 2021 · 0 comments
Open

XState-Wallet not calling ValidTransition #1

andrewgordstewart opened this issue Jan 23, 2021 · 0 comments

Comments

@andrewgordstewart
Copy link
Contributor

@SirNeural commented on Sat Aug 29 2020

Describe the bug 🐛
It seems that the validTransition function I wrote for my program isn't being used when updating the state channel. I've experimentally verified this by purposefully sending incorrect states but they aren't being picked up by the wallet and flagged as incorrect. Using versions 0.3.0 for all packages.

To Reproduce
Steps to reproduce the behavior:

  1. Go to monopoly.now.sh in two tabs, preferably in different browsers
  2. Click on Create Room in one, and Join Room in the other
  3. Click Start Game on host side
  4. Click Next state and wait until a property purchase window shows up
  5. Purchase property, note that balance deducted is 2x what it shows on the property card
  6. Continue clicking nextState until it shows nextPlayer in the bottom left
  7. Open console to see that the channel update succeeded even when incorrect states are sent

Expected behavior
Channel should not be updated to reflect incorrect states, instead there should be a revert or error or some kind to alert the user that an invalid transition was sent.

Screenshots (if applicable)
Popup for purchasing, note amount is $100 and balance of player test1 is $1500
Purchased, note balance is now $1300, meaning $200 was deducted
Channel update with this double purchase was allowed, which should fail

Additional context
src/store/index.ts in my code contains the double charging modification I made to test if the contract was being verified
contracts/Monopoly.sol in my code shows the verification method and where I use applyChange to tell the contract to expect how much to be deducted (not doubled)


@geoknee commented on Tue Sep 08 2020

Thanks for raising this @SirNeural. Validating transitions is definitely something we need to support in our wallets -- in fact we have had this working in previous browser wallets and currently have it working in our server wallet. We'll look to get this integrated into our next release of the browser wallet.


@geoknee commented on Tue Sep 22 2020

Code that does what we want in the server-wallet package https://github.com/statechannels/statechannels/blob/master/packages/server-wallet/src/evm-validator.ts

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

No branches or pull requests

1 participant