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

SWC-136: odd_even_fixed.sol can be locked #258

Open
ACaiSec opened this issue Jun 18, 2021 · 1 comment
Open

SWC-136: odd_even_fixed.sol can be locked #258

ACaiSec opened this issue Jun 18, 2021 · 1 comment

Comments

@ACaiSec
Copy link

ACaiSec commented Jun 18, 2021

If a player not call the reveal( ) function or he forgets the number or blindingFactor after calling the play( ) function to set the commitment. The OddEven contract of odd_even_fixed.sol would be locked.
I don't know if this situation is within your consideration. The above questions are only raised by me as a beginner.
Thx

@ofirgeller
Copy link

@little-petrol I think you are right, meaning

  1. loser can always tell they are the loser if they wait to reveal second (the number is a transaction parameter)
  2. loser can avoid change to the state after learning that they lost (they already know their number, and now the other party number)

The solution is not in the code but in "game theory", because the loser, being rational, will prefer to lose 1 eth and not 2. so it is better to get back the bond than to leave both the bond and the bet locked in the contract.

If you wanted to reduce the risk of a non rational actor you can add a public function that can only execute after some time has passed and which rewards all the balance to the non offending actor, however I think it is very elegant how you can get the losing party to cooperate post losing and not have to increase both contract and interaction complexity.

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

2 participants