forked from tornadocash/tornado-cli
Updated .env.examples and conditionally build groth16
Issue found from @Theo
This commit is contained in:
parent
962bf59d47
commit
94b03abd19
@ -1,8 +1,11 @@
|
|||||||
|
# THOSE VALUES ARE PROVIDED AS AN EXAMPLE YOU EITHER NOT NEED TO SUPPLY THEM IN MANUAL IF NOT NEEDED
|
||||||
|
# ALSO DO NOT USE MNEMONIC OR PRIVATE KEY SUPPLIED HERE YOUR ASSET WILL BE STOLEN
|
||||||
RPC_URL=https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607
|
RPC_URL=https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607
|
||||||
ETHRPC_URL=https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607
|
ETHRPC_URL=https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607
|
||||||
GRAPH_URL=https://api.thegraph.com
|
GRAPH_URL=https://api.thegraph.com
|
||||||
ETHGRAPH_URL=https://api.thegraph.com
|
ETHGRAPH_URL=https://api.thegraph.com
|
||||||
DISABLE_GRAPH=true
|
DISABLE_GRAPH=true
|
||||||
|
ACCOUNT_KEY=ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
|
||||||
RELAYER=torn-city.eth
|
RELAYER=torn-city.eth
|
||||||
WALLET_WITHDRAWAL=true
|
WALLET_WITHDRAWAL=true
|
||||||
TOR_PORT=9150
|
TOR_PORT=9150
|
||||||
|
41
dist/cli.js
vendored
41
dist/cli.js
vendored
@ -191238,7 +191238,7 @@ const defaultConfig = {
|
|||||||
gasLimit: 7e5
|
gasLimit: 7e5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ensSubdomainKey: "mainnet-tornado",
|
relayerEnsSubdomain: "mainnet-tornado",
|
||||||
pollInterval: 15,
|
pollInterval: 15,
|
||||||
constants: {
|
constants: {
|
||||||
GOVERNANCE_BLOCK: 11474695,
|
GOVERNANCE_BLOCK: 11474695,
|
||||||
@ -191306,7 +191306,7 @@ const defaultConfig = {
|
|||||||
decimals: 18
|
decimals: 18
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ensSubdomainKey: "bsc-tornado",
|
relayerEnsSubdomain: "bsc-tornado",
|
||||||
pollInterval: 10,
|
pollInterval: 10,
|
||||||
constants: {
|
constants: {
|
||||||
NOTE_ACCOUNT_BLOCK: 8159269,
|
NOTE_ACCOUNT_BLOCK: 8159269,
|
||||||
@ -191364,7 +191364,7 @@ const defaultConfig = {
|
|||||||
decimals: 18
|
decimals: 18
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ensSubdomainKey: "polygon-tornado",
|
relayerEnsSubdomain: "polygon-tornado",
|
||||||
pollInterval: 10,
|
pollInterval: 10,
|
||||||
constants: {
|
constants: {
|
||||||
NOTE_ACCOUNT_BLOCK: 16257996,
|
NOTE_ACCOUNT_BLOCK: 16257996,
|
||||||
@ -191430,7 +191430,7 @@ const defaultConfig = {
|
|||||||
decimals: 18
|
decimals: 18
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ensSubdomainKey: "optimism-tornado",
|
relayerEnsSubdomain: "optimism-tornado",
|
||||||
pollInterval: 15,
|
pollInterval: 15,
|
||||||
constants: {
|
constants: {
|
||||||
NOTE_ACCOUNT_BLOCK: 2243694,
|
NOTE_ACCOUNT_BLOCK: 2243694,
|
||||||
@ -191495,7 +191495,7 @@ const defaultConfig = {
|
|||||||
decimals: 18
|
decimals: 18
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ensSubdomainKey: "arbitrum-tornado",
|
relayerEnsSubdomain: "arbitrum-tornado",
|
||||||
pollInterval: 15,
|
pollInterval: 15,
|
||||||
constants: {
|
constants: {
|
||||||
NOTE_ACCOUNT_BLOCK: 3430605,
|
NOTE_ACCOUNT_BLOCK: 3430605,
|
||||||
@ -191560,7 +191560,7 @@ const defaultConfig = {
|
|||||||
decimals: 18
|
decimals: 18
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ensSubdomainKey: "gnosis-tornado",
|
relayerEnsSubdomain: "gnosis-tornado",
|
||||||
pollInterval: 15,
|
pollInterval: 15,
|
||||||
constants: {
|
constants: {
|
||||||
NOTE_ACCOUNT_BLOCK: 17754564,
|
NOTE_ACCOUNT_BLOCK: 17754564,
|
||||||
@ -191615,7 +191615,7 @@ const defaultConfig = {
|
|||||||
decimals: 18
|
decimals: 18
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ensSubdomainKey: "avalanche-tornado",
|
relayerEnsSubdomain: "avalanche-tornado",
|
||||||
pollInterval: 10,
|
pollInterval: 10,
|
||||||
constants: {
|
constants: {
|
||||||
NOTE_ACCOUNT_BLOCK: 4429813,
|
NOTE_ACCOUNT_BLOCK: 4429813,
|
||||||
@ -191689,7 +191689,7 @@ const defaultConfig = {
|
|||||||
gasLimit: 7e5
|
gasLimit: 7e5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ensSubdomainKey: "sepolia-tornado",
|
relayerEnsSubdomain: "sepolia-tornado",
|
||||||
pollInterval: 15,
|
pollInterval: 15,
|
||||||
constants: {
|
constants: {
|
||||||
GOVERNANCE_BLOCK: 5594395,
|
GOVERNANCE_BLOCK: 5594395,
|
||||||
@ -191738,7 +191738,7 @@ function getInstanceByAddress({ netId, address }) {
|
|||||||
}
|
}
|
||||||
function getSubdomains() {
|
function getSubdomains() {
|
||||||
const allConfig = getNetworkConfig();
|
const allConfig = getNetworkConfig();
|
||||||
return enabledChains.map((chain) => allConfig[chain].ensSubdomainKey);
|
return enabledChains.map((chain) => allConfig[chain].relayerEnsSubdomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
const addressType = { type: "string", pattern: "^0x[a-fA-F0-9]{40}$" };
|
const addressType = { type: "string", pattern: "^0x[a-fA-F0-9]{40}$" };
|
||||||
@ -192747,8 +192747,8 @@ class RelayerClient {
|
|||||||
filterRelayer(curr, relayer, subdomains, debugRelayer = false) {
|
filterRelayer(curr, relayer, subdomains, debugRelayer = false) {
|
||||||
return __async$3(this, null, function* () {
|
return __async$3(this, null, function* () {
|
||||||
var _a;
|
var _a;
|
||||||
const { ensSubdomainKey } = this.config;
|
const { relayerEnsSubdomain } = this.config;
|
||||||
const subdomainIndex = subdomains.indexOf(ensSubdomainKey);
|
const subdomainIndex = subdomains.indexOf(relayerEnsSubdomain);
|
||||||
const mainnetSubdomain = curr.records[0];
|
const mainnetSubdomain = curr.records[0];
|
||||||
const hostname = curr.records[subdomainIndex];
|
const hostname = curr.records[subdomainIndex];
|
||||||
const isHostWithProtocol = hostname.includes("http");
|
const isHostWithProtocol = hostname.includes("http");
|
||||||
@ -193110,14 +193110,18 @@ var __async = (__this, __arguments, generator) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
let dist_groth16;
|
let dist_groth16;
|
||||||
const groth16Promise = (() => __async(void 0, null, function* () {
|
function initGroth16() {
|
||||||
if (!dist_groth16) {
|
return __async(this, null, function* () {
|
||||||
dist_groth16 = yield groth16({ wasmInitialMemory: 2e3 });
|
if (!dist_groth16) {
|
||||||
}
|
dist_groth16 = yield groth16({ wasmInitialMemory: 2e3 });
|
||||||
}))();
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
function calculateSnarkProof(input, circuit, provingKey) {
|
function calculateSnarkProof(input, circuit, provingKey) {
|
||||||
return __async(this, null, function* () {
|
return __async(this, null, function* () {
|
||||||
yield groth16Promise;
|
if (!dist_groth16) {
|
||||||
|
yield initGroth16();
|
||||||
|
}
|
||||||
const snarkInput = {
|
const snarkInput = {
|
||||||
root: input.root,
|
root: input.root,
|
||||||
nullifierHash: BigInt(input.nullifierHex).toString(),
|
nullifierHash: BigInt(input.nullifierHex).toString(),
|
||||||
@ -193132,7 +193136,7 @@ function calculateSnarkProof(input, circuit, provingKey) {
|
|||||||
};
|
};
|
||||||
console.log("Start generating SNARK proof", snarkInput);
|
console.log("Start generating SNARK proof", snarkInput);
|
||||||
console.time("SNARK proof time");
|
console.time("SNARK proof time");
|
||||||
const proofData = yield src_utils.genWitnessAndProve(dist_groth16, snarkInput, circuit, provingKey);
|
const proofData = yield src_utils.genWitnessAndProve(yield dist_groth16, snarkInput, circuit, provingKey);
|
||||||
const proof = src_utils.toSolidityInput(proofData).proof;
|
const proof = src_utils.toSolidityInput(proofData).proof;
|
||||||
console.timeEnd("SNARK proof time");
|
console.timeEnd("SNARK proof time");
|
||||||
const args = [
|
const args = [
|
||||||
@ -193693,6 +193697,7 @@ function tornadoProgram() {
|
|||||||
(note, recipient, ethPurchase, cmdOptions) => program_async(this, null, function* () {
|
(note, recipient, ethPurchase, cmdOptions) => program_async(this, null, function* () {
|
||||||
const { options, fetchDataOptions: fetchDataOptions2 } = yield getProgramOptions(cmdOptions);
|
const { options, fetchDataOptions: fetchDataOptions2 } = yield getProgramOptions(cmdOptions);
|
||||||
const { rpc, walletWithdrawal } = options;
|
const { rpc, walletWithdrawal } = options;
|
||||||
|
initGroth16();
|
||||||
const deposit = yield Deposit.parseNote(note);
|
const deposit = yield Deposit.parseNote(note);
|
||||||
const { netId, currency, amount, commitmentHex, nullifierHex, nullifier, secret } = deposit;
|
const { netId, currency, amount, commitmentHex, nullifierHex, nullifier, secret } = deposit;
|
||||||
const config = getConfig(netId);
|
const config = getConfig(netId);
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
"@colors/colors": "1.5.0",
|
"@colors/colors": "1.5.0",
|
||||||
"@metamask/eth-sig-util": "^7.0.1",
|
"@metamask/eth-sig-util": "^7.0.1",
|
||||||
"@tornado/contracts": "1.0.0",
|
"@tornado/contracts": "1.0.0",
|
||||||
"@tornado/core": "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#767883f1e74110f899a06ef31899692f101ff54a",
|
"@tornado/core": "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#e7412f3d986f6a89382f444b6fa26e770226643f",
|
||||||
"@tornado/fixed-merkle-tree": "0.7.3",
|
"@tornado/fixed-merkle-tree": "0.7.3",
|
||||||
"@tornado/snarkjs": "0.1.20",
|
"@tornado/snarkjs": "0.1.20",
|
||||||
"@tornado/websnark": "0.0.4",
|
"@tornado/websnark": "0.0.4",
|
||||||
|
@ -81,9 +81,13 @@ import {
|
|||||||
parseRecoveryKey,
|
parseRecoveryKey,
|
||||||
getSupportedInstances,
|
getSupportedInstances,
|
||||||
TreeCache,
|
TreeCache,
|
||||||
|
initGroth16,
|
||||||
} from '@tornado/core';
|
} from '@tornado/core';
|
||||||
import * as packageJson from '../package.json';
|
import * as packageJson from '../package.json';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Static variables, shouldn't be modified by env unless you know what they are doing
|
||||||
|
*/
|
||||||
const DEFAULT_GAS_LIMIT = Number(process.env.DEFAULT_GAS_LIMIT) || 600_000;
|
const DEFAULT_GAS_LIMIT = Number(process.env.DEFAULT_GAS_LIMIT) || 600_000;
|
||||||
|
|
||||||
const RELAYER_NETWORK = Number(process.env.RELAYER_NETWORK) || NetId.MAINNET;
|
const RELAYER_NETWORK = Number(process.env.RELAYER_NETWORK) || NetId.MAINNET;
|
||||||
@ -778,6 +782,9 @@ export function tornadoProgram() {
|
|||||||
const { options, fetchDataOptions } = await getProgramOptions(cmdOptions);
|
const { options, fetchDataOptions } = await getProgramOptions(cmdOptions);
|
||||||
const { rpc, walletWithdrawal } = options;
|
const { rpc, walletWithdrawal } = options;
|
||||||
|
|
||||||
|
// Prepare groth16 in advance
|
||||||
|
initGroth16();
|
||||||
|
|
||||||
const deposit = await Deposit.parseNote(note);
|
const deposit = await Deposit.parseNote(note);
|
||||||
|
|
||||||
const { netId, currency, amount, commitmentHex, nullifierHex, nullifier, secret } = deposit;
|
const { netId, currency, amount, commitmentHex, nullifierHex, nullifier, secret } = deposit;
|
||||||
@ -952,7 +959,9 @@ export function tornadoProgram() {
|
|||||||
}).then(({ relayerClient }) => relayerClient)
|
}).then(({ relayerClient }) => relayerClient)
|
||||||
: undefined,
|
: undefined,
|
||||||
tornadoFeeOracle.fetchL1OptimismFee(),
|
tornadoFeeOracle.fetchL1OptimismFee(),
|
||||||
!isEth ? tokenPriceOracle.fetchPrices([{ tokenAddress: tokenAddress as string, decimals }]).then((p) => p[0]) : BigInt(0),
|
!isEth
|
||||||
|
? tokenPriceOracle.fetchPrices([{ tokenAddress: tokenAddress as string, decimals }]).then((p) => p[0])
|
||||||
|
: BigInt(0),
|
||||||
provider.getFeeData(),
|
provider.getFeeData(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -771,9 +771,9 @@
|
|||||||
"@openzeppelin/contracts-v3" "npm:@openzeppelin/contracts@3.2.0-rc.0"
|
"@openzeppelin/contracts-v3" "npm:@openzeppelin/contracts@3.2.0-rc.0"
|
||||||
ethers "^6.4.0"
|
ethers "^6.4.0"
|
||||||
|
|
||||||
"@tornado/core@git+https://git.tornado.ws/tornadocontrib/tornado-core.git#767883f1e74110f899a06ef31899692f101ff54a":
|
"@tornado/core@git+https://git.tornado.ws/tornadocontrib/tornado-core.git#e7412f3d986f6a89382f444b6fa26e770226643f":
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#767883f1e74110f899a06ef31899692f101ff54a"
|
resolved "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#e7412f3d986f6a89382f444b6fa26e770226643f"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@metamask/eth-sig-util" "^7.0.1"
|
"@metamask/eth-sig-util" "^7.0.1"
|
||||||
"@tornado/contracts" "^1.0.0"
|
"@tornado/contracts" "^1.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user