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

genesisProtocolWrapper.stake(..) should check result and throw an exception if not succesful #215

Open
tsuberim opened this issue May 14, 2018 · 5 comments
Labels

Comments

@tsuberim
Copy link

tsuberim commented May 14, 2018

GenesisProtocol.stake(..) returns false if unsuccessful. This should be checked in Arc.js and thrown as an exception.
Eg. this happens if staking once for YES and again with NO (according to this line).

Also, make sure cases like this are checked throughout the library.

Edit: in this case, the best way to check for this is to check if the Stake event was emitted since false may be returned in cases other than a failed stake

@tsuberim tsuberim added the bug label May 14, 2018
@dkent600
Copy link
Contributor

I am not aware of a means of checking return values when transactions are generated. The right way to do this, I believe, would be to check whether the expected events were emitted.

@tsuberim
Copy link
Author

@dkent600 Correct. Edited.

@dkent600
Copy link
Contributor

Arc.js could perhaps incorporate such a check on functions where it would make sense and be commonly needed.

@tsuberim
Copy link
Author

tsuberim commented May 14, 2018

I think it should be on a case by case basis, according to the logic defined in Arc for each method.

@dkent600
Copy link
Contributor

Definitely potentially a useful feature.

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

No branches or pull requests

2 participants