fix tests

This commit is contained in:
Alexey 2021-02-04 20:14:06 +03:00
parent 780adf3626
commit c4b81058ed
2 changed files with 11 additions and 17 deletions

@ -87,10 +87,11 @@ contract TornadoTrees is EnsResolve {
uint256 i = depositLeaf;
todo deposits.length = _tornadoTreesV1.deposits.length
// todo deposits.length = _tornadoTreesV1.deposits.length
while (true) {
(bool success, bytes memory data) = address(_tornadoTreesV1).call(abi.encodeWithSignature("deposits(uint256)", i));
// console.log("success", success);
(bool success, bytes memory data) = address(_tornadoTreesV1).staticcall{ gas: 3000 }( // todo define more specise gas value.
abi.encodeWithSignature("deposits(uint256)", i)
);
if (!success) {
break;
}
@ -99,23 +100,19 @@ contract TornadoTrees is EnsResolve {
deposits.push(deposit);
}
uint256 j = withdrawalLeaf;
i = withdrawalLeaf;
while (true) {
(bool success1, bytes memory data1) = address(_tornadoTreesV1).staticcall(
abi.encodeWithSignature("withdrawals(uint256)", j)
(bool success, bytes memory data) = address(_tornadoTreesV1).staticcall{ gas: 3000 }(
abi.encodeWithSignature("withdrawals(uint256)", i)
);
// console.log("success", success);
// console.logBytes(data);
if (!success1) {
if (!success) {
break;
}
bytes32 withdrawal = abi.decode(data1, (bytes32));
// console.logBytes32(withdrawal);
j++;
bytes32 withdrawal = abi.decode(data, (bytes32));
i++;
withdrawals.push(withdrawal);
}
console.log("end");
}
function registerDeposit(address _instance, bytes32 _commitment) external onlyTornadoProxy onlyInitialized {

@ -16,8 +16,6 @@ async function register(note, tornadoTrees, from) {
)
}
const toEns = (addr) => toFixedHex(addr, 20).padEnd(66, '0')
const levels = 20
const CHUNK_TREE_HEIGHT = 2
@ -78,7 +76,6 @@ describe('TornadoTrees', function () {
tornadoProxy.address,
tornadoTreesV1.address,
verifier.address,
// { gasLimit: 30e6 },
)
await tornadoTrees.migrate(depositEvents, withdrawalEvents)
})
@ -90,7 +87,7 @@ describe('TornadoTrees', function () {
expect(solHash).to.be.equal(args[0])
})
it.only('should prove snark', async () => {
it('should prove snark', async () => {
const { input, args } = controller.batchTreeUpdate(tree, depositEvents)
const proof = await controller.prove(input, './artifacts/circuits/BatchTreeUpdate')
await tornadoTrees.updateDepositTree(proof, ...args)