Use staticcall for external function calls in MixinSignatureValidator #1012
Conversation
f4c5a77
to
6c72d4f
Compare
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 prefer this approach over pragma experimental "v0.5.0"
!
32 // output size is 32 bytes | ||
) | ||
// Signature is valid if call did not revert and returned true | ||
isValid := and(success, mload(cdStart)) |
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.
This only works if the called contract returns a non-zero odd number for true
, like 1
. I'm not sure if the ABI guarantees that boolean true is always encoded as 1
(instead of anything non-zero like in C).
To fix we could do and(success, iszero(iszero(mload(cdStart))))
.
32 // output size is 32 bytes | ||
) | ||
// Signature is valid if call did not revert and returned true | ||
isValid := and(success, mload(cdStart)) |
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.
view | ||
returns (bool isValid) | ||
{ | ||
bytes memory calldata = abi.encodeWithSelector( |
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 this will bumb the memory pointer unnecessarily, leading to extra gas cost. (not an issue)
view | ||
returns (bool isValid) | ||
{ | ||
bytes memory calldata = abi.encodeWithSelector( |
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.
6c72d4f
to
f1283eb
Compare
f1283eb
to
070eff6
Compare
walletAddress, // address of Wallet contract | ||
cdStart, // pointer to start of input | ||
mload(calldata), // length of input | ||
cdStart, // write input over output |
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.
Should be
// write output over input
validatorAddress, // address of Validator contract | ||
cdStart, // pointer to start of input | ||
mload(calldata), // length of input | ||
cdStart, // write input over output |
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.
Should be
// write output over input
Description
Testing instructions
Types of changes
Checklist:
[WIP]
if necessary.[sol-cov] Fixed bug
.