Skip to content

Commit

Permalink
4.3.0 (#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
sohkai authored Feb 6, 2020
2 parents 0fd1ff6 + 1164625 commit 8c6db4b
Show file tree
Hide file tree
Showing 38 changed files with 318 additions and 183 deletions.
8 changes: 4 additions & 4 deletions contracts/acl/ACL.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ contract ACL is IACL, TimeHelpers, AragonApp, ACLHelpers {
address public constant ANY_ENTITY = address(-1);
address public constant BURN_ENTITY = address(1); // address(0) is already used as "no permission manager"

uint256 internal constant ORACLE_CHECK_GAS = 30000;

string private constant ERROR_AUTH_INIT_KERNEL = "ACL_AUTH_INIT_KERNEL";
string private constant ERROR_AUTH_NO_MANAGER = "ACL_AUTH_NO_MANAGER";
string private constant ERROR_EXISTENT_MANAGER = "ACL_EXISTENT_MANAGER";
Expand Down Expand Up @@ -421,11 +419,13 @@ contract ACL is IACL, TimeHelpers, AragonApp, ACLHelpers {

// a raw call is required so we can return false if the call reverts, rather than reverting
bytes memory checkCalldata = abi.encodeWithSelector(sig, _who, _where, _what, _how);
uint256 oracleCheckGas = ORACLE_CHECK_GAS;

bool ok;
assembly {
ok := staticcall(oracleCheckGas, _oracleAddr, add(checkCalldata, 0x20), mload(checkCalldata), 0, 0)
// send all available gas; if the oracle eats up all the gas, we will eventually revert
// note that we are currently guaranteed to still have some gas after the call from
// EIP-150's 63/64 gas forward rule
ok := staticcall(gas, _oracleAddr, add(checkCalldata, 0x20), mload(checkCalldata), 0, 0)
}

if (!ok) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/acl/ACLSyntaxSugar.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/acl/IACL.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/acl/IACLOracle.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/apm/APMNamehash.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/apps/AppStorage.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/apps/AragonApp.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/apps/UnsafeAragonApp.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/Autopetrified.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/EtherTokenConstant.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/IForwarder.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/IForwarderFee.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/IVaultRecoverable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/Initializable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/IsContract.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/Petrifiable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/ReentrancyGuard.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/TimeHelpers.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/UnstructuredStorage.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/common/VaultRecoverable.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/ens/ENSConstants.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/evmscript/EVMScriptRunner.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/evmscript/IEVMScriptExecutor.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/evmscript/IEVMScriptRegistry.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/evmscript/ScriptHelpers.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/evmscript/executors/BaseEVMScriptExecutor.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/kernel/IKernel.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/kernel/KernelConstants.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/misc/ERCProxy.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identitifer: MIT
* SPDX-License-Identifier: MIT
*/

pragma solidity ^0.4.24;
Expand Down
17 changes: 17 additions & 0 deletions contracts/test/helpers/ACLHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ contract RevertOracle is IACLOracle {
}
}

contract AssertOracle is IACLOracle {
function canPerform(address, address, bytes32, uint256[]) external view returns (bool) {
assert(false);
}
}

// Can't implement from IACLOracle as its canPerform() is marked as view-only
contract StateModifyingOracle /* is IACLOracle */ {
bool modifyState;
Expand All @@ -57,3 +63,14 @@ contract ConditionalOracle is IACLOracle {
return how[0] > 0;
}
}

contract OverGasLimitOracle is IACLOracle {
function canPerform(address, address, bytes32, uint256[]) external view returns (bool) {
while (true) {
// Do an SLOAD to increase the per-loop gas costs
uint256 loadFromStorage;
assembly { loadFromStorage := sload(0) }
}
return true;
}
}
2 changes: 0 additions & 2 deletions contracts/test/tests/TestACLInterpreter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ contract TestACLInterpreter is ACL, ACLHelper {

// doesn't revert even if oracle reverts
assertEval(arr(), ORACLE_PARAM_ID, Op.EQ, uint256(new RevertOracle()), false);
// the staticcall will error as the oracle tries to modify state, so a no is returned
assertEval(arr(), ORACLE_PARAM_ID, Op.EQ, uint256(new StateModifyingOracle()), false);
// if returned data size is not correct, returns false
assertEval(arr(), ORACLE_PARAM_ID, Op.EQ, uint256(new EmptyDataReturnOracle()), false);

Expand Down
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,24 @@
"license": "(GPL-3.0-or-later OR MIT)",
"devDependencies": {
"@codechecks/client": "^0.1.5",
"coveralls": "^2.13.3",
"coveralls": "^3.0.9",
"eth-ens-namehash": "^2.0.8",
"eth-gas-reporter": "^0.2.9",
"eth-gas-reporter": "^0.2.14",
"ethereumjs-abi": "^0.6.5",
"ganache-cli": "^6.4.2",
"ganache-cli": "^6.9.0",
"mocha-lcov-reporter": "^1.3.0",
"solidity-coverage": "0.6.2",
"solium": "^1.2.3",
"truffle": "4.1.14",
"truffle-bytecode-manager": "^1.1.1",
"truffle-extract": "^1.2.1",
"web3-eth-abi": "1.0.0-beta.33",
"web3-utils": "1.0.0-beta.33"
"web3-eth-abi": "1.2.5",
"web3-utils": "1.2.5"
},
"dependencies": {
"@aragon/truffle-config-v4": "^1.0.1",
"mkdirp": "^0.5.1",
"truffle-flattener": "^1.2.9",
"homedir": "^0.6.0",
"truffle-hdwallet-provider": "0.0.3",
"truffle-hdwallet-provider-privkey": "0.3.0"
"homedir": "^0.6.0"
}
}
12 changes: 10 additions & 2 deletions scripts/deploy-daofactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ const ZERO_ADDR = '0x0000000000000000000000000000000000000000'

const defaultKernelBase = process.env.KERNEL_BASE
const defaultAclBaseAddress = process.env.ACL_BASE
const defaultEvmScriptRegistryFactoryAddress = process.env.EVM_REG_FACTORY

module.exports = async (
truffleExecCallback,
{
artifacts = globalArtifacts,
kernelBaseAddress = defaultKernelBase,
aclBaseAddress = defaultAclBaseAddress,
evmScriptRegistryFactoryAddress = defaultEvmScriptRegistryFactoryAddress,
withEvmScriptRegistryFactory = true,
verbose = true
} = {}
Expand Down Expand Up @@ -47,8 +49,14 @@ module.exports = async (
let evmScriptRegistryFactory
if (withEvmScriptRegistryFactory) {
const EVMScriptRegistryFactory = artifacts.require('EVMScriptRegistryFactory')
evmScriptRegistryFactory = await EVMScriptRegistryFactory.new()
await logDeploy(evmScriptRegistryFactory, { verbose })

if (evmScriptRegistryFactoryAddress) {
evmScriptRegistryFactory = EVMScriptRegistryFactory.at(evmScriptRegistryFactoryAddress)
log(`Skipping deploying new EVMScriptRegistryFactory, using provided address: ${evmScriptRegistryFactoryAddress}`)
} else {
evmScriptRegistryFactory = await EVMScriptRegistryFactory.new()
await logDeploy(evmScriptRegistryFactory, { verbose })
}
}
const daoFactory = await DAOFactory.new(
kernelBase.address,
Expand Down
Loading

0 comments on commit 8c6db4b

Please sign in to comment.