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

Replace deprecated throw with assert in Solidity tests #506

Merged
merged 2 commits into from Nov 21, 2017
Merged

Replace deprecated throw with assert in Solidity tests #506

merged 2 commits into from Nov 21, 2017

Conversation

TalAter
Copy link
Contributor

@TalAter TalAter commented Oct 17, 2017

Both test/helpers/ReentrancyAttack.sol and test/helpers/ReentrancyMock.sol used throw which has been deprecated since 0.4.13

Replacing them with asserts removes the two ugly error messages that have plagued the tests https://travis-ci.org/OpenZeppelin/zeppelin-solidity/jobs/289039499#L535

@facuspagnuolo
Copy link
Contributor

@TalAter nice catch! would you mind using require instead of assert? Basically require is meant to be used for validations, while assert should be used in order to prevent conditions which should never be possible. I highly recommend this article https://media.consensys.net/when-to-use-revert-assert-and-require-in-solidity-61fb2c0e5a57

@TalAter TalAter closed this Nov 19, 2017
@TalAter TalAter reopened this Nov 19, 2017
@TalAter
Copy link
Contributor Author

TalAter commented Nov 19, 2017

Updated.

Thanks @facuspagnuolo 👍

@facuspagnuolo facuspagnuolo merged commit db5a12c into OpenZeppelin:master Nov 21, 2017
ProphetDaniel pushed a commit to classicdelta/Smart-Contracts that referenced this pull request Mar 9, 2018
…-in-tests

Replace deprecated throw with assert in Solidity tests
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

Successfully merging this pull request may close these issues.

None yet

2 participants