_levels < 32

This commit is contained in:
Alexey 2021-09-29 19:34:26 +03:00
parent 70f28dd845
commit 6da0358d7e
2 changed files with 5 additions and 5 deletions

View File

@ -38,7 +38,7 @@ contract MerkleTreeWithHistory is Initializable {
constructor(uint32 _levels, address _hasher) {
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;
hasher = IHasher(_hasher);
}

View File

@ -42,7 +42,7 @@ describe('MerkleTreeWithHistory', function () {
describe('#constructor', () => {
it('should correctly hash 2 leaves', async () => {
const { hasher, merkleTreeWithHistory } = await loadFixture(fixture)
const { merkleTreeWithHistory } = await loadFixture(fixture)
//console.log(hasher)
const hash0 = await merkleTreeWithHistory.hashLeftRight(toFixedHex(123), toFixedHex(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())
})
it.skip('hasher gas', async () => {
const { hasher } = await loadFixture(fixture)
const gas = await hasher.estimateGas.poseidon([123, 456])
it('hasher gas', async () => {
const { merkleTreeWithHistory } = await loadFixture(fixture)
const gas = await merkleTreeWithHistory.estimateGas.hashLeftRight(toFixedHex(123), toFixedHex(456))
console.log('hasher gas', gas - 21000)
})
})