From 0689d76df1c2192b58a84dbe53a96fc3fbdf1e8f Mon Sep 17 00:00:00 2001 From: Alexey Date: Wed, 11 Sep 2019 11:25:32 +0300 Subject: [PATCH] leafs = 2**(levels - 1) --- contracts/MerkleTreeWithHistory.sol | 2 +- test/MerkleTreeWithHistory.test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/MerkleTreeWithHistory.sol b/contracts/MerkleTreeWithHistory.sol index 23412a2..68cea8a 100644 --- a/contracts/MerkleTreeWithHistory.sol +++ b/contracts/MerkleTreeWithHistory.sol @@ -58,7 +58,7 @@ contract MerkleTreeWithHistory { function _insert(uint256 leaf) internal { uint32 current_index = next_index; - require(current_index != 2**(levels - 1), "Merkle tree is full"); + require(current_index != 2**(levels - 1), "Merkle tree is full. No more leafs can be added"); next_index += 1; uint256 current_level_hash = leaf; uint256 left; diff --git a/test/MerkleTreeWithHistory.test.js b/test/MerkleTreeWithHistory.test.js index 742c00c..82d8481 100644 --- a/test/MerkleTreeWithHistory.test.js +++ b/test/MerkleTreeWithHistory.test.js @@ -185,10 +185,10 @@ contract('MerkleTreeWithHistory', accounts => { } let error = await merkleTreeWithHistory.insert(1337).should.be.rejected - error.reason.should.be.equal('Merkle tree is full') + error.reason.should.be.equal('Merkle tree is full. No more leafs can be added') error = await merkleTreeWithHistory.insert(1).should.be.rejected - error.reason.should.be.equal('Merkle tree is full') + error.reason.should.be.equal('Merkle tree is full. No more leafs can be added') }) it.skip('mimc gas', async () => {