Merge pull request #242 from DavidKnott/upgrade-truffle-and-solidity

Upgrade to Truffle version 3.2.2 and Solidity version 0.4.11
pull/228/merge
Manuel Aráoz 8 years ago committed by GitHub
commit d53ddd4a95
  1. 2
      .travis.yml
  2. 2
      audit/ZeppelinAudit.md
  3. 2
      contracts/Bounty.sol
  4. 2
      contracts/DayLimit.sol
  5. 2
      contracts/LimitBalance.sol
  6. 4
      contracts/MultisigWallet.sol
  7. 2
      contracts/ReentrancyGuard.sol
  8. 2
      contracts/SafeMath.sol
  9. 4
      contracts/lifecycle/Destructible.sol
  10. 2
      contracts/lifecycle/Migrations.sol
  11. 2
      contracts/lifecycle/Pausable.sol
  12. 4
      contracts/lifecycle/TokenDestructible.sol
  13. 2
      contracts/ownership/Claimable.sol
  14. 2
      contracts/ownership/Contactable.sol
  15. 2
      contracts/ownership/DelayedClaimable.sol
  16. 2
      contracts/ownership/HasNoContracts.sol
  17. 2
      contracts/ownership/HasNoEther.sol
  18. 2
      contracts/ownership/HasNoTokens.sol
  19. 2
      contracts/ownership/Multisig.sol
  20. 2
      contracts/ownership/NoOwner.sol
  21. 2
      contracts/ownership/Ownable.sol
  22. 2
      contracts/ownership/Shareable.sol
  23. 2
      contracts/payment/PullPayment.sol
  24. 2
      contracts/token/BasicToken.sol
  25. 2
      contracts/token/CrowdsaleToken.sol
  26. 2
      contracts/token/ERC20.sol
  27. 2
      contracts/token/ERC20Basic.sol
  28. 2
      contracts/token/LimitedTransferToken.sol
  29. 2
      contracts/token/MintableToken.sol
  30. 2
      contracts/token/PausableToken.sol
  31. 2
      contracts/token/SimpleToken.sol
  32. 2
      contracts/token/StandardToken.sol
  33. 2
      contracts/token/VestedToken.sol
  34. 2
      package.json
  35. 4
      test/DelayedClaimble.js
  36. 6
      test/HasNoEther.js
  37. 2
      test/helpers/BasicTokenMock.sol
  38. 2
      test/helpers/DayLimitMock.sol
  39. 2
      test/helpers/ERC23TokenMock.sol
  40. 10
      test/helpers/ForceEther.sol
  41. 2
      test/helpers/HasNoEtherTest.sol
  42. 2
      test/helpers/InsecureTargetBounty.sol
  43. 2
      test/helpers/LimitBalanceMock.sol
  44. 2
      test/helpers/MultisigWalletMock.sol
  45. 2
      test/helpers/PausableMock.sol
  46. 2
      test/helpers/PausableTokenMock.sol
  47. 2
      test/helpers/PullPaymentMock.sol
  48. 2
      test/helpers/ReentrancyAttack.sol
  49. 2
      test/helpers/ReentrancyMock.sol
  50. 2
      test/helpers/SafeMathMock.sol
  51. 2
      test/helpers/SecureTargetBounty.sol
  52. 2
      test/helpers/ShareableMock.sol
  53. 2
      test/helpers/StandardTokenMock.sol
  54. 2
      test/helpers/VestedTokenMock.sol
  55. 2
      test/helpers/assertJump.js
  56. 4
      test/helpers/expectThrow.js

@ -5,7 +5,7 @@ language: node_js
node_js: node_js:
- "6" - "6"
before_install: before_install:
- npm install truffle@3.1.9 -g - npm install truffle@3.2.2 -g
- npm i -g ethereumjs-testrpc - npm i -g ethereumjs-testrpc
script: script:
- testrpc > /dev/null & - testrpc > /dev/null &

@ -48,7 +48,7 @@ We think much more could be done here, and recommend the OpenZeppelin team keep
## Solidity Version Updates Recommended ## Solidity Version Updates Recommended
Most of the code uses Solidity 0.4.8, but some files under `Ownership` are marked 0.4.0. These should be updated. Most of the code uses Solidity 0.4.11, but some files under `Ownership` are marked 0.4.0. These should be updated.
Solidity 0.4.10 will add several features which could be useful in these contracts: Solidity 0.4.10 will add several features which could be useful in these contracts:

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import './payment/PullPayment.sol'; import './payment/PullPayment.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
/** /**
* @title DayLimit * @title DayLimit

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
/** /**

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "./ownership/Multisig.sol"; import "./ownership/Multisig.sol";
@ -93,7 +93,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
/** /**
* @dev Updates the daily limit value. * @dev Updates the daily limit value.
* @param _newLimit * @param _newLimit Uint to represent the new limit.
*/ */
function setDailyLimit(uint _newLimit) onlymanyowners(keccak256(msg.data)) external { function setDailyLimit(uint _newLimit) onlymanyowners(keccak256(msg.data)) external {
_setDailyLimit(_newLimit); _setDailyLimit(_newLimit);

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
/** /**
* @title Helps contracts guard agains rentrancy attacks. * @title Helps contracts guard agains rentrancy attacks.

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
/** /**

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "../ownership/Ownable.sol"; import "../ownership/Ownable.sol";
@ -10,6 +10,8 @@ import "../ownership/Ownable.sol";
*/ */
contract Destructible is Ownable { contract Destructible is Ownable {
function Destructible() payable { }
/** /**
* @dev Transfers the current balance to the owner and terminates the contract. * @dev Transfers the current balance to the owner and terminates the contract.
*/ */

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import '../ownership/Ownable.sol'; import '../ownership/Ownable.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "../ownership/Ownable.sol"; import "../ownership/Ownable.sol";

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "../ownership/Ownable.sol"; import "../ownership/Ownable.sol";
@ -12,6 +12,8 @@ import "../token/ERC20Basic.sol";
*/ */
contract TokenDestructible is Ownable { contract TokenDestructible is Ownable {
function TokenDestructible() payable { }
/** /**
* @notice Terminate contract and refund to owner * @notice Terminate contract and refund to owner
* @param tokens List of addresses of ERC20 or ERC20Basic token contracts to * @param tokens List of addresses of ERC20 or ERC20Basic token contracts to

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import './Ownable.sol'; import './Ownable.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import './Ownable.sol'; import './Ownable.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import './Claimable.sol'; import './Claimable.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "./Ownable.sol"; import "./Ownable.sol";

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "./Ownable.sol"; import "./Ownable.sol";

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "./Ownable.sol"; import "./Ownable.sol";
import "../token/ERC20Basic.sol"; import "../token/ERC20Basic.sol";

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
/** /**

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "./HasNoEther.sol"; import "./HasNoEther.sol";
import "./HasNoTokens.sol"; import "./HasNoTokens.sol";

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
/** /**

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
/** /**

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import '../SafeMath.sol'; import '../SafeMath.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import './ERC20Basic.sol'; import './ERC20Basic.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "./StandardToken.sol"; import "./StandardToken.sol";

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import './ERC20Basic.sol'; import './ERC20Basic.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
/** /**

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "./ERC20.sol"; import "./ERC20.sol";

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import './StandardToken.sol'; import './StandardToken.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import './StandardToken.sol'; import './StandardToken.sol';
import '../lifecycle/Pausable.sol'; import '../lifecycle/Pausable.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "./StandardToken.sol"; import "./StandardToken.sol";

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import './BasicToken.sol'; import './BasicToken.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "./StandardToken.sol"; import "./StandardToken.sol";
import "./LimitedTransferToken.sol"; import "./LimitedTransferToken.sol";

@ -40,6 +40,6 @@
"ethereumjs-testrpc": "^3.0.2", "ethereumjs-testrpc": "^3.0.2",
"mocha-lcov-reporter": "^1.3.0", "mocha-lcov-reporter": "^1.3.0",
"solidity-coverage": "^0.1.0", "solidity-coverage": "^0.1.0",
"truffle": "https://github.com/ConsenSys/truffle.git#3.1.9" "truffle": "3.2.2"
} }
} }

@ -49,7 +49,7 @@ contract('DelayedClaimable', function(accounts) {
} catch (error) { } catch (error) {
err = error; err = error;
} }
assert.isFalse(err.message.search('invalid JUMP') === -1); assert.isFalse(err.message.search('invalid opcode') === -1);
let owner = await delayedClaimable.owner(); let owner = await delayedClaimable.owner();
assert.isTrue(owner !== accounts[1]); assert.isTrue(owner !== accounts[1]);
}); });
@ -62,7 +62,7 @@ contract('DelayedClaimable', function(accounts) {
} catch (error) { } catch (error) {
err = error; err = error;
} }
assert.isFalse(err.message.search('invalid JUMP') === -1); assert.isFalse(err.message.search('invalid opcode') === -1);
}); });
}); });

@ -35,7 +35,8 @@ contract('HasNoEther', function(accounts) {
assert.equal(startBalance, 0); assert.equal(startBalance, 0);
// Force ether into it // Force ether into it
await ForceEther.new(hasNoEther.address, {value: amount}); let forceEther = await ForceEther.new({value: amount});
await forceEther.destroyAndSend(hasNoEther.address);
const forcedBalance = await web3.eth.getBalance(hasNoEther.address); const forcedBalance = await web3.eth.getBalance(hasNoEther.address);
assert.equal(forcedBalance, amount); assert.equal(forcedBalance, amount);
@ -53,7 +54,8 @@ contract('HasNoEther', function(accounts) {
let hasNoEther = await HasNoEtherTest.new({from: accounts[0]}); let hasNoEther = await HasNoEtherTest.new({from: accounts[0]});
// Force ether into it // Force ether into it
await ForceEther.new(hasNoEther.address, {value: amount}); let forceEther = await ForceEther.new({value: amount});
await forceEther.destroyAndSend(hasNoEther.address);
const forcedBalance = await web3.eth.getBalance(hasNoEther.address); const forcedBalance = await web3.eth.getBalance(hasNoEther.address);
assert.equal(forcedBalance, amount); assert.equal(forcedBalance, amount);

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import '../../contracts/token/BasicToken.sol'; import '../../contracts/token/BasicToken.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "../../contracts/DayLimit.sol"; import "../../contracts/DayLimit.sol";
contract DayLimitMock is DayLimit { contract DayLimitMock is DayLimit {

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import '../../contracts/token/BasicToken.sol'; import '../../contracts/token/BasicToken.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
// @title Force Ether into a contract. // @title Force Ether into a contract.
// @notice even // @notice even
@ -6,8 +6,10 @@ pragma solidity ^0.4.8;
// @notice To use, construct the contract with the target as argument. // @notice To use, construct the contract with the target as argument.
// @author Remco Bloemen <remco@neufund.org> // @author Remco Bloemen <remco@neufund.org>
contract ForceEther { contract ForceEther {
function ForceEther(address target) payable {
// Selfdestruct transfers all Ether to the arget address function ForceEther() payable { }
selfdestruct(target);
function destroyAndSend(address _recipient) {
selfdestruct(_recipient);
} }
} }

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "../../contracts/ownership/HasNoEther.sol"; import "../../contracts/ownership/HasNoEther.sol";

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import {Bounty, Target} from "../../contracts/Bounty.sol"; import {Bounty, Target} from "../../contracts/Bounty.sol";

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import '../../contracts/LimitBalance.sol'; import '../../contracts/LimitBalance.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "../../contracts/MultisigWallet.sol"; import "../../contracts/MultisigWallet.sol";
contract MultisigWalletMock is MultisigWallet { contract MultisigWalletMock is MultisigWallet {

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import '../../contracts/lifecycle/Pausable.sol'; import '../../contracts/lifecycle/Pausable.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import '../../contracts/token/PausableToken.sol'; import '../../contracts/token/PausableToken.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import '../../contracts/payment/PullPayment.sol'; import '../../contracts/payment/PullPayment.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
contract ReentrancyAttack { contract ReentrancyAttack {

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import '../../contracts/ReentrancyGuard.sol'; import '../../contracts/ReentrancyGuard.sol';
import './ReentrancyAttack.sol'; import './ReentrancyAttack.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import '../../contracts/SafeMath.sol'; import '../../contracts/SafeMath.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import {Bounty, Target} from "../../contracts/Bounty.sol"; import {Bounty, Target} from "../../contracts/Bounty.sol";

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import "../../contracts/ownership/Shareable.sol"; import "../../contracts/ownership/Shareable.sol";
contract ShareableMock is Shareable { contract ShareableMock is Shareable {

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import '../../contracts/token/StandardToken.sol'; import '../../contracts/token/StandardToken.sol';

@ -1,4 +1,4 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.11;
import '../../contracts/token/VestedToken.sol'; import '../../contracts/token/VestedToken.sol';

@ -1,3 +1,3 @@
module.exports = function(error) { module.exports = function(error) {
assert.isAbove(error.message.search('invalid JUMP'), -1, 'Invalid JUMP error must be returned'); assert.isAbove(error.message.search('invalid opcode'), -1, 'Invalid opcode error must be returned');
} }

@ -4,14 +4,14 @@ export default async promise => {
} catch (error) { } catch (error) {
// TODO: Check jump destination to destinguish between a throw // TODO: Check jump destination to destinguish between a throw
// and an actual invalid jump. // and an actual invalid jump.
const invalidJump = error.message.search('invalid JUMP') >= 0; const invalidOpcode = error.message.search('invalid opcode') >= 0;
// TODO: When we contract A calls contract B, and B throws, instead // TODO: When we contract A calls contract B, and B throws, instead
// of an 'invalid jump', we get an 'out of gas' error. How do // of an 'invalid jump', we get an 'out of gas' error. How do
// we distinguish this from an actual out of gas event? (The // we distinguish this from an actual out of gas event? (The
// testrpc log actually show an 'invalid jump' event.) // testrpc log actually show an 'invalid jump' event.)
const outOfGas = error.message.search('out of gas') >= 0; const outOfGas = error.message.search('out of gas') >= 0;
assert( assert(
invalidJump || outOfGas, invalidOpcode || outOfGas,
"Expected throw, got '" + error + "' instead", "Expected throw, got '" + error + "' instead",
); );
return; return;

Loading…
Cancel
Save