mirror of
https://github.com/tornadocash/tornado-core.git
synced 2024-11-22 01:37:07 +01:00
leafs = 2**(levels - 1)
This commit is contained in:
parent
3404acef48
commit
0689d76df1
@ -58,7 +58,7 @@ contract MerkleTreeWithHistory {
|
|||||||
|
|
||||||
function _insert(uint256 leaf) internal {
|
function _insert(uint256 leaf) internal {
|
||||||
uint32 current_index = next_index;
|
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;
|
next_index += 1;
|
||||||
uint256 current_level_hash = leaf;
|
uint256 current_level_hash = leaf;
|
||||||
uint256 left;
|
uint256 left;
|
||||||
|
@ -185,10 +185,10 @@ contract('MerkleTreeWithHistory', accounts => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let error = await merkleTreeWithHistory.insert(1337).should.be.rejected
|
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 = 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 () => {
|
it.skip('mimc gas', async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user