Skip to content

Commit

Permalink
ACL: use assembly switch instead of if
Browse files Browse the repository at this point in the history
  • Loading branch information
sohkai committed Apr 9, 2019
1 parent 25d08da commit ea30416
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions contracts/acl/ACL.sol
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ contract ACL is IACL, TimeHelpers, AragonApp, ACLHelpers {
let ptr := mload(0x40) // free memory pointer

// A raw staticcall is required so we can return false if the call reverts, rather than reverting
let success := staticcall(
result := staticcall(
oracleCheckGas, // gas forwarded
_oracleAddr, // address
add(checkCalldata, 0x20), // calldata start
Expand All @@ -436,7 +436,9 @@ contract ACL is IACL, TimeHelpers, AragonApp, ACLHelpers {
0x20 // uint256 return
)

if gt(success, 0) {
// solidity-coverage fails on assembly `if`
switch result case 0 { }
default {
// Check number of bytes returned from last external call
switch returndatasize

Expand Down

0 comments on commit ea30416

Please sign in to comment.