Skip to content

Replace deprecated throw with assert in Solidity tests#506

Merged
facuspagnuolo merged 2 commits into
OpenZeppelin:masterfrom
TalAter:fix/deprecated-throw-in-tests
Nov 21, 2017
Merged

Replace deprecated throw with assert in Solidity tests#506
facuspagnuolo merged 2 commits into
OpenZeppelin:masterfrom
TalAter:fix/deprecated-throw-in-tests

Conversation

@TalAter

@TalAter TalAter commented Oct 17, 2017

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

TalAter commented Nov 19, 2017

Copy link
Copy Markdown
Contributor Author

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.

2 participants