Resolve dependencies via self-hosted registry & move package to tornado scope
This commit is contained in:
parent
2a26a90940
commit
427ebea84b
1
.npmrc
Normal file
1
.npmrc
Normal file
@ -0,0 +1 @@
|
|||||||
|
@tornado:registry=https://git.tornado.ws/api/packages/tornado-packages/npm/
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## v2 changes
|
## v2 changes
|
||||||
|
|
||||||
`TornadoTrees.sol` is no longer part of this project. It migrated to [tornado-trees](https://github.com/tornadocash/tornado-trees)
|
`TornadoTrees.sol` is no longer part of this project. It migrated to [@tornado/trees](https://git.tornado.ws/tornado-packages/tornado-trees)
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
include "../node_modules/circomlib/circuits/poseidon.circom";
|
include "../node_modules/@tornado/circomlib/circuits/poseidon.circom";
|
||||||
include "../node_modules/circomlib/circuits/bitify.circom";
|
include "../node_modules/@tornado/circomlib/circuits/bitify.circom";
|
||||||
|
|
||||||
// Computes Poseidon([left, right])
|
// Computes Poseidon([left, right])
|
||||||
template HashLeftRight() {
|
template HashLeftRight() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
include "../node_modules/circomlib/circuits/poseidon.circom";
|
include "../node_modules/@tornado/circomlib/circuits/poseidon.circom";
|
||||||
include "../node_modules/circomlib/circuits/bitify.circom";
|
include "../node_modules/@tornado/circomlib/circuits/bitify.circom";
|
||||||
include "../node_modules/circomlib/circuits/comparators.circom";
|
include "../node_modules/@tornado/circomlib/circuits/comparators.circom";
|
||||||
include "./Utils.circom";
|
include "./Utils.circom";
|
||||||
include "./MerkleTree.circom";
|
include "./MerkleTree.circom";
|
||||||
include "./MerkleTreeUpdater.circom";
|
include "./MerkleTreeUpdater.circom";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
include "../node_modules/circomlib/circuits/bitify.circom";
|
include "../node_modules/@tornado/circomlib/circuits/bitify.circom";
|
||||||
include "../node_modules/circomlib/circuits/pedersen.circom";
|
include "../node_modules/@tornado/circomlib/circuits/pedersen.circom";
|
||||||
|
|
||||||
// computes Pedersen(nullifier + secret)
|
// computes Pedersen(nullifier + secret)
|
||||||
template TornadoCommitmentHasher() {
|
template TornadoCommitmentHasher() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
include "../node_modules/circomlib/circuits/poseidon.circom";
|
include "../node_modules/@tornado/circomlib/circuits/poseidon.circom";
|
||||||
include "../node_modules/circomlib/circuits/bitify.circom";
|
include "../node_modules/@tornado/circomlib/circuits/bitify.circom";
|
||||||
include "./Utils.circom";
|
include "./Utils.circom";
|
||||||
include "./MerkleTree.circom";
|
include "./MerkleTree.circom";
|
||||||
include "./MerkleTreeUpdater.circom";
|
include "./MerkleTreeUpdater.circom";
|
||||||
|
@ -5,7 +5,7 @@ pragma experimental ABIEncoderV2;
|
|||||||
|
|
||||||
import "./interfaces/IVerifier.sol";
|
import "./interfaces/IVerifier.sol";
|
||||||
import "./interfaces/IRewardSwap.sol";
|
import "./interfaces/IRewardSwap.sol";
|
||||||
import "tornado-trees/contracts/TornadoTrees.sol";
|
import "@tornado/trees/contracts/TornadoTrees.sol";
|
||||||
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||||
import "@openzeppelin/contracts/math/SafeMath.sol";
|
import "@openzeppelin/contracts/math/SafeMath.sol";
|
||||||
import "torn-token/contracts/ENS.sol";
|
import "torn-token/contracts/ENS.sol";
|
||||||
@ -105,11 +105,9 @@ contract Miner is EnsResolve {
|
|||||||
|
|
||||||
_setRates(_rates);
|
_setRates(_rates);
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
_setVerifiers([
|
_setVerifiers(
|
||||||
IVerifier(resolve(_verifiers[0])),
|
[IVerifier(resolve(_verifiers[0])), IVerifier(resolve(_verifiers[1])), IVerifier(resolve(_verifiers[2]))]
|
||||||
IVerifier(resolve(_verifiers[1])),
|
);
|
||||||
IVerifier(resolve(_verifiers[2]))
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function reward(bytes memory _proof, RewardArgs memory _args) public {
|
function reward(bytes memory _proof, RewardArgs memory _args) public {
|
||||||
@ -239,15 +237,15 @@ contract Miner is EnsResolve {
|
|||||||
// ------VIEW-------
|
// ------VIEW-------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@dev Whether the root is present in the root history
|
* @dev Whether the root is present in the root history
|
||||||
*/
|
*/
|
||||||
function isKnownAccountRoot(bytes32 _root, uint256 _index) public view returns (bool) {
|
function isKnownAccountRoot(bytes32 _root, uint256 _index) public view returns (bool) {
|
||||||
return _root != 0 && accountRoots[_index % ACCOUNT_ROOT_HISTORY_SIZE] == _root;
|
return _root != 0 && accountRoots[_index % ACCOUNT_ROOT_HISTORY_SIZE] == _root;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@dev Returns the last root
|
* @dev Returns the last root
|
||||||
*/
|
*/
|
||||||
function getLastAccountRoot() public view returns (bytes32) {
|
function getLastAccountRoot() public view returns (bytes32) {
|
||||||
return accountRoots[accountCount % ACCOUNT_ROOT_HISTORY_SIZE];
|
return accountRoots[accountCount % ACCOUNT_ROOT_HISTORY_SIZE];
|
||||||
}
|
}
|
||||||
|
@ -3,4 +3,4 @@
|
|||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.0;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "tornado-trees/contracts/mocks/TornadoTreesMock.sol";
|
import "@tornado/trees/contracts/mocks/TornadoTreesMock.sol";
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.0;
|
||||||
|
|
||||||
import "tornado-trees/contracts/mocks/TornadoTreesV1Mock.sol";
|
import "@tornado/trees/contracts/mocks/TornadoTreesV1Mock.sol";
|
||||||
|
16
package.json
16
package.json
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "tornado-anonymity-mining",
|
"name": "@tornado/anonymity-mining",
|
||||||
"version": "2.1.5",
|
"version": "2.1.5",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": "https://github.com/tornadocash/tornado-anonymity-mining.git",
|
"repository": "https://git.tornado.ws/tornado-packages/anonymity-mining.git",
|
||||||
"author": "Tornadocash team <hello@tornado.cash>",
|
"author": "Tornadocash team <hello@tornado.cash>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"files": [
|
"files": [
|
||||||
@ -47,13 +47,13 @@
|
|||||||
"truffle-plugin-verify": "^0.3.11"
|
"truffle-plugin-verify": "^0.3.11"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"circomlib": "git+https://github.com/tornadocash/circomlib.git#3b492f9801573eebcfe1b6c584afe8a3beecf2b4",
|
"@tornado/circomlib": "^0.0.21",
|
||||||
|
"@tornado/fixed-merkle-tree": "0.3.4",
|
||||||
|
"@tornado/snarkjs": "0.1.20",
|
||||||
|
"@tornado/trees": "^0.0.11",
|
||||||
|
"@tornado/websnark": "^0.0.4",
|
||||||
"decimal.js": "^10.2.0",
|
"decimal.js": "^10.2.0",
|
||||||
"eth-sig-util": "^2.5.3",
|
"eth-sig-util": "^2.5.3",
|
||||||
"fixed-merkle-tree": "^0.3.4",
|
"web3": "^1.2.11"
|
||||||
"snarkjs": "git+https://github.com/tornadocash/snarkjs.git#869181cfaf7526fe8972073d31655493a04326d5",
|
|
||||||
"tornado-trees": "^0.0.11",
|
|
||||||
"web3": "^1.2.11",
|
|
||||||
"websnark": "git+https://github.com/tornadocash/websnark.git#86a526718cd6f6f5d31bdb1fe26a9ec8819f633e"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,6 @@ npx circom circuits/$1.circom -o build/circuits/$1.json
|
|||||||
npx snarkjs info -c build/circuits/$1.json
|
npx snarkjs info -c build/circuits/$1.json
|
||||||
zkutil setup -c build/circuits/$1.json -p build/circuits/$1.params
|
zkutil setup -c build/circuits/$1.json -p build/circuits/$1.params
|
||||||
zkutil export-keys -c build/circuits/$1.json -p build/circuits/$1.params --pk build/circuits/$1_proving_key.json --vk build/circuits/$1_verification_key.json
|
zkutil export-keys -c build/circuits/$1.json -p build/circuits/$1.params --pk build/circuits/$1_proving_key.json --vk build/circuits/$1_verification_key.json
|
||||||
node node_modules/websnark/tools/buildpkey.js -i build/circuits/$1_proving_key.json -o build/circuits/$1_proving_key.bin
|
node node_modules/@tornado/websnark/tools/buildpkey.js -i build/circuits/$1_proving_key.json -o build/circuits/$1_proving_key.bin
|
||||||
zkutil generate-verifier -p build/circuits/$1.params -v build/circuits/${1}Verifier.sol
|
zkutil generate-verifier -p build/circuits/$1.params -v build/circuits/${1}Verifier.sol
|
||||||
sed -i.bak "s/contract Verifier/contract ${1}Verifier/g" build/circuits/${1}Verifier.sol
|
sed -i.bak "s/contract Verifier/contract ${1}Verifier/g" build/circuits/${1}Verifier.sol
|
||||||
|
@ -11,9 +11,9 @@ const {
|
|||||||
RewardArgs,
|
RewardArgs,
|
||||||
} = require('./utils')
|
} = require('./utils')
|
||||||
const Account = require('./account')
|
const Account = require('./account')
|
||||||
const MerkleTree = require('fixed-merkle-tree')
|
const MerkleTree = require('@tornado/fixed-merkle-tree')
|
||||||
const websnarkUtils = require('websnark/src/utils')
|
const websnarkUtils = require('@tornado/websnark/src/utils')
|
||||||
const buildGroth16 = require('websnark/src/groth16')
|
const buildGroth16 = require('@tornado/websnark/src/groth16')
|
||||||
|
|
||||||
const web3 = new Web3()
|
const web3 = new Web3()
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
const crypto = require('crypto')
|
const crypto = require('crypto')
|
||||||
const Decimal = require('decimal.js')
|
const Decimal = require('decimal.js')
|
||||||
const { bigInt } = require('snarkjs')
|
const { bigInt } = require('@tornado/snarkjs')
|
||||||
const { toBN, soliditySha3 } = require('web3-utils')
|
const { toBN, soliditySha3 } = require('web3-utils')
|
||||||
const Web3 = require('web3')
|
const Web3 = require('web3')
|
||||||
const web3 = new Web3()
|
const web3 = new Web3()
|
||||||
const { babyJub, pedersenHash, mimcsponge, poseidon } = require('circomlib')
|
const { babyJub, pedersenHash, mimcsponge, poseidon } = require('@tornado/circomlib')
|
||||||
|
|
||||||
const RewardExtData = {
|
const RewardExtData = {
|
||||||
RewardExtData: {
|
RewardExtData: {
|
||||||
|
@ -34,7 +34,7 @@ const provingKeys = {
|
|||||||
withdrawProvingKey: fs.readFileSync('./build/circuits/Withdraw_proving_key.bin').buffer,
|
withdrawProvingKey: fs.readFileSync('./build/circuits/Withdraw_proving_key.bin').buffer,
|
||||||
treeUpdateProvingKey: fs.readFileSync('./build/circuits/TreeUpdate_proving_key.bin').buffer,
|
treeUpdateProvingKey: fs.readFileSync('./build/circuits/TreeUpdate_proving_key.bin').buffer,
|
||||||
}
|
}
|
||||||
const MerkleTree = require('fixed-merkle-tree')
|
const MerkleTree = require('@tornado/fixed-merkle-tree')
|
||||||
|
|
||||||
// Set time to beginning of a second
|
// Set time to beginning of a second
|
||||||
async function timeReset() {
|
async function timeReset() {
|
||||||
|
Loading…
Reference in New Issue
Block a user