From e6d0cdaa1cbc8c5559d3a9851d354e26e02cc41a Mon Sep 17 00:00:00 2001 From: Nikolai Mushegian Date: Mon, 7 Mar 2016 22:12:41 +0000 Subject: [PATCH 1/2] safeToAdd fix --- contracts/util/safety.sol | 2 +- contracts/util/safety_test.sol | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 contracts/util/safety_test.sol diff --git a/contracts/util/safety.sol b/contracts/util/safety.sol index 93d447c..5f4a2a0 100644 --- a/contracts/util/safety.sol +++ b/contracts/util/safety.sol @@ -1,6 +1,6 @@ contract DSSafeAddSub { function safeToAdd(uint a, uint b) internal returns (bool) { - return (a + b > a); + return (a + b >= a); } function safeAdd(uint a, uint b) internal returns (uint) { if (!safeToAdd(a, b)) throw; diff --git a/contracts/util/safety_test.sol b/contracts/util/safety_test.sol new file mode 100644 index 0000000..24e2c8e --- /dev/null +++ b/contracts/util/safety_test.sol @@ -0,0 +1,10 @@ +import 'dapple/test.sol'; +import 'util/safety.sol'; + +contract SafeAddSubTest is Test, DSSafeAddSub { + function setUp() { + } + function testSafeToAddFix() { + assertTrue(safeToAdd(1, 0)); + } +} From b4549a334925d0a5d9d1f7ddbc8001b78960327c Mon Sep 17 00:00:00 2001 From: Nikolai Mushegian Date: Mon, 7 Mar 2016 22:13:48 +0000 Subject: [PATCH 2/2] bump dappfile version --- dappfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dappfile b/dappfile index 815ac97..d405442 100644 --- a/dappfile +++ b/dappfile @@ -1,5 +1,5 @@ name: dappsys -version: 0.1.0 +version: 0.1.1 layout: sol_sources: contracts build_dir: build