-
Notifications
You must be signed in to change notification settings - Fork 245
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
Proxies: add checks for base being a contract #394
Conversation
@@ -21,7 +22,7 @@ contract AppProxyPinned is AppProxyBase { | |||
public // solium-disable-line visibility-first | |||
{ | |||
setPinnedCode(getAppBase(_appId)); | |||
require(pinnedCode() != address(0)); | |||
require(isContract(pinnedCode())); |
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.
Note that strictly, this isn't necessary as our Kernel
doesn't let an app be set unless it's a contract (https://github.com/aragon/aragonOS/blob/dev/contracts/kernel/Kernel.sol#L177), so this is really more of an assertion (should we make it one?).
This also complicates the tests quite a bit, as you'll see in 961a7d7
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 don't think an assertion makes sense here, as a contract that follows the IKernel
interface may not check whether a base is a contract. A require is fine IMO.
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.
Not a huge fan of the increased test complexity but I cannot think of another way to do it. The complexity is well documented though!
@@ -21,7 +22,7 @@ contract AppProxyPinned is AppProxyBase { | |||
public // solium-disable-line visibility-first | |||
{ | |||
setPinnedCode(getAppBase(_appId)); | |||
require(pinnedCode() != address(0)); | |||
require(isContract(pinnedCode())); |
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 don't think an assertion makes sense here, as a contract that follows the IKernel
interface may not check whether a base is a contract. A require is fine IMO.
test/mocks/KernelSetAppMock.sol
Outdated
function KernelSetAppMock() Kernel(false) public { | ||
} | ||
|
||
function setApp(bytes32 _namespace, bytes32 _name, address _app) public returns (bytes32 id) { |
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.
We should add a comment explaining that we are bypassing the isContract
check
f4048ef
to
5326557
Compare
Yeah... there is a way right now, by overloading the |
Adds more contract checks to the proxies.
Bytecode change: