-
Notifications
You must be signed in to change notification settings - Fork 212
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
Add isInitialized to all state-changing public functions #307
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debating whether or not it's worth it to have tests for this, but I think a single test in each app that makes sure all of the publicly accessible non-view functions revert when the app is uninitialized would be nice.
@@ -351,7 +351,7 @@ contract TokenManager is ITokenController, AragonApp { // ,IForwarder makes cove | |||
* @param _owner The address that sent the ether to create tokens | |||
* @return True if the ether is accepted, false for it to throw | |||
*/ | |||
function proxyPayment(address _owner) payable public returns (bool) { | |||
function proxyPayment(address _owner) payable isInitialized public returns (bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need to have isInitialized
on this, since it's not a view
simply out of conformance to the minime interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, I was in doubt about these ones, but I thought it was more aligned with the purpose of the issue: some day we could change the functions to modify state. Actually, most of the changes in this PR are not needed. But I agree with your comment, so removing it.
@@ -365,7 +365,7 @@ contract TokenManager is ITokenController, AragonApp { // ,IForwarder makes cove | |||
* @param _amount The amount in the `approve()` call | |||
* @return False if the controller does not authorize the approval | |||
*/ | |||
function onApprove(address _owner, address _spender, uint _amount) public returns (bool) { | |||
function onApprove(address _owner, address _spender, uint _amount) isInitialized public returns (bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
apps/vault/contracts/Vault.sol
Outdated
@@ -54,7 +54,7 @@ contract Vault is VaultBase { | |||
connectors[ETH] = ethConnector; | |||
} | |||
|
|||
function () payable public { | |||
function () payable isInitialized public { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's ignore the Vault for now, since we'll be changing it pretty soon.
Addressing PR #307 comments.
Addressing PR aragon#307 comments.
Addressing PR aragon#307 comments.
Add isInitialized to all state-changing public functions
With changes in PR aragon#307 (commit 770eaea) sending would revert instead of failing with invalid opcode, so last test needed to change from `assertInvalidOpcode` to `assertRevert`. We didn't realize because CI was broken prior to PR aragon#309.
Closes #303.