From 5912a5c030a2e26432ffc4eddd2d69a32d9c0782 Mon Sep 17 00:00:00 2001 From: poma Date: Wed, 10 Feb 2021 11:14:33 +0300 Subject: [PATCH] minor --- contracts/TornadoTrees.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/TornadoTrees.sol b/contracts/TornadoTrees.sol index 9998450..dd32905 100644 --- a/contracts/TornadoTrees.sol +++ b/contracts/TornadoTrees.sol @@ -116,7 +116,7 @@ contract TornadoTrees is EnsResolve { // Find the segment with correct array length bool direction = elementExists(_tornadoTreesV1, _type, _from); do { - _from = direction ? _from + _step : _from - _step; // safe math? + _from = direction ? _from + _step : _from - _step; } while (direction == elementExists(_tornadoTreesV1, _type, _from)); uint256 high = direction ? _from : _from + _step; uint256 low = direction ? _from - _step : _from; @@ -129,7 +129,7 @@ contract TornadoTrees is EnsResolve { } else { high = mid; } - mid = (high + low) / 2; + mid = (low + high) / 2; } return mid + 1; } @@ -139,7 +139,7 @@ contract TornadoTrees is EnsResolve { string memory _type, uint256 index ) public view returns (bool success) { - // Try to get the element. If it succeeds array the length is higher, it it reverts the length is equal or lower + // Try to get the element. If it succeeds the array length is higher, it it reverts the length is equal or lower (success, ) = address(_tornadoTreesV1).staticcall{ gas: 2500 }(abi.encodeWithSignature(_type, index)); }