mirror of
https://github.com/tornadocash/tornado-core.git
synced 2024-10-01 01:06:17 -04:00
Merge pull request #33 from tornadocash/circomlib_audit
new circomlib update
This commit is contained in:
commit
0ac236d439
@ -6,7 +6,7 @@ template HashLeftRight() {
|
|||||||
signal input right;
|
signal input right;
|
||||||
signal output hash;
|
signal output hash;
|
||||||
|
|
||||||
component hasher = MiMCSponge(2, 220, 1);
|
component hasher = MiMCSponge(2, 1);
|
||||||
hasher.ins[0] <== left;
|
hasher.ins[0] <== left;
|
||||||
hasher.ins[1] <== right;
|
hasher.ins[1] <== right;
|
||||||
hasher.k <== 0;
|
hasher.k <== 0;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
pragma solidity ^0.5.8;
|
pragma solidity ^0.5.8;
|
||||||
|
|
||||||
library Hasher {
|
library Hasher {
|
||||||
function MiMCSponge(uint256 in_xL, uint256 in_xR, uint256 in_k) public pure returns (uint256 xL, uint256 xR);
|
function MiMCSponge(uint256 in_xL, uint256 in_xR) public pure returns (uint256 xL, uint256 xR);
|
||||||
}
|
}
|
||||||
|
|
||||||
contract MerkleTreeWithHistory {
|
contract MerkleTreeWithHistory {
|
||||||
@ -56,9 +56,9 @@ contract MerkleTreeWithHistory {
|
|||||||
require(uint256(_right) < FIELD_SIZE, "_right should be inside the field");
|
require(uint256(_right) < FIELD_SIZE, "_right should be inside the field");
|
||||||
uint256 R = uint256(_left);
|
uint256 R = uint256(_left);
|
||||||
uint256 C = 0;
|
uint256 C = 0;
|
||||||
(R, C) = Hasher.MiMCSponge(R, C, 0);
|
(R, C) = Hasher.MiMCSponge(R, C);
|
||||||
R = addmod(R, uint256(_right), FIELD_SIZE);
|
R = addmod(R, uint256(_right), FIELD_SIZE);
|
||||||
(R, C) = Hasher.MiMCSponge(R, C, 0);
|
(R, C) = Hasher.MiMCSponge(R, C);
|
||||||
return bytes32(R);
|
return bytes32(R);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,13 +100,13 @@ contract MerkleTreeWithHistory {
|
|||||||
}
|
}
|
||||||
uint32 i = currentRootIndex;
|
uint32 i = currentRootIndex;
|
||||||
do {
|
do {
|
||||||
if (_root == roots[i]) {
|
if (_root == roots[i]) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
i = ROOT_HISTORY_SIZE;
|
i = ROOT_HISTORY_SIZE;
|
||||||
}
|
}
|
||||||
i--;
|
i--;
|
||||||
} while (i != currentRootIndex);
|
} while (i != currentRootIndex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
112
package-lock.json
generated
112
package-lock.json
generated
@ -1687,122 +1687,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"circomlib": {
|
"circomlib": {
|
||||||
"version": "0.0.19",
|
"version": "git+https://github.com/tornadocash/circomlib.git#347822604996bf25f659f96ee0f02810a1f71bb0",
|
||||||
"resolved": "https://registry.npmjs.org/circomlib/-/circomlib-0.0.19.tgz",
|
"from": "git+https://github.com/tornadocash/circomlib.git#347822604996bf25f659f96ee0f02810a1f71bb0",
|
||||||
"integrity": "sha512-0Jei/2BplQM/XFx3lC8+kcaSCxKHhE3w1MrjfWCFSTyT+VRRbBwHH1Kd7HYqYsQ4XMJELIEHmIhtQnKpC9Rr5w==",
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"blake-hash": "^1.1.0",
|
"blake-hash": "^1.1.0",
|
||||||
"blake2b": "^2.1.3",
|
"blake2b": "^2.1.3",
|
||||||
"snarkjs": "^0.1.20",
|
"snarkjs": "^0.1.20",
|
||||||
"typedarray-to-buffer": "^3.1.5",
|
"typedarray-to-buffer": "^3.1.5",
|
||||||
"web3": "^1.0.0-beta.55"
|
"web3": "^1.0.0-beta.55"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-regex": {
|
|
||||||
"version": "3.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
|
|
||||||
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg="
|
|
||||||
},
|
|
||||||
"ansi-styles": {
|
|
||||||
"version": "3.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
|
||||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
|
||||||
"requires": {
|
|
||||||
"color-convert": "^1.9.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"chalk": {
|
|
||||||
"version": "2.4.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
|
||||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
|
||||||
"requires": {
|
|
||||||
"ansi-styles": "^3.2.1",
|
|
||||||
"escape-string-regexp": "^1.0.5",
|
|
||||||
"supports-color": "^5.3.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"eslint": {
|
|
||||||
"version": "5.16.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-5.16.0.tgz",
|
|
||||||
"integrity": "sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==",
|
|
||||||
"requires": {
|
|
||||||
"@babel/code-frame": "^7.0.0",
|
|
||||||
"ajv": "^6.9.1",
|
|
||||||
"chalk": "^2.1.0",
|
|
||||||
"cross-spawn": "^6.0.5",
|
|
||||||
"debug": "^4.0.1",
|
|
||||||
"doctrine": "^3.0.0",
|
|
||||||
"eslint-scope": "^4.0.3",
|
|
||||||
"eslint-utils": "^1.3.1",
|
|
||||||
"eslint-visitor-keys": "^1.0.0",
|
|
||||||
"espree": "^5.0.1",
|
|
||||||
"esquery": "^1.0.1",
|
|
||||||
"esutils": "^2.0.2",
|
|
||||||
"file-entry-cache": "^5.0.1",
|
|
||||||
"functional-red-black-tree": "^1.0.1",
|
|
||||||
"glob": "^7.1.2",
|
|
||||||
"globals": "^11.7.0",
|
|
||||||
"ignore": "^4.0.6",
|
|
||||||
"import-fresh": "^3.0.0",
|
|
||||||
"imurmurhash": "^0.1.4",
|
|
||||||
"inquirer": "^6.2.2",
|
|
||||||
"js-yaml": "^3.13.0",
|
|
||||||
"json-stable-stringify-without-jsonify": "^1.0.1",
|
|
||||||
"levn": "^0.3.0",
|
|
||||||
"lodash": "^4.17.11",
|
|
||||||
"minimatch": "^3.0.4",
|
|
||||||
"mkdirp": "^0.5.1",
|
|
||||||
"natural-compare": "^1.4.0",
|
|
||||||
"optionator": "^0.8.2",
|
|
||||||
"path-is-inside": "^1.0.2",
|
|
||||||
"progress": "^2.0.0",
|
|
||||||
"regexpp": "^2.0.1",
|
|
||||||
"semver": "^5.5.1",
|
|
||||||
"strip-ansi": "^4.0.0",
|
|
||||||
"strip-json-comments": "^2.0.1",
|
|
||||||
"table": "^5.2.3",
|
|
||||||
"text-table": "^0.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"globals": {
|
|
||||||
"version": "11.12.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
|
|
||||||
"integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="
|
|
||||||
},
|
|
||||||
"semver": {
|
|
||||||
"version": "5.7.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
|
||||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
|
|
||||||
},
|
|
||||||
"snarkjs": {
|
|
||||||
"version": "0.1.20",
|
|
||||||
"resolved": "https://registry.npmjs.org/snarkjs/-/snarkjs-0.1.20.tgz",
|
|
||||||
"integrity": "sha512-tYmWiVm1sZiB44aIh5w/3HUaTntTUC4fv+CWs4rR0gfkt2KbHTpArOqZW++/Lxujrn9IypXVhdKVUr/eE6Hxfg==",
|
|
||||||
"requires": {
|
|
||||||
"big-integer": "^1.6.43",
|
|
||||||
"chai": "^4.2.0",
|
|
||||||
"escape-string-regexp": "^1.0.5",
|
|
||||||
"eslint": "^5.16.0",
|
|
||||||
"keccak": "^2.0.0",
|
|
||||||
"yargs": "^12.0.5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"strip-ansi": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
|
|
||||||
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
|
|
||||||
"requires": {
|
|
||||||
"ansi-regex": "^3.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"supports-color": {
|
|
||||||
"version": "5.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
|
||||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
|
||||||
"requires": {
|
|
||||||
"has-flag": "^3.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cli-cursor": {
|
"cli-cursor": {
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"circom": "0.0.34",
|
"circom": "0.0.34",
|
||||||
"circomlib": "^0.0.19",
|
"circomlib": "git+https://github.com/tornadocash/circomlib.git#347822604996bf25f659f96ee0f02810a1f71bb0",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
"eslint": "^6.6.0",
|
"eslint": "^6.6.0",
|
||||||
"ganache-cli": "^6.7.0",
|
"ganache-cli": "^6.7.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user