mirror of
https://github.com/tornadocash/tornado-nova
synced 2024-02-02 14:53:56 +01:00
_levels < 32
This commit is contained in:
parent
70f28dd845
commit
6da0358d7e
@ -38,7 +38,7 @@ contract MerkleTreeWithHistory is Initializable {
|
|||||||
|
|
||||||
constructor(uint32 _levels, address _hasher) {
|
constructor(uint32 _levels, address _hasher) {
|
||||||
require(_levels > 0, "_levels should be greater than zero");
|
require(_levels > 0, "_levels should be greater than zero");
|
||||||
require(_levels < 31, "_levels should be less than 31");
|
require(_levels < 32, "_levels should be less than 32");
|
||||||
levels = _levels;
|
levels = _levels;
|
||||||
hasher = IHasher(_hasher);
|
hasher = IHasher(_hasher);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ describe('MerkleTreeWithHistory', function () {
|
|||||||
|
|
||||||
describe('#constructor', () => {
|
describe('#constructor', () => {
|
||||||
it('should correctly hash 2 leaves', async () => {
|
it('should correctly hash 2 leaves', async () => {
|
||||||
const { hasher, merkleTreeWithHistory } = await loadFixture(fixture)
|
const { merkleTreeWithHistory } = await loadFixture(fixture)
|
||||||
//console.log(hasher)
|
//console.log(hasher)
|
||||||
const hash0 = await merkleTreeWithHistory.hashLeftRight(toFixedHex(123), toFixedHex(456))
|
const hash0 = await merkleTreeWithHistory.hashLeftRight(toFixedHex(123), toFixedHex(456))
|
||||||
// const hash1 = await hasher.poseidon([123, 456])
|
// const hash1 = await hasher.poseidon([123, 456])
|
||||||
@ -80,9 +80,9 @@ describe('MerkleTreeWithHistory', function () {
|
|||||||
expect(tree.root()).to.be.be.equal(await merkleTreeWithHistory.getLastRoot())
|
expect(tree.root()).to.be.be.equal(await merkleTreeWithHistory.getLastRoot())
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('hasher gas', async () => {
|
it('hasher gas', async () => {
|
||||||
const { hasher } = await loadFixture(fixture)
|
const { merkleTreeWithHistory } = await loadFixture(fixture)
|
||||||
const gas = await hasher.estimateGas.poseidon([123, 456])
|
const gas = await merkleTreeWithHistory.estimateGas.hashLeftRight(toFixedHex(123), toFixedHex(456))
|
||||||
console.log('hasher gas', gas - 21000)
|
console.log('hasher gas', gas - 21000)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user