From c5287388f53b5d166c941652735d2199be862665 Mon Sep 17 00:00:00 2001 From: Alexey Date: Wed, 10 Feb 2021 23:32:30 +0300 Subject: [PATCH] init --- README.md | 4 + compileHasher.js | 35 -- contracts/Miner.sol | 2 +- contracts/TornadoProxy.sol | 47 +- contracts/TornadoTrees.sol | 132 ---- contracts/mocks/MerkleTreeWithHistoryMock.sol | 18 - contracts/mocks/TornadoTreesMock.sol | 26 +- contracts/mocks/TornadoTreesV1Mock.sol | 5 + contracts/utils/MerkleTreeWithHistory.sol | 136 ----- contracts/utils/OwnableMerkleTree.sol | 17 - package.json | 1 + test/merkleTree.test.js | 107 ---- test/miner.test.js | 86 +-- test/tornadoTrees.test.js | 142 ----- truffle.js | 11 - yarn.lock | 567 +++++++++++++++++- 16 files changed, 632 insertions(+), 704 deletions(-) delete mode 100644 compileHasher.js delete mode 100644 contracts/TornadoTrees.sol delete mode 100644 contracts/mocks/MerkleTreeWithHistoryMock.sol create mode 100644 contracts/mocks/TornadoTreesV1Mock.sol delete mode 100644 contracts/utils/MerkleTreeWithHistory.sol delete mode 100644 contracts/utils/OwnableMerkleTree.sol delete mode 100644 test/merkleTree.test.js delete mode 100644 test/tornadoTrees.test.js diff --git a/README.md b/README.md index 1a73001..3bbf1de 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Tornado.cash anonymity mining [![Build Status](https://github.com/tornadocash/tornado-anonymity-mining/workflows/build/badge.svg)](https://github.com/tornadocash/tornado-anonymity-mining/actions) [![npm](https://img.shields.io/npm/v/tornado-anonymity-mining)](https://www.npmjs.com/package/tornado-anonymity-mining) +## v2 changes + +`TornadoTrees.sol` is no longer part of this project. It migrated to [tornado-trees](https://github.com/tornadocash/tornado-trees) + ## Dependencies 1. node 12 diff --git a/compileHasher.js b/compileHasher.js deleted file mode 100644 index e679e21..0000000 --- a/compileHasher.js +++ /dev/null @@ -1,35 +0,0 @@ -// Generates Hasher artifact at compile-time using Truffle's external compiler -// mechanism -const path = require('path') -const fs = require('fs') -const genContract = require('circomlib/src/poseidon_gencontract.js') - -// where Truffle will expect to find the results of the external compiler -// command -const outputPath = path.join(__dirname, 'build', 'contracts') -const outputPath2 = path.join(outputPath, 'Hasher2.json') -const outputPath3 = path.join(outputPath, 'Hasher3.json') - -if (!fs.existsSync(outputPath)) { - fs.mkdirSync(outputPath, { recursive: true }) -} - -function main() { - const contract2 = { - contractName: 'Hasher2', - abi: genContract.generateABI(2), - bytecode: genContract.createCode(2), - } - - fs.writeFileSync(outputPath2, JSON.stringify(contract2, null, 2)) - - const contract3 = { - contractName: 'Hasher3', - abi: genContract.generateABI(3), - bytecode: genContract.createCode(3), - } - - fs.writeFileSync(outputPath3, JSON.stringify(contract3, null, 2)) -} - -main() diff --git a/contracts/Miner.sol b/contracts/Miner.sol index 0a74d22..2235063 100644 --- a/contracts/Miner.sol +++ b/contracts/Miner.sol @@ -5,7 +5,7 @@ pragma experimental ABIEncoderV2; import "./interfaces/IVerifier.sol"; import "./interfaces/IRewardSwap.sol"; -import "./TornadoTrees.sol"; +import "tornado-trees/contracts/TornadoTrees.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "torn-token/contracts/ENS.sol"; diff --git a/contracts/TornadoProxy.sol b/contracts/TornadoProxy.sol index 12a34ad..584741f 100644 --- a/contracts/TornadoProxy.sol +++ b/contracts/TornadoProxy.sol @@ -1,6 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; +pragma experimental ABIEncoderV2; + import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/Math.sol"; @@ -12,26 +14,31 @@ contract TornadoProxy is EnsResolve { using SafeERC20 for IERC20; event EncryptedNote(address indexed sender, bytes encryptedNote); + enum InstanceState { Disabled, Enabled, Mineable } + struct Instance { + bytes32 instance; + InstanceState state; + } - ITornadoTrees public immutable tornadoTrees; + ITornadoTrees public tornadoTrees; address public immutable governance; + mapping(ITornadoInstance => InstanceState) public instances; - mapping(ITornadoInstance => bool) public instances; modifier onlyGovernance() { require(msg.sender == governance, "Not authorized"); _; } constructor( - bytes32 _tornadoTrees, - bytes32 _governance, - bytes32[] memory _instances + address _tornadoTrees, + address _governance, + Instance[] memory _instances ) public { - tornadoTrees = ITornadoTrees(resolve(_tornadoTrees)); - governance = resolve(_governance); + tornadoTrees = ITornadoTrees(_tornadoTrees); + governance = _governance; for (uint256 i = 0; i < _instances.length; i++) { - instances[ITornadoInstance(resolve(_instances[i]))] = true; + instances[ITornadoInstance(resolve(_instances[i].instance))] = _instances[i].state; } } @@ -40,17 +47,15 @@ contract TornadoProxy is EnsResolve { bytes32 _commitment, bytes calldata _encryptedNote ) external payable { - require(instances[_tornado], "The instance is not supported"); + require(instances[_tornado] != InstanceState.Disabled, "The instance is not supported"); _tornado.deposit{ value: msg.value }(_commitment); - tornadoTrees.registerDeposit(address(_tornado), _commitment); + if (instances[_tornado] == InstanceState.Mineable) { + tornadoTrees.registerDeposit(address(_tornado), _commitment); + } emit EncryptedNote(msg.sender, _encryptedNote); } - function updateInstance(ITornadoInstance _instance, bool _update) external onlyGovernance { - instances[_instance] = _update; - } - function withdraw( ITornadoInstance _tornado, bytes calldata _proof, @@ -61,10 +66,20 @@ contract TornadoProxy is EnsResolve { uint256 _fee, uint256 _refund ) external payable { - require(instances[_tornado], "The instance is not supported"); + require(instances[_tornado] != InstanceState.Disabled, "The instance is not supported"); _tornado.withdraw{ value: msg.value }(_proof, _root, _nullifierHash, _recipient, _relayer, _fee, _refund); - tornadoTrees.registerWithdrawal(address(_tornado), _nullifierHash); + if (instances[_tornado] == InstanceState.Mineable) { + tornadoTrees.registerWithdrawal(address(_tornado), _nullifierHash); + } + } + + function updateInstance(ITornadoInstance _instance, InstanceState _state) external onlyGovernance { + instances[_instance] = _state; + } + + function setTornadoTreesContract(address _instance) external onlyGovernance { + tornadoTrees = ITornadoTrees(_instance); } /// @dev Method to claim junk and accidentally sent tokens diff --git a/contracts/TornadoTrees.sol b/contracts/TornadoTrees.sol deleted file mode 100644 index 5fadd2e..0000000 --- a/contracts/TornadoTrees.sol +++ /dev/null @@ -1,132 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; - -import "torn-token/contracts/ENS.sol"; -import "./utils/OwnableMerkleTree.sol"; -import "./interfaces/ITornadoTrees.sol"; -import "./interfaces/IHasher.sol"; - -contract TornadoTrees is ITornadoTrees, EnsResolve { - OwnableMerkleTree public immutable depositTree; - OwnableMerkleTree public immutable withdrawalTree; - IHasher public immutable hasher; - address public immutable tornadoProxy; - - bytes32[] public deposits; - uint256 public lastProcessedDepositLeaf; - - bytes32[] public withdrawals; - uint256 public lastProcessedWithdrawalLeaf; - - event DepositData(address instance, bytes32 indexed hash, uint256 block, uint256 index); - event WithdrawalData(address instance, bytes32 indexed hash, uint256 block, uint256 index); - - struct TreeLeaf { - address instance; - bytes32 hash; - uint256 block; - } - - modifier onlyTornadoProxy { - require(msg.sender == tornadoProxy, "Not authorized"); - _; - } - - constructor( - bytes32 _tornadoProxy, - bytes32 _hasher2, - bytes32 _hasher3, - uint32 _levels - ) public { - tornadoProxy = resolve(_tornadoProxy); - hasher = IHasher(resolve(_hasher3)); - depositTree = new OwnableMerkleTree(_levels, IHasher(resolve(_hasher2))); - withdrawalTree = new OwnableMerkleTree(_levels, IHasher(resolve(_hasher2))); - } - - function registerDeposit(address _instance, bytes32 _commitment) external override onlyTornadoProxy { - deposits.push(keccak256(abi.encode(_instance, _commitment, blockNumber()))); - } - - function registerWithdrawal(address _instance, bytes32 _nullifier) external override onlyTornadoProxy { - withdrawals.push(keccak256(abi.encode(_instance, _nullifier, blockNumber()))); - } - - function updateRoots(TreeLeaf[] calldata _deposits, TreeLeaf[] calldata _withdrawals) external { - if (_deposits.length > 0) updateDepositTree(_deposits); - if (_withdrawals.length > 0) updateWithdrawalTree(_withdrawals); - } - - function updateDepositTree(TreeLeaf[] calldata _deposits) public { - bytes32[] memory leaves = new bytes32[](_deposits.length); - uint256 offset = lastProcessedDepositLeaf; - - for (uint256 i = 0; i < _deposits.length; i++) { - TreeLeaf memory deposit = _deposits[i]; - bytes32 leafHash = keccak256(abi.encode(deposit.instance, deposit.hash, deposit.block)); - require(deposits[offset + i] == leafHash, "Incorrect deposit"); - - leaves[i] = hasher.poseidon([bytes32(uint256(deposit.instance)), deposit.hash, bytes32(deposit.block)]); - delete deposits[offset + i]; - - emit DepositData(deposit.instance, deposit.hash, deposit.block, offset + i); - } - - lastProcessedDepositLeaf = offset + _deposits.length; - depositTree.bulkInsert(leaves); - } - - function updateWithdrawalTree(TreeLeaf[] calldata _withdrawals) public { - bytes32[] memory leaves = new bytes32[](_withdrawals.length); - uint256 offset = lastProcessedWithdrawalLeaf; - - for (uint256 i = 0; i < _withdrawals.length; i++) { - TreeLeaf memory withdrawal = _withdrawals[i]; - bytes32 leafHash = keccak256(abi.encode(withdrawal.instance, withdrawal.hash, withdrawal.block)); - require(withdrawals[offset + i] == leafHash, "Incorrect withdrawal"); - - leaves[i] = hasher.poseidon([bytes32(uint256(withdrawal.instance)), withdrawal.hash, bytes32(withdrawal.block)]); - delete withdrawals[offset + i]; - - emit WithdrawalData(withdrawal.instance, withdrawal.hash, withdrawal.block, offset + i); - } - - lastProcessedWithdrawalLeaf = offset + _withdrawals.length; - withdrawalTree.bulkInsert(leaves); - } - - function validateRoots(bytes32 _depositRoot, bytes32 _withdrawalRoot) public view { - require(depositTree.isKnownRoot(_depositRoot), "Incorrect deposit tree root"); - require(withdrawalTree.isKnownRoot(_withdrawalRoot), "Incorrect withdrawal tree root"); - } - - function depositRoot() external view returns (bytes32) { - return depositTree.getLastRoot(); - } - - function withdrawalRoot() external view returns (bytes32) { - return withdrawalTree.getLastRoot(); - } - - function getRegisteredDeposits() external view returns (bytes32[] memory _deposits) { - uint256 count = deposits.length - lastProcessedDepositLeaf; - _deposits = new bytes32[](count); - for (uint256 i = 0; i < count; i++) { - _deposits[i] = deposits[lastProcessedDepositLeaf + i]; - } - } - - function getRegisteredWithdrawals() external view returns (bytes32[] memory _withdrawals) { - uint256 count = withdrawals.length - lastProcessedWithdrawalLeaf; - _withdrawals = new bytes32[](count); - for (uint256 i = 0; i < count; i++) { - _withdrawals[i] = withdrawals[lastProcessedWithdrawalLeaf + i]; - } - } - - function blockNumber() public view virtual returns (uint256) { - return block.number; - } -} diff --git a/contracts/mocks/MerkleTreeWithHistoryMock.sol b/contracts/mocks/MerkleTreeWithHistoryMock.sol deleted file mode 100644 index ece31c6..0000000 --- a/contracts/mocks/MerkleTreeWithHistoryMock.sol +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.6.0; -pragma experimental ABIEncoderV2; - -import "../utils/MerkleTreeWithHistory.sol"; - -contract MerkleTreeWithHistoryMock is MerkleTreeWithHistory { - constructor(uint32 _treeLevels, IHasher _hasher) public MerkleTreeWithHistory(_treeLevels, _hasher) {} - - function insert(bytes32 _leaf) external returns (uint32 index) { - return _insert(_leaf); - } - - function bulkInsert(bytes32[] memory _leaves) external { - _bulkInsert(_leaves); - } -} diff --git a/contracts/mocks/TornadoTreesMock.sol b/contracts/mocks/TornadoTreesMock.sol index e06953f..0446831 100644 --- a/contracts/mocks/TornadoTreesMock.sol +++ b/contracts/mocks/TornadoTreesMock.sol @@ -3,28 +3,4 @@ pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; -import "../TornadoTrees.sol"; - -contract TornadoTreesMock is TornadoTrees { - uint256 public timestamp; - uint256 public currentBlock; - - constructor( - bytes32 _tornadoProxy, - bytes32 _hasher2, - bytes32 _hasher3, - uint32 _levels - ) public TornadoTrees(_tornadoProxy, _hasher2, _hasher3, _levels) {} - - function resolve(bytes32 _addr) public view override returns (address) { - return address(uint160(uint256(_addr) >> (12 * 8))); - } - - function setBlockNumber(uint256 _blockNumber) public { - currentBlock = _blockNumber; - } - - function blockNumber() public view override returns (uint256) { - return currentBlock == 0 ? block.number : currentBlock; - } -} +import "tornado-trees/contracts/mocks/TornadoTreesMock.sol"; diff --git a/contracts/mocks/TornadoTreesV1Mock.sol b/contracts/mocks/TornadoTreesV1Mock.sol new file mode 100644 index 0000000..abc3d3e --- /dev/null +++ b/contracts/mocks/TornadoTreesV1Mock.sol @@ -0,0 +1,5 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.6.0; + +import "tornado-trees/contracts/mocks/TornadoTreesV1Mock.sol"; diff --git a/contracts/utils/MerkleTreeWithHistory.sol b/contracts/utils/MerkleTreeWithHistory.sol deleted file mode 100644 index e915184..0000000 --- a/contracts/utils/MerkleTreeWithHistory.sol +++ /dev/null @@ -1,136 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.6.0; -import "../interfaces/IHasher.sol"; - -contract MerkleTreeWithHistory { - uint256 public constant FIELD_SIZE = 21888242871839275222246405745257275088548364400416034343698204186575808495617; - uint256 public constant ZERO_VALUE = 21663839004416932945382355908790599225266501822907911457504978515578255421292; // = keccak256("tornado") % FIELD_SIZE - - uint32 public immutable levels; - IHasher public hasher; // todo immutable - - bytes32[] public filledSubtrees; - bytes32[] public zeros; - uint32 public currentRootIndex = 0; - uint32 public nextIndex = 0; - uint32 public constant ROOT_HISTORY_SIZE = 10; - bytes32[ROOT_HISTORY_SIZE] public roots; - - constructor(uint32 _treeLevels, IHasher _hasher) public { - require(_treeLevels > 0, "_treeLevels should be greater than zero"); - require(_treeLevels < 32, "_treeLevels should be less than 32"); - levels = _treeLevels; - hasher = _hasher; - - bytes32 currentZero = bytes32(ZERO_VALUE); - zeros.push(currentZero); - filledSubtrees.push(currentZero); - - for (uint32 i = 1; i < _treeLevels; i++) { - currentZero = hashLeftRight(currentZero, currentZero); - zeros.push(currentZero); - filledSubtrees.push(currentZero); - } - - filledSubtrees.push(hashLeftRight(currentZero, currentZero)); - roots[0] = filledSubtrees[_treeLevels]; - } - - /** - @dev Hash 2 tree leaves, returns poseidon(_left, _right) - */ - function hashLeftRight(bytes32 _left, bytes32 _right) public view returns (bytes32) { - return hasher.poseidon([_left, _right]); - } - - function _insert(bytes32 _leaf) internal returns (uint32 index) { - uint32 currentIndex = nextIndex; - require(currentIndex != uint32(2)**levels, "Merkle tree is full. No more leaves can be added"); - nextIndex = currentIndex + 1; - bytes32 currentLevelHash = _leaf; - bytes32 left; - bytes32 right; - - for (uint32 i = 0; i < levels; i++) { - if (currentIndex % 2 == 0) { - left = currentLevelHash; - right = zeros[i]; - filledSubtrees[i] = currentLevelHash; - } else { - left = filledSubtrees[i]; - right = currentLevelHash; - } - - currentLevelHash = hashLeftRight(left, right); - currentIndex /= 2; - } - - currentRootIndex = (currentRootIndex + 1) % ROOT_HISTORY_SIZE; - roots[currentRootIndex] = currentLevelHash; - return nextIndex - 1; - } - - function _bulkInsert(bytes32[] memory _leaves) internal { - uint32 insertIndex = nextIndex; - require(insertIndex + _leaves.length <= uint32(2)**levels, "Merkle doesn't have enough capacity to add specified leaves"); - - bytes32[] memory subtrees = new bytes32[](levels); - bool[] memory modifiedSubtrees = new bool[](levels); - for (uint32 j = 0; j < _leaves.length - 1; j++) { - uint256 index = insertIndex + j; - bytes32 currentLevelHash = _leaves[j]; - - for (uint32 i = 0; ; i++) { - if (index % 2 == 0) { - modifiedSubtrees[i] = true; - subtrees[i] = currentLevelHash; - break; - } - - if (subtrees[i] == bytes32(0)) { - subtrees[i] = filledSubtrees[i]; - } - currentLevelHash = hashLeftRight(subtrees[i], currentLevelHash); - index /= 2; - } - } - - for (uint32 i = 0; i < levels; i++) { - // using local map to save on gas on writes if elements were not modified - if (modifiedSubtrees[i]) { - filledSubtrees[i] = subtrees[i]; - } - } - - nextIndex = uint32(insertIndex + _leaves.length - 1); - _insert(_leaves[_leaves.length - 1]); - } - - /** - @dev Whether the root is present in the root history - */ - function isKnownRoot(bytes32 _root) public view returns (bool) { - if (_root == 0) { - return false; - } - uint32 i = currentRootIndex; - do { - if (_root == roots[i]) { - return true; - } - if (i == 0) { - i = ROOT_HISTORY_SIZE; - } - i--; - } while (i != currentRootIndex); - return false; - } - - /** - @dev Returns the last root - */ - function getLastRoot() public view returns (bytes32) { - return roots[currentRootIndex]; - } -} diff --git a/contracts/utils/OwnableMerkleTree.sol b/contracts/utils/OwnableMerkleTree.sol deleted file mode 100644 index cdb8436..0000000 --- a/contracts/utils/OwnableMerkleTree.sol +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.6.0; -import "@openzeppelin/contracts/access/Ownable.sol"; -import "./MerkleTreeWithHistory.sol"; - -contract OwnableMerkleTree is Ownable, MerkleTreeWithHistory { - constructor(uint32 _treeLevels, IHasher _hasher) public MerkleTreeWithHistory(_treeLevels, _hasher) {} - - function insert(bytes32 _leaf) external onlyOwner returns (uint32 index) { - return _insert(_leaf); - } - - function bulkInsert(bytes32[] calldata _leaves) external onlyOwner { - _bulkInsert(_leaves); - } -} diff --git a/package.json b/package.json index 1477cf0..d9aabf2 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "eth-sig-util": "^2.5.3", "fixed-merkle-tree": "^0.3.4", "snarkjs": "git+https://github.com/tornadocash/snarkjs.git#869181cfaf7526fe8972073d31655493a04326d5", + "tornado-trees": "^0.0.4", "web3": "^1.2.11", "websnark": "git+https://github.com/tornadocash/websnark.git#86a526718cd6f6f5d31bdb1fe26a9ec8819f633e" } diff --git a/test/merkleTree.test.js b/test/merkleTree.test.js deleted file mode 100644 index 817cf4c..0000000 --- a/test/merkleTree.test.js +++ /dev/null @@ -1,107 +0,0 @@ -/* global artifacts, web3, contract */ -require('chai').use(require('bn-chai')(web3.utils.BN)).use(require('chai-as-promised')).should() - -const { takeSnapshot, revertSnapshot } = require('../scripts/ganacheHelper') -const { toFixedHex, randomBN } = require('../src/utils') -const MerkleTree = artifacts.require('MerkleTreeWithHistoryMock') -const Hasher = artifacts.require('Hasher2') - -const levels = 16 - -contract('MerkleTree', () => { - let tree1 - let tree2 - let snapshotId - let hasher - - before(async () => { - hasher = await Hasher.new() - tree1 = await MerkleTree.new(levels, hasher.address) - tree2 = await MerkleTree.new(levels, hasher.address) - snapshotId = await takeSnapshot() - }) - - describe('#tree', () => { - it('should bulk insert', async () => { - const elements = ['123', '456', '789'].map((e) => toFixedHex(e)) - - await tree1.bulkInsert(elements) - for (const e of elements) { - await tree2.insert(e) - } - - const root1 = await tree1.getLastRoot() - const root2 = await tree2.getLastRoot() - - root1.should.be.equal(root2) - }) - - it('almost full tree', async () => { - let tree = await MerkleTree.new(3, hasher.address) - let elements = ['1', '2', '3', '4', '5', '6', '7'].map((e) => toFixedHex(e)) - await tree.bulkInsert(elements) - - tree = await MerkleTree.new(3, hasher.address) - elements = ['1', '2', '3', '4', '5', '6', '7', '8'].map((e) => toFixedHex(e)) - await tree.bulkInsert(elements) - - tree = await MerkleTree.new(3, hasher.address) - elements = ['1', '2', '3', '4', '5', '6', '7', '8', '9'].map((e) => toFixedHex(e)) - // prettier-ignore - await tree - .bulkInsert(elements) - .should.be.rejectedWith('Merkle doesn\'t have enough capacity to add specified leaves') - }) - - // it('estimate gas hasher', async () => { - // const gas = await tree1.test() // hasher.contract.methods.poseidon([1, 2]).estimateGas() - // console.log('gas', gas.toString()) - // }) - - it('should bulk insert with initial state', async () => { - const initElements = [123, 456, 789].map((e) => toFixedHex(e)) - const elements = [12, 34, 56, 78, 90].map((e) => toFixedHex(e)) - - for (const e of initElements) { - await tree1.insert(e) - await tree2.insert(e) - } - - await tree1.bulkInsert(elements) - for (const e of elements) { - await tree2.insert(e) - } - - const root1 = await tree1.getLastRoot() - const root2 = await tree2.getLastRoot() - - root1.should.be.equal(root2) - }) - - it.skip('should pass the stress test', async () => { - const rounds = 40 - const elementCount = 10 - - for (let i = 0; i < rounds; i++) { - const length = 1 + Math.floor(Math.random() * elementCount) - const elements = Array.from({ length }, () => randomBN()).map((e) => toFixedHex(e)) - - await tree1.bulkInsert(elements) - for (const e of elements) { - await tree2.insert(e) - } - - const root1 = await tree1.getLastRoot() - const root2 = await tree2.getLastRoot() - - root1.should.be.equal(root2) - } - }) - }) - - afterEach(async () => { - await revertSnapshot(snapshotId.result) - // eslint-disable-next-line require-atomic-updates - snapshotId = await takeSnapshot() - }) -}) diff --git a/test/miner.test.js b/test/miner.test.js index cdba2a1..0bcf6d8 100644 --- a/test/miner.test.js +++ b/test/miner.test.js @@ -11,6 +11,7 @@ const Account = require('../src/account') const Note = require('../src/note') const { toFixedHex, + poseidonHash, poseidonHash2, packEncryptedMessage, unpackEncryptedMessage, @@ -19,6 +20,7 @@ const { const { getEncryptionPublicKey } = require('eth-sig-util') const Miner = artifacts.require('MinerMock') const TornadoTrees = artifacts.require('TornadoTreesMock') +const TornadoTreesV1 = artifacts.require('TornadoTreesV1Mock') const Torn = artifacts.require('TORNMock') const RewardSwap = artifacts.require('RewardSwapMock') const RewardVerifier = artifacts.require('RewardVerifier') @@ -33,8 +35,6 @@ const provingKeys = { treeUpdateProvingKey: fs.readFileSync('./build/circuits/TreeUpdate_proving_key.bin').buffer, } const MerkleTree = require('fixed-merkle-tree') -const Hasher2 = artifacts.require('Hasher2') -const Hasher3 = artifacts.require('Hasher3') // Set time to beginning of a second async function timeReset() { @@ -55,11 +55,13 @@ async function getNextAddr(sender, offset = 0) { } async function registerNote(note, tornadoTrees) { - await tornadoTrees.setBlockNumber(note.depositBlock) - await tornadoTrees.registerDeposit(note.instance, toFixedHex(note.commitment)) - - await tornadoTrees.setBlockNumber(note.withdrawalBlock) - await tornadoTrees.registerWithdrawal(note.instance, toFixedHex(note.nullifierHash)) + await tornadoTrees.register( + note.instance, + toFixedHex(note.commitment), + toFixedHex(note.nullifierHash), + note.depositBlock, + note.withdrawalBlock, + ) return { depositLeaf: { @@ -118,17 +120,30 @@ contract('Miner', (accounts) => { const privateKey = web3.eth.accounts.create().privateKey.slice(2) const publicKey = getEncryptionPublicKey(privateKey) const operator = accounts[0] + const verifier = accounts[1] const thirtyDays = 30 * 24 * 3600 const poolWeight = 1e11 const governance = accounts[9] + let depositTree + let withdrawalTree before(async () => { const rewardVerifier = await RewardVerifier.new() const withdrawVerifier = await WithdrawVerifier.new() const treeUpdateVerifier = await TreeUpdateVerifier.new() - const hasher2 = await Hasher2.new() - const hasher3 = await Hasher3.new() - tornadoTrees = await TornadoTrees.new(operator, hasher2.address, hasher3.address, levels) + const tornadoTreesV1 = await TornadoTreesV1.new( + 0, + 0, + toFixedHex(emptyTree.root()), + toFixedHex(emptyTree.root()), + ) + + tornadoTrees = await TornadoTrees.new(operator, operator, tornadoTreesV1.address, verifier, { + unprocessedDeposits: 0, + unprocessedWithdrawals: 0, + depositsPerDay: 0, + withdrawalsPerDay: 0, + }) const swapExpectedAddr = await getNextAddr(accounts[0], 1) const minerExpectedAddr = await getNextAddr(accounts[0], 2) torn = await Torn.new(sender, thirtyDays, [ @@ -151,15 +166,17 @@ contract('Miner', (accounts) => { [{ instance: tornado, value: RATE.toString() }], ) - const depositData = [] - const withdrawalData = [] + depositTree = new MerkleTree(levels, [], { hashFunction: poseidonHash2 }) + withdrawalTree = new MerkleTree(levels, [], { hashFunction: poseidonHash2 }) for (const note of notes) { const { depositLeaf, withdrawalLeaf } = await registerNote(note, tornadoTrees) - depositData.push(depositLeaf) - withdrawalData.push(withdrawalLeaf) + depositTree.insert(poseidonHash([depositLeaf.instance, depositLeaf.hash, depositLeaf.block])) + withdrawalTree.insert( + poseidonHash([withdrawalLeaf.instance, withdrawalLeaf.hash, withdrawalLeaf.block]), + ) } - await tornadoTrees.updateRoots(depositData, withdrawalData) + await tornadoTrees.updateRoots(toFixedHex(depositTree.root()), toFixedHex(withdrawalTree.root())) const anotherWeb3 = new AnotherWeb3(web3.currentProvider) contract = new anotherWeb3.eth.Contract(miner.abi, miner.address) @@ -493,45 +510,6 @@ contract('Miner', (accounts) => { .reward(proof, args, tmp.proof, update.args) .should.be.rejectedWith('Invalid tree update proof') }) - - it('should work with outdated deposit or withdrawal merkle root', async () => { - const note0 = new Note({ - instance: tornado, - depositBlock: 10, - withdrawalBlock: 55, - }) - const note4 = new Note({ - instance: tornado, - depositBlock: 10, - withdrawalBlock: 55, - }) - const note5 = new Note({ - instance: tornado, - depositBlock: 10, - withdrawalBlock: 65, - }) - - const claim1 = await controller.reward({ account: new Account(), note: note3, publicKey }) - - const note4Leaves = await registerNote(note4, tornadoTrees) - await tornadoTrees.updateRoots([note4Leaves.depositLeaf], [note4Leaves.withdrawalLeaf]) - - const claim2 = await controller.reward({ account: new Account(), note: note4, publicKey }) - - for (let i = 0; i < 9; i++) { - const note0Leaves = await registerNote(note0, tornadoTrees) - await tornadoTrees.updateRoots([note0Leaves.depositLeaf], [note0Leaves.withdrawalLeaf]) - } - - await miner.reward(claim1.proof, claim1.args).should.be.rejectedWith('Incorrect deposit tree root') - await miner.reward(claim2.proof, claim2.args).should.be.fulfilled - - const note5Leaves = await registerNote(note5, tornadoTrees) - await tornadoTrees.updateRoots([note5Leaves.depositLeaf], [note5Leaves.withdrawalLeaf]) - - const claim3 = await controller.reward({ account: new Account(), note: note5, publicKey }) - await miner.reward(claim3.proof, claim3.args).should.be.fulfilled - }) }) describe('#withdraw', () => { diff --git a/test/tornadoTrees.test.js b/test/tornadoTrees.test.js deleted file mode 100644 index 744020a..0000000 --- a/test/tornadoTrees.test.js +++ /dev/null @@ -1,142 +0,0 @@ -/* global artifacts, web3, contract */ -require('chai').use(require('bn-chai')(web3.utils.BN)).use(require('chai-as-promised')).should() - -const { takeSnapshot, revertSnapshot } = require('../scripts/ganacheHelper') -const Note = require('../src/note') -const TornadoTrees = artifacts.require('TornadoTreesMock') -const OwnableMerkleTree = artifacts.require('OwnableMerkleTree') -const Hasher2 = artifacts.require('Hasher2') -const Hasher3 = artifacts.require('Hasher3') -const { toFixedHex, poseidonHash2, poseidonHash } = require('../src/utils') -const MerkleTree = require('fixed-merkle-tree') - -async function registerDeposit(note, tornadoTrees) { - await tornadoTrees.setBlockNumber(note.depositBlock) - await tornadoTrees.registerDeposit(note.instance, toFixedHex(note.commitment)) - return { - instance: note.instance, - hash: toFixedHex(note.commitment), - block: toFixedHex(note.depositBlock), - } -} - -async function registerWithdrawal(note, tornadoTrees) { - await tornadoTrees.setBlockNumber(note.withdrawalBlock) - await tornadoTrees.registerWithdrawal(note.instance, toFixedHex(note.nullifierHash)) - return { - instance: note.instance, - hash: toFixedHex(note.nullifierHash), - block: toFixedHex(note.withdrawalBlock), - } -} - -const levels = 16 -contract('TornadoTrees', (accounts) => { - let tornadoTrees - let snapshotId - let hasher2 - let hasher3 - let operator = accounts[0] - let depositTree - let withdrawalTree - const instances = { - one: '0x0000000000000000000000000000000000000001', - two: '0x0000000000000000000000000000000000000002', - three: '0x0000000000000000000000000000000000000003', - four: '0x0000000000000000000000000000000000000004', - } - const note1 = new Note({ - instance: instances.one, - depositBlock: 10, - withdrawalBlock: 10 + 4 * 60 * 24, - }) - const note2 = new Note({ - instance: instances.two, - depositBlock: 10, - withdrawalBlock: 10 + 2 * 4 * 60 * 24, - }) - const note3 = new Note({ - instance: instances.three, - depositBlock: 10, - withdrawalBlock: 10 + 3 * 4 * 60 * 24, - }) - - before(async () => { - hasher2 = await Hasher2.new() - hasher3 = await Hasher3.new() - tornadoTrees = await TornadoTrees.new(operator, hasher2.address, hasher3.address, levels) - depositTree = await OwnableMerkleTree.at(await tornadoTrees.depositTree()) - withdrawalTree = await OwnableMerkleTree.at(await tornadoTrees.withdrawalTree()) - snapshotId = await takeSnapshot() - }) - - describe('#constructor', () => { - it('should be initialized', async () => { - const owner = await tornadoTrees.tornadoProxy() - owner.should.be.equal(operator) - }) - }) - - describe('#updateRoots', () => { - it('should work for many instances', async () => { - const note1DepositLeaf = await registerDeposit(note1, tornadoTrees) - const note2DepositLeaf = await registerDeposit(note2, tornadoTrees) - - const note2WithdrawalLeaf = await registerWithdrawal(note2, tornadoTrees) - - const note3DepositLeaf = await registerDeposit(note3, tornadoTrees) - const note3WithdrawalLeaf = await registerWithdrawal(note3, tornadoTrees) - - await tornadoTrees.updateRoots( - [note1DepositLeaf, note2DepositLeaf, note3DepositLeaf], - [note2WithdrawalLeaf, note3WithdrawalLeaf], - ) - - const localDepositTree = new MerkleTree(levels, [], { - hashFunction: poseidonHash2, - }) - - localDepositTree.insert(poseidonHash([note1.instance, note1.commitment, note1.depositBlock])) - localDepositTree.insert(poseidonHash([note2.instance, note2.commitment, note2.depositBlock])) - localDepositTree.insert(poseidonHash([note3.instance, note3.commitment, note3.depositBlock])) - - const lastDepositRoot = await depositTree.getLastRoot() - toFixedHex(localDepositTree.root()).should.be.equal(lastDepositRoot.toString()) - - const localWithdrawalTree = new MerkleTree(levels, [], { - hashFunction: poseidonHash2, - }) - localWithdrawalTree.insert(poseidonHash([note2.instance, note2.nullifierHash, note2.withdrawalBlock])) - localWithdrawalTree.insert(poseidonHash([note3.instance, note3.nullifierHash, note3.withdrawalBlock])) - - const lastWithdrawalRoot = await withdrawalTree.getLastRoot() - toFixedHex(localWithdrawalTree.root()).should.be.equal(lastWithdrawalRoot.toString()) - }) - it('should work for empty arrays', async () => { - await tornadoTrees.updateRoots([], []) - }) - }) - - describe('#getRegisteredDeposits', () => { - it('should work', async () => { - const note1DepositLeaf = await registerDeposit(note1, tornadoTrees) - let res = await tornadoTrees.getRegisteredDeposits() - res.length.should.be.equal(1) - // res[0].should.be.true - await tornadoTrees.updateRoots([note1DepositLeaf], []) - - res = await tornadoTrees.getRegisteredDeposits() - res.length.should.be.equal(0) - - await registerDeposit(note2, tornadoTrees) - res = await tornadoTrees.getRegisteredDeposits() - // res[0].should.be.true - }) - }) - - afterEach(async () => { - await revertSnapshot(snapshotId.result) - // eslint-disable-next-line require-atomic-updates - snapshotId = await takeSnapshot() - }) -}) diff --git a/truffle.js b/truffle.js index 77a19fd..ba91b85 100644 --- a/truffle.js +++ b/truffle.js @@ -34,17 +34,6 @@ module.exports = { }, }, }, - external: { - command: 'node ./compileHasher.js', - targets: [ - { - path: './build/contracts/Hasher2.json', - }, - { - path: './build/contracts/Hasher3.json', - }, - ], - }, }, plugins: ['truffle-plugin-verify', 'solidity-coverage'], } diff --git a/yarn.lock b/yarn.lock index 336b4d2..256f67f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -216,6 +216,19 @@ "@ethersproject/rlp" "^5.0.0" "@ethersproject/signing-key" "^5.0.0" +"@iden3/bigarray@0.0.2": + version "0.0.2" + resolved "https://registry.yarnpkg.com/@iden3/bigarray/-/bigarray-0.0.2.tgz#6fc4ba5be18daf8a26ee393f2fb62b80d98c05e9" + integrity sha512-Xzdyxqm1bOFF6pdIsiHLLl3HkSLjbhqJHVyqaTxXt3RqXBEnmsUmEW47H7VOi/ak7TdkRpNkxjyK5Zbkm+y52g== + +"@iden3/binfileutils@0.0.8": + version "0.0.8" + resolved "https://registry.yarnpkg.com/@iden3/binfileutils/-/binfileutils-0.0.8.tgz#d1d349bdbaa9f0a99644232c7d75ea0db98ea1c7" + integrity sha512-/GqTsujUssGuQY+sd/XaLrA+OiCwzm+6yH28C57QQDWCHET2Logry9fGxU10n6XKdhCQBjZ7T/YMQkLwwkpRTQ== + dependencies: + fastfile "0.0.19" + ffjavascript "^0.2.30" + "@nodelib/fs.scandir@2.1.3": version "2.1.3" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b" @@ -381,6 +394,11 @@ dependencies: "@types/node" "*" +"@ungap/promise-all-settled@1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" + integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== + "@web3-js/scrypt-shim@^0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@web3-js/scrypt-shim/-/scrypt-shim-0.1.0.tgz#0bf7529ab6788311d3e07586f7d89107c3bea2cc" @@ -495,6 +513,13 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" +ansi-styles@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + ansi-styles@^4.1.0: version "4.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" @@ -589,6 +614,11 @@ async-limiter@~1.0.0: resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== +async@0.9.x: + version "0.9.2" + resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" + integrity sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0= + async@1.x: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" @@ -652,7 +682,7 @@ bcrypt-pbkdf@^1.0.0: dependencies: tweetnacl "^0.14.3" -big-integer@^1.6.32, big-integer@^1.6.42, big-integer@^1.6.43: +big-integer@^1.6.32, big-integer@^1.6.42, big-integer@^1.6.43, big-integer@^1.6.48: version "1.6.48" resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.48.tgz#8fd88bd1632cba4a1c8c3e3d7159f08bb95b4b9e" integrity sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w== @@ -705,6 +735,12 @@ blake2b-wasm@^1.1.0: dependencies: nanoassert "^1.0.0" +"blake2b-wasm@https://github.com/jbaylina/blake2b-wasm.git": + version "2.1.0" + resolved "https://github.com/jbaylina/blake2b-wasm.git#0d5f024b212429c7f50a7f533aa3a2406b5b42b3" + dependencies: + nanoassert "^1.0.0" + blake2b@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/blake2b/-/blake2b-2.1.3.tgz#f5388be424768e7c6327025dad0c3c6d83351bca" @@ -938,6 +974,11 @@ camelcase@^5.0.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== +camelcase@^6.0.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" + integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== + caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" @@ -1004,6 +1045,21 @@ chokidar@3.3.1: optionalDependencies: fsevents "~2.1.2" +chokidar@3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.4.3.tgz#c1df38231448e45ca4ac588e6c79573ba6a57d5b" + integrity sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.5.0" + optionalDependencies: + fsevents "~2.1.2" + chownr@^1.1.1: version "1.1.4" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" @@ -1037,6 +1093,62 @@ circom@0.0.35: optimist "^0.6.1" yargs "^12.0.2" +circom@0.5.33: + version "0.5.33" + resolved "https://registry.yarnpkg.com/circom/-/circom-0.5.33.tgz#6943d5799adf5388989bfbb3ef8f502fb1b4f662" + integrity sha512-UdL8fr6GckhQ4VoWjIvuYwCHneJe8z/AyJpDxgKLyuaX51ijd4gBP6jlwHDbQJsha2aU2GR9qgDsxd0jfari1Q== + dependencies: + chai "^4.2.0" + circom_runtime "0.1.8" + fastfile "0.0.18" + ffiasm "0.1.1" + ffjavascript "0.2.22" + ffwasm "0.0.7" + fnv-plus "^1.3.1" + r1csfile "0.0.16" + tmp-promise "^2.0.2" + wasmbuilder "0.0.10" + +circom@^0.5.38: + version "0.5.38" + resolved "https://registry.yarnpkg.com/circom/-/circom-0.5.38.tgz#c099fb196085837575fb266f37b0516b1ec56eb5" + integrity sha512-PFlXto8gDysUlwk6z/GYbn1Mv5BtW9BI4769N9gSP0/7KDNSqLNyVmL4DgMLc67/EpG4qJLGch3SdgzQD+/cfw== + dependencies: + chai "^4.2.0" + circom_runtime "0.1.12" + fastfile "0.0.18" + ffiasm "0.1.1" + ffjavascript "0.2.22" + ffwasm "0.0.7" + fnv-plus "^1.3.1" + r1csfile "0.0.16" + tmp-promise "^2.0.2" + wasmbuilder "0.0.10" + +circom_runtime@0.1.12: + version "0.1.12" + resolved "https://registry.yarnpkg.com/circom_runtime/-/circom_runtime-0.1.12.tgz#e1a302c6fe8cec390f035c2e7a8496cfa7cfb4a2" + integrity sha512-R+QT9HS9w71cmGmWIn+PSyD3aHyR5JZBiVvxOjCfn12wwnpuFwBjdMG7he+v8h/oQD1mDRAu2KrBeL4mAt5s4A== + dependencies: + ffjavascript "0.2.34" + fnv-plus "^1.3.1" + +circom_runtime@0.1.13, circom_runtime@^0.1.12: + version "0.1.13" + resolved "https://registry.yarnpkg.com/circom_runtime/-/circom_runtime-0.1.13.tgz#90f86f35d989c48d4c27595b94664ea6918fbede" + integrity sha512-vmv19/0p5OTe5uCI7PWqPtB5vPoYWjczqKYnabaC5HOxX99R4K1MuNqEXsNEAoEfZrmfAQd7vXLcATN9NVnsPA== + dependencies: + ffjavascript "0.2.35" + fnv-plus "^1.3.1" + +circom_runtime@0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/circom_runtime/-/circom_runtime-0.1.8.tgz#d967a1618fe5290849f9c0bbffb6b97b95c0f1c8" + integrity sha512-5ZmzCyidkNPb1zZsJGRXTuWcJ6kW6+gRBtHgf2tFqTh5dUyWVVPH0Zg7AsU2ijPr1AmYZUlme0yORUZK5HrjOA== + dependencies: + ffjavascript "0.2.10" + fnv-plus "^1.3.1" + "circomlib@git+https://github.com/tornadocash/circomlib.git#3b492f9801573eebcfe1b6c584afe8a3beecf2b4": version "0.0.20" resolved "git+https://github.com/tornadocash/circomlib.git#3b492f9801573eebcfe1b6c584afe8a3beecf2b4" @@ -1057,6 +1169,15 @@ circom@0.0.35: typedarray-to-buffer "^3.1.5" web3 "^1.2.11" +"circomlib@git+https://github.com/tornadocash/circomlib.git#d20d53411d1bef61f38c99a8b36d5d0cc4836aa1": + version "0.4.1" + resolved "git+https://github.com/tornadocash/circomlib.git#d20d53411d1bef61f38c99a8b36d5d0cc4836aa1" + dependencies: + blake-hash "^1.1.0" + blake2b "^2.1.3" + circom "0.5.33" + ffjavascript "0.1.0" + circular@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/circular/-/circular-1.0.5.tgz#7da77af98bbde9ce4b5b358cd556b5dded2d3149" @@ -1129,6 +1250,15 @@ cliui@^5.0.0: strip-ansi "^5.2.0" wrap-ansi "^5.1.0" +cliui@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" + integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^6.2.0" + clone-response@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.2.tgz#d1dc973920314df67fbeb94223b4ee350239e96b" @@ -1340,6 +1470,13 @@ debug@3.2.6, debug@^3.1.0: dependencies: ms "^2.1.1" +debug@4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.2.0.tgz#7f150f93920e94c58f5574c2fd01a3110effe7f1" + integrity sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg== + dependencies: + ms "2.1.2" + debug@=3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" @@ -1359,6 +1496,11 @@ decamelize@^1.2.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= +decamelize@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" + integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== + decimal.js@^10.2.0: version "10.2.0" resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.2.0.tgz#39466113a9e036111d02f82489b5fd6b0b5ed231" @@ -1559,6 +1701,13 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= +ejs@^3.0.1: + version "3.1.6" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.6.tgz#5bfd0a0689743bb5268b3550cceeebbc1702822a" + integrity sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw== + dependencies: + jake "^10.6.1" + elliptic@6.3.3: version "6.3.3" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.3.3.tgz#5482d9646d54bcb89fd7d994fc9e2e9568876e3f" @@ -1719,7 +1868,7 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -escape-string-regexp@^4.0.0: +escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== @@ -2297,6 +2446,16 @@ fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fastfile@0.0.18: + version "0.0.18" + resolved "https://registry.yarnpkg.com/fastfile/-/fastfile-0.0.18.tgz#2b69bbbfd2fcccc9bc8099c27de1379b89756a4b" + integrity sha512-q03PTKc+wptis4WmuFOwPNQx2p5myFUrl/dMgRlW9mymc1Egyc14JPHgiGnWK+sJ0+dBl2Vwtfh5GfSQltYOpw== + +fastfile@0.0.19: + version "0.0.19" + resolved "https://registry.yarnpkg.com/fastfile/-/fastfile-0.0.19.tgz#02cef9ade123b0a74adb794f4a1abcfa5719fd46" + integrity sha512-tz9nWR5KYb6eR2odFQ7oxqEkx8F3YQZ6NBJoJR92YEG3DqYOqyxMck8PKvTVNKx3uwvOqGnLXNScnqpdHRdHGQ== + fastq@^1.6.0: version "1.8.0" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.8.0.tgz#550e1f9f59bbc65fe185cb6a9b4d95357107f481" @@ -2311,6 +2470,67 @@ fd-slicer@~1.1.0: dependencies: pend "~1.2.0" +ffiasm@0.1.1, ffiasm@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ffiasm/-/ffiasm-0.1.1.tgz#34ca6a00a875b5a926f66fd46e79530194e9c312" + integrity sha512-irMMHiR9JJ7BVBrAhtliUawxVdPYSdyl81taUYJ4C1mJ0iw2ueThE/qtr0J8B83tsIY8HJvh0lg5F+6ClK4xpA== + dependencies: + big-integer "^1.6.48" + ejs "^3.0.1" + yargs "^15.3.1" + +ffjavascript@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/ffjavascript/-/ffjavascript-0.1.0.tgz#456256c259654cc1ce864c6762b0e76ee1714100" + integrity sha512-dmKlUasSfvUcxBm8nCSKl2x7EFJsXA7OVP8XLFA03T2+6mAc3IiVLC2ambEVOcMOhyhl0vJfVZjM9f9d38D1rw== + dependencies: + big-integer "^1.6.48" + +ffjavascript@0.2.10: + version "0.2.10" + resolved "https://registry.yarnpkg.com/ffjavascript/-/ffjavascript-0.2.10.tgz#b0bf88d69be0b51e0bd28e1966c4a6fb29a86682" + integrity sha512-GQI6gHYYG5/iD4Kt3VzezzK7fARJzP0zkc82V/+JAdjfeKBXhDSo5rpKFuK3cDcrdW0Fu2emuYNMEAuFqhEQvQ== + dependencies: + big-integer "^1.6.48" + wasmcurves "0.0.5" + worker-threads "^1.0.0" + +ffjavascript@0.2.22: + version "0.2.22" + resolved "https://registry.yarnpkg.com/ffjavascript/-/ffjavascript-0.2.22.tgz#101f33db330b0f6a0c10dec22ebf5725618a8a7d" + integrity sha512-EsVqap2Txm17bKW0z/jXCX3M7rQ++nQUAJY8alWDpyhjRj90xjl6GLeVSKZQ8rOFDQ/SFFXcEB8w9X8Boxid+w== + dependencies: + big-integer "^1.6.48" + wasmcurves "0.0.12" + worker-threads "^1.0.0" + +ffjavascript@0.2.34: + version "0.2.34" + resolved "https://registry.yarnpkg.com/ffjavascript/-/ffjavascript-0.2.34.tgz#e0607d1635ad06e8519268af475bc90deac60fbd" + integrity sha512-fq/qfJluC4spiOD1lp5jfckZVnS0o0kI5eKXVLw7UKwIwbNr+NBMBveBVcidSfMizF87T6wb7NBtLSdckQiAnQ== + dependencies: + big-integer "^1.6.48" + mocha "^8.2.1" + wasmcurves "0.0.14" + worker-threads "^1.0.0" + +ffjavascript@0.2.35, ffjavascript@^0.2.30: + version "0.2.35" + resolved "https://registry.yarnpkg.com/ffjavascript/-/ffjavascript-0.2.35.tgz#9166d95173b1c0a743b455bb03a72b581922a42e" + integrity sha512-xnC51tWbi0ah4SH+02jEfJyO+P+NiZWnxQrLDLtBYY1Dv3QM5ydxzd+gxnLEfWdT8i1bMM5pIh5P25l6fNCaVQ== + dependencies: + big-integer "^1.6.48" + wasmcurves "0.0.14" + web-worker "^1.0.0" + +ffwasm@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/ffwasm/-/ffwasm-0.0.7.tgz#23bb9a3537ecc87c0f24fcfb3a9ddd0e86855fff" + integrity sha512-17cTLzv7HHAKqZbX8MvHxjSrR0yDdn1sh4TVsTbAvO9e6klhFicnyoVXc/sCuViV/M8g65sCmVrAmoPCZp1YkQ== + dependencies: + big-integer "^1.6.48" + wasmbuilder "0.0.10" + figures@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" @@ -2345,6 +2565,13 @@ file-uri-to-path@1.0.0: resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== +filelist@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/filelist/-/filelist-1.0.2.tgz#80202f21462d4d1c2e214119b1807c1bc0380e5b" + integrity sha512-z7O0IS8Plc39rTCq6i6iHxk43duYOn8uFJiWSewIq0Bww1RNybVHSCjahmcC87ZqAm4OTvFzlzeGu3XAzG1ctQ== + dependencies: + minimatch "^3.0.4" + fill-range@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" @@ -2365,7 +2592,7 @@ finalhandler@~1.1.2: statuses "~1.5.0" unpipe "~1.0.0" -find-up@4.1.0: +find-up@4.1.0, find-up@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== @@ -2373,6 +2600,14 @@ find-up@4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-up@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + find-up@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" @@ -2395,6 +2630,14 @@ fixed-merkle-tree@^0.3.4: circomlib "git+https://github.com/tornadocash/circomlib.git#5beb6aee94923052faeecea40135d45b6ce6172c" snarkjs "git+https://github.com/tornadocash/snarkjs.git#869181cfaf7526fe8972073d31655493a04326d5" +fixed-merkle-tree@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/fixed-merkle-tree/-/fixed-merkle-tree-0.5.0.tgz#401cdcf3d670c1e18bc7d3a8e81322eb1b27c1d1" + integrity sha512-egOy12EzVATX3Ru2/SLtnWprVpy/sbPCt/MbeG3ANB28jykWLEYj7EjinFnOxtsgR3gTHU6xYXX53yMn/bZqyw== + dependencies: + circomlib "git+https://github.com/tornadocash/circomlib.git#5beb6aee94923052faeecea40135d45b6ce6172c" + snarkjs "git+https://github.com/tornadocash/snarkjs.git#869181cfaf7526fe8972073d31655493a04326d5" + flat-cache@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" @@ -2411,11 +2654,21 @@ flat@^4.1.0: dependencies: is-buffer "~2.0.3" +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + flatted@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== +fnv-plus@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/fnv-plus/-/fnv-plus-1.3.1.tgz#c34cb4572565434acb08ba257e4044ce2b006d67" + integrity sha512-Gz1EvfOneuFfk4yG458dJ3TLJ7gV19q3OM/vVvvHf7eT02Hm1DleB4edsia6ahbKgAYxO9gvyQ1ioWZR+a00Yw== + follow-redirects@1.5.10: version "1.5.10" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a" @@ -3039,6 +3292,11 @@ is-plain-obj@^1.1.0: resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= +is-plain-obj@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + is-promise@^2.1: version "2.2.2" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" @@ -3124,6 +3382,16 @@ iterate-value@^1.0.0: es-get-iterator "^1.0.2" iterate-iterator "^1.0.1" +jake@^10.6.1: + version "10.8.2" + resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.2.tgz#ebc9de8558160a66d82d0eadc6a2e58fbc500a7b" + integrity sha512-eLpKyrfG3mzvGE2Du8VoPbeSkRry093+tyNjdYaBbJS9v17knImYGNXQCUV0gLxQtF82m3E8iRb/wdSQZLoq7A== + dependencies: + async "0.9.x" + chalk "^2.4.2" + filelist "^1.0.1" + minimatch "^3.0.4" + js-sha3@0.5.7, js-sha3@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz#0d4ffd8002d5333aabaf4a23eed2f6374c9f28e7" @@ -3147,7 +3415,7 @@ js-yaml@3.13.1: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@3.x, js-yaml@^3.13.0, js-yaml@^3.13.1: +js-yaml@3.14.0, js-yaml@3.x, js-yaml@^3.13.0, js-yaml@^3.13.1: version "3.14.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== @@ -3212,6 +3480,11 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" +jssha@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/jssha/-/jssha-3.2.0.tgz#88ec50b866dd1411deaddbe6b3e3692e4c710f16" + integrity sha512-QuruyBENDWdN4tZwJbQq7/eAK85FqrI4oDbXjy5IBhYD+2pTJyBUWZe8ctWaCkrV0gy6AaelgOZZBMeswEa/6Q== + keccak@^1.0.2: version "1.4.0" resolved "https://registry.yarnpkg.com/keccak/-/keccak-1.4.0.tgz#572f8a6dbee8e7b3aa421550f9e6408ca2186f80" @@ -3298,6 +3571,13 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + lodash.toarray@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.toarray/-/lodash.toarray-4.4.0.tgz#24c4bfcd6b2fba38bfd0594db1179d8e9b656561" @@ -3315,6 +3595,18 @@ log-symbols@3.0.0: dependencies: chalk "^2.4.2" +log-symbols@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920" + integrity sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA== + dependencies: + chalk "^4.0.0" + +logplease@^1.2.15: + version "1.2.15" + resolved "https://registry.yarnpkg.com/logplease/-/logplease-1.2.15.tgz#3da442e93751a5992cc19010a826b08d0293c48a" + integrity sha512-jLlHnlsPSJjpwUfcNyUxXCl33AYg2cHhIf9QhGL2T4iPT0XPB+xP1LRKFPgIg1M/sg9kAJvy94w9CzBNrfnstA== + lowercase-keys@^1.0.0, lowercase-keys@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" @@ -3545,6 +3837,37 @@ mocha@8.0.1: yargs-parser "13.1.2" yargs-unparser "1.6.0" +mocha@^8.2.1: + version "8.2.1" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-8.2.1.tgz#f2fa68817ed0e53343d989df65ccd358bc3a4b39" + integrity sha512-cuLBVfyFfFqbNR0uUKbDGXKGk+UDFe6aR4os78XIrMQpZl/nv7JYHcvP5MFIAb374b2zFXsdgEGwmzMtP0Xg8w== + dependencies: + "@ungap/promise-all-settled" "1.1.2" + ansi-colors "4.1.1" + browser-stdout "1.3.1" + chokidar "3.4.3" + debug "4.2.0" + diff "4.0.2" + escape-string-regexp "4.0.0" + find-up "5.0.0" + glob "7.1.6" + growl "1.10.5" + he "1.2.0" + js-yaml "3.14.0" + log-symbols "4.0.0" + minimatch "3.0.4" + ms "2.1.2" + nanoid "3.1.12" + serialize-javascript "5.0.1" + strip-json-comments "3.1.1" + supports-color "7.2.0" + which "2.0.2" + wide-align "1.1.3" + workerpool "6.0.2" + yargs "13.3.2" + yargs-parser "13.1.2" + yargs-unparser "2.0.0" + mock-fs@^4.1.0: version "4.12.0" resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-4.12.0.tgz#a5d50b12d2d75e5bec9dac3b67ffe3c41d31ade4" @@ -3625,6 +3948,11 @@ nanoassert@^1.0.0: resolved "https://registry.yarnpkg.com/nanoassert/-/nanoassert-1.1.0.tgz#4f3152e09540fde28c76f44b19bbcd1d5a42478d" integrity sha1-TzFS4JVA/eKMdvRLGbvNHVpCR40= +nanoid@3.1.12: + version "3.1.12" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.12.tgz#6f7736c62e8d39421601e4a0c77623a97ea69654" + integrity sha512-1qstj9z5+x491jfiC4Nelk+f8XBad7LN20PmyWINJEMRSf3wcAjAWysw1qaA8z6NSKe2sjq1hRSDpBH5paCb6A== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -3857,6 +4185,13 @@ p-limit@^2.0.0, p-limit@^2.2.0: dependencies: p-try "^2.0.0" +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" @@ -3878,6 +4213,13 @@ p-locate@^4.1.0: dependencies: p-limit "^2.2.0" +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + p-timeout@^1.1.1: version "1.2.1" resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-1.2.1.tgz#5eb3b353b7fce99f101a1038880bb054ebbea386" @@ -4176,6 +4518,25 @@ querystring@0.2.0: resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= +r1csfile@0.0.16: + version "0.0.16" + resolved "https://registry.yarnpkg.com/r1csfile/-/r1csfile-0.0.16.tgz#53c66a79b50eebc2d15a1048e39d548ce9da7ccd" + integrity sha512-A2jRVWzGgmXeG2lVAc0H4suJmzt50it5UvBnycJgBCpMXM3tH/M6RguP7nvs6suY/yYnkN6jX6iTScSiDUF3FA== + dependencies: + "@iden3/bigarray" "0.0.2" + fastfile "0.0.18" + ffjavascript "0.2.22" + +r1csfile@0.0.32: + version "0.0.32" + resolved "https://registry.yarnpkg.com/r1csfile/-/r1csfile-0.0.32.tgz#64a6c63ff76b737b3ee22bcedb2bb9a033cbeb1a" + integrity sha512-DkRXeOg0iRmfhgIuWICvdkOiLHpyb7+AcUd/WHpqBJEUp27pe7wKXBR4Jr3TPYCT4sTV9a/F3bovyAC4wystnQ== + dependencies: + "@iden3/bigarray" "0.0.2" + "@iden3/binfileutils" "0.0.8" + fastfile "0.0.19" + ffjavascript "0.2.35" + randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -4240,6 +4601,13 @@ readdirp@~3.3.0: dependencies: picomatch "^2.0.7" +readdirp@~3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz#9ba74c019b15d365278d2e91bb8c48d7b4d42c9e" + integrity sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ== + dependencies: + picomatch "^2.2.1" + rechoir@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" @@ -4349,6 +4717,20 @@ rimraf@2.6.3: dependencies: glob "^7.1.3" +rimraf@^2.6.3: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + +rimraf@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" @@ -4524,6 +4906,13 @@ serialize-javascript@3.0.0: resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-3.0.0.tgz#492e489a2d77b7b804ad391a5f5d97870952548e" integrity sha512-skZcHYw2vEX4bw90nAr2iTTsz6x2SrHEnfxgKYmZlvJYBEZrvbKtobJWlQ20zczKb3bsHHXXTYt48zBA7ni9cw== +serialize-javascript@5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4" + integrity sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA== + dependencies: + randombytes "^2.1.0" + serve-static@1.14.1: version "1.14.1" resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" @@ -4639,6 +5028,19 @@ slice-ansi@^2.1.0: astral-regex "^1.0.0" is-fullwidth-code-point "^2.0.0" +snarkjs@^0.3.57: + version "0.3.58" + resolved "https://registry.yarnpkg.com/snarkjs/-/snarkjs-0.3.58.tgz#fc26fe5ca637243abe05bbff5892d34917d1a7c4" + integrity sha512-AMEwkC6M+uv5dOXr1GK2rpgKzzo1POOW15LPtZVGW0Aa+2ZJH0vzE1seIrAxrLU6UF29eJnW/bkJ9l8gGod3uQ== + dependencies: + "@iden3/binfileutils" "0.0.8" + blake2b-wasm "https://github.com/jbaylina/blake2b-wasm.git" + circom_runtime "0.1.13" + fastfile "0.0.19" + ffjavascript "0.2.35" + logplease "^1.2.15" + r1csfile "0.0.32" + "snarkjs@git+https://github.com/tornadocash/snarkjs.git#869181cfaf7526fe8972073d31655493a04326d5": version "0.1.20" resolved "git+https://github.com/tornadocash/snarkjs.git#869181cfaf7526fe8972073d31655493a04326d5" @@ -4775,7 +5177,7 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string-width@^4.2.0: +string-width@^4.1.0, string-width@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== @@ -4866,16 +5268,16 @@ strip-json-comments@3.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== +strip-json-comments@3.1.1, strip-json-comments@^3.0.1, strip-json-comments@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + strip-json-comments@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= -strip-json-comments@^3.0.1, strip-json-comments@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" - integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== - supports-color@7.1.0, supports-color@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" @@ -4883,6 +5285,13 @@ supports-color@7.1.0, supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +supports-color@7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + supports-color@^3.1.0: version "3.2.3" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" @@ -4991,6 +5400,27 @@ timers-ext@^0.1.5: es5-ext "~0.10.46" next-tick "1" +tmp-promise@^2.0.2: + version "2.1.1" + resolved "https://registry.yarnpkg.com/tmp-promise/-/tmp-promise-2.1.1.tgz#eb97c038995af74efbfe8156f5e07fdd0c935539" + integrity sha512-Z048AOz/w9b6lCbJUpevIJpRpUztENl8zdv1bmAKVHimfqRFl92ROkmT9rp7TVBnrEw2gtMTol/2Cp2S2kJa4Q== + dependencies: + tmp "0.1.0" + +tmp-promise@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/tmp-promise/-/tmp-promise-3.0.2.tgz#6e933782abff8b00c3119d63589ca1fb9caaa62a" + integrity sha512-OyCLAKU1HzBjL6Ev3gxUeraJNlbNingmi8IrHHEsYH8LTmEuhvYfqvhn2F/je+mjf4N58UmZ96OMEy1JanSCpA== + dependencies: + tmp "^0.2.0" + +tmp@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.1.0.tgz#ee434a4e22543082e294ba6201dcc6eafefa2877" + integrity sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw== + dependencies: + rimraf "^2.6.3" + tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" @@ -4998,6 +5428,13 @@ tmp@^0.0.33: dependencies: os-tmpdir "~1.0.2" +tmp@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" + integrity sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ== + dependencies: + rimraf "^3.0.0" + to-buffer@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/to-buffer/-/to-buffer-1.1.1.tgz#493bd48f62d7c43fcded313a03dcadb2e1213a80" @@ -5036,6 +5473,21 @@ torn-token@^1.0.0: ethereumjs-util "^7.0.3" web3 "^1.2.11" +tornado-trees@^0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/tornado-trees/-/tornado-trees-0.0.4.tgz#568838277b01f23c9a4c01318231dea0a4af83f3" + integrity sha512-SL/tJ2TlY9tBpQJumg4ebKCtp5AyRxL+z+5SLhklf50E1n2GIUpETzCVqbqqSPplE6sVgpyAbFnnK1/MfGgNIQ== + dependencies: + circom "^0.5.38" + circom_runtime "^0.1.12" + circomlib "git+https://github.com/tornadocash/circomlib.git#d20d53411d1bef61f38c99a8b36d5d0cc4836aa1" + dotenv "^8.2.0" + ffiasm "^0.1.1" + fixed-merkle-tree "^0.5.0" + jssha "^3.2.0" + snarkjs "^0.3.57" + tmp-promise "^3.0.2" + tough-cookie@~2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" @@ -5284,6 +5736,42 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" +wasmbuilder@0.0.10: + version "0.0.10" + resolved "https://registry.yarnpkg.com/wasmbuilder/-/wasmbuilder-0.0.10.tgz#b8298b2095ef9979d32f3881d1feef1705ec868a" + integrity sha512-zQSvZ7d74d9OvN+mCN6ucNne4QS5/cBBYTHldX0Oe+u9gStY21orapvuX1ajisA7RVIpuFhYg+ZgdySsPfeh0A== + dependencies: + big-integer "^1.6.48" + +wasmcurves@0.0.12: + version "0.0.12" + resolved "https://registry.yarnpkg.com/wasmcurves/-/wasmcurves-0.0.12.tgz#1496e2219ac07f9a420f527803ae13b1d7a89246" + integrity sha512-1Jl9mkatyHSNj80ILjf85SZUNuZQBCkTjJlhzqHnZQXUmIimCIWkugaVaYNjozLs1Gun4h/keZe1MBeBN0sRpg== + dependencies: + big-integer "^1.6.42" + blakejs "^1.1.0" + +wasmcurves@0.0.14: + version "0.0.14" + resolved "https://registry.yarnpkg.com/wasmcurves/-/wasmcurves-0.0.14.tgz#cbe0f19650d9554937154afdbed66b305bd2a348" + integrity sha512-G1iMkxlRaQSdqQ1JrwHcU+awLmwyH6kFKfT8g9obd8MWe+u5oSdFXrODB0zmSI5aGGvJPG+4cAmqCGYv9R+7qg== + dependencies: + big-integer "^1.6.42" + blakejs "^1.1.0" + +wasmcurves@0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/wasmcurves/-/wasmcurves-0.0.5.tgz#d0b58e803c0b1c09c966b7dc0fad6dd405d18547" + integrity sha512-BmI4GXLjLawGg2YkvHa8zRsnWec+d1uwoxE+Iov8cqOpDL7GA5XO2pk2yuDbXHMzwIug2exnKot3baRZ86R0pA== + dependencies: + big-integer "^1.6.42" + blakejs "^1.1.0" + +web-worker@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/web-worker/-/web-worker-1.0.0.tgz#c7ced4e1eb6227636ada35056a9e5a477414e4d0" + integrity sha512-BzuMqeKVkKKwHV6tJuwePFcxYMxvC97D448mXTgh/CxXAB4sRtoV26gRPN+JDxsXRR7QZyioMV9O6NzQaASf7Q== + web3-bzz@1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.2.1.tgz#c3bd1e8f0c02a13cd6d4e3c3e9e1713f144f6f0d" @@ -6297,11 +6785,21 @@ wordwrap@~0.0.2: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= +worker-threads@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/worker-threads/-/worker-threads-1.0.0.tgz#2b49ea7c9692ba737d9148f2c9b2be65e14e3470" + integrity sha512-vK6Hhvph8oLxocEJIlc3YfGAZhm210uGzjZsXSu+JYLAQ/s/w4Tqgl60JrdH58hW8NSGP4m3bp8a92qPXgX05w== + workerpool@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.0.0.tgz#85aad67fa1a2c8ef9386a1b43539900f61d03d58" integrity sha512-fU2OcNA/GVAJLLyKUoHkAgIhKb0JoCpSjLC/G2vYKxUjVmQwGbRVeoPJ1a8U4pnVofz4AQV5Y/NEw8oKqxEBtA== +workerpool@6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.0.2.tgz#e241b43d8d033f1beb52c7851069456039d1d438" + integrity sha512-DSNyvOpFKrNusaaUwk+ej6cBj1bmhLcBfj80elGk+ZIo5JSkq+unB1dLKEOcNfJDZgjGICfhQ0Q5TbP0PvF4+Q== + wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" @@ -6319,6 +6817,15 @@ wrap-ansi@^5.1.0: string-width "^3.0.0" strip-ansi "^5.0.0" +wrap-ansi@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" @@ -6418,6 +6925,14 @@ yargs-parser@^11.1.1: camelcase "^5.0.0" decamelize "^1.2.0" +yargs-parser@^18.1.2: + version "18.1.3" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" + integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + yargs-unparser@1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-1.6.0.tgz#ef25c2c769ff6bd09e4b0f9d7c605fb27846ea9f" @@ -6427,6 +6942,16 @@ yargs-unparser@1.6.0: lodash "^4.17.15" yargs "^13.3.0" +yargs-unparser@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" + integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== + dependencies: + camelcase "^6.0.0" + decamelize "^4.0.0" + flat "^5.0.2" + is-plain-obj "^2.1.0" + yargs@13.2.4: version "13.2.4" resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.2.4.tgz#0b562b794016eb9651b98bd37acf364aa5d6dc83" @@ -6478,6 +7003,23 @@ yargs@^12.0.2, yargs@^12.0.5: y18n "^3.2.1 || ^4.0.0" yargs-parser "^11.1.1" +yargs@^15.3.1: + version "15.4.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^4.2.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^18.1.2" + yauzl@^2.4.2: version "2.10.0" resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9" @@ -6485,3 +7027,8 @@ yauzl@^2.4.2: dependencies: buffer-crc32 "~0.2.3" fd-slicer "~1.1.0" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==