From cdd88f2ed455f9e737fe9615dabc71f627a9fb73 Mon Sep 17 00:00:00 2001 From: poma Date: Tue, 2 Feb 2021 15:23:09 +0300 Subject: [PATCH] use poseidon compatible with mining --- circuits/BatchTreeUpdate.circom | 15 +-------------- contracts/Greeter.sol | 22 ---------------------- package.json | 2 +- yarn.lock | 19 +++++++++---------- 4 files changed, 11 insertions(+), 47 deletions(-) delete mode 100644 contracts/Greeter.sol diff --git a/circuits/BatchTreeUpdate.circom b/circuits/BatchTreeUpdate.circom index 1bf0539..e12f162 100644 --- a/circuits/BatchTreeUpdate.circom +++ b/circuits/BatchTreeUpdate.circom @@ -74,23 +74,10 @@ template BatchTreeUpdate(levels, batchLevels, zeroBatchLeaf) { // zeroLeaf = keccak256("tornado") % FIELD_SIZE // zeroBatchLeaf is poseidon(zeroLeaf, zeroLeaf) (batchLevels - 1) times -component main = BatchTreeUpdate(20, 2, 18183130938628345667957803100405002905363080101794697711581833408293369315484) +component main = BatchTreeUpdate(20, 2, 21572503925325825116380792768937986743990254033176521064707045559165336555197) // for mainnet use 20, 7, 17278668323652664881420209773995988768195998574629614593395162463145689805534 -/* -circom has new incompatible poseidon. Temp zeroes list for it: //todo change before going to prod -21663839004416932945382355908790599225266501822907911457504978515578255421292 -6558759280185035534262768457043627242000481389071721366452285175835842504378 -18183130938628345667957803100405002905363080101794697711581833408293369315484 -1649420513912702105317807420227791840680436863908773772957989215330544908558 -1519470092809891639075459401377052367516123764590098800258495876383484284269 -11483247544333149638457900649034027061705091890934198553446561731884583952449 -1676192069326199968794155063658499005818740739752078691901135837045539426569 -3691667188955435348598133121052392834370851623525570836101013075316308823822 -1023697156307946028208019788980135577833715295171390138750488664899512032833 -*/ - /* zeros of n-th order: 21663839004416932945382355908790599225266501822907911457504978515578255421292 diff --git a/contracts/Greeter.sol b/contracts/Greeter.sol deleted file mode 100644 index 2f9eafb..0000000 --- a/contracts/Greeter.sol +++ /dev/null @@ -1,22 +0,0 @@ -//SPDX-License-Identifier: MIT -pragma solidity ^0.6.0; - -import "hardhat/console.sol"; - -contract Greeter { - string greeting; - - constructor(string memory _greeting) public { - console.log("Deploying a Greeter with greeting:", _greeting); - greeting = _greeting; - } - - function greet() public view returns (string memory) { - return greeting; - } - - function setGreeting(string memory _greeting) public { - console.log("Changing greeting from '%s' to '%s'", greeting, _greeting); - greeting = _greeting; - } -} diff --git a/package.json b/package.json index c3889ef..f7bc8e3 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "dependencies": { "circom": "^0.5.38", "circom_runtime": "^0.1.12", - "circomlib": "^0.4.1", + "circomlib": "git+https://github.com/tornadocash/circomlib.git#d20d53411d1bef61f38c99a8b36d5d0cc4836aa1", "dotenv": "^8.2.0", "ffiasm": "^0.1.1", "fixed-merkle-tree": "^0.5.0", diff --git a/yarn.lock b/yarn.lock index 85a9ece..dd9dcb4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2253,16 +2253,6 @@ circom_runtime@0.1.8: ffjavascript "0.2.10" fnv-plus "^1.3.1" -circomlib@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/circomlib/-/circomlib-0.4.1.tgz#ada51bec78fbd2602ccecf18ed145296411f20e4" - integrity sha512-e77a7qn+86W39ufQl7alNIbdLQmxtyzAJQhp708xLp3xln4mYM26slxt+jOg731RDDLmpZLpNFuVYAuUvDn9CQ== - dependencies: - blake-hash "^1.1.0" - blake2b "^2.1.3" - circom "0.5.33" - ffjavascript "0.1.0" - "circomlib@git+https://github.com/tornadocash/circomlib.git#5beb6aee94923052faeecea40135d45b6ce6172c": version "0.0.20" resolved "git+https://github.com/tornadocash/circomlib.git#5beb6aee94923052faeecea40135d45b6ce6172c" @@ -2273,6 +2263,15 @@ circomlib@^0.4.1: 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" + class-is@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/class-is/-/class-is-1.1.0.tgz#9d3c0fba0440d211d843cec3dedfa48055005825"