minor refactor

This commit is contained in:
poma 2021-08-21 15:54:24 +03:00
parent 576ba47938
commit 454adf3720
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657

View File

@ -18,24 +18,23 @@ describe('TornadoPool', function () {
async function deploy(contractName, ...args) { async function deploy(contractName, ...args) {
const Factory = await ethers.getContractFactory(contractName) const Factory = await ethers.getContractFactory(contractName)
const instance = await Factory.deploy(...args) const instance = await Factory.deploy(...args)
await instance.deployed() return instance.deployed()
return instance
} }
async function fixture() { async function fixture() {
const [deployer] = await ethers.getSigners()
const verifier2 = await deploy('Verifier2') const verifier2 = await deploy('Verifier2')
const verifier16 = await deploy('Verifier16') const verifier16 = await deploy('Verifier16')
const tree = new MerkleTree(MERKLE_TREE_HEIGHT, [], { hashFunction: poseidonHash2 }) const tree = new MerkleTree(MERKLE_TREE_HEIGHT, [], { hashFunction: poseidonHash2 })
const root = await tree.root()
/** @type {TornadoPool} */ /** @type {TornadoPool} */
const tornadoPool = await deploy('TornadoPool', verifier2.address, verifier16.address, toFixedHex(root)) const tornadoPool = await deploy(
'TornadoPool',
verifier2.address,
verifier16.address,
toFixedHex(tree.root()),
)
return { tornadoPool, deployer } return { tornadoPool }
} }
it('encrypt -> decrypt should work', () => { it('encrypt -> decrypt should work', () => {