commit 6006120e60aaccab9ada135858f979e92c67324b Author: T-Hax <> Date: Wed May 3 20:35:27 2023 +0000 Set up monorepo Signed-off-by: T-Hax <> diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1ed453a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +[*.{js,json,yml}] +charset = utf-8 +indent_style = space +indent_size = 2 diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..517cbd3 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +export GITEA_AUTH_TOKEN= \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..af3ad12 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +/.yarn/** linguist-vendored +/.yarn/releases/* binary +/.yarn/plugins/**/* binary +/.pnp.* binary linguist-generated diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..24e7279 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# NOT using zero installs + +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions + +# Environment + +.env + +# node modules + +node_modules \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..06dd640 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "arcanis.vscode-zipfs" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2dfa944 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "typescript.tsdk": "node_modules/typescript/lib", + "search.exclude": { + "**/.yarn": true, + "**/.pnp.*": true + } +} diff --git a/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs b/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs new file mode 100644 index 0000000..4e89c7c Binary files /dev/null and b/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs differ diff --git a/.yarn/sdks/integrations.yml b/.yarn/sdks/integrations.yml new file mode 100644 index 0000000..aa9d0d0 --- /dev/null +++ b/.yarn/sdks/integrations.yml @@ -0,0 +1,5 @@ +# This file is automatically generated by @yarnpkg/sdks. +# Manual changes might be lost! + +integrations: + - vscode diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000..df9c669 --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1,31 @@ +# So basically, we want to selectively download packages from the Gitea repository but still allow the +# main repositories, so we are going to have to scope our packages properly. +npmScopes: + tornado: + # The @tornado scope can just be set to the right registry by editing the T-Hax here. + # I could even make it an env var but it seems too much, that is for secrets. + npmPublishRegistry: "https://development.tornadocash.community/api/packages/T-Hax/npm/" + npmRegistryServer: "https://development.tornadocash.community/api/packages/T-Hax/npm/" + # The below can be EXPORTED via some env file which actually exports the variables though + # Check the env.example, you will notice it's not a regular env + # So split your env files up, since this is only for manual actions + npmAuthToken: ${GITEA_AUTH_TOKEN} + +# If the following isn't set you won't have a node_modules folder +# You might be used to a node_modules folder instead of a pnp or other folder type +# If you want to use the new linkers uncomment or change the following +nodeLinker: "node-modules" + +# So the tornadocash org, the person who maintains it, might setup something (in future) like, +# tornadocash: +# npmPublishRegistry: "https://development.tornadocash.community/api/packages/tornadocash/npm/" +# npmRegistryServer: "https://development.tornadocash.community/api/packages/tornadocash/npm/" + +# We disable telemetry for obvious reasons. enableTelemetry: false +enableTelemetry: false + +plugins: + - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs + spec: "@yarnpkg/plugin-workspace-tools" + +npmPublishAccess: public diff --git a/@tornado/circomlib/.gitignore b/@tornado/circomlib/.gitignore new file mode 100644 index 0000000..5587e20 --- /dev/null +++ b/@tornado/circomlib/.gitignore @@ -0,0 +1,74 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# next.js build output +.next + +tmp + +.DS_Store + +# yarn v3 +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions \ No newline at end of file diff --git a/@tornado/circomlib/README.md b/@tornado/circomlib/README.md new file mode 100644 index 0000000..68e306a --- /dev/null +++ b/@tornado/circomlib/README.md @@ -0,0 +1,21 @@ +# @T-Hax/circomlib + +This repository serves to configure the equivalent Tornado Cash repository for npm publishing. Below the rest of the description. + +# CircomLib + +## Description + +- This repository contains a library of circuit templates. +- All files are copyrighted under 2018 0KIMS association and part of the free software [circom](https://github.com/iden3/circom) (Zero Knowledge Circuit Compiler). + +## Organisation + +This respository contains 5 folders: +- `circuits`: it contains the implementation of different cryptographic primitives in circom language. +- `calcpedersenbases`: set of functions in JavaScript used to find a set of points in [Baby Jubjub](https://github.com/barryWhiteHat/baby_jubjub) elliptic curve that serve as basis for the [Pedersen Hash](https://github.com/zcash/zcash/issues/2234). +- `doc`: it contains some circuit schemes in ASCII (must be opened with Monodraw, an ASCII art editor for Mac). +- `src`: it contains similar implementation of circuits in JavaScript. +- `test`: tests. + +A description of the specific circuit templates for the `circuit` folder will be soon updated. \ No newline at end of file diff --git a/@tornado/circomlib/calcpedersenbases/calcpedersenbases.js b/@tornado/circomlib/calcpedersenbases/calcpedersenbases.js new file mode 100644 index 0000000..0008a9d --- /dev/null +++ b/@tornado/circomlib/calcpedersenbases/calcpedersenbases.js @@ -0,0 +1,83 @@ +const bn128 = require("snarkjs").bn128; +const bigInt = require("snarkjs").bigInt; +const createBlakeHash = require("blake-hash"); +const babyJub = require("../src/babyjub"); + +function getPoint(S) { + const F = bn128.Fr; + const h = createBlakeHash("blake256").update(S).digest(); + + if (h.length != 32) { + throw new Error("Invalid length") + } + + let sign = false; + if (h[31] & 0x80) { + h[31] = h[31] & 0x7F; + sign = true; + } + + let y = bigInt(0); + for (let i=0; i<32; i++) { + y = y.shl(8); + y = y.add(bigInt(h[i])); + } + + const a = bigInt("168700"); + const d = bigInt("168696"); + + const y2 = F.square(y); + + let x = F.sqrt(F.div( + F.sub(F.one, y2), + F.sub(a, F.mul(d, y2)))); + + if (x == null) return null; + + if (sign) x = F.neg(x); + + const p = [bn128.Fr.affine(x), bn128.Fr.affine(y)]; + + const p8 = babyJub.mulPointEscalar(p, 8); + + return p8; +} + + +function generatePoint(S) { + let p= null; + let idx = 0; + while (p==null) { + let sidx = "" + idx; + while (sidx.length<16) sidx = "0"+sidx; + p = getPoint(S+"_"+sidx); + idx++; + } + if (!babyJub.inCurve(p)){ + throw new Error("Point not in curve"); + } + return p; +} + + + + + +const g = [ + bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"), + bigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203")]; + +// Sanity check +if (!babyJub.inCurve(g)) { + throw new Error("Generator not In curve -> Some thing goes wrong..."); +} + +for (let i=0; i<25; i++) { + let S = "" +i; + while (S.length<16) S = "0"+S; + const P = generatePoint("Iden3_PedersenGenerator_"+S); + console.log(`[${P[0].toString()}, ${P[1].toString()}]`); +} + + + diff --git a/@tornado/circomlib/circuits/README.md b/@tornado/circomlib/circuits/README.md new file mode 100644 index 0000000..afd4a1f --- /dev/null +++ b/@tornado/circomlib/circuits/README.md @@ -0,0 +1,830 @@ +# CircomLib/Circuits + +## Description + +- This folder contains circuit templates for standard operations and many cryptographic primitives. +- Below you can find specifications of each function. In the representation of elements, there are three tyes: + - Binary + - String + - Field element (the field is specified in each case. We consider 2 possible fields: Fp and Fr, where p... and r... .) + +## Table of Contents + +[TOC] + +## Jordi + +* compconstant - Returns 1 if `in` (expanded to binary array) > `ct` +* aliascheck - check if `in` (expanded to binary array) oveflowed its 254 bits (<= -1) +* babyjub - twisted Edwards curve 168700.x^2 + y^2 = 1 + 168696.x^2.y^2 + * BabyAdd - (`xout`,`yout`) = (`x1`,`y1`) + (`x2`,`y2`) + * BabyDbl - (`xout`,`yout`) = 2*(`x`,`y`) + * BabyCheck - check that (`x`,`y`) is on the curve +* binsub - binary subtraction +* gates - logical gates +* mimc - SNARK-friendly hash Minimal Multiplicative Complexity. + * https://eprint.iacr.org/2016/492.pdf + * zcash/zcash#2233 +* smt - Sparse Merkle Tree + * https://ethresear.ch/t/optimizing-sparse-merkle-trees/3751 +* montgomery https://en.wikipedia.org/wiki/Montgomery_curve + +## Circuits + +### sha256 + +Folder containing the implementation of sha256 hash circuit. + +### smt + +Folder containing the circuit implementation of Sparse Merkle Trees. + +### aliascheck + +- `AliasCheck()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### babyjub + +Arithmetic on [Baby Jubjub elliptic curve](https://github.com/barryWhiteHat/baby_jubjub) in twisted Edwards form. (TODO: Expose here the characteristics of the curve?) + + +- `BabyAdd()` + + - DESCRIPTION + + It adds two points on the Baby Jubjub curve. More specifically, given two points P1 = (`x1`, `y1`) and P2 = (`x2`, `y2`) it returns a point P3 = (`xout`, `yout`) such that + + (`xout`, `yout`) = (`x1`,`y1`) + (`x2`,`y2`) + = ((`x1y2`+`y1x2`)/(1+`dx1x2y1y2`)),(`y1y2`-`ax1x2`)/(1-`dx1x2y1y2`)) + + - SCHEMA + ``` + var a var d + | | + | | + ______v_________v_______ + input x1 ----> | | + input y1 ----> | BabyAdd() | ----> output xout + input x2 ----> | | ----> output yout + input y2 ----> |________________________| + ``` + + - INPUTS + + | Input | Representation | Description | | + | ------------- | ------------- | ------------- | ------------- | + | `x1` | Bigint | Field element of Fp | First coordinate of a point (x1, y1) on E. | + | `y1` | Bigint | Field element of Fp | Second coordinate of a point (x1, y1) on E. | + | `x2` | Bigint | Field element of Fp | First coordinate of a point (x2, y2) on E. | + | `y2` | Bigint | Field element of Fp | Second coordinate of a point (x2, y2) on E. | + + Requirement: at least `x1`!=`x2` or `y1`!=`y2`. + + - OUTPUT + + | Input | Representation | Description | | + | ------------- | ------------- | ------------- | ------------- | + | `xout` | Bigint | Field element of Fp | First coordinate of the addition point (xout, yout) = (x1, y1) + (x2, y2). | + | `yout` | Bigint | Field element of Fp | Second coordinate of the addition point (xout, yout) = (x1, y1) + (x2, y2). | + + - BENCHMARKS (constraints) + + - EXAMPLE + +- `BabyDbl()` + - DESCRIPTION : doubles a point (`xout`,`yout`) = 2*(`x`,`y`). + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `BabyCheck()` + + - DESCRIPTION : checks if a given point is in the curve. + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `BabyPbk()` + + - DESCRIPTION: : given a private key, it returns the associated public key. + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + + +### binsub + +- `BinSub(n)` + + - DESCRIPTION: binary substraction. + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### binsum + +- `nbits(a)` + + - DESCRIPTION : binary sum. + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `BinSum(n, ops)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### bitify + +- `Num2Bits()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Num2Bits_strict()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Bits2Num()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Bits2Num_strict()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Num2BitsNeg()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### comparators + +- `IsZero() ` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `IsEqual()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `ForceEqualIfEnabled()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `LessThan()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `GreaterThan()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `GreaterEqThan()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### compconstant + +- `CompConstant(ct)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### eddsa + +Edwards Digital Signature Algorithm in Baby Jubjbub (link a eddsa) + +- `EdDSAVerifier(n)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### eddsamimc + +- `EdDSAMiMCVerifier()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### eddsamimcsponge + +- `EdDSAMiMCSpongeVerifier()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### eddsaposeidon + +- `EdDSAPoseidonVerifier()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### escalarmul + +- `EscalarMulWindow(base, k)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `EscalarMul(n, base)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### escalarmulany + +- `Multiplexor2()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `BitElementMulAny()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `SegmentMulAny(n)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `EscalarMulAny(n)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### escalarmulfix + +- `WindowMulFix()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `SegmentMulFix(nWindows)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `EscalarMulFix(n, BASE)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### escalarmulw4table + +- `pointAdd` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `EscalarMulW4Table` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### gates + +- `XOR` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `AND` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `OR` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `NOT` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `NAND` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `NOR` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `MultiAND` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### mimc + +Implementation of MiMC-7 hash in Fp being... (link to description of the hash) + +- `MiMC7(nrounds)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `MultiMiMC7(nInputs, nRounds)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### mimcsponge + +- `MiMCSponge(nInputs, nOutputs)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `MiMCFeistel(nrounds)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### montgomery + +- `Edwards2Montgomery()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Montgomery2Edwards()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `MontgomeryAdd()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `MontgomeryDouble()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### multiplexer + +- `log2(a)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `EscalarProduct(w)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Decoder(w)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Multiplexer(wIn, nIn)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### mux1 + +- `MultiMux1(n)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Mux1()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### mux2 + +- `MultiMux2(n)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Mux2()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### mux3 + +- `MultiMux3(n)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Mux3()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### mux4 + +- `MultiMux4(n)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Mux4()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### pedersen_old + +Old version of the Pedersen hash (do not use any +more?). + +### pedersen + +- `Window4()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Segment(nWindows)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Pedersen(n)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### pointbits + +- `sqrt(n)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Bits2Point()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Bits2Point_Strict()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Point2Bits` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Point2Bits_Strict` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### poseidon + +Implementation of Poseidon hash function (LINK) + +- `Sigma()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Ark(t, C)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Mix(t, M)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +- `Poseidon(nInputs, t, nRoundsF, nRoundsP)` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### sign + +- `Sign()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE + +### switcher + +- `Switcher()` + + - DESCRIPTION + - SCHEMA + - INPUT + - OUTPUT + - BENCHMARKS + - EXAMPLE diff --git a/@tornado/circomlib/circuits/aliascheck.circom b/@tornado/circomlib/circuits/aliascheck.circom new file mode 100644 index 0000000..a5e8fb7 --- /dev/null +++ b/@tornado/circomlib/circuits/aliascheck.circom @@ -0,0 +1,43 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "compconstant.circom"; + + +template AliasCheck() { + signal input in[254]; + + component compConstant = CompConstant(-1); + + for (var i=0; i<254; i++) in[i] ==> compConstant.in[i]; + + compConstant.out === 0; +} + +template AliasCheckBabyJub() { + signal input in[251]; + signal input enabled; + + component compConstant = CompConstant(2736030358979909402780800718157159386076813972158567259200215660948447373040); + + for (var i=0; i<251; i++) in[i] ==> compConstant.in[i]; + for (var i=0; i<3; i++) 0 ==> compConstant.in[251+i]; + + compConstant.out*enabled === 0; +} diff --git a/@tornado/circomlib/circuits/babyjub.circom b/@tornado/circomlib/circuits/babyjub.circom new file mode 100644 index 0000000..a9c0432 --- /dev/null +++ b/@tornado/circomlib/circuits/babyjub.circom @@ -0,0 +1,106 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "bitify.circom"; +include "escalarmulfix.circom"; + +template BabyAdd() { + signal input x1; + signal input y1; + signal input x2; + signal input y2; + signal output xout; + signal output yout; + + signal beta; + signal gamma; + signal delta; + signal tau; + + var a = 168700; + var d = 168696; + + beta <== x1*y2; + gamma <== y1*x2; + delta <== (-a*x1+y1)*(x2 + y2); + tau <== beta * gamma; + + xout <-- (beta + gamma) / (1+ d*tau); + (1+ d*tau) * xout === (beta + gamma); + + yout <-- (delta + a*beta - gamma) / (1-d*tau); + (1-d*tau)*yout === (delta + a*beta - gamma); +} + +template BabyDbl() { + signal input x; + signal input y; + signal output xout; + signal output yout; + + component adder = BabyAdd(); + adder.x1 <== x; + adder.y1 <== y; + adder.x2 <== x; + adder.y2 <== y; + + adder.xout ==> xout; + adder.yout ==> yout; +} + + +template BabyCheck() { + signal input x; + signal input y; + + signal x2; + signal y2; + + var a = 168700; + var d = 168696; + + x2 <== x*x; + y2 <== y*y; + + a*x2 + y2 === 1 + d*x2*y2; +} + +// Extracts the public key from private key, as mentioned in https://tools.ietf.org/html/rfc8032 +template BabyPbk() { + signal private input in; + signal output Ax; + signal output Ay; + + var BASE8 = [ + 5299619240641551281634865583518297030282874472190772894086521144482721001553, + 16950150798460657717958625567821834550301663161624707787222815936182638968203 + ]; + + component pvkBits = Num2Bits(253); + pvkBits.in <== in; + + component mulFix = EscalarMulFix(253, BASE8); + + var i; + for (i=0; i<253; i++) { + mulFix.e[i] <== pvkBits.out[i]; + } + Ax <== mulFix.out[0]; + Ay <== mulFix.out[1]; +} diff --git a/@tornado/circomlib/circuits/binsub.circom b/@tornado/circomlib/circuits/binsub.circom new file mode 100644 index 0000000..ec52d83 --- /dev/null +++ b/@tornado/circomlib/circuits/binsub.circom @@ -0,0 +1,71 @@ + /* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +/* +This component creates a binary substraction. + + +Main Constraint: + (in[0][0] * 2^0 + in[0][1] * 2^1 + ..... + in[0][n-1] * 2^(n-1)) + + + 2^n + - (in[1][0] * 2^0 + in[1][1] * 2^1 + ..... + in[1][n-1] * 2^(n-1)) + === + out[0] * 2^0 + out[1] * 2^1 + + out[n-1] *2^(n-1) + aux + + + out[0] * (out[0] - 1) === 0 + out[1] * (out[0] - 1) === 0 + . + . + . + out[n-1] * (out[n-1] - 1) === 0 + aux * (aux-1) == 0 + +*/ + +template BinSub(n) { + signal input in[2][n]; + signal output out[n]; + + signal aux; + + var lin = 2**n; + var lout = 0; + + for (var i=0; i> i) & 1; + + // Ensure out is binary + out[i] * (out[i] - 1) === 0; + + lout = lout + out[i]*(2**i); + } + + aux <-- (lin >> n) & 1; + aux*(aux-1) === 0; + lout = lout + aux*(2**n); + + // Ensure the sum; + lin === lout; +} diff --git a/@tornado/circomlib/circuits/binsum.circom b/@tornado/circomlib/circuits/binsum.circom new file mode 100644 index 0000000..34b561f --- /dev/null +++ b/@tornado/circomlib/circuits/binsum.circom @@ -0,0 +1,95 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +/* + +Binary Sum +========== + +This component creates a binary sum componet of ops operands and n bits each operand. + +e is Number of carries: Depends on the number of operands in the input. + +Main Constraint: + in[0][0] * 2^0 + in[0][1] * 2^1 + ..... + in[0][n-1] * 2^(n-1) + + + in[1][0] * 2^0 + in[1][1] * 2^1 + ..... + in[1][n-1] * 2^(n-1) + + + .. + + in[ops-1][0] * 2^0 + in[ops-1][1] * 2^1 + ..... + in[ops-1][n-1] * 2^(n-1) + + === + out[0] * 2^0 + out[1] * 2^1 + + out[n+e-1] *2(n+e-1) + +To waranty binary outputs: + + out[0] * (out[0] - 1) === 0 + out[1] * (out[0] - 1) === 0 + . + . + . + out[n+e-1] * (out[n+e-1] - 1) == 0 + + */ + + +/* + This function calculates the number of extra bits in the output to do the full sum. + */ + +/* a must be < Nq/2, where Nq is the number of elements in the scalar field */ +function nbits(a) { + var n = 1; + var r = 0; + while (n-1> k) & 1; + + // Ensure out is binary + out[k] * (out[k] - 1) === 0; + + lout += out[k] * 2**k; + } + + // Ensure the sum; + + lin === lout; +} diff --git a/@tornado/circomlib/circuits/bitify.circom b/@tornado/circomlib/circuits/bitify.circom new file mode 100644 index 0000000..470e0c8 --- /dev/null +++ b/@tornado/circomlib/circuits/bitify.circom @@ -0,0 +1,103 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "comparators.circom"; +include "aliascheck.circom"; + + +/* This doesn't check aliasing, so for n > 253 there are multiple bit strings for each number */ +template Num2Bits(n) { + signal input in; + signal output out[n]; + var lc1=0; + + for (var i = 0; i> i) & 1; + out[i] * (out[i] -1 ) === 0; + lc1 += out[i] * 2**i; + } + + lc1 === in; +} + +template Num2Bits_strict() { + signal input in; + signal output out[254]; + + component aliasCheck = AliasCheck(); + component n2b = Num2Bits(254); + in ==> n2b.in; + + for (var i=0; i<254; i++) { + n2b.out[i] ==> out[i]; + n2b.out[i] ==> aliasCheck.in[i]; + } +} + +template Bits2Num(n) { + signal input in[n]; + signal output out; + var lc1=0; + + for (var i = 0; i out; +} + +template Bits2Num_strict() { + signal input in[n]; + signal output out; + + component aliasCheck = AliasCheck(); + component b2n = Bits2Num(254); + + for (var i=0; i<254; i++) { + in[i] ==> b2n.in[i]; + in[i] ==> aliasCheck.in[i]; + } + + b2n.out ==> out; +} + +/* n must not exceed 253 */ +template Num2BitsNeg(n) { + signal input in; + signal output out[n]; + var lc1=0; + + component isZero; + + isZero = IsZero(); + + var neg = n == 0 ? 0 : 2**n - in; + + for (var i = 0; i> i) & 1; + out[i] * (out[i] -1 ) === 0; + lc1 += out[i] * 2**i; + } + + in ==> isZero.in; + + + + lc1 + isZero.out * 2**n === 2**n - in; +} diff --git a/@tornado/circomlib/circuits/comparators.circom b/@tornado/circomlib/circuits/comparators.circom new file mode 100644 index 0000000..3eaa3d8 --- /dev/null +++ b/@tornado/circomlib/circuits/comparators.circom @@ -0,0 +1,139 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "bitify.circom"; +include "binsum.circom"; + +template IsZero() { + signal input in; + signal output out; + + signal inv; + + inv <-- in!=0 ? 1/in : 0; + + out <== -in*inv +1; + in*out === 0; +} + + +template IsEqual() { + signal input in[2]; + signal output out; + + component isz = IsZero(); + + in[1] - in[0] ==> isz.in; + + isz.out ==> out; +} + +template ForceEqualIfEnabled() { + signal input enabled; + signal input in[2]; + + component isz = IsZero(); + + in[1] - in[0] ==> isz.in; + + (1 - isz.out)*enabled === 0; +} + +/* +// N is the number of bits the input have. +// The MSF is the sign bit. +template LessThan(n) { + signal input in[2]; + signal output out; + + component num2Bits0; + component num2Bits1; + + component adder; + + adder = BinSum(n, 2); + + num2Bits0 = Num2Bits(n); + num2Bits1 = Num2BitsNeg(n); + + in[0] ==> num2Bits0.in; + in[1] ==> num2Bits1.in; + + var i; + for (i=0;i adder.in[0][i]; + num2Bits1.out[i] ==> adder.in[1][i]; + } + + adder.out[n-1] ==> out; +} +*/ + +template LessThan(n) { + signal input in[2]; + signal output out; + + component n2b = Num2Bits(n*2+1); + + n2b.in <== in[0]+ (1< out; +} + +// N is the number of bits the input have. +// The MSF is the sign bit. +template GreaterThan(n) { + signal input in[2]; + signal output out; + + component lt = LessThan(n); + + lt.in[0] <== in[1]; + lt.in[1] <== in[0]; + lt.out ==> out; +} + +// N is the number of bits the input have. +// The MSF is the sign bit. +template GreaterEqThan(n) { + signal input in[2]; + signal output out; + + component lt = LessThan(n); + + lt.in[0] <== in[1]; + lt.in[1] <== in[0]+1; + lt.out ==> out; +} + diff --git a/@tornado/circomlib/circuits/compconstant.circom b/@tornado/circomlib/circuits/compconstant.circom new file mode 100644 index 0000000..96a6f1b --- /dev/null +++ b/@tornado/circomlib/circuits/compconstant.circom @@ -0,0 +1,74 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "bitify.circom"; + +// Returns 1 if in (in binary) > ct + +template CompConstant(ct) { + signal input in[254]; + signal output out; + + signal parts[127]; + signal sout; + + var clsb; + var cmsb; + var slsb; + var smsb; + + var sum=0; + + var b = (1 << 128) -1; + var a = 1; + var e = 1; + var i; + + for (i=0;i<127; i++) { + clsb = (ct >> (i*2)) & 1; + cmsb = (ct >> (i*2+1)) & 1; + slsb = in[i*2]; + smsb = in[i*2+1]; + + + if ((cmsb==0)&(clsb==0)) { + parts[i] <== -b*smsb*slsb + b*smsb + b*slsb; + } else if ((cmsb==0)&(clsb==1)) { + parts[i] <== a*smsb*slsb - a*slsb + b*smsb - a*smsb + a; + } else if ((cmsb==1)&(clsb==0)) { + parts[i] <== b*smsb*slsb - a*smsb + a; + } else { + parts[i] <== -a*smsb*slsb + a; + } + + sum = sum + parts[i]; + + b = b -e; + a = a +e; + e = e*2; + } + + sout <== sum; + + component num2bits = Num2Bits(135); + + num2bits.in <== sout; + + out <== num2bits.out[127]; +} diff --git a/@tornado/circomlib/circuits/eddsa.circom b/@tornado/circomlib/circuits/eddsa.circom new file mode 100644 index 0000000..93cfbe6 --- /dev/null +++ b/@tornado/circomlib/circuits/eddsa.circom @@ -0,0 +1,141 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "aliascheck.circom"; +include "pointbits.circom"; +include "pedersen.circom"; +include "escalarmulany.circom"; +include "escalarmulfix.circom"; + +template EdDSAVerifier(n) { + signal input msg[n]; + + signal input A[256]; + signal input R8[256]; + signal input S[256]; + + signal Ax; + signal Ay; + + signal R8x; + signal R8y; + + var i; + +// Ensure S aliasCheck.in[i]; + } + S[251] === 0; + S[252] === 0; + S[253] === 0; + S[254] === 0; + S[255] === 0; + +// Convert A to Field elements (And verify A) + + component bits2pointA = Bits2Point_Strict(); + + for (i=0; i<256; i++) { + bits2pointA.in[i] <== A[i]; + } + Ax <== bits2pointA.out[0]; + Ay <== bits2pointA.out[1]; + +// Convert R8 to Field elements (And verify R8) + + component bits2pointR8 = Bits2Point_Strict(); + + for (i=0; i<256; i++) { + bits2pointR8.in[i] <== R8[i]; + } + R8x <== bits2pointR8.out[0]; + R8y <== bits2pointR8.out[1]; + +// Calculate the h = H(R,A, msg) + + component hash = Pedersen(512+n); + + for (i=0; i<256; i++) { + hash.in[i] <== R8[i]; + hash.in[256+i] <== A[i]; + } + for (i=0; i. +*/ + +include "aliascheck.circom"; +include "pointbits.circom"; +include "mimc.circom"; +include "bitify.circom"; +include "escalarmulany.circom"; +include "escalarmulfix.circom"; + +template EdDSAMiMCVerifier() { + signal input enabled; + signal input Ax; + signal input Ay; + + signal input S; + signal input R8x; + signal input R8y; + + signal input M; + + var i; + +// Ensure S aliasCheck.in[i]; + } + +// Calculate the h = H(R,A, msg) + + component hash = MultiMiMC7(5, 91); + hash.in[0] <== R8x; + hash.in[1] <== R8y; + hash.in[2] <== Ax; + hash.in[3] <== Ay; + hash.in[4] <== M; + hash.k <== 0; + + component h2bits = Num2Bits_strict(); + h2bits.in <== hash.out; + +// Calculate second part of the right side: right2 = h*8*A + + // Multiply by 8 by adding it 3 times. This also ensure that the result is in + // the subgroup. + component dbl1 = BabyDbl(); + dbl1.x <== Ax; + dbl1.y <== Ay; + component dbl2 = BabyDbl(); + dbl2.x <== dbl1.xout; + dbl2.y <== dbl1.yout; + component dbl3 = BabyDbl(); + dbl3.x <== dbl2.xout; + dbl3.y <== dbl2.yout; + + // We check that A is not zero. + component isZero = IsZero(); + isZero.in <== dbl3.x; + isZero.out === 0; + + component mulAny = EscalarMulAny(254); + for (i=0; i<254; i++) { + mulAny.e[i] <== h2bits.out[i]; + } + mulAny.p[0] <== dbl3.xout; + mulAny.p[1] <== dbl3.yout; + + +// Compute the right side: right = R8 + right2 + + component addRight = BabyAdd(); + addRight.x1 <== R8x; + addRight.y1 <== R8y; + addRight.x2 <== mulAny.out[0]; + addRight.y2 <== mulAny.out[1]; + +// Calculate left side of equation left = S*B8 + + var BASE8 = [ + 5299619240641551281634865583518297030282874472190772894086521144482721001553, + 16950150798460657717958625567821834550301663161624707787222815936182638968203 + ]; + component mulFix = EscalarMulFix(251, BASE8); + for (i=0; i<251; i++) { + mulFix.e[i] <== snum2bits.out[i]; + } + +// Do the comparation left == right if enabled; + + component eqCheckX = ForceEqualIfEnabled(); + eqCheckX.enabled <== enabled; + eqCheckX.in[0] <== mulFix.out[0]; + eqCheckX.in[1] <== addRight.xout; + + component eqCheckY = ForceEqualIfEnabled(); + eqCheckY.enabled <== enabled; + eqCheckY.in[0] <== mulFix.out[1]; + eqCheckY.in[1] <== addRight.yout; +} diff --git a/@tornado/circomlib/circuits/eddsamimcsponge.circom b/@tornado/circomlib/circuits/eddsamimcsponge.circom new file mode 100644 index 0000000..ffa22a5 --- /dev/null +++ b/@tornado/circomlib/circuits/eddsamimcsponge.circom @@ -0,0 +1,122 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "aliascheck.circom"; +include "pointbits.circom"; +include "mimcsponge.circom"; +include "bitify.circom"; +include "escalarmulany.circom"; +include "escalarmulfix.circom"; + +template EdDSAMiMCSpongeVerifier() { + signal input enabled; + signal input Ax; + signal input Ay; + + signal input S; + signal input R8x; + signal input R8y; + + signal input M; + + var i; + +// Ensure S aliasCheck.in[i]; + } + +// Calculate the h = H(R,A, msg) + + component hash = MiMCSponge(5, 1); + hash.ins[0] <== R8x; + hash.ins[1] <== R8y; + hash.ins[2] <== Ax; + hash.ins[3] <== Ay; + hash.ins[4] <== M; + hash.k <== 0; + + component h2bits = Num2Bits_strict(); + h2bits.in <== hash.outs[0]; + +// Calculate second part of the right side: right2 = h*8*A + + // Multiply by 8 by adding it 3 times. This also ensure that the result is in + // the subgroup. + component dbl1 = BabyDbl(); + dbl1.x <== Ax; + dbl1.y <== Ay; + component dbl2 = BabyDbl(); + dbl2.x <== dbl1.xout; + dbl2.y <== dbl1.yout; + component dbl3 = BabyDbl(); + dbl3.x <== dbl2.xout; + dbl3.y <== dbl2.yout; + + // We check that A is not zero. + component isZero = IsZero(); + isZero.in <== dbl3.x; + isZero.out === 0; + + component mulAny = EscalarMulAny(254); + for (i=0; i<254; i++) { + mulAny.e[i] <== h2bits.out[i]; + } + mulAny.p[0] <== dbl3.xout; + mulAny.p[1] <== dbl3.yout; + + +// Compute the right side: right = R8 + right2 + + component addRight = BabyAdd(); + addRight.x1 <== R8x; + addRight.y1 <== R8y; + addRight.x2 <== mulAny.out[0]; + addRight.y2 <== mulAny.out[1]; + +// Calculate left side of equation left = S*B8 + + var BASE8 = [ + 5299619240641551281634865583518297030282874472190772894086521144482721001553, + 16950150798460657717958625567821834550301663161624707787222815936182638968203 + ]; + component mulFix = EscalarMulFix(251, BASE8); + for (i=0; i<251; i++) { + mulFix.e[i] <== snum2bits.out[i]; + } + +// Do the comparation left == right if enabled; + + component eqCheckX = ForceEqualIfEnabled(); + eqCheckX.enabled <== enabled; + eqCheckX.in[0] <== mulFix.out[0]; + eqCheckX.in[1] <== addRight.xout; + + component eqCheckY = ForceEqualIfEnabled(); + eqCheckY.enabled <== enabled; + eqCheckY.in[0] <== mulFix.out[1]; + eqCheckY.in[1] <== addRight.yout; +} diff --git a/@tornado/circomlib/circuits/eddsaposeidon.circom b/@tornado/circomlib/circuits/eddsaposeidon.circom new file mode 100644 index 0000000..fb6c782 --- /dev/null +++ b/@tornado/circomlib/circuits/eddsaposeidon.circom @@ -0,0 +1,121 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "compconstant.circom"; +include "poseidon.circom"; +include "bitify.circom"; +include "escalarmulany.circom"; +include "escalarmulfix.circom"; + +template EdDSAPoseidonVerifier() { + signal input enabled; + signal input Ax; + signal input Ay; + + signal input S; + signal input R8x; + signal input R8y; + + signal input M; + + var i; + +// Ensure S aliasCheck.in[i]; + } + +// Calculate the h = H(R,A, msg) + + component hash = Poseidon(5, 6, 8, 57); + + hash.inputs[0] <== R8x; + hash.inputs[1] <== R8y; + hash.inputs[2] <== Ax; + hash.inputs[3] <== Ay; + hash.inputs[4] <== M; + + component h2bits = Num2Bits_strict(); + h2bits.in <== hash.out; + +// Calculate second part of the right side: right2 = h*8*A + + // Multiply by 8 by adding it 3 times. This also ensure that the result is in + // the subgroup. + component dbl1 = BabyDbl(); + dbl1.x <== Ax; + dbl1.y <== Ay; + component dbl2 = BabyDbl(); + dbl2.x <== dbl1.xout; + dbl2.y <== dbl1.yout; + component dbl3 = BabyDbl(); + dbl3.x <== dbl2.xout; + dbl3.y <== dbl2.yout; + + // We check that A is not zero. + component isZero = IsZero(); + isZero.in <== dbl3.x; + isZero.out*enabled === 0; + + component mulAny = EscalarMulAny(254); + for (i=0; i<254; i++) { + mulAny.e[i] <== h2bits.out[i]; + } + mulAny.p[0] <== dbl3.xout; + mulAny.p[1] <== dbl3.yout; + + +// Compute the right side: right = R8 + right2 + + component addRight = BabyAdd(); + addRight.x1 <== R8x; + addRight.y1 <== R8y; + addRight.x2 <== mulAny.out[0]; + addRight.y2 <== mulAny.out[1]; + +// Calculate left side of equation left = S*B8 + + var BASE8 = [ + 5299619240641551281634865583518297030282874472190772894086521144482721001553, + 16950150798460657717958625567821834550301663161624707787222815936182638968203 + ]; + component mulFix = EscalarMulFix(251, BASE8); + for (i=0; i<251; i++) { + mulFix.e[i] <== snum2bits.out[i]; + } + +// Do the comparation left == right if enabled; + + component eqCheckX = ForceEqualIfEnabled(); + eqCheckX.enabled <== enabled; + eqCheckX.in[0] <== mulFix.out[0]; + eqCheckX.in[1] <== addRight.xout; + + component eqCheckY = ForceEqualIfEnabled(); + eqCheckY.enabled <== enabled; + eqCheckY.in[0] <== mulFix.out[1]; + eqCheckY.in[1] <== addRight.yout; +} diff --git a/@tornado/circomlib/circuits/escalarmul.circom b/@tornado/circomlib/circuits/escalarmul.circom new file mode 100644 index 0000000..b3cc806 --- /dev/null +++ b/@tornado/circomlib/circuits/escalarmul.circom @@ -0,0 +1,165 @@ + /* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +/* + + ┏━━━━━━━━━━━┓ + ┃ ┃ + ┃ ┃ + (inx, iny) ══════════════════════════════════════════▶┃ EC Point ┃ + ┃ ╠═▶ (outx, outy) + ╔══▶┃ Adder ┃ + ║ ┃ ┃ + ║ ┃ ┃ + ║ ┃ ┃ + ┏━━━━━━━━━━━┓ ┏━━━━━━━━━━━━┓ ║ ┗━━━━━━━━━━━┛ + ┃ ┃ ┃ ┃ ║ + ┃ ┃ ┃ ┃ ║ + ┃ ╠═══(p0x,p0y)═══▶┃ ┃ ║ + ┃ ╠═══(p1x,p1y)═══▶┃ ┃ ║ + ┃ ╠═══(p2x,p2y)═══▶┃ ┃ ║ + ┃ ╠═══(p3x,p3y)═══▶┃ ┃ ║ + ┃ ╠═══(p4x,p4y)═══▶┃ ┃ ║ + ┃ ╠═══(p5x,p5y)═══▶┃ ┃ ║ + ┃ ╠═══(p6x,p6y)═══▶┃ ┃ ║ + ┃ Constant ╠═══(p7x,p7y)═══▶┃ ┃ ║ + ┃ Points ┃ ┃ Mux4 ╠══╝ + ┃ ╠═══(p8x,p8y)═══▶┃ ┃ + ┃ ╠═══(p9x,p9y)═══▶┃ ┃ + ┃ ╠══(p10x,p10y)══▶┃ ┃ + ┃ ╠══(p11x,p11y)══▶┃ ┃ + ┃ ╠══(p12x,p12y)══▶┃ ┃ + ┃ ╠══(p13x,p13y)══▶┃ ┃ + ┃ ╠══(p14x,p14y)══▶┃ ┃ + ┃ ╠══(p15x,p15y)══▶┃ ┃ + ┃ ┃ ┃ ┃ + ┃ ┃ ┃ ┃ + ┗━━━━━━━━━━━┛ ┗━━━━━━━━━━━━┛ + ▲ ▲ ▲ ▲ + │ │ │ │ + s0 ─────────────────────────────────┘ │ │ │ + s1 ────────────────────────────────────┘ │ │ + s2 ───────────────────────────────────────┘ │ + s3 ──────────────────────────────────────────┘ + + + */ + +include "mux4.circom"; +include "escalarmulw4table.circom"; +include "babyjub.circom"; + +template EscalarMulWindow(base, k) { + + signal input in[2]; + signal input sel[4]; + signal output out[2]; + + var table; + component mux; + component adder; + + var i; + + table = EscalarMulW4Table(base, k); + mux = MultiMux4(2); + adder = BabyAdd(); + + for (i=0; i<4; i++) { + sel[i] ==> mux.s[i]; + } + + for (i=0; i<16; i++) { + mux.c[0][i] <== table[i][0]; + mux.c[1][i] <== table[i][1]; + } + + in[0] ==> adder.x1; + in[1] ==> adder.y1; + + mux.out[0] ==> adder.x2; + mux.out[1] ==> adder.y2; + + adder.xout ==> out[0]; + adder.yout ==> out[1]; +} + +/* + + + ┏━━━━━━━━━┓ ┏━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━━━┓ + ┃ ┃ ┃ ┃ ┃ ┃ + inp ════▶┃Window(0)┃═════▶┃Window(1)┃════════ . . . . ═════════▶┃ Window(nBlocks-1) ┃═════▶ out + ┃ ┃ ┃ ┃ ┃ ┃ + ┗━━━━━━━━━┛ ┗━━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━━━━┛ + ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ + in[0]─────────┘ │ │ │ │ │ │ │ │ │ │ │ + in[1]───────────┘ │ │ │ │ │ │ │ │ │ │ + in[2]─────────────┘ │ │ │ │ │ │ │ 0 0 + in[3]───────────────┘ │ │ │ │ │ │ + in[4]──────────────────────────┘ │ │ │ │ │ + in[5]────────────────────────────┘ │ │ │ │ + in[6]──────────────────────────────┘ │ │ │ + in[7]────────────────────────────────┘ │ │ + . │ │ + . │ │ + in[n-2]─────────────────────────────────────────────────────────────────────┘ │ + in[n-1]───────────────────────────────────────────────────────────────────────┘ + + */ + +template EscalarMul(n, base) { + signal input in[n]; + signal input inp[2]; // Point input to be added + signal output out[2]; + + var nBlocks = ((n-1)>>2)+1; + var i; + var j; + + component windows[nBlocks]; + + // Construct the windows + for (i=0; i= n) { + windows[i].sel[j] <== 0; + } else { + windows[i].sel[j] <== in[i*4+j]; + } + } + } + + // Start with generator + windows[0].in[0] <== inp[0]; + windows[0].in[1] <== inp[1]; + + for(i=0; i windows[i+1].in[0]; + windows[i].out[1] ==> windows[i+1].in[1]; + } + + windows[nBlocks-1].out[0] ==> out[0]; + windows[nBlocks-1].out[1] ==> out[1]; +} diff --git a/@tornado/circomlib/circuits/escalarmulany.circom b/@tornado/circomlib/circuits/escalarmulany.circom new file mode 100644 index 0000000..3f6aec4 --- /dev/null +++ b/@tornado/circomlib/circuits/escalarmulany.circom @@ -0,0 +1,196 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "montgomery.circom"; +include "babyjub.circom"; +include "comparators.circom"; + +template Multiplexor2() { + signal input sel; + signal input in[2][2]; + signal output out[2]; + + out[0] <== (in[1][0] - in[0][0])*sel + in[0][0]; + out[1] <== (in[1][1] - in[0][1])*sel + in[0][1]; +} + +template BitElementMulAny() { + signal input sel; + signal input dblIn[2]; + signal input addIn[2]; + signal output dblOut[2]; + signal output addOut[2]; + + component doubler = MontgomeryDouble(); + component adder = MontgomeryAdd(); + component selector = Multiplexor2(); + + + sel ==> selector.sel; + + dblIn[0] ==> doubler.in[0]; + dblIn[1] ==> doubler.in[1]; + doubler.out[0] ==> adder.in1[0]; + doubler.out[1] ==> adder.in1[1]; + addIn[0] ==> adder.in2[0]; + addIn[1] ==> adder.in2[1]; + addIn[0] ==> selector.in[0][0]; + addIn[1] ==> selector.in[0][1]; + adder.out[0] ==> selector.in[1][0]; + adder.out[1] ==> selector.in[1][1]; + + doubler.out[0] ==> dblOut[0]; + doubler.out[1] ==> dblOut[1]; + selector.out[0] ==> addOut[0]; + selector.out[1] ==> addOut[1]; +} + +// p is montgomery point +// n must be <= 248 +// returns out in twisted edwards +// Double is in montgomery to be linked; + +template SegmentMulAny(n) { + signal input e[n]; + signal input p[2]; + signal output out[2]; + signal output dbl[2]; + + component bits[n-1]; + + component e2m = Edwards2Montgomery(); + + p[0] ==> e2m.in[0]; + p[1] ==> e2m.in[1]; + + var i; + + bits[0] = BitElementMulAny(); + e2m.out[0] ==> bits[0].dblIn[0] + e2m.out[1] ==> bits[0].dblIn[1] + e2m.out[0] ==> bits[0].addIn[0] + e2m.out[1] ==> bits[0].addIn[1] + e[1] ==> bits[0].sel; + + for (i=1; i bits[i].dblIn[0] + bits[i-1].dblOut[1] ==> bits[i].dblIn[1] + bits[i-1].addOut[0] ==> bits[i].addIn[0] + bits[i-1].addOut[1] ==> bits[i].addIn[1] + e[i+1] ==> bits[i].sel; + } + + bits[n-2].dblOut[0] ==> dbl[0]; + bits[n-2].dblOut[1] ==> dbl[1]; + + component m2e = Montgomery2Edwards(); + + bits[n-2].addOut[0] ==> m2e.in[0]; + bits[n-2].addOut[1] ==> m2e.in[1]; + + component eadder = BabyAdd(); + + m2e.out[0] ==> eadder.x1; + m2e.out[1] ==> eadder.y1; + -p[0] ==> eadder.x2; + p[1] ==> eadder.y2; + + component lastSel = Multiplexor2(); + + e[0] ==> lastSel.sel; + eadder.xout ==> lastSel.in[0][0]; + eadder.yout ==> lastSel.in[0][1]; + m2e.out[0] ==> lastSel.in[1][0]; + m2e.out[1] ==> lastSel.in[1][1]; + + lastSel.out[0] ==> out[0]; + lastSel.out[1] ==> out[1]; +} + +// This function assumes that p is in the subgroup and it is different to 0 + +template EscalarMulAny(n) { + signal input e[n]; // Input in binary format + signal input p[2]; // Point (Twisted format) + signal output out[2]; // Point (Twisted format) + + var nsegments = (n-1)\148 +1; + var nlastsegment = n - (nsegments-1)*148; + + component segments[nsegments]; + component doublers[nsegments-1]; + component m2e[nsegments-1]; + component adders[nsegments-1]; + component zeropoint = IsZero(); + zeropoint.in <== p[0]; + + var s; + var i; + var nseg; + + for (s=0; s segments[s].e[i]; + } + + if (s==0) { + // force G8 point if input point is zero + segments[s].p[0] <== p[0] + (5299619240641551281634865583518297030282874472190772894086521144482721001553 - p[0])*zeropoint.out; + segments[s].p[1] <== p[1] + (16950150798460657717958625567821834550301663161624707787222815936182638968203 - p[1])*zeropoint.out; + } else { + doublers[s-1] = MontgomeryDouble(); + m2e[s-1] = Montgomery2Edwards(); + adders[s-1] = BabyAdd(); + + segments[s-1].dbl[0] ==> doublers[s-1].in[0]; + segments[s-1].dbl[1] ==> doublers[s-1].in[1]; + + doublers[s-1].out[0] ==> m2e[s-1].in[0]; + doublers[s-1].out[1] ==> m2e[s-1].in[1]; + + m2e[s-1].out[0] ==> segments[s].p[0]; + m2e[s-1].out[1] ==> segments[s].p[1]; + + if (s==1) { + segments[s-1].out[0] ==> adders[s-1].x1; + segments[s-1].out[1] ==> adders[s-1].y1; + } else { + adders[s-2].xout ==> adders[s-1].x1; + adders[s-2].yout ==> adders[s-1].y1; + } + segments[s].out[0] ==> adders[s-1].x2; + segments[s].out[1] ==> adders[s-1].y2; + } + } + + if (nsegments == 1) { + segments[0].out[0]*(1-zeropoint.out) ==> out[0]; + segments[0].out[1]+(1-segments[0].out[1])*zeropoint.out ==> out[1]; + } else { + adders[nsegments-2].xout*(1-zeropoint.out) ==> out[0]; + adders[nsegments-2].yout+(1-adders[nsegments-2].yout)*zeropoint.out ==> out[1]; + } +} diff --git a/@tornado/circomlib/circuits/escalarmulfix.circom b/@tornado/circomlib/circuits/escalarmulfix.circom new file mode 100644 index 0000000..5ea8e09 --- /dev/null +++ b/@tornado/circomlib/circuits/escalarmulfix.circom @@ -0,0 +1,300 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "mux3.circom"; +include "montgomery.circom"; +include "babyjub.circom"; + +/* + Window of 3 elements, it calculates + out = base + base*in[0] + 2*base*in[1] + 4*base*in[2] + out4 = 4*base + + The result should be compensated. + */ + +/* + + The scalar is s = a0 + a1*2^3 + a2*2^6 + ...... + a81*2^243 + First We calculate Q = B + 2^3*B + 2^6*B + ......... + 2^246*B + + Then we calculate S1 = 2*2^246*B + (1 + a0)*B + (2^3 + a1)*B + .....+ (2^243 + a81)*B + + And Finaly we compute the result: RES = SQ - Q + + As you can see the input of the adders cannot be equal nor zero, except for the last + substraction that it's done in montgomery. + + A good way to see it is that the accumulator input of the adder >= 2^247*B and the other input + is the output of the windows that it's going to be <= 2^246*B + */ + /* base must not be the neutral element nor points of small order */ +template WindowMulFix() { + signal input in[3]; + signal input base[2]; + signal output out[2]; + signal output out8[2]; // Returns 8*Base (To be linked) + + component mux = MultiMux3(2); + + mux.s[0] <== in[0]; + mux.s[1] <== in[1]; + mux.s[2] <== in[2]; + + component dbl2 = MontgomeryDouble(); + component adr3 = MontgomeryAdd(); + component adr4 = MontgomeryAdd(); + component adr5 = MontgomeryAdd(); + component adr6 = MontgomeryAdd(); + component adr7 = MontgomeryAdd(); + component adr8 = MontgomeryAdd(); + +// in[0] -> 1*BASE + + mux.c[0][0] <== base[0]; + mux.c[1][0] <== base[1]; + +// in[1] -> 2*BASE + dbl2.in[0] <== base[0]; + dbl2.in[1] <== base[1]; + mux.c[0][1] <== dbl2.out[0]; + mux.c[1][1] <== dbl2.out[1]; + +// in[2] -> 3*BASE + adr3.in1[0] <== base[0]; + adr3.in1[1] <== base[1]; + adr3.in2[0] <== dbl2.out[0]; + adr3.in2[1] <== dbl2.out[1]; + mux.c[0][2] <== adr3.out[0]; + mux.c[1][2] <== adr3.out[1]; + +// in[3] -> 4*BASE + adr4.in1[0] <== base[0]; + adr4.in1[1] <== base[1]; + adr4.in2[0] <== adr3.out[0]; + adr4.in2[1] <== adr3.out[1]; + mux.c[0][3] <== adr4.out[0]; + mux.c[1][3] <== adr4.out[1]; + +// in[4] -> 5*BASE + adr5.in1[0] <== base[0]; + adr5.in1[1] <== base[1]; + adr5.in2[0] <== adr4.out[0]; + adr5.in2[1] <== adr4.out[1]; + mux.c[0][4] <== adr5.out[0]; + mux.c[1][4] <== adr5.out[1]; + +// in[5] -> 6*BASE + adr6.in1[0] <== base[0]; + adr6.in1[1] <== base[1]; + adr6.in2[0] <== adr5.out[0]; + adr6.in2[1] <== adr5.out[1]; + mux.c[0][5] <== adr6.out[0]; + mux.c[1][5] <== adr6.out[1]; + +// in[6] -> 7*BASE + adr7.in1[0] <== base[0]; + adr7.in1[1] <== base[1]; + adr7.in2[0] <== adr6.out[0]; + adr7.in2[1] <== adr6.out[1]; + mux.c[0][6] <== adr7.out[0]; + mux.c[1][6] <== adr7.out[1]; + +// in[7] -> 8*BASE + adr8.in1[0] <== base[0]; + adr8.in1[1] <== base[1]; + adr8.in2[0] <== adr7.out[0]; + adr8.in2[1] <== adr7.out[1]; + mux.c[0][7] <== adr8.out[0]; + mux.c[1][7] <== adr8.out[1]; + + out8[0] <== adr8.out[0]; + out8[1] <== adr8.out[1]; + + out[0] <== mux.out[0]; + out[1] <== mux.out[1]; +} + + +/* + This component does a multiplication of a escalar times a fix base + nWindows must not exceed 82 + Signals: + e: The scalar in bits + base: the base point in edwards format + out: The result + dbl: Point in Montgomery to be linked to the next segment. + */ + +template SegmentMulFix(nWindows) { + signal input e[nWindows*3]; + signal input base[2]; + signal output out[2]; + signal output dbl[2]; + + var i; + var j; + + // Convert the base to montgomery + + component e2m = Edwards2Montgomery(); + e2m.in[0] <== base[0]; + e2m.in[1] <== base[1]; + + component windows[nWindows]; + component adders[nWindows]; + component cadders[nWindows]; + + // In the last step we add an extra doubler so that numbers do not match. + component dblLast = MontgomeryDouble(); + + for (i=0; i out[0]; + cAdd.yout ==> out[1]; + + windows[nWindows-1].out8[0] ==> dbl[0]; + windows[nWindows-1].out8[1] ==> dbl[1]; +} + + +/* +This component multiplies a escalar times a fixed point BASE (twisted edwards format) + Signals + e: The escalar in binary format + out: The output point in twisted edwards + */ +template EscalarMulFix(n, BASE) { + signal input e[n]; // Input in binary format + signal output out[2]; // Point (Twisted format) + + var nsegments = (n-1)\246 +1; // 249 probably would work. But I'm not sure and for security I keep 246 + var nlastsegment = n - (nsegments-1)*246; + + component segments[nsegments]; + + component m2e[nsegments-1]; + component adders[nsegments-1]; + + var s; + var i; + var nseg; + var nWindows; + + for (s=0; s m2e[s-1].in[0]; + segments[s-1].dbl[1] ==> m2e[s-1].in[1]; + + m2e[s-1].out[0] ==> segments[s].base[0]; + m2e[s-1].out[1] ==> segments[s].base[1]; + + if (s==1) { + segments[s-1].out[0] ==> adders[s-1].x1; + segments[s-1].out[1] ==> adders[s-1].y1; + } else { + adders[s-2].xout ==> adders[s-1].x1; + adders[s-2].yout ==> adders[s-1].y1; + } + segments[s].out[0] ==> adders[s-1].x2; + segments[s].out[1] ==> adders[s-1].y2; + } + } + + if (nsegments == 1) { + segments[0].out[0] ==> out[0]; + segments[0].out[1] ==> out[1]; + } else { + adders[nsegments-2].xout ==> out[0]; + adders[nsegments-2].yout ==> out[1]; + } +} diff --git a/@tornado/circomlib/circuits/escalarmulw4table.circom b/@tornado/circomlib/circuits/escalarmulw4table.circom new file mode 100644 index 0000000..d056e66 --- /dev/null +++ b/@tornado/circomlib/circuits/escalarmulw4table.circom @@ -0,0 +1,51 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +function pointAdd(x1,y1,x2,y2) { + var a = 168700; + var d = 168696; + + var res[2]; + res[0] = (x1*y2 + y1*x2) / (1 + d*x1*x2*y1*y2); + res[1] = (y1*y2 - a*x1*x2) / (1 - d*x1*x2*y1*y2); + return res; +} + +function EscalarMulW4Table(base, k) { + var out[16][2]; + + var i; + var p[2]; + + var dbl = base; + + for (i=0; i. +*/ + +template XOR() { + signal input a; + signal input b; + signal output out; + + out <== a + b - 2*a*b; +} + +template AND() { + signal input a; + signal input b; + signal output out; + + out <== a*b; +} + +template OR() { + signal input a; + signal input b; + signal output out; + + out <== a + b - a*b; +} + +template NOT() { + signal input in; + signal output out; + + out <== 1 + in - 2*in; +} + +template NAND() { + signal input a; + signal input b; + signal output out; + + out <== 1 - a*b; +} + +template NOR() { + signal input a; + signal input b; + signal output out; + + out <== a*b + 1 - a - b; +} + +template MultiAND(n) { + signal input in[n]; + signal output out; + if (n==1) { + out <== in[0]; + } else if (n==2) { + component and1 = AND(); + and1.a <== in[0]; + and1.b <== in[1]; + out <== and1.out; + } else { + component and2 = AND(); + component ands[2]; + var n1 = n\2; + var n2 = n-n\2; + ands[0] = MultiAND(n1); + ands[1] = MultiAND(n2); + for (var i=0; i. +*/ + +template MiMC7(nrounds) { + signal input x_in; + signal input k; + signal output out; + + var c = [ + 0, + 20888961410941983456478427210666206549300505294776164667214940546594746570981, + 15265126113435022738560151911929040668591755459209400716467504685752745317193, + 8334177627492981984476504167502758309043212251641796197711684499645635709656, + 1374324219480165500871639364801692115397519265181803854177629327624133579404, + 11442588683664344394633565859260176446561886575962616332903193988751292992472, + 2558901189096558760448896669327086721003508630712968559048179091037845349145, + 11189978595292752354820141775598510151189959177917284797737745690127318076389, + 3262966573163560839685415914157855077211340576201936620532175028036746741754, + 17029914891543225301403832095880481731551830725367286980611178737703889171730, + 4614037031668406927330683909387957156531244689520944789503628527855167665518, + 19647356996769918391113967168615123299113119185942498194367262335168397100658, + 5040699236106090655289931820723926657076483236860546282406111821875672148900, + 2632385916954580941368956176626336146806721642583847728103570779270161510514, + 17691411851977575435597871505860208507285462834710151833948561098560743654671, + 11482807709115676646560379017491661435505951727793345550942389701970904563183, + 8360838254132998143349158726141014535383109403565779450210746881879715734773, + 12663821244032248511491386323242575231591777785787269938928497649288048289525, + 3067001377342968891237590775929219083706800062321980129409398033259904188058, + 8536471869378957766675292398190944925664113548202769136103887479787957959589, + 19825444354178182240559170937204690272111734703605805530888940813160705385792, + 16703465144013840124940690347975638755097486902749048533167980887413919317592, + 13061236261277650370863439564453267964462486225679643020432589226741411380501, + 10864774797625152707517901967943775867717907803542223029967000416969007792571, + 10035653564014594269791753415727486340557376923045841607746250017541686319774, + 3446968588058668564420958894889124905706353937375068998436129414772610003289, + 4653317306466493184743870159523234588955994456998076243468148492375236846006, + 8486711143589723036499933521576871883500223198263343024003617825616410932026, + 250710584458582618659378487568129931785810765264752039738223488321597070280, + 2104159799604932521291371026105311735948154964200596636974609406977292675173, + 16313562605837709339799839901240652934758303521543693857533755376563489378839, + 6032365105133504724925793806318578936233045029919447519826248813478479197288, + 14025118133847866722315446277964222215118620050302054655768867040006542798474, + 7400123822125662712777833064081316757896757785777291653271747396958201309118, + 1744432620323851751204287974553233986555641872755053103823939564833813704825, + 8316378125659383262515151597439205374263247719876250938893842106722210729522, + 6739722627047123650704294650168547689199576889424317598327664349670094847386, + 21211457866117465531949733809706514799713333930924902519246949506964470524162, + 13718112532745211817410303291774369209520657938741992779396229864894885156527, + 5264534817993325015357427094323255342713527811596856940387954546330728068658, + 18884137497114307927425084003812022333609937761793387700010402412840002189451, + 5148596049900083984813839872929010525572543381981952060869301611018636120248, + 19799686398774806587970184652860783461860993790013219899147141137827718662674, + 19240878651604412704364448729659032944342952609050243268894572835672205984837, + 10546185249390392695582524554167530669949955276893453512788278945742408153192, + 5507959600969845538113649209272736011390582494851145043668969080335346810411, + 18177751737739153338153217698774510185696788019377850245260475034576050820091, + 19603444733183990109492724100282114612026332366576932662794133334264283907557, + 10548274686824425401349248282213580046351514091431715597441736281987273193140, + 1823201861560942974198127384034483127920205835821334101215923769688644479957, + 11867589662193422187545516240823411225342068709600734253659804646934346124945, + 18718569356736340558616379408444812528964066420519677106145092918482774343613, + 10530777752259630125564678480897857853807637120039176813174150229243735996839, + 20486583726592018813337145844457018474256372770211860618687961310422228379031, + 12690713110714036569415168795200156516217175005650145422920562694422306200486, + 17386427286863519095301372413760745749282643730629659997153085139065756667205, + 2216432659854733047132347621569505613620980842043977268828076165669557467682, + 6309765381643925252238633914530877025934201680691496500372265330505506717193, + 20806323192073945401862788605803131761175139076694468214027227878952047793390, + 4037040458505567977365391535756875199663510397600316887746139396052445718861, + 19948974083684238245321361840704327952464170097132407924861169241740046562673, + 845322671528508199439318170916419179535949348988022948153107378280175750024, + 16222384601744433420585982239113457177459602187868460608565289920306145389382, + 10232118865851112229330353999139005145127746617219324244541194256766741433339, + 6699067738555349409504843460654299019000594109597429103342076743347235369120, + 6220784880752427143725783746407285094967584864656399181815603544365010379208, + 6129250029437675212264306655559561251995722990149771051304736001195288083309, + 10773245783118750721454994239248013870822765715268323522295722350908043393604, + 4490242021765793917495398271905043433053432245571325177153467194570741607167, + 19596995117319480189066041930051006586888908165330319666010398892494684778526, + 837850695495734270707668553360118467905109360511302468085569220634750561083, + 11803922811376367215191737026157445294481406304781326649717082177394185903907, + 10201298324909697255105265958780781450978049256931478989759448189112393506592, + 13564695482314888817576351063608519127702411536552857463682060761575100923924, + 9262808208636973454201420823766139682381973240743541030659775288508921362724, + 173271062536305557219323722062711383294158572562695717740068656098441040230, + 18120430890549410286417591505529104700901943324772175772035648111937818237369, + 20484495168135072493552514219686101965206843697794133766912991150184337935627, + 19155651295705203459475805213866664350848604323501251939850063308319753686505, + 11971299749478202793661982361798418342615500543489781306376058267926437157297, + 18285310723116790056148596536349375622245669010373674803854111592441823052978, + 7069216248902547653615508023941692395371990416048967468982099270925308100727, + 6465151453746412132599596984628739550147379072443683076388208843341824127379, + 16143532858389170960690347742477978826830511669766530042104134302796355145785, + 19362583304414853660976404410208489566967618125972377176980367224623492419647, + 1702213613534733786921602839210290505213503664731919006932367875629005980493, + 10781825404476535814285389902565833897646945212027592373510689209734812292327, + 4212716923652881254737947578600828255798948993302968210248673545442808456151, + 7594017890037021425366623750593200398174488805473151513558919864633711506220, + 18979889247746272055963929241596362599320706910852082477600815822482192194401, + 13602139229813231349386885113156901793661719180900395818909719758150455500533 + ]; + + var t; + signal t2[nrounds]; + signal t4[nrounds]; + signal t6[nrounds]; + signal t7[nrounds-1]; + + for (var i=0; i nRounds should be 220 +template MiMCSponge(nInputs, nOutputs) { + signal input ins[nInputs]; + signal input k; + signal output outs[nOutputs]; + + var nRounds = 220; + + // S = R||C + component S[nInputs + nOutputs - 1]; + + for (var i = 0; i < nInputs; i++) { + S[i] = MiMCFeistel(nRounds); + S[i].k <== k; + if (i == 0) { + S[i].xL_in <== ins[0]; + S[i].xR_in <== 0; + } else { + S[i].xL_in <== S[i-1].xL_out + ins[i]; + S[i].xR_in <== S[i-1].xR_out; + } + } + + outs[0] <== S[nInputs - 1].xL_out; + + for (var i = 0; i < nOutputs - 1; i++) { + S[nInputs + i] = MiMCFeistel(nRounds); + S[nInputs + i].k <== k; + S[nInputs + i].xL_in <== S[nInputs + i - 1].xL_out; + S[nInputs + i].xR_in <== S[nInputs + i - 1].xR_out; + outs[i + 1] <== S[nInputs + i].xL_out; + } +} + +template MiMCFeistel(nrounds) { + signal input xL_in; + signal input xR_in; + signal input k; + signal output xL_out; + signal output xR_out; + + // doesn't contain the first and last round constants, which are always zero + var c_partial = [ + 7120861356467848435263064379192047478074060781135320967663101236819528304084, + 5024705281721889198577876690145313457398658950011302225525409148828000436681, + 17980351014018068290387269214713820287804403312720763401943303895585469787384, + 19886576439381707240399940949310933992335779767309383709787331470398675714258, + 1213715278223786725806155661738676903520350859678319590331207960381534602599, + 18162138253399958831050545255414688239130588254891200470934232514682584734511, + 7667462281466170157858259197976388676420847047604921256361474169980037581876, + 7207551498477838452286210989212982851118089401128156132319807392460388436957, + 9864183311657946807255900203841777810810224615118629957816193727554621093838, + 4798196928559910300796064665904583125427459076060519468052008159779219347957, + 17387238494588145257484818061490088963673275521250153686214197573695921400950, + 10005334761930299057035055370088813230849810566234116771751925093634136574742, + 11897542014760736209670863723231849628230383119798486487899539017466261308762, + 16771780563523793011283273687253985566177232886900511371656074413362142152543, + 749264854018824809464168489785113337925400687349357088413132714480582918506, + 3683645737503705042628598550438395339383572464204988015434959428676652575331, + 7556750851783822914673316211129907782679509728346361368978891584375551186255, + 20391289379084797414557439284689954098721219201171527383291525676334308303023, + 18146517657445423462330854383025300323335289319277199154920964274562014376193, + 8080173465267536232534446836148661251987053305394647905212781979099916615292, + 10796443006899450245502071131975731672911747129805343722228413358507805531141, + 5404287610364961067658660283245291234008692303120470305032076412056764726509, + 4623894483395123520243967718315330178025957095502546813929290333264120223168, + 16845753148201777192406958674202574751725237939980634861948953189320362207797, + 4622170486584704769521001011395820886029808520586507873417553166762370293671, + 16688277490485052681847773549197928630624828392248424077804829676011512392564, + 11878652861183667748838188993669912629573713271883125458838494308957689090959, + 2436445725746972287496138382764643208791713986676129260589667864467010129482, + 1888098689545151571063267806606510032698677328923740058080630641742325067877, + 148924106504065664829055598316821983869409581623245780505601526786791681102, + 18875020877782404439294079398043479420415331640996249745272087358069018086569, + 15189693413320228845990326214136820307649565437237093707846682797649429515840, + 19669450123472657781282985229369348220906547335081730205028099210442632534079, + 5521922218264623411380547905210139511350706092570900075727555783240701821773, + 4144769320246558352780591737261172907511489963810975650573703217887429086546, + 10097732913112662248360143041019433907849917041759137293018029019134392559350, + 1720059427972723034107765345743336447947522473310069975142483982753181038321, + 6302388219880227251325608388535181451187131054211388356563634768253301290116, + 6745410632962119604799318394592010194450845483518862700079921360015766217097, + 10858157235265583624235850660462324469799552996870780238992046963007491306222, + 20241898894740093733047052816576694435372877719072347814065227797906130857593, + 10165780782761211520836029617746977303303335603838343292431760011576528327409, + 2832093654883670345969792724123161241696170611611744759675180839473215203706, + 153011722355526826233082383360057587249818749719433916258246100068258954737, + 20196970640587451358539129330170636295243141659030208529338914906436009086943, + 3180973917010545328313139835982464870638521890385603025657430208141494469656, + 17198004293191777441573635123110935015228014028618868252989374962722329283022, + 7642160509228669138628515458941659189680509753651629476399516332224325757132, + 19346204940546791021518535594447257347218878114049998691060016493806845179755, + 11501810868606870391127866188394535330696206817602260610801897042898616817272, + 3113973447392053821824427670386252797811804954746053461397972968381571297505, + 6545064306297957002139416752334741502722251869537551068239642131448768236585, + 5203908808704813498389265425172875593837960384349653691918590736979872578408, + 2246692432011290582160062129070762007374502637007107318105405626910313810224, + 11760570435432189127645691249600821064883781677693087773459065574359292849137, + 5543749482491340532547407723464609328207990784853381797689466144924198391839, + 8837549193990558762776520822018694066937602576881497343584903902880277769302, + 12855514863299373699594410385788943772765811961581749194183533625311486462501, + 5363660674689121676875069134269386492382220935599781121306637800261912519729, + 13162342403579303950549728848130828093497701266240457479693991108217307949435, + 916941639326869583414469202910306428966657806899788970948781207501251816730, + 15618589556584434434009868216186115416835494805174158488636000580759692174228, + 8959562060028569701043973060670353733575345393653685776974948916988033453971, + 16390754464333401712265575949874369157699293840516802426621216808905079127650, + 168282396747788514908709091757591226095443902501365500003618183905496160435, + 8327443473179334761744301768309008451162322941906921742120510244986704677004, + 17213012626801210615058753489149961717422101711567228037597150941152495100640, + 10394369641533736715250242399198097296122982486516256408681925424076248952280, + 17784386835392322654196171115293700800825771210400152504776806618892170162248, + 16533189939837087893364000390641148516479148564190420358849587959161226782982, + 18725396114211370207078434315900726338547621160475533496863298091023511945076, + 7132325028834551397904855671244375895110341505383911719294705267624034122405, + 148317947440800089795933930720822493695520852448386394775371401743494965187, + 19001050671757720352890779127693793630251266879994702723636759889378387053056, + 18824274411769830274877839365728651108434404855803844568234862945613766611460, + 12771414330193951156383998390424063470766226667986423961689712557338777174205, + 11332046574800279729678603488745295198038913503395629790213378101166488244657, + 9607550223176946388146938069307456967842408600269548190739947540821716354749, + 8756385288462344550200229174435953103162307705310807828651304665320046782583, + 176061952957067086877570020242717222844908281373122372938833890096257042779, + 12200212977482648306758992405065921724409841940671166017620928947866825250857, + 10868453624107875516866146499877130701929063632959660262366632833504750028858, + 2016095394399807253596787752134573207202567875457560571095586743878953450738, + 21815578223768330433802113452339488275704145896544481092014911825656390567514, + 4923772847693564777744725640710197015181591950368494148029046443433103381621, + 1813584943682214789802230765734821149202472893379265320098816901270224589984, + 10810123816265612772922113403831964815724109728287572256602010709288980656498, + 1153669123397255702524721206511185557982017410156956216465120456256288427021, + 5007518659266430200134478928344522649876467369278722765097865662497773767152, + 2511432546938591792036639990606464315121646668029252285288323664350666551637, + 32883284540320451295484135704808083452381176816565850047310272290579727564, + 10484856914279112612610993418405543310546746652738541161791501150994088679557, + 2026733759645519472558796412979210009170379159866522399881566309631434814953, + 14731806221235869882801331463708736361296174006732553130708107037190460654379, + 14740327483193277147065845135561988641238516852487657117813536909482068950652, + 18787428285295558781869865751953016580493190547148386433580291216673009884554, + 3804047064713122820157099453648459188816376755739202017447862327783289895072, + 16709604795697901641948603019242067672006293290826991671766611326262532802914, + 11061717085931490100602849654034280576915102867237101935487893025907907250695, + 2821730726367472966906149684046356272806484545281639696873240305052362149654, + 17467794879902895769410571945152708684493991588672014763135370927880883292655, + 1571520786233540988201616650622796363168031165456869481368085474420849243232, + 10041051776251223165849354194892664881051125330236567356945669006147134614302, + 3981753758468103976812813304477670033098707002886030847251581853700311567551, + 4365864398105436789177703571412645548020537580493599380018290523813331678900, + 2391801327305361293476178683853802679507598622000359948432171562543560193350, + 214219368547551689972421167733597094823289857206402800635962137077096090722, + 18192064100315141084242006659317257023098826945893371479835220462302399655674, + 15487549757142039139328911515400805508248576685795694919457041092150651939253, + 10142447197759703415402259672441315777933858467700579946665223821199077641122, + 11246573086260753259993971254725613211193686683988426513880826148090811891866, + 6574066859860991369704567902211886840188702386542112593710271426704432301235, + 11311085442652291634822798307831431035776248927202286895207125867542470350078, + 20977948360215259915441258687649465618185769343138135384346964466965010873779, + 792781492853909872425531014397300057232399608769451037135936617996830018501, + 5027602491523497423798779154966735896562099398367163998686335127580757861872, + 14595204575654316237672764823862241845410365278802914304953002937313300553572, + 13973538843621261113924259058427434053808430378163734641175100160836376897004, + 16395063164993626722686882727042150241125309409717445381854913964674649318585, + 8465768840047024550750516678171433288207841931251654898809033371655109266663, + 21345603324471810861925019445720576814602636473739003852898308205213912255830, + 21171984405852590343970239018692870799717057961108910523876770029017785940991, + 10761027113757988230637066281488532903174559953630210849190212601991063767647, + 6678298831065390834922566306988418588227382406175769592902974103663687992230, + 4993662582188632374202316265508850988596880036291765531885657575099537176757, + 18364168158495573675698600238443218434246806358811328083953887470513967121206, + 3506345610354615013737144848471391553141006285964325596214723571988011984829, + 248732676202643792226973868626360612151424823368345645514532870586234380100, + 10090204501612803176317709245679152331057882187411777688746797044706063410969, + 21297149835078365363970699581821844234354988617890041296044775371855432973500, + 16729368143229828574342820060716366330476985824952922184463387490091156065099, + 4467191506765339364971058668792642195242197133011672559453028147641428433293, + 8677548159358013363291014307402600830078662555833653517843708051504582990832, + 1022951765127126818581466247360193856197472064872288389992480993218645055345, + 1888195070251580606973417065636430294417895423429240431595054184472931224452, + 4221265384902749246920810956363310125115516771964522748896154428740238579824, + 2825393571154632139467378429077438870179957021959813965940638905853993971879, + 19171031072692942278056619599721228021635671304612437350119663236604712493093, + 10780807212297131186617505517708903709488273075252405602261683478333331220733, + 18230936781133176044598070768084230333433368654744509969087239465125979720995, + 16901065971871379877929280081392692752968612240624985552337779093292740763381, + 146494141603558321291767829522948454429758543710648402457451799015963102253, + 2492729278659146790410698334997955258248120870028541691998279257260289595548, + 2204224910006646535594933495262085193210692406133533679934843341237521233504, + 16062117410185840274616925297332331018523844434907012275592638570193234893570, + 5894928453677122829055071981254202951712129328678534592916926069506935491729, + 4947482739415078212217504789923078546034438919537985740403824517728200332286, + 16143265650645676880461646123844627780378251900510645261875867423498913438066, + 397690828254561723549349897112473766901585444153303054845160673059519614409, + 11272653598912269895509621181205395118899451234151664604248382803490621227687, + 15566927854306879444693061574322104423426072650522411176731130806720753591030, + 14222898219492484180162096141564251903058269177856173968147960855133048449557, + 16690275395485630428127725067513114066329712673106153451801968992299636791385, + 3667030990325966886479548860429670833692690972701471494757671819017808678584, + 21280039024501430842616328642522421302481259067470872421086939673482530783142, + 15895485136902450169492923978042129726601461603404514670348703312850236146328, + 7733050956302327984762132317027414325566202380840692458138724610131603812560, + 438123800976401478772659663183448617575635636575786782566035096946820525816, + 814913922521637742587885320797606426167962526342166512693085292151314976633, + 12368712287081330853637674140264759478736012797026621876924395982504369598764, + 2494806857395134874309386694756263421445039103814920780777601708371037591569, + 16101132301514338989512946061786320637179843435886825102406248183507106312877, + 6252650284989960032925831409804233477770646333900692286731621844532438095656, + 9277135875276787021836189566799935097400042171346561246305113339462708861695, + 10493603554686607050979497281838644324893776154179810893893660722522945589063, + 8673089750662709235894359384294076697329948991010184356091130382437645649279, + 9558393272910366944245875920138649617479779893610128634419086981339060613250, + 19012287860122586147374214541764572282814469237161122489573881644994964647218, + 9783723818270121678386992630754842961728702994964214799008457449989291229500, + 15550788416669474113213749561488122552422887538676036667630838378023479382689, + 15016165746156232864069722572047169071786333815661109750860165034341572904221, + 6506225705710197163670556961299945987488979904603689017479840649664564978574, + 10796631184889302076168355684722130903785890709107732067446714470783437829037, + 19871836214837460419845806980869387567383718044439891735114283113359312279540, + 20871081766843466343749609089986071784031203517506781251203251608363835140622, + 5100105771517691442278432864090229416166996183792075307747582375962855820797, + 8777887112076272395250620301071581171386440850451972412060638225741125310886, + 5300440870136391278944213332144327695659161151625757537632832724102670898756, + 1205448543652932944633962232545707633928124666868453915721030884663332604536, + 5542499997310181530432302492142574333860449305424174466698068685590909336771, + 11028094245762332275225364962905938096659249161369092798505554939952525894293, + 19187314764836593118404597958543112407224947638377479622725713735224279297009, + 17047263688548829001253658727764731047114098556534482052135734487985276987385, + 19914849528178967155534624144358541535306360577227460456855821557421213606310, + 2929658084700714257515872921366736697080475676508114973627124569375444665664, + 15092262360719700162343163278648422751610766427236295023221516498310468956361, + 21578580340755653236050830649990190843552802306886938815497471545814130084980, + 1258781501221760320019859066036073675029057285507345332959539295621677296991, + 3819598418157732134449049289585680301176983019643974929528867686268702720163, + 8653175945487997845203439345797943132543211416447757110963967501177317426221, + 6614652990340435611114076169697104582524566019034036680161902142028967568142, + 19212515502973904821995111796203064175854996071497099383090983975618035391558, + 18664315914479294273286016871365663486061896605232511201418576829062292269769, + 11498264615058604317482574216318586415670903094838791165247179252175768794889, + 10814026414212439999107945133852431304483604215416531759535467355316227331774, + 17566185590731088197064706533119299946752127014428399631467913813769853431107, + 14016139747289624978792446847000951708158212463304817001882956166752906714332, + 8242601581342441750402731523736202888792436665415852106196418942315563860366, + 9244680976345080074252591214216060854998619670381671198295645618515047080988, + 12216779172735125538689875667307129262237123728082657485828359100719208190116, + 10702811721859145441471328511968332847175733707711670171718794132331147396634, + 6479667912792222539919362076122453947926362746906450079329453150607427372979, + 15117544653571553820496948522381772148324367479772362833334593000535648316185, + 6842203153996907264167856337497139692895299874139131328642472698663046726780, + 12732823292801537626009139514048596316076834307941224506504666470961250728055, + 6936272626871035740815028148058841877090860312517423346335878088297448888663, + 17297554111853491139852678417579991271009602631577069694853813331124433680030, + 16641596134749940573104316021365063031319260205559553673368334842484345864859, + 7400481189785154329569470986896455371037813715804007747228648863919991399081, + 2273205422216987330510475127669563545720586464429614439716564154166712854048, + 15162538063742142685306302282127534305212832649282186184583465569986719234456, + 5628039096440332922248578319648483863204530861778160259559031331287721255522, + 16085392195894691829567913404182676871326863890140775376809129785155092531260, + 14227467863135365427954093998621993651369686288941275436795622973781503444257, + 18224457394066545825553407391290108485121649197258948320896164404518684305122, + 274945154732293792784580363548970818611304339008964723447672490026510689427, + 11050822248291117548220126630860474473945266276626263036056336623671308219529, + 2119542016932434047340813757208803962484943912710204325088879681995922344971 + ]; + + var t; + signal t2[nrounds]; + signal t4[nrounds]; + signal xL[nrounds-1]; + signal xR[nrounds-1]; + + var c; + for (var i=0; i. +*/ + +/* + Source: https://en.wikipedia.org/wiki/Montgomery_curve + + 1 + y 1 + y + [u, v] = [ ------- , ---------- ] + 1 - y (1 - y)x + + */ + +template Edwards2Montgomery() { + signal input in[2]; + signal output out[2]; + + out[0] <-- (1 + in[1]) / (1 - in[1]); + out[1] <-- out[0] / in[0]; + + + out[0] * (1-in[1]) === (1 + in[1]); + out[1] * in[0] === out[0]; +} + +/* + + u u - 1 + [x, y] = [ ---, ------- ] + v u + 1 + + */ +template Montgomery2Edwards() { + signal input in[2]; + signal output out[2]; + + out[0] <-- in[0] / in[1]; + out[1] <-- (in[0] - 1) / (in[0] + 1); + + out[0] * in[1] === in[0]; + out[1] * (in[0] + 1) === in[0] - 1; +} + + +/* + x2 - x1 + lamda = --------- + y2 - y1 + + x3 + A + x1 + x2 + x3 = B * lamda^2 - A - x1 -x2 => lamda^2 = ------------------ + B + + y3 = (2*x1 + x2 + A)*lamda - B*lamda^3 - y1 => + + + => y3 = lamda * ( 2*x1 + x2 + A - x3 - A - x1 - x2) - y1 => + + => y3 = lamda * ( x1 - x3 ) - y1 + +---------- + + y2 - y1 + lamda = --------- + x2 - x1 + + x3 = B * lamda^2 - A - x1 -x2 + + y3 = lamda * ( x1 - x3 ) - y1 + + */ + +/* in1 must be != in2 */ +template MontgomeryAdd() { + signal input in1[2]; + signal input in2[2]; + signal output out[2]; + + var a = 168700; + var d = 168696; + + var A = (2 * (a + d)) / (a - d); + var B = 4 / (a - d); + + signal lamda; + + lamda <-- (in2[1] - in1[1]) / (in2[0] - in1[0]); + lamda * (in2[0] - in1[0]) === (in2[1] - in1[1]); + + out[0] <== B*lamda*lamda - A - in1[0] -in2[0]; + out[1] <== lamda * (in1[0] - out[0]) - in1[1]; +} + +/* + + x1_2 = x1*x1 + + 3*x1_2 + 2*A*x1 + 1 + lamda = --------------------- + 2*B*y1 + + x3 = B * lamda^2 - A - x1 -x1 + + y3 = lamda * ( x1 - x3 ) - y1 + + */ +template MontgomeryDouble() { + signal input in[2]; + signal output out[2]; + + var a = 168700; + var d = 168696; + + var A = (2 * (a + d)) / (a - d); + var B = 4 / (a - d); + + signal lamda; + signal x1_2; + + x1_2 <== in[0] * in[0]; + + lamda <-- (3*x1_2 + 2*A*in[0] + 1 ) / (2*B*in[1]); + lamda * (2*B*in[1]) === (3*x1_2 + 2*A*in[0] + 1 ); + + out[0] <== B*lamda*lamda - A - 2*in[0]; + out[1] <== lamda * (in[0] - out[0]) - in[1]; +} diff --git a/@tornado/circomlib/circuits/multiplexer.circom b/@tornado/circomlib/circuits/multiplexer.circom new file mode 100644 index 0000000..091bd2b --- /dev/null +++ b/@tornado/circomlib/circuits/multiplexer.circom @@ -0,0 +1,113 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +// --> Assignation without constraint +// <-- Assignation without constraint +// === Constraint +// <== Assignation with constraint +// ==> Assignation with constraint +// All variables are members of the field F[p] +// https://github.com/zcash-hackworks/sapling-crypto +// https://github.com/ebfull/bellman + +/* +function log2(a) { + if (a==0) { + return 0; + } + let n = 1; + let r = 1; + while (n success; + success * (success -1) === 0; +} + + +template Multiplexer(wIn, nIn) { + signal input inp[nIn][wIn]; + signal input sel; + signal output out[wIn]; + component dec = Decoder(nIn); + component ep[wIn]; + + for (var k=0; k dec.inp; + for (var j=0; j ep[j].in1[k]; + dec.out[k] ==> ep[j].in2[k]; + } + ep[j].out ==> out[j]; + } + dec.success === 1; +} diff --git a/@tornado/circomlib/circuits/mux1.circom b/@tornado/circomlib/circuits/mux1.circom new file mode 100644 index 0000000..3473c6c --- /dev/null +++ b/@tornado/circomlib/circuits/mux1.circom @@ -0,0 +1,47 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +template MultiMux1(n) { + signal input c[n][2]; // Constants + signal input s; // Selector + signal output out[n]; + + for (var i=0; i mux.s; + + mux.out[0] ==> out; +} diff --git a/@tornado/circomlib/circuits/mux2.circom b/@tornado/circomlib/circuits/mux2.circom new file mode 100644 index 0000000..1e71cf7 --- /dev/null +++ b/@tornado/circomlib/circuits/mux2.circom @@ -0,0 +1,62 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +template MultiMux2(n) { + signal input c[n][4]; // Constants + signal input s[2]; // Selector + signal output out[n]; + + signal a10[n]; + signal a1[n]; + signal a0[n]; + signal a[n]; + + signal s10; + s10 <== s[1] * s[0]; + + for (var i=0; i mux.s[i]; + } + + mux.out[0] ==> out; +} diff --git a/@tornado/circomlib/circuits/mux3.circom b/@tornado/circomlib/circuits/mux3.circom new file mode 100644 index 0000000..277ead2 --- /dev/null +++ b/@tornado/circomlib/circuits/mux3.circom @@ -0,0 +1,74 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +template MultiMux3(n) { + signal input c[n][8]; // Constants + signal input s[3]; // Selector + signal output out[n]; + + signal a210[n]; + signal a21[n]; + signal a20[n]; + signal a2[n]; + + signal a10[n]; + signal a1[n]; + signal a0[n]; + signal a[n]; + + // 4 constrains for the intermediary variables + signal s10; + s10 <== s[1] * s[0]; + + for (var i=0; i mux.s[i]; + } + + mux.out[0] ==> out; +} diff --git a/@tornado/circomlib/circuits/mux4.circom b/@tornado/circomlib/circuits/mux4.circom new file mode 100644 index 0000000..c30bb94 --- /dev/null +++ b/@tornado/circomlib/circuits/mux4.circom @@ -0,0 +1,118 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +template MultiMux4(n) { + signal input c[n][16]; // Constants + signal input s[4]; // Selector + signal output out[n]; + + signal a3210[n]; + signal a321[n]; + signal a320[n]; + signal a310[n]; + signal a32[n]; + signal a31[n]; + signal a30[n]; + signal a3[n]; + + signal a210[n]; + signal a21[n]; + signal a20[n]; + signal a10[n]; + signal a2[n]; + signal a1[n]; + signal a0[n]; + signal a[n]; + + // 4 constrains for the intermediary variables + signal s10; + s10 <== s[1] * s[0]; + signal s20; + s20 <== s[2] * s[0]; + signal s21; + s21 <== s[2] * s[1]; + signal s210; + s210 <== s21 * s[0]; + + + for (var i=0; i mux.s[i]; + } + + mux.out[0] ==> out; +} diff --git a/@tornado/circomlib/circuits/pedersen.circom b/@tornado/circomlib/circuits/pedersen.circom new file mode 100644 index 0000000..aca0d09 --- /dev/null +++ b/@tornado/circomlib/circuits/pedersen.circom @@ -0,0 +1,256 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "montgomery.circom"; +include "mux3.circom"; +include "babyjub.circom"; + +template Window4() { + signal input in[4]; + signal input base[2]; + signal output out[2]; + signal output out8[2]; // Returns 8*Base (To be linked) + + component mux = MultiMux3(2); + + mux.s[0] <== in[0]; + mux.s[1] <== in[1]; + mux.s[2] <== in[2]; + + component dbl2 = MontgomeryDouble(); + component adr3 = MontgomeryAdd(); + component adr4 = MontgomeryAdd(); + component adr5 = MontgomeryAdd(); + component adr6 = MontgomeryAdd(); + component adr7 = MontgomeryAdd(); + component adr8 = MontgomeryAdd(); + +// in[0] -> 1*BASE + + mux.c[0][0] <== base[0]; + mux.c[1][0] <== base[1]; + +// in[1] -> 2*BASE + dbl2.in[0] <== base[0]; + dbl2.in[1] <== base[1]; + mux.c[0][1] <== dbl2.out[0]; + mux.c[1][1] <== dbl2.out[1]; + +// in[2] -> 3*BASE + adr3.in1[0] <== base[0]; + adr3.in1[1] <== base[1]; + adr3.in2[0] <== dbl2.out[0]; + adr3.in2[1] <== dbl2.out[1]; + mux.c[0][2] <== adr3.out[0]; + mux.c[1][2] <== adr3.out[1]; + +// in[3] -> 4*BASE + adr4.in1[0] <== base[0]; + adr4.in1[1] <== base[1]; + adr4.in2[0] <== adr3.out[0]; + adr4.in2[1] <== adr3.out[1]; + mux.c[0][3] <== adr4.out[0]; + mux.c[1][3] <== adr4.out[1]; + +// in[4] -> 5*BASE + adr5.in1[0] <== base[0]; + adr5.in1[1] <== base[1]; + adr5.in2[0] <== adr4.out[0]; + adr5.in2[1] <== adr4.out[1]; + mux.c[0][4] <== adr5.out[0]; + mux.c[1][4] <== adr5.out[1]; + +// in[5] -> 6*BASE + adr6.in1[0] <== base[0]; + adr6.in1[1] <== base[1]; + adr6.in2[0] <== adr5.out[0]; + adr6.in2[1] <== adr5.out[1]; + mux.c[0][5] <== adr6.out[0]; + mux.c[1][5] <== adr6.out[1]; + +// in[6] -> 7*BASE + adr7.in1[0] <== base[0]; + adr7.in1[1] <== base[1]; + adr7.in2[0] <== adr6.out[0]; + adr7.in2[1] <== adr6.out[1]; + mux.c[0][6] <== adr7.out[0]; + mux.c[1][6] <== adr7.out[1]; + +// in[7] -> 8*BASE + adr8.in1[0] <== base[0]; + adr8.in1[1] <== base[1]; + adr8.in2[0] <== adr7.out[0]; + adr8.in2[1] <== adr7.out[1]; + mux.c[0][7] <== adr8.out[0]; + mux.c[1][7] <== adr8.out[1]; + + out8[0] <== adr8.out[0]; + out8[1] <== adr8.out[1]; + + out[0] <== mux.out[0]; + out[1] <== - mux.out[1]*2*in[3] + mux.out[1]; // Negate y if in[3] is one +} + + +/* nWindows must not exceed 50 */ +template Segment(nWindows) { + signal input in[nWindows*4]; + signal input base[2]; + signal output out[2]; + + var i; + var j; + + // Convert the base to montgomery + + component e2m = Edwards2Montgomery(); + e2m.in[0] <== base[0]; + e2m.in[1] <== base[1]; + + component windows[nWindows]; + component doublers1[nWindows-1]; + component doublers2[nWindows-1]; + component adders[nWindows-1]; + for (i=0; i 1) { + m2e.in[0] <== adders[nWindows-2].out[0]; + m2e.in[1] <== adders[nWindows-2].out[1]; + } else { + m2e.in[0] <== windows[0].out[0]; + m2e.in[1] <== windows[0].out[1]; + } + + out[0] <== m2e.out[0]; + out[1] <== m2e.out[1]; +} + +template Pedersen(n) { + signal input in[n]; + signal output out[2]; + + var BASE = [ + [10457101036533406547632367118273992217979173478358440826365724437999023779287,19824078218392094440610104313265183977899662750282163392862422243483260492317], + [2671756056509184035029146175565761955751135805354291559563293617232983272177,2663205510731142763556352975002641716101654201788071096152948830924149045094], + [5802099305472655231388284418920769829666717045250560929368476121199858275951,5980429700218124965372158798884772646841287887664001482443826541541529227896], + [7107336197374528537877327281242680114152313102022415488494307685842428166594,2857869773864086953506483169737724679646433914307247183624878062391496185654], + [20265828622013100949498132415626198973119240347465898028410217039057588424236,1160461593266035632937973507065134938065359936056410650153315956301179689506], + [1487999857809287756929114517587739322941449154962237464737694709326309567994,14017256862867289575056460215526364897734808720610101650676790868051368668003], + [14618644331049802168996997831720384953259095788558646464435263343433563860015,13115243279999696210147231297848654998887864576952244320558158620692603342236], + [6814338563135591367010655964669793483652536871717891893032616415581401894627,13660303521961041205824633772157003587453809761793065294055279768121314853695], + [3571615583211663069428808372184817973703476260057504149923239576077102575715,11981351099832644138306422070127357074117642951423551606012551622164230222506], + [18597552580465440374022635246985743886550544261632147935254624835147509493269,6753322320275422086923032033899357299485124665258735666995435957890214041481] + ] + + var nSegments = ((n-1)\200)+1; + + component segments[nSegments]; + + var i; + var j; + var nBits; + var nWindows; + for (i=0; i1) { + packPoint.in[0] <== adders[nSegments-2].xout; + packPoint.in[1] <== adders[nSegments-2].yout; + } else { + packPoint.in[0] <== segments[0].out[0]; + packPoint.in[1] <== segments[0].out[1]; + } + + out[0] <== packPoint.out[0]; + out[1] <== packPoint.out[1]; +*/ + + if (nSegments>1) { + out[0] <== adders[nSegments-2].xout; + out[1] <== adders[nSegments-2].yout; + } else { + out[0] <== segments[0].out[0]; + out[1] <== segments[0].out[1]; + } +} + diff --git a/@tornado/circomlib/circuits/pedersen_old.circom b/@tornado/circomlib/circuits/pedersen_old.circom new file mode 100644 index 0000000..35d23a5 --- /dev/null +++ b/@tornado/circomlib/circuits/pedersen_old.circom @@ -0,0 +1,66 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "escalarmul.circom"; + +template Pedersen(n) { + signal input in[n]; + signal output out[2]; + + var nexps = ((n-1) \ 250) + 1; + var nlastbits = n - (nexps-1)*250; + + component escalarMuls[nexps]; + + var PBASE = [ + [10457101036533406547632367118273992217979173478358440826365724437999023779287,19824078218392094440610104313265183977899662750282163392862422243483260492317], + [2671756056509184035029146175565761955751135805354291559563293617232983272177,2663205510731142763556352975002641716101654201788071096152948830924149045094], + [5802099305472655231388284418920769829666717045250560929368476121199858275951,5980429700218124965372158798884772646841287887664001482443826541541529227896], + [7107336197374528537877327281242680114152313102022415488494307685842428166594,2857869773864086953506483169737724679646433914307247183624878062391496185654], + [20265828622013100949498132415626198973119240347465898028410217039057588424236,1160461593266035632937973507065134938065359936056410650153315956301179689506], + [1487999857809287756929114517587739322941449154962237464737694709326309567994,14017256862867289575056460215526364897734808720610101650676790868051368668003], + [14618644331049802168996997831720384953259095788558646464435263343433563860015,13115243279999696210147231297848654998887864576952244320558158620692603342236], + [6814338563135591367010655964669793483652536871717891893032616415581401894627,13660303521961041205824633772157003587453809761793065294055279768121314853695], + [3571615583211663069428808372184817973703476260057504149923239576077102575715,11981351099832644138306422070127357074117642951423551606012551622164230222506], + [18597552580465440374022635246985743886550544261632147935254624835147509493269,6753322320275422086923032033899357299485124665258735666995435957890214041481] + ]; + + var i; + var j; + var nexpbits; + for (i=0; i out[0]; + escalarMuls[nexps-1].out[1] ==> out[1]; +} diff --git a/@tornado/circomlib/circuits/pointbits.circom b/@tornado/circomlib/circuits/pointbits.circom new file mode 100644 index 0000000..ec4d2e7 --- /dev/null +++ b/@tornado/circomlib/circuits/pointbits.circom @@ -0,0 +1,163 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "bitify.circom"; +include "aliascheck.circom"; +include "compconstant.circom"; +include "babyjub.circom"; + + +function sqrt(n) { + + if (n == 0) { + return 0; + } + + // Test that have solution + var res = n ** ((-1) >> 1); +// if (res!=1) assert(false, "SQRT does not exists"); + if (res!=1) return 0; + + var m = 28; + var c = 19103219067921713944291392827692070036145651957329286315305642004821462161904; + var t = n ** 81540058820840996586704275553141814055101440848469862132140264610111; + var r = n ** ((81540058820840996586704275553141814055101440848469862132140264610111+1)>>1); + var sq; + var i; + var b; + var j; + + while ((r != 0)&&(t != 1)) { + sq = t*t; + i = 1; + while (sq!=1) { + i++; + sq = sq*sq; + } + + // b = c ^ m-i-1 + b = c; + for (j=0; j< m-i-1; j ++) b = b*b; + + m = i; + c = b*b; + t = t*c; + r = r*b; + } + + if (r > ((-1) >> 1)) { + r = -r; + } + + return r; +} + + +template Bits2Point() { + signal input in[256]; + signal output out[2]; +} + +template Bits2Point_Strict() { + signal input in[256]; + signal output out[2]; + + var i; + + // Check aliasing + component aliasCheckY = AliasCheck(); + for (i=0; i<254; i++) { + aliasCheckY.in[i] <== in[i]; + } + in[254] === 0; + + component b2nY = Bits2Num(254); + for (i=0; i<254; i++) { + b2nY.in[i] <== in[i]; + } + + out[1] <== b2nY.out; + + var a = 168700; + var d = 168696; + + var y2 = out[1] * out[1]; + + var x = sqrt( (1-y2)/(a - d*y2) ); + + if (in[255] == 1) x = -x; + + out[0] <-- x; + + component babyCheck = BabyCheck(); + babyCheck.x <== out[0]; + babyCheck.y <== out[1]; + + component n2bX = Num2Bits(254); + n2bX.in <== out[0]; + component aliasCheckX = AliasCheck(); + for (i=0; i<254; i++) { + aliasCheckX.in[i] <== n2bX.out[i]; + } + + component signCalc = CompConstant(10944121435919637611123202872628637544274182200208017171849102093287904247808); + for (i=0; i<254; i++) { + signCalc.in[i] <== n2bX.out[i]; + } + + signCalc.out === in[255]; +} + + +template Point2Bits() { + signal input in[2]; + signal output out[256]; + + +} + +template Point2Bits_Strict() { + signal input in[2]; + signal output out[256]; + + var i; + + component n2bX = Num2Bits(254); + n2bX.in <== in[0]; + component n2bY = Num2Bits(254); + n2bY.in <== in[1]; + + component aliasCheckX = AliasCheck(); + component aliasCheckY = AliasCheck(); + for (i=0; i<254; i++) { + aliasCheckX.in[i] <== n2bX.out[i]; + aliasCheckY.in[i] <== n2bY.out[i]; + } + + component signCalc = CompConstant(10944121435919637611123202872628637544274182200208017171849102093287904247808); + for (i=0; i<254; i++) { + signCalc.in[i] <== n2bX.out[i]; + } + + for (i=0; i<254; i++) { + out[i] <== n2bY.out[i]; + } + out[254] <== 0; + out[255] <== signCalc.out; +} diff --git a/@tornado/circomlib/circuits/poseidon.circom b/@tornado/circomlib/circuits/poseidon.circom new file mode 100644 index 0000000..dad6806 --- /dev/null +++ b/@tornado/circomlib/circuits/poseidon.circom @@ -0,0 +1,203 @@ + +template Sigma() { + signal input in; + signal output out; + + signal in2; + signal in4; + + in2 <== in*in; + in4 <== in2*in2; + + out <== in4*in; +} + +template Ark(t, C) { + signal input in[t]; + signal output out[t]; + for (var i=0; i= (nRoundsP + nRoundsF/2))) { + k= i. +*/ + +/* Ch + +000 0 +001 1 +010 0 +011 1 +100 0 +101 0 +110 1 +111 1 + +out = a&b ^ (!a)&c => + +out = a*(b-c) + c + +*/ + +template Ch(n) { + signal input a[n]; + signal input b[n]; + signal input c[n]; + signal output out[n]; + + for (var k=0; k. +*/ + +template H(x) { + signal output out[32]; + var c = [0x6a09e667, + 0xbb67ae85, + 0x3c6ef372, + 0xa54ff53a, + 0x510e527f, + 0x9b05688c, + 0x1f83d9ab, + 0x5be0cd19]; + + for (var i=0; i<32; i++) { + out[i] <== (c[x] >> i) & 1; + } +} + +template K(x) { + signal output out[32]; + var c = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 + ]; + + for (var i=0; i<32; i++) { + out[i] <== (c[x] >> i) & 1; + } +} diff --git a/@tornado/circomlib/circuits/sha256/main.circom b/@tornado/circomlib/circuits/sha256/main.circom new file mode 100644 index 0000000..fbf2434 --- /dev/null +++ b/@tornado/circomlib/circuits/sha256/main.circom @@ -0,0 +1,34 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "sha256_2.jaz"; + +template Main() { + signal private input a; + signal private input b; + signal output out; + + component sha256_2 = SHA256_2(); + + sha256_2.a <== a; + sha256_2.b <== a; + out <== sha256_2.out; +} + +component main = Main(); diff --git a/@tornado/circomlib/circuits/sha256/maj.circom b/@tornado/circomlib/circuits/sha256/maj.circom new file mode 100644 index 0000000..ee53687 --- /dev/null +++ b/@tornado/circomlib/circuits/sha256/maj.circom @@ -0,0 +1,44 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +/* Maj function for sha256 + +out = a&b ^ a&c ^ b&c => + +out = a*b + a*c + b*c - 2*a*b*c => + +out = a*( b + c - 2*b*c ) + b*c => + +mid = b*c +out = a*( b + c - 2*mid ) + mid + +*/ + +template Maj(n) { + signal input a[n]; + signal input b[n]; + signal input c[n]; + signal output out[n]; + signal mid[n]; + + for (var k=0; k. +*/ + +template RotR(n, r) { + signal input in[n]; + signal output out[n]; + + for (var i=0; i> k)&1; + } + + component ha0 = H(0); + component hb0 = H(1); + component hc0 = H(2); + component hd0 = H(3); + component he0 = H(4); + component hf0 = H(5); + component hg0 = H(6); + component hh0 = H(7); + + component sha256compression[nBlocks]; + + for (i=0; i. +*/ + +include "constants.circom"; +include "sha256compression.circom"; +include "../bitify.circom" + +template Sha256_2() { + signal input a; + signal input b; + signal output out; + + var i; + var k; + + component bits2num = Bits2Num(216); + component num2bits[2]; + + num2bits[0] = Num2Bits(216); + num2bits[1] = Num2Bits(216); + + num2bits[0].in <== a; + num2bits[1].in <== b; + + + component sha256compression = Sha256compression() ; + + component ha0 = H(0); + component hb0 = H(1); + component hc0 = H(2); + component hd0 = H(3); + component he0 = H(4); + component hf0 = H(5); + component hg0 = H(6); + component hh0 = H(7); + + for (k=0; k<32; k++ ) { + sha256compression.hin[0*32+k] <== ha0.out[k]; + sha256compression.hin[1*32+k] <== hb0.out[k]; + sha256compression.hin[2*32+k] <== hc0.out[k]; + sha256compression.hin[3*32+k] <== hd0.out[k]; + sha256compression.hin[4*32+k] <== he0.out[k]; + sha256compression.hin[5*32+k] <== hf0.out[k]; + sha256compression.hin[6*32+k] <== hg0.out[k]; + sha256compression.hin[7*32+k] <== hh0.out[k]; + } + + for (i=0; i<216; i++) { + sha256compression.inp[i] <== num2bits[0].out[215-i]; + sha256compression.inp[i+216] <== num2bits[1].out[215-i]; + } + + sha256compression.inp[432] <== 1; + + for (i=433; i<503; i++) { + sha256compression.inp[i] <== 0; + } + + sha256compression.inp[503] <== 1; + sha256compression.inp[504] <== 1; + sha256compression.inp[505] <== 0; + sha256compression.inp[506] <== 1; + sha256compression.inp[507] <== 1; + sha256compression.inp[508] <== 0; + sha256compression.inp[509] <== 0; + sha256compression.inp[510] <== 0; + sha256compression.inp[511] <== 0; + + for (i=0; i<216; i++) { + bits2num.in[i] <== sha256compression.out[255-i]; + } + + out <== bits2num.out; +} diff --git a/@tornado/circomlib/circuits/sha256/sha256compression.circom b/@tornado/circomlib/circuits/sha256/sha256compression.circom new file mode 100644 index 0000000..4ec62dc --- /dev/null +++ b/@tornado/circomlib/circuits/sha256/sha256compression.circom @@ -0,0 +1,156 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "constants.circom"; +include "t1.circom"; +include "t2.circom"; +include "../binsum.circom"; +include "sigmaplus.circom"; + +template Sha256compression() { + signal input hin[256]; + signal input inp[512]; + signal output out[256]; + signal a[65][32]; + signal b[65][32]; + signal c[65][32]; + signal d[65][32]; + signal e[65][32]; + signal f[65][32]; + signal g[65][32]; + signal h[65][32]; + signal w[64][32]; + + var i; + + component sigmaPlus[48]; + for (i=0; i<48; i++) sigmaPlus[i] = SigmaPlus(); + + component ct_k[64]; + for (i=0; i<64; i++) ct_k[i] = K(i); + + component t1[64]; + for (i=0; i<64; i++) t1[i] = T1(); + + component t2[64]; + for (i=0; i<64; i++) t2[i] = T2(); + + component suma[64]; + for (i=0; i<64; i++) suma[i] = BinSum(32, 2); + + component sume[64]; + for (i=0; i<64; i++) sume[i] = BinSum(32, 2); + + component fsum[8]; + for (i=0; i<8; i++) fsum[i] = BinSum(32, 2); + + var k; + var t; + + for (t=0; t<64; t++) { + if (t<16) { + for (k=0; k<32; k++) { + w[t][k] <== inp[t*32+31-k]; + } + } else { + for (k=0; k<32; k++) { + sigmaPlus[t-16].in2[k] <== w[t-2][k]; + sigmaPlus[t-16].in7[k] <== w[t-7][k]; + sigmaPlus[t-16].in15[k] <== w[t-15][k]; + sigmaPlus[t-16].in16[k] <== w[t-16][k]; + w[t][k] <== sigmaPlus[t-16].out[k]; + } + } + } + + for (k=0; k<32; k++ ) { + a[0][k] <== hin[k]; + b[0][k] <== hin[32*1 + k]; + c[0][k] <== hin[32*2 + k]; + d[0][k] <== hin[32*3 + k]; + e[0][k] <== hin[32*4 + k]; + f[0][k] <== hin[32*5 + k]; + g[0][k] <== hin[32*6 + k]; + h[0][k] <== hin[32*7 + k]; + } + + for (t = 0; t<64; t++) { + for (k=0; k<32; k++) { + t1[t].h[k] <== h[t][k]; + t1[t].e[k] <== e[t][k]; + t1[t].f[k] <== f[t][k]; + t1[t].g[k] <== g[t][k]; + t1[t].k[k] <== ct_k[t].out[k]; + t1[t].w[k] <== w[t][k]; + + t2[t].a[k] <== a[t][k]; + t2[t].b[k] <== b[t][k]; + t2[t].c[k] <== c[t][k]; + } + + for (k=0; k<32; k++) { + sume[t].in[0][k] <== d[t][k]; + sume[t].in[1][k] <== t1[t].out[k]; + + suma[t].in[0][k] <== t1[t].out[k]; + suma[t].in[1][k] <== t2[t].out[k]; + } + + for (k=0; k<32; k++) { + h[t+1][k] <== g[t][k]; + g[t+1][k] <== f[t][k]; + f[t+1][k] <== e[t][k]; + e[t+1][k] <== sume[t].out[k]; + d[t+1][k] <== c[t][k]; + c[t+1][k] <== b[t][k]; + b[t+1][k] <== a[t][k]; + a[t+1][k] <== suma[t].out[k]; + } + } + + for (k=0; k<32; k++) { + fsum[0].in[0][k] <== hin[32*0+k]; + fsum[0].in[1][k] <== a[64][k]; + fsum[1].in[0][k] <== hin[32*1+k]; + fsum[1].in[1][k] <== b[64][k]; + fsum[2].in[0][k] <== hin[32*2+k]; + fsum[2].in[1][k] <== c[64][k]; + fsum[3].in[0][k] <== hin[32*3+k]; + fsum[3].in[1][k] <== d[64][k]; + fsum[4].in[0][k] <== hin[32*4+k]; + fsum[4].in[1][k] <== e[64][k]; + fsum[5].in[0][k] <== hin[32*5+k]; + fsum[5].in[1][k] <== f[64][k]; + fsum[6].in[0][k] <== hin[32*6+k]; + fsum[6].in[1][k] <== g[64][k]; + fsum[7].in[0][k] <== hin[32*7+k]; + fsum[7].in[1][k] <== h[64][k]; + } + + for (k=0; k<32; k++) { + out[31-k] <== fsum[0].out[k]; + out[32+31-k] <== fsum[1].out[k]; + out[64+31-k] <== fsum[2].out[k]; + out[96+31-k] <== fsum[3].out[k]; + out[128+31-k] <== fsum[4].out[k]; + out[160+31-k] <== fsum[5].out[k]; + out[192+31-k] <== fsum[6].out[k]; + out[224+31-k] <== fsum[7].out[k]; + } +} diff --git a/@tornado/circomlib/circuits/sha256/shift.circom b/@tornado/circomlib/circuits/sha256/shift.circom new file mode 100644 index 0000000..bdff3fd --- /dev/null +++ b/@tornado/circomlib/circuits/sha256/shift.circom @@ -0,0 +1,32 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +template ShR(n, r) { + signal input in[n]; + signal output out[n]; + + for (var i=0; i= n) { + out[i] <== 0; + } else { + out[i] <== in[ i+r ]; + } + } +} + diff --git a/@tornado/circomlib/circuits/sha256/sigma.circom b/@tornado/circomlib/circuits/sha256/sigma.circom new file mode 100644 index 0000000..3baa646 --- /dev/null +++ b/@tornado/circomlib/circuits/sha256/sigma.circom @@ -0,0 +1,68 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "xor3.circom"; +include "rotate.circom"; +include "shift.circom"; + +template SmallSigma(ra, rb, rc) { + signal input in[32]; + signal output out[32]; + + component xor3 = Xor3(32); + + component rota = RotR(32, ra); + component rotb = RotR(32, rb); + component shrc = ShR(32, rc); + + for (var k=0; k<32; k++) { + rota.in[k] <== in[k]; + rotb.in[k] <== in[k]; + shrc.in[k] <== in[k]; + + xor3.a[k] <== rota.out[k]; + xor3.b[k] <== rotb.out[k]; + xor3.c[k] <== shrc.out[k]; + + out[k] <== xor3.out[k]; + } +} + +template BigSigma(ra, rb, rc) { + signal input in[32]; + signal output out[32]; + + component xor3 = Xor3(32); + + component rota = RotR(32, ra); + component rotb = RotR(32, rb); + component rotc = RotR(32, rc); + + for (var k=0; k<32; k++) { + rota.in[k] <== in[k]; + rotb.in[k] <== in[k]; + rotc.in[k] <== in[k]; + + xor3.a[k] <== rota.out[k]; + xor3.b[k] <== rotb.out[k]; + xor3.c[k] <== rotc.out[k]; + + out[k] <== xor3.out[k]; + } +} diff --git a/@tornado/circomlib/circuits/sha256/sigmaplus.circom b/@tornado/circomlib/circuits/sha256/sigmaplus.circom new file mode 100644 index 0000000..ec5a457 --- /dev/null +++ b/@tornado/circomlib/circuits/sha256/sigmaplus.circom @@ -0,0 +1,45 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "../binsum.circom" +include "sigma.circom" + +template SigmaPlus() { + signal input in2[32]; + signal input in7[32]; + signal input in15[32]; + signal input in16[32]; + signal output out[32]; + + component sum = BinSum(32, 4); + component sigma1 = SmallSigma(17,19,10); + component sigma0 = SmallSigma(7, 18, 3); + + for (var k=0; k<32; k++) { + sigma1.in[k] <== in2[k]; + sigma0.in[k] <== in15[k]; + + sum.in[0][k] <== sigma1.out[k]; + sum.in[1][k] <== in7[k]; + sum.in[2][k] <== sigma0.out[k]; + sum.in[3][k] <== in16[k]; + + out[k] <== sum.out[k]; + } +} diff --git a/@tornado/circomlib/circuits/sha256/t1.circom b/@tornado/circomlib/circuits/sha256/t1.circom new file mode 100644 index 0000000..28caed6 --- /dev/null +++ b/@tornado/circomlib/circuits/sha256/t1.circom @@ -0,0 +1,52 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "../binsum.circom"; +include "sigma.circom"; +include "ch.circom"; + +template T1() { + signal input h[32]; + signal input e[32]; + signal input f[32]; + signal input g[32]; + signal input k[32]; + signal input w[32]; + signal output out[32]; + + component sum = BinSum(32, 5); + component ch = Ch(32); + + component bigsigma1 = BigSigma(6, 11, 25); + + for (var ki=0; ki<32; ki++) { + bigsigma1.in[ki] <== e[ki]; + ch.a[ki] <== e[ki]; + ch.b[ki] <== f[ki]; + ch.c[ki] <== g[ki] + + sum.in[0][ki] <== h[ki]; + sum.in[1][ki] <== bigsigma1.out[ki]; + sum.in[2][ki] <== ch.out[ki]; + sum.in[3][ki] <== k[ki]; + sum.in[4][ki] <== w[ki]; + + out[ki] <== sum.out[ki]; + } +} diff --git a/@tornado/circomlib/circuits/sha256/t2.circom b/@tornado/circomlib/circuits/sha256/t2.circom new file mode 100644 index 0000000..54de837 --- /dev/null +++ b/@tornado/circomlib/circuits/sha256/t2.circom @@ -0,0 +1,47 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "../binsum.circom"; +include "sigma.circom"; +include "maj.circom" + +template T2() { + signal input a[32]; + signal input b[32]; + signal input c[32]; + signal output out[32]; + + component sum = BinSum(32, 2); + + component bigsigma0 = BigSigma(2, 13, 22); + component maj = Maj(32); + + for (var k=0; k<32; k++) { + + bigsigma0.in[k] <== a[k]; + maj.a[k] <== a[k]; + maj.b[k] <== b[k]; + maj.c[k] <== c[k]; + + sum.in[0][k] <== bigsigma0.out[k]; + sum.in[1][k] <== maj.out[k]; + + out[k] <== sum.out[k]; + } +} diff --git a/@tornado/circomlib/circuits/sha256/xor3.circom b/@tornado/circomlib/circuits/sha256/xor3.circom new file mode 100644 index 0000000..9bbe76c --- /dev/null +++ b/@tornado/circomlib/circuits/sha256/xor3.circom @@ -0,0 +1,44 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +/* Xor3 function for sha256 + +out = a ^ b ^ c => + +out = a+b+c - 2*a*b - 2*a*c - 2*b*c + 4*a*b*c => + +out = a*( 1 - 2*b - 2*c + 4*b*c ) + b + c - 2*b*c => + +mid = b*c +out = a*( 1 - 2*b -2*c + 4*mid ) + b + c - 2 * mid + +*/ + +template Xor3(n) { + signal input a[n]; + signal input b[n]; + signal input c[n]; + signal output out[n]; + signal mid[n]; + + for (var k=0; k. +*/ + +include "compconstant.circom"; + +template Sign() { + signal input in[254]; + signal output sign; + + component comp = CompConstant(10944121435919637611123202872628637544274182200208017171849102093287904247808); + + var i; + + for (i=0; i<254; i++) { + comp.in[i] <== in[i]; + } + + sign <== comp.out; +} diff --git a/@tornado/circomlib/circuits/smt/smthash_mimc.circom b/@tornado/circomlib/circuits/smt/smthash_mimc.circom new file mode 100644 index 0000000..bad5290 --- /dev/null +++ b/@tornado/circomlib/circuits/smt/smthash_mimc.circom @@ -0,0 +1,57 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "../mimc.circom"; + + +/* + Hash1 = H(1 | key | value) + */ + +template SMTHash1() { + signal input key; + signal input value; + signal output out; + + component h = MultiMiMC7(2, 91); // Constant + h.in[0] <== key; + h.in[1] <== value; + h.k <== 1; + + out <== h.out; +} + +/* + This component is used to create the 2 nodes. + + Hash2 = H(Hl | Hr) + */ + +template SMTHash2() { + signal input L; + signal input R; + signal output out; + + component h = MultiMiMC7(2, 91); // Constant + h.in[0] <== L; + h.in[1] <== R; + h.k <== 0; + + out <== h.out; +} diff --git a/@tornado/circomlib/circuits/smt/smthash_poseidon.circom b/@tornado/circomlib/circuits/smt/smthash_poseidon.circom new file mode 100644 index 0000000..5a9feb7 --- /dev/null +++ b/@tornado/circomlib/circuits/smt/smthash_poseidon.circom @@ -0,0 +1,56 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +include "../poseidon.circom"; + + +/* + Hash1 = H(1 | key | value) + */ + +template SMTHash1() { + signal input key; + signal input value; + signal output out; + + component h = Poseidon(3, 6, 8, 57); // Constant + h.inputs[0] <== key; + h.inputs[1] <== value; + h.inputs[2] <== 1; + + out <== h.out; +} + +/* + This component is used to create the 2 nodes. + + Hash2 = H(Hl | Hr) + */ + +template SMTHash2() { + signal input L; + signal input R; + signal output out; + + component h = Poseidon(2, 6, 8, 57); // Constant + h.inputs[0] <== L; + h.inputs[1] <== R; + + out <== h.out; +} diff --git a/@tornado/circomlib/circuits/smt/smtlevins.circom b/@tornado/circomlib/circuits/smt/smtlevins.circom new file mode 100644 index 0000000..dfcac1c --- /dev/null +++ b/@tornado/circomlib/circuits/smt/smtlevins.circom @@ -0,0 +1,100 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +/* + +This component finds the level where the oldInsert is done. +The rules are: + +levIns[i] == 1 if its level and all the child levels have a sibling of 0 and +the parent level has a sibling != 0. Considere that the root level always has +a parent with a sibling != 0. + + + ┌──────────────┐ + │ │ + │ │───▶ levIns[0] <== (1-done[i]) + │ │ + └──────────────┘ + ▲ + │ + │ + done[0] + + + + done[i-1] <== levIns[i] + done[i] + ▲ + │ + │ + ┌───────────┐ ┌──────────────┐ + │ │ │ │ + sibling[i-1]───▶│IsZero[i-1]│─▶│ │───▶ levIns[i] <== (1-done[i])*(1-isZero[i-1].out) + │ │ │ │ + └───────────┘ └──────────────┘ + ▲ + │ + │ + done[i] + + + + done[n-2] <== levIns[n-1] + ▲ + │ + │ + ┌───────────┐ ┌──────────────┐ + │ │ │ │ + sibling[n-2]───▶│IsZero[n-2]│─▶│ │────▶ levIns[n-1] <== (1-isZero[n-2].out) + │ │ │ │ + └───────────┘ └──────────────┘ + + ┌───────────┐ + │ │ + sibling[n-1]───▶│IsZero[n-1]│────▶ === 0 + │ │ + └───────────┘ + + */ + +template SMTLevIns(nLevels) { + signal input enabled; + signal input siblings[nLevels]; + signal output levIns[nLevels]; + signal done[nLevels-1]; // Indicates if the insLevel has aready been detected. + + component isZero[nLevels]; + + for (var i=0; i0; i--) { + levIns[i] <== (1-done[i])*(1-isZero[i-1].out) + done[i-1] <== levIns[i] + done[i]; + } + + levIns[0] <== (1-done[0]); +} diff --git a/@tornado/circomlib/circuits/smt/smtprocessor.circom b/@tornado/circomlib/circuits/smt/smtprocessor.circom new file mode 100644 index 0000000..d4e6fb4 --- /dev/null +++ b/@tornado/circomlib/circuits/smt/smtprocessor.circom @@ -0,0 +1,258 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +/*************************************************************************************************** + +SMTProcessor: Sparse Merkle Tree processor is a component to verify an insert/update/delete elements +into the Sparse Merkle tree. + + +Insert to an empty leaf +======================= + + STATE OLD STATE NEW STATE + ===== ========= ========= + + oldRoot newRoot + ▲ ▲ + │ │ + ┌───────┐ ┏━━━┻━━━┓ ┌───────┐ ┏━━━┻━━━┓ + top │Sibling├────▶┃ Hash ┃◀─┐ │Sibling├────▶┃ Hash ┃◀─┐ + └───────┘ ┗━━━━━━━┛ │ └───────┘ ┗━━━━━━━┛ │ + │ │ + │ │ + ┏━━━┻━━━┓ ┌───────┐ ┏━━━┻━━━┓ ┌───────┐ + top ┌─────▶┃ Hash ┃◀──┤Sibling│ ┌─────▶┃ Hash ┃◀──┤Sibling│ + │ ┗━━━━━━━┛ └───────┘ │ ┗━━━━━━━┛ └───────┘ + │ │ + │ │ + ┌───────┐ ┏━━━┻━━━┓ ┌───────┐ ┏━━━┻━━━┓ + top │Sibling├──▶┃ Hash ┃◀─────┐ │Sibling├──▶┃ Hash ┃◀─────┐ + └───────┘ ┗━━━━━━━┛ │ └───────┘ ┗━━━━━━━┛ │ + │ │ + │ │ + ┌────┴────┐ ┌────┴────┐ + old0 │ 0 │ │New1Leaf │ + └─────────┘ └─────────┘ + + + ┏━━━━━━━┓ ┏━━━━━━━┓ + na ┃ Hash ┃ ┃ Hash ┃ + ┗━━━━━━━┛ ┗━━━━━━━┛ + + + ┏━━━━━━━┓ ┏━━━━━━━┓ + na ┃ Hash ┃ ┃ Hash ┃ + ┗━━━━━━━┛ ┗━━━━━━━┛ + + + +Insert to a used leaf. +===================== + + STATE OLD STATE NEW STATE + ===== ========= ========= + + + oldRoot newRoot + ▲ ▲ + │ │ + ┌───────┐ ┏━━━┻━━━┓ ┌───────┐ ┏━━━┻━━━┓ + top │Sibling├────▶┃ Hash ┃◀─┐ │Sibling├────▶┃ Hash ┃◀─┐ + └───────┘ ┗━━━━━━━┛ │ └───────┘ ┗━━━━━━━┛ │ + │ │ + │ │ + ┏━━━┻━━━┓ ┌───────┐ ┏━━━┻━━━┓ ┌───────┐ + top ┌─────▶┃ Hash ┃◀──┤Sibling│ ┌─────▶┃ Hash ┃◀──┤Sibling│ + │ ┗━━━━━━━┛ └───────┘ │ ┗━━━━━━━┛ └───────┘ + │ │ + │ │ + ┌───────┐ ┏━━━┻━━━┓ ┌───────┐ ┏━━━┻━━━┓ + top │Sibling├──▶┃ Hash ┃◀─────┐ │Sibling├──▶┃ Hash ┃◀─────┐ + └───────┘ ┗━━━━━━━┛ │ └───────┘ ┗━━━━━━━┛ │ + │ │ + │ │ + ┌────┴────┐ ┏━━━┻━━━┓ ┌───────┐ + bot │Old1Leaf │ ┌─────▶┃ Hash ┃◀──┼─ 0 │ + └─────────┘ │ ┗━━━━━━━┛ └───────┘ + │ + │ + ┏━━━━━━━┓ ┌───────┐ ┏━━━┻━━━┓ + bot ┃ Hash ┃ │ 0 ─┼──▶┃ Hash ┃◀─────┐ + ┗━━━━━━━┛ └───────┘ ┗━━━━━━━┛ │ + │ + │ + ┏━━━━━━━┓ ┏━━━┻━━━┓ ┌───────┐ + bot ┃ Hash ┃ ┌─────▶┃ Hash ┃◀──│ 0 │ + ┗━━━━━━━┛ │ ┗━━━━━━━┛ └───────┘ + │ + │ + ┏━━━━━━━┓ ┌─────────┐ ┏━━━┻━━━┓ ┌─────────┐ + new1 ┃ Hash ┃ │Old1Leaf ├──▶┃ Hash ┃◀──│New1Leaf │ + ┗━━━━━━━┛ └─────────┘ ┗━━━━━━━┛ └─────────┘ + + + ┏━━━━━━━┓ ┏━━━━━━━┓ + na ┃ Hash ┃ ┃ Hash ┃ + ┗━━━━━━━┛ ┗━━━━━━━┛ + + + ┏━━━━━━━┓ ┏━━━━━━━┓ + na ┃ Hash ┃ ┃ Hash ┃ + ┗━━━━━━━┛ ┗━━━━━━━┛ + + +Fnction +fnc[0] fnc[1] +0 0 NOP +0 1 UPDATE +1 0 INSERT +1 1 DELETE + + +***************************************************************************************************/ + +include "../gates.circom"; +include "../bitify.circom"; +include "../comparators.circom"; +include "../switcher.circom"; +include "smtlevins.circom"; +include "smtprocessorlevel.circom"; +include "smtprocessorsm.circom"; +include "smthash_poseidon.circom"; + +template SMTProcessor(nLevels) { + signal input oldRoot; + signal output newRoot; + signal input siblings[nLevels]; + signal input oldKey; + signal input oldValue; + signal input isOld0; + signal input newKey; + signal input newValue; + signal input fnc[2]; + + signal enabled; + + enabled <== fnc[0] + fnc[1] - fnc[0]*fnc[1] + + component hash1Old = SMTHash1(); + hash1Old.key <== oldKey; + hash1Old.value <== oldValue; + + component hash1New = SMTHash1(); + hash1New.key <== newKey; + hash1New.value <== newValue; + + component n2bOld = Num2Bits_strict(); + component n2bNew = Num2Bits_strict(); + + n2bOld.in <== oldKey; + n2bNew.in <== newKey; + + component smtLevIns = SMTLevIns(nLevels); + for (var i=0; i. +*/ + +/****** + +SMTProcessorLevel + +This circuit has 2 hash + +Outputs according to the state. + +State oldRoot newRoot +===== ======= ======= +top H'(oldChild, sibling) H'(newChild, sibling) +old0 0 new1leaf +bot old1leaf H'(newChild, 0) +new1 old1leaf H'(new1leaf, old1leaf) +na 0 0 + +upd old1leaf new1leaf + +H' is the Hash function with the inputs shifted acordingly. + +*****/ + + +template SMTProcessorLevel() { + signal input st_top; + signal input st_old0; + signal input st_bot; + signal input st_new1; + signal input st_na; + signal input st_upd; + + signal output oldRoot; + signal output newRoot; + signal input sibling; + signal input old1leaf; + signal input new1leaf; + signal input newlrbit; + signal input oldChild; + signal input newChild; + + signal aux[4]; + + component oldProofHash = SMTHash2(); + component newProofHash = SMTHash2(); + + component oldSwitcher = Switcher(); + component newSwitcher = Switcher(); + + // Old side + + oldSwitcher.L <== oldChild; + oldSwitcher.R <== sibling; + + oldSwitcher.sel <== newlrbit; + oldProofHash.L <== oldSwitcher.outL; + oldProofHash.R <== oldSwitcher.outR; + + aux[0] <== old1leaf * (st_bot + st_new1 + st_upd); + oldRoot <== aux[0] + oldProofHash.out * st_top; + + // New side + + aux[1] <== newChild * ( st_top + st_bot); + newSwitcher.L <== aux[1] + new1leaf*st_new1; + + aux[2] <== sibling*st_top; + newSwitcher.R <== aux[2] + old1leaf*st_new1; + + newSwitcher.sel <== newlrbit; + newProofHash.L <== newSwitcher.outL; + newProofHash.R <== newSwitcher.outR; + + aux[3] <== newProofHash.out * (st_top + st_bot + st_new1); + newRoot <== aux[3] + new1leaf * (st_old0 + st_upd); +} diff --git a/@tornado/circomlib/circuits/smt/smtprocessorsm.circom b/@tornado/circomlib/circuits/smt/smtprocessorsm.circom new file mode 100644 index 0000000..fac95b0 --- /dev/null +++ b/@tornado/circomlib/circuits/smt/smtprocessorsm.circom @@ -0,0 +1,164 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +/*************************************************************************************************** +Each level on a SMTProcessor has a state. + +The state of the level depends on the state of te botom level and on `xor` and +`is0` signals. + +`isOldLev` 1 when is the level where oldLeaf is. + +`xor` signal is 0 if the index bit at the current level is the same in the old +and the new index, and 1 if it is different. + +`is0` signal, is 1 if we are inserting/deleting in an empty leaf and 0 if we +are inserting/deleting in a leaf that contains an element. + +The states are: + +top: While the index bits of the old and new insex in the top level is the same, whe are in the top state. +old0: When the we reach insert level, we go to old0 state +if `is0`=1. +btn: Once in insert level and `is0` =0 we go to btn or new1 level if xor=1 +new1: This level is reached when xor=1. Here is where we insert/delete the hash of the +old and the new trees with just one element. +na: Not appliable. After processing it, we go to the na level. + + +Fnction +fnc[0] fnc[1] +0 0 NOP +0 1 UPDATE +1 0 INSERT +1 1 DELETE + + + ########### + # # + ┌────────────────────────────▶# upd #─────────────────────┐ + │ ## ## │ + │ ######### │ + levIns=1 │ │ + fnc[0]=0 │ │ any + │ │ + │ │ + │ │ + │ ########### │ + │ levIns=1 # # │ + levIns=0 │ is0=1 ┌────────────▶# old0 #────────┐ │ any + ┌─────┐ │ fnc[0]=1│ ## ## │ │ ┌──────┐ + │ │ │ │ ######### │ any │ │ │ + │ ▼ │ │ │ ▼ ▼ │ + │ ########### │ │ ########### │ + │ # # ────────────┘ └────────▶# #│ + └──# top # # na # + ## ## ───────────────────┐ levIns=1 ┌──▶## ## + ######### │ is0=0 │ ######### + │ │ fnc[0]=1 │ + │ │ xor=1 ########### │ any + │ └──────────────────▶# # │ + │ # new1 #──┘ + │ ## ## + └────────────────────────────────┐ ######### + levIns=1 │ ▲ + is0=0 │ ┌─────┘ + fnc[0]=1 │ ###########│ xor=1 + xor=0 │ # # + ▼# btn # + ## ## + #########◀───────┐ + │ │ + │ │ + └────────────┘ + xor=0 + +***************************************************************************************************/ + +template SMTProcessorSM() { + signal input xor; + signal input is0; + signal input levIns; + signal input fnc[2]; + + signal input prev_top; + signal input prev_old0; + signal input prev_bot; + signal input prev_new1; + signal input prev_na; + signal input prev_upd; + + signal output st_top; + signal output st_old0; + signal output st_bot; + signal output st_new1; + signal output st_na; + signal output st_upd; + + signal aux1; + signal aux2; + + aux1 <== prev_top * levIns; + aux2 <== aux1*fnc[0]; // prev_top * levIns * fnc[0] + + // st_top = prev_top*(1-levIns) + // = + prev_top + // - prev_top * levIns = aux1 + + st_top <== prev_top - aux1; + + // st_old0 = prev_top * levIns * is0 * fnc[0] + // = + prev_top * levIns * is0 * fnc[0] = aux2 * is0 + + st_old0 <== aux2 * is0; // prev_top * levIns * is0 * fnc[0] + + // st_new1 = prev_top * levIns * (1-is0)*fnc[0] * xor + prev_bot*xor = + // = + prev_top * levIns * fnc[0] * xor = aux2 * xor + // - prev_top * levIns * is0 * fnc[0] * xor = st_old0 * xor + // + prev_bot * xor = prev_bot * xor + + st_new1 <== (aux2 - st_old0 + prev_bot)*xor; + + + // st_bot = prev_top * levIns * (1-is0)*fnc[0] * (1-xor) + prev_bot*(1-xor); + // = + prev_top * levIns * fnc[0] + // - prev_top * levIns * is0 * fnc[0] + // - prev_top * levIns * fnc[0] * xor + // + prev_top * levIns * is0 * fnc[0] * xor + // + prev_bot + // - prev_bot * xor + + st_bot <== (1-xor) * (aux2 - st_old0 + prev_bot) + + + // st_upd = prev_top * (1-fnc[0]) *levIns; + // = + prev_top * levIns + // - prev_top * levIns * fnc[0] + + st_upd <== aux1 - aux2 + + // st_na = prev_new1 + prev_old0 + prev_na + prev_upd; + // = + prev_new1 + // + prev_old0 + // + prev_na + // + prev_upd + + st_na <== prev_new1 + prev_old0 + prev_na + prev_upd; + +} diff --git a/@tornado/circomlib/circuits/smt/smtverifier.circom b/@tornado/circomlib/circuits/smt/smtverifier.circom new file mode 100644 index 0000000..fbfba25 --- /dev/null +++ b/@tornado/circomlib/circuits/smt/smtverifier.circom @@ -0,0 +1,135 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +/* + +SMTVerifier is a component to verify inclusion/exclusion of an element in the tree + + +fnc: 0 -> VERIFY INCLUSION + 1 -> VERIFY NOT INCLUSION + + */ + + +include "../gates.circom"; +include "../bitify.circom"; +include "../comparators.circom"; +include "../switcher.circom"; +include "smtlevins.circom"; +include "smtverifierlevel.circom"; +include "smtverifiersm.circom"; +include "smthash_poseidon.circom"; + +template SMTVerifier(nLevels) { + signal input enabled; + signal input root; + signal input siblings[nLevels]; + signal input oldKey; + signal input oldValue; + signal input isOld0; + signal input key; + signal input value; + signal input fnc; + + component hash1Old = SMTHash1(); + hash1Old.key <== oldKey; + hash1Old.value <== oldValue; + + component hash1New = SMTHash1(); + hash1New.key <== key; + hash1New.value <== value; + + component n2bOld = Num2Bits_strict(); + component n2bNew = Num2Bits_strict(); + + n2bOld.in <== oldKey; + n2bNew.in <== key; + + component smtLevIns = SMTLevIns(nLevels); + for (var i=0; i. +*/ + +/****** + +SMTVerifierLevel + +This circuit has 1 hash + +Outputs according to the state. + +State root +===== ======= +top H'(child, sibling) +i0 0 +iold old1leaf +inew new1leaf +na 0 + +H' is the Hash function with the inputs shifted acordingly. + +*****/ + + +template SMTVerifierLevel() { + signal input st_top; + signal input st_i0; + signal input st_iold; + signal input st_inew; + signal input st_na; + + signal output root; + signal input sibling; + signal input old1leaf; + signal input new1leaf; + signal input lrbit; + signal input child; + + signal aux[2]; + + component proofHash = SMTHash2(); + component switcher = Switcher(); + + switcher.L <== child; + switcher.R <== sibling; + + switcher.sel <== lrbit; + proofHash.L <== switcher.outL; + proofHash.R <== switcher.outR; + + aux[0] <== proofHash.out * st_top; + aux[1] <== old1leaf*st_iold; + + root <== aux[0] + aux[1] + new1leaf*st_inew; +} diff --git a/@tornado/circomlib/circuits/smt/smtverifiersm.circom b/@tornado/circomlib/circuits/smt/smtverifiersm.circom new file mode 100644 index 0000000..f519653 --- /dev/null +++ b/@tornado/circomlib/circuits/smt/smtverifiersm.circom @@ -0,0 +1,105 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +/* +Each level in the SMTVerifier has a state. + +This is the state machine. + +The signals are + +levIns: 1 if we are in the level where the insertion should happen +xor: 1 if the bitKey of the old and new keys are different in this level +is0: Input that indicates that the oldKey is 0 +fnc: 0 -> VERIFY INCLUSION + 1 -> VERIFY NOT INCLUSION + +err state is not a state itself. It's a lack of state. + +The end of the last level will have to be `na` + + levIns=0 any + ┌────┐ ┌────┐ + │ │ │ │ + │ ▼ levIns=1 ▼ │ + │ ########### is0=1 ########### ########### │ + │ # # fnc=1 # # any # # │ + └──# top # ─────────────────────▶# i0 #───────────────▶# na #──┘ + ## ## ──────────┐ ## ## ┌───────▶## ## + ########─────────────┐│ ######### │┌────────▶######### + ││ levIns=1 ││ + ││ is0=0 ########### ││ + ││ fnc=1 # # any│ + │└──────────▶ # iold #────────┘│ + │ ## ## │ + │ ######### │ + │ │ + │ levIns=1 ########### │ + │ fnc=0 # # any + └────────────▶# inew #─────────┘ + ## ## + ######### + + */ + + +template SMTVerifierSM() { + signal input is0; + signal input levIns; + signal input fnc; + + signal input prev_top; + signal input prev_i0; + signal input prev_iold; + signal input prev_inew; + signal input prev_na; + + signal output st_top; + signal output st_i0; + signal output st_iold; + signal output st_inew; + signal output st_na; + + signal prev_top_lev_ins; + signal prev_top_lev_ins_fnc; + + prev_top_lev_ins <== prev_top * levIns; + prev_top_lev_ins_fnc <== prev_top_lev_ins*fnc; // prev_top * levIns * fnc + + // st_top = prev_top * (1-levIns) + // = + prev_top + // - prev_top * levIns + st_top <== prev_top - prev_top_lev_ins; + + // st_inew = prev_top * levIns * (1-fnc) + // = + prev_top * levIns + // - prev_top * levIns * fnc + st_inew <== prev_top_lev_ins - prev_top_lev_ins_fnc; + + // st_iold = prev_top * levIns * (1-is0)*fnc + // = + prev_top * levIns * fnc + // - prev_top * levIns * fnc * is0 + st_iold <== prev_top_lev_ins_fnc * (1 - is0); + + // st_i0 = prev_top * levIns * is0 + // = + prev_top * levIns * is0 + st_i0 <== prev_top_lev_ins * is0; + + st_na <== prev_na + prev_inew + prev_iold + prev_i0; +} diff --git a/@tornado/circomlib/circuits/switcher.circom b/@tornado/circomlib/circuits/switcher.circom new file mode 100644 index 0000000..4d8b114 --- /dev/null +++ b/@tornado/circomlib/circuits/switcher.circom @@ -0,0 +1,40 @@ +/* + Copyright 2018 0KIMS association. + + This file is part of circom (Zero Knowledge Circuit Compiler). + + circom is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + circom is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with circom. If not, see . +*/ + +/* + Assume sel is binary. + + If sel == 0 then outL = L and outR=R + If sel == 1 then outL = R and outR=L + + */ + +template Switcher() { + signal input sel; + signal input L; + signal input R; + signal output outL; + signal output outR; + + signal aux; + + aux <== (R-L)*sel; // We create aux in order to have only one multiplication + outL <== aux + L; + outR <== -aux + R; +} diff --git a/@tornado/circomlib/doc/root_transfer.monopic b/@tornado/circomlib/doc/root_transfer.monopic new file mode 100644 index 0000000..032c0ba Binary files /dev/null and b/@tornado/circomlib/doc/root_transfer.monopic differ diff --git a/@tornado/circomlib/doc/smt_diagram_0.monopic b/@tornado/circomlib/doc/smt_diagram_0.monopic new file mode 100644 index 0000000..c8e5b9b Binary files /dev/null and b/@tornado/circomlib/doc/smt_diagram_0.monopic differ diff --git a/@tornado/circomlib/doc/smt_diagram_1.monopic b/@tornado/circomlib/doc/smt_diagram_1.monopic new file mode 100644 index 0000000..2f645f2 Binary files /dev/null and b/@tornado/circomlib/doc/smt_diagram_1.monopic differ diff --git a/@tornado/circomlib/doc/smt_hash.monopic b/@tornado/circomlib/doc/smt_hash.monopic new file mode 100644 index 0000000..afb506a Binary files /dev/null and b/@tornado/circomlib/doc/smt_hash.monopic differ diff --git a/@tornado/circomlib/doc/smt_levins.monopic b/@tornado/circomlib/doc/smt_levins.monopic new file mode 100644 index 0000000..2c306a8 Binary files /dev/null and b/@tornado/circomlib/doc/smt_levins.monopic differ diff --git a/@tornado/circomlib/doc/smt_sm.monopic b/@tornado/circomlib/doc/smt_sm.monopic new file mode 100644 index 0000000..f3ee288 Binary files /dev/null and b/@tornado/circomlib/doc/smt_sm.monopic differ diff --git a/@tornado/circomlib/doc/smt_verifier_sm.monopic b/@tornado/circomlib/doc/smt_verifier_sm.monopic new file mode 100644 index 0000000..60551cb Binary files /dev/null and b/@tornado/circomlib/doc/smt_verifier_sm.monopic differ diff --git a/@tornado/circomlib/doc/voting.monopic b/@tornado/circomlib/doc/voting.monopic new file mode 100644 index 0000000..0e1710d Binary files /dev/null and b/@tornado/circomlib/doc/voting.monopic differ diff --git a/@tornado/circomlib/doc/window.monopic b/@tornado/circomlib/doc/window.monopic new file mode 100644 index 0000000..309dfb1 Binary files /dev/null and b/@tornado/circomlib/doc/window.monopic differ diff --git a/@tornado/circomlib/doc/window_chain.monopic b/@tornado/circomlib/doc/window_chain.monopic new file mode 100644 index 0000000..47c18bd Binary files /dev/null and b/@tornado/circomlib/doc/window_chain.monopic differ diff --git a/@tornado/circomlib/index.d.ts b/@tornado/circomlib/index.d.ts new file mode 100644 index 0000000..be31b6c --- /dev/null +++ b/@tornado/circomlib/index.d.ts @@ -0,0 +1,328 @@ +declare module "circomlib/src/babyjub" { + export const Generator: any[]; + export const Base8: any[]; + export const order: any; + export const subOrder: any; + export const A: any; + export const D: any; + export function addPoint(a: any, b: any): any[]; + export function mulPointEscalar(base: any, e: any): any[]; + export function inCurve(P: any): boolean; + export function inSubgroup(P: any): any; + export function packPoint(P: any): any; + export function unpackPoint(_buff: any): any[]; + export { unknown as p }; +} +declare module "circomlib/src/pedersenHash" { + function pedersenHash(msg: any): any; + export function getBasePoint(pointIdx: any): any; + export { pedersenHash as hash }; +} +declare module "circomlib/src/mimc7" { + export function getIV(seed: any): any; + export function getConstants(seed: any, nRounds: any): any[]; + export function hash(_x_in: any, _k: any): any; + export function multiHash(arr: any, key: any): any; +} +declare module "circomlib/src/poseidon" { + export function getMatrix(t: any, seed: any, nRounds: any): any[]; + export function getConstants(t: any, seed: any, nRounds: any): any[]; + export function createHash(t: any, nRoundsF: any, nRoundsP: any, seed: any): (inputs: any) => any; +} +declare module "circomlib/src/mimcsponge" { + export function getIV(seed: any): any; + export function getConstants(seed: any, nRounds: any): any[]; + export function hash(_xL_in: any, _xR_in: any, _k: any): { + xL: any; + xR: any; + }; + export function multiHash(arr: any, key: any, numOutputs: any): any; +} +declare module "circomlib/src/eddsa" { + export function prv2pub(prv: any): any[]; + export function sign(prv: any, msg: any): { + R8: any[]; + S: any; + }; + export function signMiMC(prv: any, msg: any): { + R8: any[]; + S: any; + }; + export function signPoseidon(prv: any, msg: any): { + R8: any[]; + S: any; + }; + export function signMiMCSponge(prv: any, msg: any): { + R8: any[]; + S: any; + }; + export function verify(msg: any, sig: any, A: any): boolean; + export function verifyMiMC(msg: any, sig: any, A: any): boolean; + export function verifyPoseidon(msg: any, sig: any, A: any): boolean; + export function verifyMiMCSponge(msg: any, sig: any, A: any): boolean; + export function packSignature(sig: any): Buffer; + export function unpackSignature(sigBuff: any): { + R8: any[]; + S: any; + }; + export function pruneBuffer(_buff: any): Buffer; +} +declare module "circomlib/src/evmasm" { + export = Contract; + export class Contract { + code: any[]; + labels: {}; + pendingLabels: {}; + createTxData(): string; + stop(): void; + add(): void; + mul(): void; + sub(): void; + div(): void; + sdiv(): void; + mod(): void; + smod(): void; + addmod(): void; + mulmod(): void; + exp(): void; + signextend(): void; + lt(): void; + gt(): void; + slt(): void; + sgt(): void; + eq(): void; + iszero(): void; + and(): void; + or(): void; + shor(): void; + not(): void; + byte(): void; + keccak(): void; + sha3(): void; + address(): void; + balance(): void; + origin(): void; + caller(): void; + callvalue(): void; + calldataload(): void; + calldatasize(): void; + calldatacopy(): void; + codesize(): void; + codecopy(): void; + gasprice(): void; + extcodesize(): void; + extcodecopy(): void; + returndatasize(): void; + returndatacopy(): void; + blockhash(): void; + coinbase(): void; + timestamp(): void; + number(): void; + difficulty(): void; + gaslimit(): void; + pop(): void; + mload(): void; + mstore(): void; + mstore8(): void; + sload(): void; + sstore(): void; + _pushLabel(label: any): void; + _fillLabel(label: any): void; + jmp(label: any): void; + jmpi(label: any): void; + pc(): void; + msize(): void; + gas(): void; + label(name: any): void; + push(data: any): void; + dup(n: any): void; + swap(n: any): void; + log0(): void; + log1(): void; + log2(): void; + log3(): void; + log4(): void; + create(): void; + call(): void; + callcode(): void; + return(): void; + delegatecall(): void; + staticcall(): void; + revert(): void; + invalid(): void; + selfdestruct(): void; + } +} +declare module "circomlib/src/g2_gencontract" { + export const abi: { + constant: boolean; + inputs: { + name: string; + type: string; + }[]; + name: string; + outputs: { + name: string; + type: string; + }[]; + payable: boolean; + stateMutability: string; + type: string; + }[]; + export function createCode(P: any, w: any): string; +} +declare module "circomlib/src/mimc_gencontract" { + export const abi: { + constant: boolean; + inputs: { + name: string; + type: string; + }[]; + name: string; + outputs: { + name: string; + type: string; + }[]; + payable: boolean; + stateMutability: string; + type: string; + }[]; + export function createCode(seed: any, n: any): string; +} +declare module "circomlib/src/mimc_print_iv" { + export {}; +} +declare module "circomlib/src/mimc_printconstants" { + export {}; +} +declare module "circomlib/src/mimc_printcontract" { + export {}; +} +declare module "circomlib/src/mimcsponge_gencontract" { + export const abi: { + constant: boolean; + inputs: { + name: string; + type: string; + }[]; + name: string; + outputs: { + name: string; + type: string; + }[]; + payable: boolean; + stateMutability: string; + type: string; + }[]; + export function createCode(seed: any, n: any): string; +} +declare module "circomlib/src/mimcsponge_printconstants" { + export {}; +} +declare module "circomlib/src/mimcsponge_printcontract" { + export {}; +} +declare module "circomlib/src/pedersen_printbases" { + export {}; +} +declare module "circomlib/src/poseidon_gencontract" { + export const abi: { + constant: boolean; + inputs: { + name: string; + type: string; + }[]; + name: string; + outputs: { + name: string; + type: string; + }[]; + payable: boolean; + stateMutability: string; + type: string; + }[]; + export function createCode(t: any, nRoundsF: any, nRoundsP: any, seed: any): string; +} +declare module "circomlib/src/poseidon_printconstants" { + export {}; +} +declare module "circomlib/src/poseidon_printcontract" { + export {}; +} +declare module "circomlib/src/poseidon_printmatrix" { + export {}; +} +declare module "circomlib/src/smt_memdb" { + export = SMTMemDb; + export class SMTMemDb { + nodes: {}; + root: any; + getRoot(): Promise; + _key2str(k: any): any; + _normalize(n: any): void; + get(key: any): Promise; + multiGet(keys: any): Promise; + setRoot(rt: any): Promise; + multiIns(inserts: any): Promise; + multiDel(dels: any): Promise; + } +} +declare module "circomlib/src/smt_hashes_poseidon" { + export function hash0(left: any, right: any): any; + export function hash1(key: any, value: any): any; +} +declare module "circomlib/src/smt" { + export function loadFromFile(fileName: any): Promise; + export function newMemEmptyTrie(): Promise; + export class SMT { + constructor(db: any, root: any); + db: any; + root: any; + _splitBits(_key: any): boolean[]; + update(_key: any, _newValue: any): Promise<{ + oldRoot: any; + oldKey: any; + oldValue: any; + newKey: any; + newValue: any; + siblings: any; + newRoot: any; + }>; + delete(_key: any): Promise<{ + siblings: any[]; + delKey: any; + delValue: any; + }>; + insert(_key: any, _value: any): Promise<{ + oldRoot: any; + siblings: any; + oldKey: any; + oldValue: any; + newRoot: any; + isOld0: any; + }>; + find(key: any): Promise; + _find(key: any, keyBits: any, root: any, level: any): any; + } + import SMTMemDB = require("circomlib/src/smt_memdb"); + export { SMTMemDB }; +} +declare module "circomlib/src/smt_hashes_mimc" { + export function hash0(left: any, right: any): any; + export function hash1(key: any, value: any): any; +} +declare module "circomlib/calcpedersenbases/calcpedersenbases" { + export {}; +} +declare module "circomlib" { + export const smt: typeof import("circomlib/src/smt"); + export const eddsa: typeof import("circomlib/src/eddsa"); + export const mimc7: typeof import("circomlib/src/mimc7"); + export const mimcsponge: typeof import("circomlib/src/mimcsponge"); + export const babyJub: typeof import("circomlib/src/babyjub"); + export const pedersenHash: typeof import("circomlib/src/pedersenHash"); + export const SMT: typeof import("circomlib/src/smt").SMT; + export const SMTMemDB: typeof import("circomlib/src/smt_memdb"); + export const poseidon: typeof import("circomlib/src/poseidon"); +} +//# sourceMappingURL=index.d.ts.map diff --git a/@tornado/circomlib/index.d.ts.map b/@tornado/circomlib/index.d.ts.map new file mode 100644 index 0000000..7e1b7c9 --- /dev/null +++ b/@tornado/circomlib/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/babyjub.js","src/pedersenHash.js","src/mimc7.js","src/poseidon.js","src/mimcsponge.js","src/eddsa.js","src/evmasm.js","src/g2_gencontract.js","src/mimc_gencontract.js","src/mimc_print_iv.js","src/mimc_printconstants.js","src/mimc_printcontract.js","src/mimcsponge_gencontract.js","src/mimcsponge_printconstants.js","src/mimcsponge_printcontract.js","src/pedersen_printbases.js","src/poseidon_gencontract.js","src/poseidon_printconstants.js","src/poseidon_printcontract.js","src/poseidon_printmatrix.js","src/smt_memdb.js","src/smt_hashes_poseidon.js","src/smt.js","src/smt_hashes_mimc.js","calcpedersenbases/calcpedersenbases.js","index.js"],"names":[],"mappings":";;;;;;;IAwBA,gDAaC;IAED,0DAcC;IAQD,yCAWC;IAjBD,wCAIC;IAeD,uCAMC;IAED,+CA0BC;;;;IChGD,qCA4CC;IAID,iDAoBC;;;;ICxEe,sCAMf;IAEsB,6DActB;IAIe,+CAUf;IAEmB,mDAiBnB;;;IC7BmB,kEAoBnB;IAEsB,qEAMtB;IAuBoB,kGA4BpB;;;ICzGe,sCAMf;IAEsB,6DAetB;IAIc;;;MAmBd;IAEmB,oEA6BnB;;;ICvDD,yCAKC;IAED;;;MAmBC;IAED;;;MAiBC;IAqBD;;;MAkBC;IArCD;;;MAiBC;IAsBD,4DAuBC;IAED,gEAoBC;IAGD,oEAqBC;IAED,sEAoBC;IAED,gDAIC;IAED;;;MAKC;IAtMD,gDAMC;;;;ICrBD;QAEQ,YAAc;QACd,WAAgB;QAChB,kBAAuB;QAG3B,uBA2BC;QAED,aAAgC;QAChC,YAAgC;QAChC,YAAgC;QAChC,YAAgC;QAChC,YAAgC;QAChC,aAAgC;QAChC,YAAgC;QAChC,aAAiC;QACjC,eAAmC;QACnC,eAAmC;QACnC,YAAgC;QAChC,mBAAuC;QAEvC,WAAgC;QAChC,WAAgC;QAChC,YAAgC;QAChC,YAAgC;QAChC,WAAgC;QAChC,eAAmC;QACnC,YAAgC;QAChC,WAA+B;QAC/B,aAAiC;QACjC,YAAgC;QAChC,aAAiC;QAEjC,eAAkC;QAClC,aAAgC;QAEhC,gBAAoC;QACpC,gBAAoC;QACpC,eAAmC;QACnC,eAAmC;QACnC,kBAAsC;QACtC,qBAAyC;QACzC,qBAAyC;QACzC,qBAAyC;QACzC,iBAAqC;QACrC,iBAAqC;QACrC,iBAAqC;QACrC,oBAAwC;QACxC,oBAAwC;QACxC,uBAA2C;QAC3C,uBAA2C;QAE3C,kBAAsC;QACtC,iBAAqC;QACrC,kBAAsC;QACtC,eAAmC;QACnC,mBAAuC;QACvC,iBAAqC;QAErC,YAAgC;QAChC,cAAkC;QAClC,eAAmC;QACnC,gBAAoC;QACpC,cAAkC;QAClC,eAAmC;QAEnC,6BAQC;QAED,6BAcC;QAGD,sBAKC;QAED,uBAKC;QAED,WAA+B;QAC/B,cAAkC;QAClC,YAAgC;QAChC,uBAQC;QAED,sBAMC;QAED,kBAKC;QAED,mBAKC;QAED,aAAiC;QACjC,aAAiC;QACjC,aAAiC;QACjC,aAAiC;QACjC,aAAiC;QAEjC,eAAmC;QACnC,aAAiC;QACjC,iBAAqC;QACrC,eAAmC;QACnC,qBAAyC;QAEzC,mBAAuC;QACvC,eAAmC;QACnC,gBAAoC;QACpC,qBAAyC;KAC5C;;;;;;;;;;;;;;;;;;IClLD,mDA2hBC;;;;;;;;;;;;;;;;;;ICliBD,sDA2EC;;;;;;;;;;;;;;;;;;;;;;;;;;;II3ED,sDAyEC;;;;;;;;;;;;;;;;;;;;;;;;;;;II9DD,oFAsIC;;;;;;;;;;;;;IIvJD;QAEQ,UAAe;QACf,UAAqB;QAGzB,wBAEC;QAED,sBAIC;QAED,yBAIC;QAED,4BAGC;QAED,oCAMC;QAED,gCAEC;QAED,sCAMC;QAED,mCAKC;KACJ;;;IClDe,kDAEf;IAEe,iDAEf;;;IC+RD,2DAEC;IAED,gDAKC;IA9SD;QAEI,gCAGC;QAFG,QAAY;QACZ,UAAgB;QAGpB,iCAiBC;QAED;;;;;;;;WA+CC;QAED;;;;WAmFC;QAED;;;;;;;WA+EC;QAED,6BAGC;QAED,0DA4CC;KACJ;;;;;ICrSe,kDAEf;IAEe,iDAEf"} \ No newline at end of file diff --git a/@tornado/circomlib/index.js b/@tornado/circomlib/index.js new file mode 100644 index 0000000..b5df488 --- /dev/null +++ b/@tornado/circomlib/index.js @@ -0,0 +1,9 @@ +exports.smt = require("./src/smt"); +exports.eddsa = require("./src/eddsa"); +exports.mimc7 = require("./src/mimc7"); +exports.mimcsponge = require("./src/mimcsponge"); +exports.babyJub = require("./src/babyjub"); +exports.pedersenHash = require("./src/pedersenHash"); +exports.SMT = require("./src/smt").SMT; +exports.SMTMemDB = require("./src/smt_memdb"); +exports.poseidon = require("./src/poseidon"); diff --git a/@tornado/circomlib/package.json b/@tornado/circomlib/package.json new file mode 100644 index 0000000..36bf8bd --- /dev/null +++ b/@tornado/circomlib/package.json @@ -0,0 +1,41 @@ +{ + "name": "@tornado/circomlib", + "version": "0.0.20-p2", + "description": "Basic circuits library for Circom", + "main": "index.js", + "directories": { + "test": "test" + }, + "scripts": { + "test": "mocha --max-old-space-size=4000" + }, + "keywords": [ + "pedersen", + "hash", + "ethereum", + "circuit", + "circom", + "zksnark" + ], + "repository": { + "type": "git", + "url": "https://development.tornadocash.community/tornadocash/circomlib" + }, + "author": "0Kims", + "license": "GPL-3.0", + "dependencies": { + "@tornado/snarkjs": "workspace:*", + "blake-hash": "^1.1.0", + "blake2b": "^2.1.3", + "typedarray-to-buffer": "^3.1.5", + "web3": "^1.9.0", + "web3-utils": "^1.9.0" + }, + "devDependencies": { + "circom": "0.0.35", + "eslint-plugin-mocha": "^5.2.0", + "ganache-cli": "^6.4.4", + "mocha": "^5.2.0", + "typescript": "^5.0.2" + } +} diff --git a/@tornado/circomlib/src/babyjub.js b/@tornado/circomlib/src/babyjub.js new file mode 100644 index 0000000..9851736 --- /dev/null +++ b/@tornado/circomlib/src/babyjub.js @@ -0,0 +1,109 @@ +const bn128 = require("@tornado/snarkjs").bn128; +const bigInt = require("@tornado/snarkjs").bigInt; + +exports.addPoint = addPoint; +exports.mulPointEscalar = mulPointEscalar; +exports.inCurve = inCurve; +exports.inSubgroup = inSubgroup; +exports.packPoint = packPoint; +exports.unpackPoint = unpackPoint; +exports.Generator = [ + bigInt("995203441582195749578291179787384436505546430278305826713579947235728471134"), + bigInt("5472060717959818805561601436314318772137091100104008585924551046643952123905") +]; +exports.Base8 = [ + bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"), + bigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203") +]; +exports.order = bigInt("21888242871839275222246405745257275088614511777268538073601725287587578984328"); +exports.subOrder = exports.order.shr(3); +exports.p = bn128.r; +exports.A = bigInt("168700"); +exports.D = bigInt("168696"); + + +function addPoint(a,b) { + const q = bn128.r; + + const res = []; + + /* does the equivalent of: + res[0] = bigInt((a[0]*b[1] + b[0]*a[1]) * bigInt(bigInt("1") + d*a[0]*b[0]*a[1]*b[1]).inverse(q)).affine(q); + res[1] = bigInt((a[1]*b[1] - cta*a[0]*b[0]) * bigInt(bigInt("1") - d*a[0]*b[0]*a[1]*b[1]).inverse(q)).affine(q); + */ + res[0] = bigInt((bigInt(a[0]).mul(b[1]).add(bigInt(b[0]).mul(a[1]))).mul(bigInt(bigInt("1").add(exports.D.mul(a[0]).mul(b[0]).mul(a[1]).mul(b[1]))).inverse(q))).affine(q); + res[1] = bigInt((bigInt(a[1]).mul(b[1]).sub(exports.A.mul(a[0]).mul(b[0]))).mul(bigInt(bigInt("1").sub(exports.D.mul(a[0]).mul(b[0]).mul(a[1]).mul(b[1]))).inverse(q))).affine(q); + + return res; +} + +function mulPointEscalar(base, e) { + let res = [bigInt("0"),bigInt("1")]; + let rem = bigInt(e); + let exp = base; + + while (! rem.isZero()) { + if (rem.isOdd()) { + res = addPoint(res, exp); + } + exp = addPoint(exp, exp); + rem = rem.shr(1); + } + + return res; +} + +function inSubgroup(P) { + if (!inCurve(P)) return false; + const res= mulPointEscalar(P, exports.subOrder); + return (res[0].equals(bigInt(0))) && (res[1].equals(bigInt(1))); +} + +function inCurve(P) { + const F = bn128.Fr; + + const x2 = F.square(P[0]); + const y2 = F.square(P[1]); + + if (!F.equals( + F.add(F.mul(exports.A, x2), y2), + F.add(F.one, F.mul(F.mul(x2, y2), exports.D)))) return false; + + return true; +} + +function packPoint(P) { + const buff = bigInt.leInt2Buff(P[1], 32); + if (P[0].greater(exports.p.shr(1))) { + buff[31] = buff[31] | 0x80; + } + return buff; +} + +function unpackPoint(_buff) { + const F = bn128.Fr; + + const buff = Buffer.from(_buff); + let sign = false; + const P = new Array(2); + if (buff[31] & 0x80) { + sign = true; + buff[31] = buff[31] & 0x7F; + } + P[1] = bigInt.leBuff2int(buff); + if (P[1].greaterOrEquals(exports.p)) return null; + + const y2 = F.square(P[1]); + + let x = F.sqrt(F.div( + F.sub(F.one, y2), + F.sub(exports.A, F.mul(exports.D, y2)))); + + if (x == null) return null; + + if (sign) x = F.neg(x); + + P[0] = F.affine(x); + + return P; +} diff --git a/@tornado/circomlib/src/eddsa.js b/@tornado/circomlib/src/eddsa.js new file mode 100644 index 0000000..e3fa3de --- /dev/null +++ b/@tornado/circomlib/src/eddsa.js @@ -0,0 +1,223 @@ +const createBlakeHash = require("blake-hash"); +const bigInt = require("@tornado/snarkjs").bigInt; +const babyJub = require("./babyjub"); +const pedersenHash = require("./pedersenHash").hash; +const mimc7 = require("./mimc7"); +const poseidon = require("./poseidon.js"); +const mimcsponge = require("./mimcsponge"); + +exports.prv2pub= prv2pub; +exports.sign = sign; +exports.signMiMC = signMiMC; +exports.signPoseidon = signPoseidon; +exports.signMiMCSponge = signMiMCSponge; +exports.verify = verify; +exports.verifyMiMC = verifyMiMC; +exports.verifyPoseidon = verifyPoseidon; +exports.verifyMiMCSponge = verifyMiMCSponge; +exports.packSignature = packSignature; +exports.unpackSignature = unpackSignature; +exports.pruneBuffer = pruneBuffer; + + +function pruneBuffer(_buff) { + const buff = Buffer.from(_buff); + buff[0] = buff[0] & 0xF8; + buff[31] = buff[31] & 0x7F; + buff[31] = buff[31] | 0x40; + return buff; +} + +function prv2pub(prv) { + const sBuff = pruneBuffer(createBlakeHash("blake512").update(prv).digest().slice(0,32)); + let s = bigInt.leBuff2int(sBuff); + const A = babyJub.mulPointEscalar(babyJub.Base8, s.shr(3)); + return A; +} + +function sign(prv, msg) { + const h1 = createBlakeHash("blake512").update(prv).digest(); + const sBuff = pruneBuffer(h1.slice(0,32)); + const s = bigInt.leBuff2int(sBuff); + const A = babyJub.mulPointEscalar(babyJub.Base8, s.shr(3)); + + const rBuff = createBlakeHash("blake512").update(Buffer.concat([h1.slice(32,64), msg])).digest(); + let r = bigInt.leBuff2int(rBuff); + r = r.mod(babyJub.subOrder); + const R8 = babyJub.mulPointEscalar(babyJub.Base8, r); + const R8p = babyJub.packPoint(R8); + const Ap = babyJub.packPoint(A); + const hmBuff = pedersenHash(Buffer.concat([R8p, Ap, msg])); + const hm = bigInt.leBuff2int(hmBuff); + const S = r.add(hm.mul(s)).mod(babyJub.subOrder); + return { + R8: R8, + S: S + }; +} + +function signMiMC(prv, msg) { + const h1 = createBlakeHash("blake512").update(prv).digest(); + const sBuff = pruneBuffer(h1.slice(0,32)); + const s = bigInt.leBuff2int(sBuff); + const A = babyJub.mulPointEscalar(babyJub.Base8, s.shr(3)); + + const msgBuff = bigInt.leInt2Buff(msg, 32); + const rBuff = createBlakeHash("blake512").update(Buffer.concat([h1.slice(32,64), msgBuff])).digest(); + let r = bigInt.leBuff2int(rBuff); + r = r.mod(babyJub.subOrder); + const R8 = babyJub.mulPointEscalar(babyJub.Base8, r); + const hm = mimc7.multiHash([R8[0], R8[1], A[0], A[1], msg]); + const S = r.add(hm.mul(s)).mod(babyJub.subOrder); + return { + R8: R8, + S: S + }; +} + +function signMiMCSponge(prv, msg) { + const h1 = createBlakeHash("blake512").update(prv).digest(); + const sBuff = pruneBuffer(h1.slice(0,32)); + const s = bigInt.leBuff2int(sBuff); + const A = babyJub.mulPointEscalar(babyJub.Base8, s.shr(3)); + + const msgBuff = bigInt.leInt2Buff(msg, 32); + const rBuff = createBlakeHash("blake512").update(Buffer.concat([h1.slice(32,64), msgBuff])).digest(); + let r = bigInt.leBuff2int(rBuff); + r = r.mod(babyJub.subOrder); + const R8 = babyJub.mulPointEscalar(babyJub.Base8, r); + const hm = mimcsponge.multiHash([R8[0], R8[1], A[0], A[1], msg]); + const S = r.add(hm.mul(s)).mod(babyJub.subOrder); + return { + R8: R8, + S: S + }; +} + +function signPoseidon(prv, msg) { + const h1 = createBlakeHash("blake512").update(prv).digest(); + const sBuff = pruneBuffer(h1.slice(0,32)); + const s = bigInt.leBuff2int(sBuff); + const A = babyJub.mulPointEscalar(babyJub.Base8, s.shr(3)); + + const msgBuff = bigInt.leInt2Buff(msg, 32); + const rBuff = createBlakeHash("blake512").update(Buffer.concat([h1.slice(32,64), msgBuff])).digest(); + let r = bigInt.leBuff2int(rBuff); + r = r.mod(babyJub.subOrder); + const R8 = babyJub.mulPointEscalar(babyJub.Base8, r); + const hash = poseidon.createHash(6, 8, 57); + const hm = hash([R8[0], R8[1], A[0], A[1], msg]); + const S = r.add(hm.mul(s)).mod(babyJub.subOrder); + return { + R8: R8, + S: S + }; +} + +function verify(msg, sig, A) { + // Check parameters + if (typeof sig != "object") return false; + if (!Array.isArray(sig.R8)) return false; + if (sig.R8.length!= 2) return false; + if (!babyJub.inCurve(sig.R8)) return false; + if (!Array.isArray(A)) return false; + if (A.length!= 2) return false; + if (!babyJub.inCurve(A)) return false; + if (sig.S>= babyJub.subOrder) return false; + + const R8p = babyJub.packPoint(sig.R8); + const Ap = babyJub.packPoint(A); + const hmBuff = pedersenHash(Buffer.concat([R8p, Ap, msg])); + const hm = bigInt.leBuff2int(hmBuff); + + const Pleft = babyJub.mulPointEscalar(babyJub.Base8, sig.S); + let Pright = babyJub.mulPointEscalar(A, hm.mul(bigInt("8"))); + Pright = babyJub.addPoint(sig.R8, Pright); + + if (!Pleft[0].equals(Pright[0])) return false; + if (!Pleft[1].equals(Pright[1])) return false; + return true; +} + +function verifyMiMC(msg, sig, A) { + // Check parameters + if (typeof sig != "object") return false; + if (!Array.isArray(sig.R8)) return false; + if (sig.R8.length!= 2) return false; + if (!babyJub.inCurve(sig.R8)) return false; + if (!Array.isArray(A)) return false; + if (A.length!= 2) return false; + if (!babyJub.inCurve(A)) return false; + if (sig.S>= babyJub.subOrder) return false; + + const hm = mimc7.multiHash([sig.R8[0], sig.R8[1], A[0], A[1], msg]); + + const Pleft = babyJub.mulPointEscalar(babyJub.Base8, sig.S); + let Pright = babyJub.mulPointEscalar(A, hm.mul(bigInt("8"))); + Pright = babyJub.addPoint(sig.R8, Pright); + + if (!Pleft[0].equals(Pright[0])) return false; + if (!Pleft[1].equals(Pright[1])) return false; + return true; +} + + +function verifyPoseidon(msg, sig, A) { + // Check parameters + if (typeof sig != "object") return false; + if (!Array.isArray(sig.R8)) return false; + if (sig.R8.length!= 2) return false; + if (!babyJub.inCurve(sig.R8)) return false; + if (!Array.isArray(A)) return false; + if (A.length!= 2) return false; + if (!babyJub.inCurve(A)) return false; + if (sig.S>= babyJub.subOrder) return false; + + const hash = poseidon.createHash(6, 8, 57); + const hm = hash([sig.R8[0], sig.R8[1], A[0], A[1], msg]); + + const Pleft = babyJub.mulPointEscalar(babyJub.Base8, sig.S); + let Pright = babyJub.mulPointEscalar(A, hm.mul(bigInt("8"))); + Pright = babyJub.addPoint(sig.R8, Pright); + + if (!Pleft[0].equals(Pright[0])) return false; + if (!Pleft[1].equals(Pright[1])) return false; + return true; +} + +function verifyMiMCSponge(msg, sig, A) { + // Check parameters + if (typeof sig != "object") return false; + if (!Array.isArray(sig.R8)) return false; + if (sig.R8.length!= 2) return false; + if (!babyJub.inCurve(sig.R8)) return false; + if (!Array.isArray(A)) return false; + if (A.length!= 2) return false; + if (!babyJub.inCurve(A)) return false; + if (sig.S>= babyJub.subOrder) return false; + + const hm = mimcsponge.multiHash([sig.R8[0], sig.R8[1], A[0], A[1], msg]); + + const Pleft = babyJub.mulPointEscalar(babyJub.Base8, sig.S); + let Pright = babyJub.mulPointEscalar(A, hm.mul(bigInt("8"))); + Pright = babyJub.addPoint(sig.R8, Pright); + + if (!Pleft[0].equals(Pright[0])) return false; + if (!Pleft[1].equals(Pright[1])) return false; + return true; +} + +function packSignature(sig) { + const R8p = babyJub.packPoint(sig.R8); + const Sp = bigInt.leInt2Buff(sig.S, 32); + return Buffer.concat([R8p, Sp]); +} + +function unpackSignature(sigBuff) { + return { + R8: babyJub.unpackPoint(sigBuff.slice(0,32)), + S: bigInt.leBuff2int(sigBuff.slice(32,64)) + }; +} + + diff --git a/@tornado/circomlib/src/evmasm.js b/@tornado/circomlib/src/evmasm.js new file mode 100644 index 0000000..8bf223f --- /dev/null +++ b/@tornado/circomlib/src/evmasm.js @@ -0,0 +1,197 @@ +// Copyright (c) 2018 Jordi Baylina +// License: LGPL-3.0+ +// + + +const Web3Utils = require("web3-utils"); + +class Contract { + constructor() { + this.code = []; + this.labels = {}; + this.pendingLabels = {}; + } + + createTxData() { + let C; + + // Check all labels are defined + const pendingLabels = Object.keys(this.pendingLabels); + if (pendingLabels.length>0) { + throw new Error("Lables not defined: "+ pendingLabels.join(", ")); + } + + let setLoaderLength = 0; + let genLoadedLength = -1; + + while (genLoadedLength!=setLoaderLength) { + setLoaderLength = genLoadedLength; + C = new module.exports(); + C.codesize(); + C.push(setLoaderLength); + C.push(0); + C.codecopy(); + + C.push(this.code.length); + C.push(0); + C.return(); + genLoadedLength = C.code.length; + } + + return Web3Utils.bytesToHex(C.code.concat(this.code)); + } + + stop() { this.code.push(0x00); } + add() { this.code.push(0x01); } + mul() { this.code.push(0x02); } + sub() { this.code.push(0x03); } + div() { this.code.push(0x04); } + sdiv() { this.code.push(0x05); } + mod() { this.code.push(0x06); } + smod() { this.code.push(0x07); } + addmod() { this.code.push(0x08); } + mulmod() { this.code.push(0x09); } + exp() { this.code.push(0x0a); } + signextend() { this.code.push(0x0b); } + + lt() { this.code.push(0x10); } + gt() { this.code.push(0x11); } + slt() { this.code.push(0x12); } + sgt() { this.code.push(0x13); } + eq() { this.code.push(0x14); } + iszero() { this.code.push(0x15); } + and() { this.code.push(0x16); } + or() { this.code.push(0x17); } + shor() { this.code.push(0x18); } + not() { this.code.push(0x19); } + byte() { this.code.push(0x1a); } + + keccak() { this.code.push(0x20); } + sha3() { this.code.push(0x20); } // alias + + address() { this.code.push(0x30); } + balance() { this.code.push(0x31); } + origin() { this.code.push(0x32); } + caller() { this.code.push(0x33); } + callvalue() { this.code.push(0x34); } + calldataload() { this.code.push(0x35); } + calldatasize() { this.code.push(0x36); } + calldatacopy() { this.code.push(0x37); } + codesize() { this.code.push(0x38); } + codecopy() { this.code.push(0x39); } + gasprice() { this.code.push(0x3a); } + extcodesize() { this.code.push(0x3b); } + extcodecopy() { this.code.push(0x3c); } + returndatasize() { this.code.push(0x3d); } + returndatacopy() { this.code.push(0x3e); } + + blockhash() { this.code.push(0x40); } + coinbase() { this.code.push(0x41); } + timestamp() { this.code.push(0x42); } + number() { this.code.push(0x43); } + difficulty() { this.code.push(0x44); } + gaslimit() { this.code.push(0x45); } + + pop() { this.code.push(0x50); } + mload() { this.code.push(0x51); } + mstore() { this.code.push(0x52); } + mstore8() { this.code.push(0x53); } + sload() { this.code.push(0x54); } + sstore() { this.code.push(0x55); } + + _pushLabel(label) { + if (typeof this.labels[label] != "undefined") { + this.push(this.labels[label]); + } else { + this.pendingLabels[label] = this.pendingLabels[label] || []; + this.pendingLabels[label].push(this.code.length); + this.push("0x000000"); + } + } + + _fillLabel(label) { + if (!this.pendingLabels[label]) return; + + let dst = this.labels[label]; + + const dst3 = [dst >> 16, (dst >> 8) & 0xFF, dst & 0xFF]; + + this.pendingLabels[label].forEach((p) => { + for (let i=0; i<3; i++) { + this.code[p+i+1] = dst3[i]; + } + }); + + delete this.pendingLabels[label]; + } + + + jmp(label) { + if (typeof label !== "undefined") { + this._pushLabel(label); + } + this.code.push(0x56); + } + + jmpi(label) { + if (typeof label !== "undefined") { + this._pushLabel(label); + } + this.code.push(0x57); + } + + pc() { this.code.push(0x58); } + msize() { this.code.push(0x59); } + gas() { this.code.push(0x5a); } + label(name) { + if (typeof this.labels[name] != "undefined") { + throw new Error("Label already defined"); + } + this.labels[name] = this.code.length; + this.code.push(0x5b); + + this._fillLabel(name); + } + + push(data) { + const d = Web3Utils.hexToBytes(Web3Utils.toHex(data)); + if (d.length == 0 || d.length > 32) { + throw new Error("Assertion failed"); + } + this.code = this.code.concat([0x5F + d.length], d); + } + + dup(n) { + if (n < 0 || n >= 16) { + throw new Error("Assertion failed"); + } + this.code.push(0x80 + n); + } + + swap(n) { + if (n < 1 || n > 16) { + throw new Error("Assertion failed"); + } + this.code.push(0x8f + n); + } + + log0() { this.code.push(0xa0); } + log1() { this.code.push(0xa1); } + log2() { this.code.push(0xa2); } + log3() { this.code.push(0xa3); } + log4() { this.code.push(0xa4); } + + create() { this.code.push(0xf0); } + call() { this.code.push(0xf1); } + callcode() { this.code.push(0xf2); } + return() { this.code.push(0xf3); } + delegatecall() { this.code.push(0xf4); } + + staticcall() { this.code.push(0xfa); } + revert() { this.code.push(0xfd); } + invalid() { this.code.push(0xfe); } + selfdestruct() { this.code.push(0xff); } +} + +module.exports = Contract; + diff --git a/@tornado/circomlib/src/g2_gencontract.js b/@tornado/circomlib/src/g2_gencontract.js new file mode 100644 index 0000000..5371665 --- /dev/null +++ b/@tornado/circomlib/src/g2_gencontract.js @@ -0,0 +1,583 @@ +// Copyright (c) 2018 Jordi Baylina +// License: LGPL-3.0+ +// + +const Contract = require("./evmasm"); +const G2 = require("@tornado/snarkjs").bn128.G2; +const bigInt = require("@tornado/snarkjs").bigInt; + + +function toHex256(a) { + let S = a.toString(16); + while (S.length < 64) S="0"+S; + return "0x" + S; +} + +function createCode(P, w) { + + const C = new Contract(); + + const NPOINTS = 1 << (w-1); + + const VAR_POS = C.allocMem(32); + const VAR_POINTS = C.allocMem( (NPOINTS)*4*32); + const savedP = C.allocMem(32); + const savedZ3 = C.allocMem(32); + + // Check selector + C.push("0x0100000000000000000000000000000000000000000000000000000000"); + C.push(0); + C.calldataload(); + C.div(); + C.push("b65c7c74"); // mulexp(uint256) + C.eq(); + C.jmpi("start"); + C.invalid(); + + C.label("start"); + + storeVals(); + + C.push( Math.floor(255/w)*w ); // pos := 255 + C.push(VAR_POS); + C.mstore(); + + C.push("21888242871839275222246405745257275088696311157297823662689037894645226208583"); + C.push(0); + C.push(0); + C.push(0); + C.push(0); + C.push(0); + C.push(0); + + C.label("begin_loop"); // ACC_X ACC_Y ACC_Z q + + C.internalCall("double"); + + // g = (e>>pos)&MASK + C.push(4); + C.calldataload(); // e ACC_X ACC_Y ACC_Z q + + C.push(VAR_POS); + C.mload(); // pos e ACC_X ACC_Y ACC_Z q + C.shr(); + + C.push(NPOINTS-1); + C.and(); // g ACC_X ACC_Y ACC_Z q + + C.internalCall("add"); // acc_x acc_y acc_z + + C.push(VAR_POS); + C.mload(); // pos acc_x acc_y acc_z + C.dup(0); // pos pos acc_x acc_y acc_z + C.push(0); // 0 pos pos acc_x acc_y acc_z + C.eq(); // eq pos acc_x acc_y acc_z + C.jmpi("after_loop"); // pos acc_x acc_y acc_z + C.push(w); // 5 pos acc_x acc_y acc_z + C.sub(); // pos acc_x acc_y acc_z + C.push(VAR_POS); + C.mstore(); // acc_x acc_y acc_z + C.jmp("begin_loop"); + C.label("after_loop"); // pos acc_x acc_y acc_z + C.pop(); // acc_x acc_y acc_z + + C.internalCall("affine"); // acc_x acc_y + + C.push(0); + C.mstore(); + C.push(20); + C.mstore(); + C.push(40); + C.mstore(); + C.push(60); + C.mstore(); + + C.push("0x80"); + C.push("0x00"); + C.return(); + + + double(); + addPoint(); + affine(); + + return C.createTxData(); + + function add(a,b,q) { + C.dup(q); + C.dup(a+1 + 1); + C.dup(b+1 + 2); + C.addmod(); + C.dup(q + 1); + C.dup(a + 2); + C.dup(b + 3); + C.addmod(); + } + + function sub(a,b,q) { + C.dup(q); // q + C.dup(a+1 + 1); // ai q + C.dub(q + 2); // q ai q + C.dup(b+1 + 3); // bi q ai q + C.sub(); // -bi ai q + C.addmod(); // ci + C.dup(q + 1); // q ci + C.dup(a + 2); // ar q ci + C.dup(q + 3); // q ar q ci + C.dup(b + 4); // br q ar q ci + C.sub(); // -br ar q ci + C.addmod(); // cr ci + } + + function mul(a, b, q) { + C.dup(q); // q + C.dup(q + 1); // q q + C.dup(a + 2); // ar q q + C.dup(b+1 + 3); // bi ar q q + C.mulmod(); // ci1 q + C.dup(q + 2); // q ci1 q + C.dup(a+1 + 3); // ai q ci1 q + C.dup(b + 4); // ar ai q ci1 q + C.mulmod(); // ci2 ci1 q + C.addmod(); // ci + C.dup(q + 1); // q ci + C.dup(q + 2); // q q ci + C.dup(q + 3); // q q q ci + C.dup(a+1 + 4); // ai q q ci + C.dup(b+1 + 5); // bi ai q q ci + C.mulmod(); // cr2 q q ci + C.sub(); // -cr2 q ci + C.dup(q + 3); // q -cr2 q ci + C.dup(a + 4); // ar q -cr2 q ci + C.dup(b + 5); // br ar q -cr2 q ci + C.mulmod(); // cr1 -cr2 q ci + C.addmod(); // cr ci + } + + function square(a, q) { + C.dup(q); // q + C.dup(q + 1); // q q + C.dup(a + 2); // ar q q + C.dup(a+1 + 3); // ai ar q q + C.mulmod(); // arai q + C.dup(0); // arai arai q + C.addmod(); // ci + C.dup(q + 1); // q ci + C.dup(q + 2); // q q ci + C.dup(q + 3); // q q q ci + C.dup(a+1 + 4); // ai q q ci + C.dup(a+1 + 5); // ai ai q q ci + C.mulmod(); // cr2 q q ci + C.sub(); // -cr2 q ci + C.dup(q + 3); // q -cr2 q ci + C.dup(a + 4); // ar q -cr2 q ci + C.dup(a + 5); // br ar q -cr2 q ci + C.mulmod(); // cr1 -cr2 q ci + C.addmod(); // cr ci + } + + function add1(a, q) { + C.dup(a+1); // im + C.dup(1 + q); // q + C.dup(2 + a); // re q im + C.push(1); // 1 re q im + C.addmod(); + } + + function cmp(a, b) { + C.dup(a); + C.dup(b); + C.eq(); + C.dup(a+1); + C.dup(a+1); + C.and(); + } + + function rm(a) { + if (a>0) C.swap(a); + C.pop(); + if (a>0) C.swap(a); + C.pop(); + } + + function double() { + C.label("double"); // xR, xI, yR, yI, zR zI, q + + C.dup(4); + C.iszero(); + C.dup(6); + C.iszero(); + C.and(); + C.jumpi("enddouble"); // X Y Z q + + + // Z3 = 2*Y*Z // Remove Z + mul(2, 4, 6); // yz X Y Z q + rm(6); // X Y yz q + + add(4, 4, 6); // 2yz X Y yz q + rm(6); // X Y Z3 q + + // A = X^2 + square(0,6); // A X Y Z3 q + + // B = Y^2 // Remove Y + square(4,8); // B A X Y Z3 q + rm(6); // A X B Z3 q + + // C = B^2 + square(4,8); // C A X B Z3 q + + // D = (X+B)^2-A-C // Remove X, Remove B + add(4,6, 10); // X+B C A X B Z3 q + rm(6); // C A X+B B Z3 q + rm(6); // A X+B C Z3 q + square(2,8); // (X+B)^2 A X+B C Z3 q + rm(4); // A (X+B)^2 C Z3 q + sub(2, 0, 8); // (X+B)^2-A A (X+B)^2 C Z3 q + rm(4); // A (X+B)^2-A C Z3 q + sub(2, 4, 8); // (X+B)^2-A-C A (X+B)^2-A C Z3 q + rm(4); // A D C Z3 q + + // D = D+D + add(2,2, 8); // D+D A D C Z3 q + rm(4); // A D C Z3 q + + // E=A+A+A + add(0, 0, 8); // 2A A D C Z3 q + add(0, 2, 10); // 3A 2A A D C Z3 q + rm(4); // 2A 3A D C Z3 q + rm(0); // E D C Z3 q + + // F=E^2 + square(0, 8); // F E D C Z3 q + + // X3= F - 2*D // Remove F + add(4, 4, 10); // 2D F E D C Z3 q + sub(2, 0, 12); // F-2D 2D F E D C Z3 q + rm(4); // 2D X3 E D C Z3 q + rm(0); // X3 E D C Z3 q + + // Y3 = E * (D - X3) - 8 * C // Remove D C E + + sub(4, 0, 10); // D-X3 X3 E D C Z3 q + rm(6); // X3 E D-X3 C Z3 q + mul(2, 4, 10); // E*(D-X3) X3 E D-X3 C Z3 q + rm(6); // X3 E E*(D-X3) C Z3 q + rm(2); // X3 E*(D-X3) C Z3 q + add(4, 4, 8); // 2C X3 E*(D-X3) C Z3 q + rm(6); // X3 E*(D-X3) 2C Z3 q + add(4, 4, 8); // 4C X3 E*(D-X3) 2C Z3 q + rm(6); // X3 E*(D-X3) 4C Z3 q + add(4, 4, 8); // 8C X3 E*(D-X3) 4C Z3 q + rm(6); // X3 E*(D-X3) 8C Z3 q + sub(2, 4, 8); // E*(D-X3)-8C X3 E*(D-X3) 8C Z3 q + rm(6); // X3 E*(D-X3) Y3 Z3 q + rm(2); // X3 Y3 Z3 q + + C.label("enddouble"); + C.returnCall(); + } + + function addPoint() { // p, xR, xI, yR, yI, zR zI, q + + + C.dup(0); // p p X2 Y2 Z2 q + + C.push(savedP); + C.mstore(); + + C.iszero(); // X2 Y2 Z2 q + C.jumpi("endpadd"); + + + C.dup(4); + C.iszero(); + C.dup(6); + C.iszero(); + C.and(); + C.jumpi("returnP"); // X2 Y2 Z2 q + + + + // lastZ3 = (Z2+1)^2 - Z2^2 + add1(4, 6); // Z2+1 X2 Y2 Z2 q + square(0, 8); // (Z2+1)^2 Z2+1 X2 Y2 Z2 q + rm(2); // (Z2+1)^2 X2 Y2 Z2 q + square(6, 8); // Z2^2 (Z2+1)^2 X2 Y2 Z2 q + + + sub(2, 0, 10); // (Z2+1)^2-Z2^2 Z2^2 (Z2+1)^2 X2 Y2 Z2 q + + saveZ3(); // Z2^2 (Z2+1)^2 X2 Y2 Z2 q + rm(2); // Z2^2 X2 Y2 Z2 q + + // U2 = X2 + // S2 = Y2 // Z2^2 U2 S2 Z2 q + + + // U1 = X1 * Z2^2 + loadX(); // X1 Z2^2 U2 S2 Z2 q + mul(0, 2, 10); // X1*Z2^2 X1 Z2^2 U2 S2 Z2 q + rm(2); // X1*Z2^2 Z2^2 U2 S2 Z2 q + + + mul(2, 8, 10); // Z2^3 U1 Z2^2 U2 S2 Z2 q + rm(4); // U1 Z2^3 U2 S2 Z2 q + rm(8); // Z2^3 U2 S2 U1 q + + // S1 = Y1 * Z1^3 + loadY(); // Y1 Z2^3 U2 S2 U1 q + mul(0, 2, 10); // S1 Y1 Z2^3 U2 S2 U1 q + rm(4); // Y1 S1 U2 S2 U1 q + rm(0); // S1 U2 S2 U1 q + + cmp(0, 4); // c1 S1 U2 S2 U1 q + cmp(3, 7); // c2 c1 S1 U2 S2 U1 q + C.and(); // c2&c1 S1 U2 S2 U1 q + C.jumpi("double1"); // S1 U2 S2 U1 q + + + // Returns the double + + // H = U2-U1 // Remove U2 + C.sub(4, 8, 10); // H S1 U2 S2 U1 q + rm(4); // S1 H S2 U1 q + + // // r = 2 * (S2-S1) // Remove S2 + C.sub(4, 4, 8); // S1-S2 S1 H S2 U1 q + rm(6); // S1 H S1-S2 U1 q + C.add(4, 4, 8); // 2*(S1-S2) S1 H S1-S2 U1 q + rm(6); // S1 H r U1 q + + // I = (2 * H)^2 + C.add(2, 2, 8); // 2*H S1 H r U1 q + C.square(0, 10); // (2*H)^2 2*H S1 H r U1 q + rm(2); // I S1 H r U1 q + + // V = U1 * I + mul(8, 0, 10); // V I S1 H r U1 q + rm(10); // I S1 H r V q + + // J = H * I // Remove I + mul(4, 0, 10); // J I S1 H r V q + rm(2); // J S1 H r V q + + // X3 = r^2 - J - 2 * V + + // S1J2 = (S1*J)*2 // Remove S1 + mul(2, 0, 10); // S1*J J S1 H r V q + rm(4); // J S1*J H r V q + add(2,2, 10); // (S1*J)*2 J S1*J H r V q + rm(4); // J S1J2 H r V q + + // X3 = r^2 - J - 2 * V + square(6, 10); // r^2 J S1J2 H r V q + sub(0, 2, 12); // r^2-J r^2 J S1J2 H r V q + rm(2); // r^2-J J S1J2 H r V q + rm(2); // r^2-J S1J2 H r V q + add(8, 8, 10); // 2*V r^2-J S1J2 H r V q + sub(2, 0, 12); // r^2-J-2*V 2*V r^2-J S1J2 H r V q + rm(4); // 2*V X3 S1J2 H r V q + rm(0); // X3 S1J2 H r V q + + // Y3 = r * (V-X3)-S1J2 + + sub(8, 0, 10); // V-X3 X3 S1J2 H r V q + rm(10); // X3 S1J2 H r V-X3 q + mul(6, 8, 10); // r*(V-X3) X3 S1J2 H r V-X3 q + rm(8); // X3 S1J2 H r*(V-X3) V-X3 q + rm(8); // S1J2 H r*(V-X3) X3 q + sub(4, 0, 8); // Y3 S1J2 H r*(V-X3) X3 q + rm(6); // S1J2 H Y3 X3 q + rm(0); // H Y3 X3 q + + // Z3 = lastZ * H + loadZ3(); // lastZ3 H Y3 X3 q + mul(0, 2, 8); // Z3 lastZ3 H Y3 X3 q + rm(4); // lastZ3 Z3 Y3 X3 q + rm(0); // Z3 Y3 X3 q + + C.swap(1); + C.swap(5); + C.swap(1); + C.swap(4); // X3 Y3 Z3 q + + // returns the point in memory + C.label("returnP"); // X Y Z q + rm(0); + rm(0); + rm(0); + C.push(0); + C.push(1); + loadX(); + loadY(); + C.jump("endpadd"); + + C.label("double1"); // S1 U2 S2 U1 q + rm(0); + rm(0); + rm(0); + rm(0); + C.push(0); + C.push(1); + loadX(); + loadY(); + C.jump("double"); + + C.label("endpadd"); + C.returnCall(); + + function loadX() { + C.push(savedP); + C.mload(); // p + C.push(32); + C.mul(); // P*32 + C.push(VAR_POINTS+32); + C.add(); // P*32+32 + C.dup(); // P*32+32 P*32+32 + C.mload(); // im P*32+32 + C.swap(1); // P*32+32 im + C.push(0x20); // 32 P*32+32 im + C.sub(); // P*32 im + C.mload(); // re im + } + + function loadY() { + C.push(savedP); + C.mload(); // p + C.push(32); + C.mul(); // P*32 + C.push(VAR_POINTS+32*3); + C.add(); // P*32+32 + C.dup(); // P*32+32 P*32+32 + C.mload(); // im P*32+32 + C.swap(1); // P*32+32 im + C.push(0x20); // 32 P*32+32 im + C.sub(); // P*32 im + C.mload(); // re im + } + + function loadZ3() { + C.push(savedZ3+32); + C.mload(); // p + C.push(savedZ3); + C.mload(); + } + + function saveZ3() { + C.push(savedZ3); + C.mstore(); + C.push(savedZ3+32); + C.mstore(); + } + } + + function affine() { // X Y Z q + // If Z2=0 return 0 + C.label("affine"); + C.dup(4); + C.dup(5 + 1); + C.or(); + C.jumpi("notZero"); // X Y Z q + rm(0); + rm(0); + C.push(0); + C.push(0); + + C.jmp("endAffine"); + C.label("notZero"); + + inverse2(4,6); // Z_inv X Y Z q + square(2, 8); // Z2_inv Z_inv X Y Z q + mul(0, 2, 10); // Z3_inv Z2_inv Z_inv X Y Z q + rm(4); // Z2_inv Z3_inv X Y Z q + C.push(1); + C.push(0); // 1 Z2_inv Z3_inv X Y Z q + rm(10); // Z2_inv Z3_inv X Y 1 q + mul(2, 6, 10); // YI Z2_inv Z3_inv X Y 1 q + rm(8); // Z2_inv Z3_inv X YI 1 q + mul(0, 4, 10); // XI Z2_inv Z3_inv X YI 1 q + rm(6); // Z2_inv Z3_inv XI YI 1 q + rm(0); // Z3_inv XI YI 1 q + rm(0); // XI YI 1 q + C.label("endAffine"); + C.returnCall(); + } + + function inverse2(a, q) { + C.dup(q); // q + C.dup(q + 1); // q q + C.push(2); // 2 q q + C.sub(); // q-2 q + C.dup(q + 2); // q q-2 q + C.dup(q + 3); // q q q-2 q + C.dup(a + 4); // ar q q q-2 q + C.dup(a + 5); // ar ar q q q-2 q + C.mulmod(); // t0 q q-2 q + + C.dup(q + 4); // q t0 q q-2 q + C.dup(a+1 + 5); // ai q t0 q q-2 q + C.dup(a+1 + 6); // ai ai q t0 q q-2 q + C.mulmod(); // t1 t0 q q-2 q + + C.addmod(); // t2 q-2 q + C.expmod(); // t3 + + C.dup(q + 1); // q t3 + C.dup(q + 2); // q q t3 + C.dup(q + 3); // q q q t3 + C.dup(1); // t3 q q q t3 + C.sub(); // -t3 q q t3 + C.dup(a+1 + 3); // ai -t3 q q t3 + C.mulmod(); // ii q t3 + C.swap(2); // t3 q ii + C.dup(a + 3); // ar t3 q ii + C.mulmod(); // ir ii + } + + function storeVals() { + C.push(VAR_POINTS); // p + for (let i=0; i { + if (typeof seed === "undefined") seed = SEED; + const c = Web3Utils.keccak256(seed+"_iv"); + const cn = bigInt(Web3Utils.toBN(c).toString()); + const iv = cn.mod(F.q); + return iv; +}; + +exports.getConstants = (seed, nRounds) => { + if (typeof seed === "undefined") seed = SEED; + if (typeof nRounds === "undefined") nRounds = NROUNDS; + const cts = new Array(nRounds); + let c = Web3Utils.keccak256(SEED); + for (let i=1; i{ + const x_in = bigInt(_x_in); + const k = bigInt(_k); + let r; + for (let i=0; i { + let r; + if (typeof(key) === "undefined") { + r = F.zero; + } else { + r = key; + } + for (let i=0; i { + if (typeof seed === "undefined") seed = SEED; + const c = Web3Utils.keccak256(seed+"_iv"); + const cn = bigInt(Web3Utils.toBN(c).toString()); + const iv = cn.mod(F.q); + return iv; +}; + +exports.getConstants = (seed, nRounds) => { + if (typeof seed === "undefined") seed = SEED; + if (typeof nRounds === "undefined") nRounds = NROUNDS; + const cts = new Array(nRounds); + let c = Web3Utils.keccak256(SEED); + for (let i=1; i{ + let xL = bigInt(_xL_in); + let xR = bigInt(_xR_in); + const k = bigInt(_k); + for (let i=0; i { + if (typeof(numOutputs) === "undefined") { + numOutputs = 1; + } + if (typeof(key) === "undefined") { + key = F.zero; + } + + let R = F.zero; + let C = F.zero; + + for (let i=0; i F.affine(x)); + } +}; diff --git a/@tornado/circomlib/src/mimcsponge_gencontract.js b/@tornado/circomlib/src/mimcsponge_gencontract.js new file mode 100644 index 0000000..1fd5bb1 --- /dev/null +++ b/@tornado/circomlib/src/mimcsponge_gencontract.js @@ -0,0 +1,116 @@ +// Copyright (c) 2018 Jordi Baylina +// License: LGPL-3.0+ +// + +const Web3Utils = require("web3-utils"); + +const Contract = require("./evmasm"); + +function createCode(seed, n) { + + let ci = Web3Utils.keccak256(seed); + + const C = new Contract(); + + C.push(0x64); + C.push("0x00"); + C.push("0x00"); + C.calldatacopy(); + C.push("0x0100000000000000000000000000000000000000000000000000000000"); + C.push("0x00"); + C.mload(); + C.div(); + C.push("0xf47d33b5"); // MiMCSponge(uint256,uint256) + C.eq(); + C.jmpi("start"); + C.invalid(); + + C.label("start"); + C.push("0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001"); // q + C.push("0x04"); + C.mload(); // xL q + C.dup(1); // q xL q + C.push("0x24"); + C.mload(); // xR q xL q + C.dup(1); // q xR q xL q + C.dup(3); // xL q xR q xL q + C.dup(1); // q xL q xR q xL q + C.dup(0); // q q xL q xR q xL q + C.dup(2); // xL q q xL q xR q xL q + C.dup(0); // xL xL q q xL q xR q xL q + C.mulmod(); // b=xL^2 q xL q xR q xL q + C.dup(0); // b b q xL q xR q xL q + C.mulmod(); // c=xL^4 xL q xR q xL q + C.mulmod(); // d=xL^5 xR q xL q + C.addmod(); // e=xL^5+xR xL q (for next round: xL xR q) + + for (let i=0; i { + if (typeof seed === "undefined") seed = SEED; + if (typeof nRounds === "undefined") nRounds = NROUNDSF + NROUNDSP; + if (typeof t === "undefined") t = T; + let nonce = "0000"; + let cmatrix = getPseudoRandom(seed+"_matrix_"+nonce, t*2); + while (!allDifferent(cmatrix)) { + nonce = (Number(nonce)+1)+""; + while(nonce.length<4) nonce = "0"+nonce; + cmatrix = getPseudoRandom(seed+"_matrix_"+nonce, t*2); + } + + const M = new Array(t); + for (let i=0; i { + if (typeof seed === "undefined") seed = SEED; + if (typeof nRounds === "undefined") nRounds = NROUNDSF + NROUNDSP; + if (typeof t === "undefined") t = T; + const cts = getPseudoRandom(seed+"_constants", nRounds); + return cts; +}; + +function ark(state, c) { + for (let j=0; j { + + if (typeof seed === "undefined") seed = SEED; + if (typeof nRoundsF === "undefined") nRoundsF = NROUNDSF; + if (typeof nRoundsP === "undefined") nRoundsP = NROUNDSP; + if (typeof t === "undefined") t = T; + + assert(nRoundsF % 2 == 0); + const C = exports.getConstants(t, seed, nRoundsF + nRoundsP); + const M = exports.getMatrix(t, seed, nRoundsF + nRoundsP); + return function(inputs) { + let state = []; + assert(inputs.length <= t); + assert(inputs.length > 0); + for (let i=0; i= nRoundsF/2 + nRoundsP)) { + for (let j=0; j=nRoundsP+nRoundsF/2)) { + for (let j=0; j=0; level--) { + let oldNode, newNode; + const sibling = resFind.siblings[level]; + if (keyBits[level]) { + oldNode = [sibling, rtOld]; + newNode = [sibling, rtNew]; + } else { + oldNode = [rtOld, sibling]; + newNode = [rtNew, sibling]; + } + rtOld = hash0(oldNode[0], oldNode[1]); + rtNew = hash0(newNode[0], newNode[1]); + dels.push(rtOld); + ins.push([rtNew, newNode]); + } + + res.newRoot = rtNew; + + await this.db.multiIns(ins); + await this.db.setRoot(rtNew); + this.root = rtNew; + await this.db.multiDel(dels); + + return res; + } + + async delete(_key) { + const key = bigInt(_key); + + const resFind = await this.find(key); + if (!resFind.found) throw new Error("Key does not exists"); + + const res = { + siblings: [], + delKey: key, + delValue: resFind.foundValue + }; + + const dels = []; + const ins = []; + let rtOld = hash1(key, resFind.foundValue); + let rtNew; + dels.push(rtOld); + + let mixed; + if (resFind.siblings.length > 0) { + const record = await this.db.get(resFind.siblings[resFind.siblings.length - 1]); + if ((record.length == 3)&&(record[0].equals(bigInt.one))) { + mixed = false; + res.oldKey = record[1]; + res.oldValue = record[2]; + res.isOld0 = false; + rtNew = resFind.siblings[resFind.siblings.length - 1]; + } else if (record.length == 2) { + mixed = true; + res.oldKey = key; + res.oldValue = bigInt(0); + res.isOld0 = true; + rtNew = bigInt.zero; + } else { + throw new Error("Invalid node. Database corrupted"); + } + } else { + rtNew = bigInt.zero; + res.oldKey = key; + res.oldValue = bigInt(0); + res.isOld0 = true; + } + + const keyBits = this._splitBits(key); + + for (let level = resFind.siblings.length-1; level >=0; level--) { + let newSibling = resFind.siblings[level]; + if ((level == resFind.siblings.length-1)&&(!res.isOld0)) { + newSibling = bigInt.zero; + } + const oldSibling = resFind.siblings[level]; + if (keyBits[level]) { + rtOld = hash0(oldSibling, rtOld); + } else { + rtOld = hash0(rtOld, oldSibling); + } + dels.push(rtOld); + if (!newSibling.isZero()) { + mixed = true; + } + + if (mixed) { + res.siblings.unshift(resFind.siblings[level]); + let newNode; + if (keyBits[level]) { + newNode = [newSibling, rtNew]; + } else { + newNode = [rtNew, newSibling]; + } + rtNew = hash0(newNode[0], newNode[1]); + ins.push([rtNew, newNode]); + } + } + + await this.db.multiIns(ins); + await this.db.setRoot(rtNew); + this.root = rtNew; + await this.db.multiDel(dels); + + res.newRoot = rtNew; + res.oldRoot = rtOld; + + return res; + } + + async insert(_key, _value) { + const key = bigInt(_key); + const value = bigInt(_value); + let addedOne = false; + const res = {}; + res.oldRoot = this.root; + const newKeyBits = this._splitBits(key); + + let rtOld; + + const resFind = await this.find(key); + + if (resFind.found) throw new Error("Key already exists"); + + res.siblings = resFind.siblings; + let mixed; + + if (!resFind.isOld0) { + const oldKeyits = this._splitBits(resFind.notFoundKey); + for (let i= res.siblings.length; oldKeyits[i] == newKeyBits[i]; i++) { + res.siblings.push(bigInt.zero); + } + rtOld = hash1(resFind.notFoundKey, resFind.notFoundValue); + res.siblings.push(rtOld); + addedOne = true; + mixed = false; + } else if (res.siblings.length >0) { + mixed = true; + rtOld = bigInt.zero; + } + + const inserts = []; + const dels = []; + + let rt = hash1(key, value); + inserts.push([rt,[1, key, value]] ); + + for (let i=res.siblings.length-1; i>=0; i--) { + if ((i0) && (res.siblings[res.siblings.length-1].isZero())) { + res.siblings.pop(); + } + res.oldKey = resFind.notFoundKey; + res.oldValue = resFind.notFoundValue; + res.newRoot = rt; + res.isOld0 = resFind.isOld0; + + + await this.db.multiIns(inserts); + await this.db.setRoot(rt); + this.root = rt; + await this.db.multiDel(dels); + + return res; + } + + async find(key) { + const keyBits = this._splitBits(key); + return await this._find(key, keyBits, this.root, 0); + } + + async _find(key, keyBits, root, level) { + if (typeof root === "undefined") root = this.root; + + let res; + if (root.isZero()) { + res = { + found: false, + siblings: [], + notFoundKey: key, + notFoundValue: bigInt.zero, + isOld0: true + }; + return res; + } + + const record = await this.db.get(root); + + if ((record.length==3)&&(record[0].equals(bigInt.one))) { + if (record[1].equals(key)) { + res = { + found: true, + siblings: [], + foundValue: record[2], + isOld0: false + }; + } else { + res = { + found: false, + siblings: [], + notFoundKey: record[1], + notFoundValue: record[2], + isOld0: false + }; + } + } else { + if (keyBits[level] == 0) { + res = await this._find(key, keyBits, record[0], level+1); + res.siblings.unshift(record[1]); + } else { + res = await this._find(key, keyBits, record[1], level+1); + res.siblings.unshift(record[0]); + } + } + return res; + } +} + +async function loadFromFile(fileName) { + +} + +async function newMemEmptyTrie() { + const db = new SMTMemDB(); + const rt = await db.getRoot(); + const smt = new SMT(db, rt); + return smt; +} + +module.exports.loadFromFile = loadFromFile; +module.exports.newMemEmptyTrie = newMemEmptyTrie; +module.exports.SMT = SMT; +module.exports.SMTMemDB = SMTMemDB; diff --git a/@tornado/circomlib/src/smt_hashes_mimc.js b/@tornado/circomlib/src/smt_hashes_mimc.js new file mode 100644 index 0000000..a68fd41 --- /dev/null +++ b/@tornado/circomlib/src/smt_hashes_mimc.js @@ -0,0 +1,10 @@ +const mimc7 = require("./mimc7"); +const bigInt = require("@tornado/snarkjs").bigInt; + +exports.hash0 = function (left, right) { + return mimc7.multiHash(left, right); +}; + +exports.hash1 = function(key, value) { + return mimc7.multiHash([key, value], bigInt.one); +}; diff --git a/@tornado/circomlib/src/smt_hashes_poseidon.js b/@tornado/circomlib/src/smt_hashes_poseidon.js new file mode 100644 index 0000000..2c4c7b3 --- /dev/null +++ b/@tornado/circomlib/src/smt_hashes_poseidon.js @@ -0,0 +1,12 @@ +const Poseidon = require("./poseidon"); +const bigInt = require("@tornado/snarkjs").bigInt; + +const hash = Poseidon.createHash(6, 8, 57); + +exports.hash0 = function (left, right) { + return hash([left, right]); +}; + +exports.hash1 = function(key, value) { + return hash([key, value, bigInt.one]); +}; diff --git a/@tornado/circomlib/src/smt_memdb.js b/@tornado/circomlib/src/smt_memdb.js new file mode 100644 index 0000000..da194f4 --- /dev/null +++ b/@tornado/circomlib/src/smt_memdb.js @@ -0,0 +1,58 @@ +const bigInt = require("@tornado/snarkjs").bigInt; + +class SMTMemDb { + constructor() { + this.nodes = {}; + this.root = bigInt(0); + } + + async getRoot() { + return this.root; + } + + _key2str(k) { + // const keyS = bigInt(key).leInt2Buff(32).toString("hex"); + const keyS = bigInt(k).toString(); + return keyS; + } + + _normalize(n) { + for (let i=0; i { + let circuit; + before( async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "aliascheck_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains: " + circuit.nConstraints); + }); + + it("Satisfy the aliastest 0", async () => { + const inp = getBits(bigInt.zero, 254); + circuit.calculateWitness({in: inp}); + }); + + it("Satisfy the aliastest 3", async () => { + const inp = getBits(bigInt(3), 254); + circuit.calculateWitness({in: inp}); + }); + + it("Satisfy the aliastest q-1", async () => { + const inp = getBits(q.sub(bigInt.one), 254); + circuit.calculateWitness({in: inp}); + }); + + it("Nhot not satisfy an input of q", async () => { + const inp = getBits(q, 254); + try { + circuit.calculateWitness({in: inp}); + assert(false); + } catch(err) { + assert(/Constraint\sdoesn't\smatch(.*)1\s!=\s0/.test(err.message) ); + assert(err.message.indexOf("1 != 0") >= 0); + } + }); + + it("Nhot not satisfy all ones", async () => { + + const inp = getBits(bigInt(1).shl(254).sub(bigInt(1)), 254); + try { + circuit.calculateWitness({in: inp}); + assert(false); + } catch(err) { + assert(/Constraint\sdoesn't\smatch(.*)1\s!=\s0/.test(err.message) ); + assert(err.message.indexOf("1 != 0") >= 0); + } + }); + +}); diff --git a/@tornado/circomlib/test/aliascheckbabyjub.js b/@tornado/circomlib/test/aliascheckbabyjub.js new file mode 100644 index 0000000..7d88479 --- /dev/null +++ b/@tornado/circomlib/test/aliascheckbabyjub.js @@ -0,0 +1,75 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +function print(circuit, w, s) { + console.log(s + ": " + w[circuit.getSignalIdx(s)]); +} + +function getBits(v, n) { + const res = []; + for (let i=0; i { + let circuit; + before( async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "aliascheckbabyjub_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains: " + circuit.nConstraints); + }); + + it("Satisfy the aliastest 0", async () => { + const inp = getBits(bigInt.zero, 251); + circuit.calculateWitness({in: inp}); + }); + + it("Satisfy the aliastest 3", async () => { + const inp = getBits(bigInt(3), 251); + circuit.calculateWitness({in: inp}); + }); + + it("Satisfy the aliastest r-1", async () => { + const inp = getBits(r.sub(bigInt.one), 251); + circuit.calculateWitness({in: inp}); + }); + + it("Nhot not satisfy an input of r", async () => { + const inp = getBits(r, 251); + try { + circuit.calculateWitness({in: inp}); + assert(false); + } catch(err) { + assert(err.message.indexOf("Constraint doesn't match") >= 0); + assert(err.message.indexOf("1 != 0") >= 0); + } + }); + + it("Nhot not satisfy all ones", async () => { + const inp = getBits(bigInt(1).shl(251).sub(bigInt(1)), 251); + try { + circuit.calculateWitness({in: inp}); + assert(false); + } catch(err) { + assert(err.message.indexOf("Constraint doesn't match") >= 0); + assert(err.message.indexOf("1 != 0") >= 0); + } + }); + +}); diff --git a/@tornado/circomlib/test/babyjub.js b/@tornado/circomlib/test/babyjub.js new file mode 100644 index 0000000..608bbe6 --- /dev/null +++ b/@tornado/circomlib/test/babyjub.js @@ -0,0 +1,126 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const createBlakeHash = require("blake-hash"); +const eddsa = require("../src/eddsa.js"); + +const assert = chai.assert; + +const bigInt = require("@tornado/snarkjs").bigInt; + +describe("Baby Jub test", function () { + let circuitAdd; + let circuitTest; + + this.timeout(100000); + + before( async() => { + const cirDefAdd = await compiler(path.join(__dirname, "circuits", "babyadd_tester.circom")); + circuitAdd = new snarkjs.Circuit(cirDefAdd); + console.log("NConstrains BabyAdd: " + circuitAdd.nConstraints); + + const cirDefTest = await compiler(path.join(__dirname, "circuits", "babycheck_test.circom")); + circuitTest = new snarkjs.Circuit(cirDefTest); + console.log("NConstrains BabyTest: " + circuitTest.nConstraints); + + const cirDefPbk = await compiler(path.join(__dirname, "circuits", "babypbk_test.circom")); + circuitPbk = new snarkjs.Circuit(cirDefPbk); + console.log("NConstrains BabyPbk: " + circuitPbk.nConstraints); + + }); + + it("Should add point (0,1) and (0,1)", async () => { + + const input={ + x1: snarkjs.bigInt(0), + y1: snarkjs.bigInt(1), + x2: snarkjs.bigInt(0), + y2: snarkjs.bigInt(1) + }; + + const w = circuitAdd.calculateWitness(input); + + const xout = w[circuitAdd.getSignalIdx("main.xout")]; + const yout = w[circuitAdd.getSignalIdx("main.yout")]; + + assert(xout.equals(0)); + assert(yout.equals(1)); + }); + + it("Should add 2 same numbers", async () => { + + const input={ + x1: snarkjs.bigInt("17777552123799933955779906779655732241715742912184938656739573121738514868268"), + y1: snarkjs.bigInt("2626589144620713026669568689430873010625803728049924121243784502389097019475"), + x2: snarkjs.bigInt("17777552123799933955779906779655732241715742912184938656739573121738514868268"), + y2: snarkjs.bigInt("2626589144620713026669568689430873010625803728049924121243784502389097019475") + }; + + const w = circuitAdd.calculateWitness(input); + + const xout = w[circuitAdd.getSignalIdx("main.xout")]; + const yout = w[circuitAdd.getSignalIdx("main.yout")]; + + assert(xout.equals(snarkjs.bigInt("6890855772600357754907169075114257697580319025794532037257385534741338397365"))); + assert(yout.equals(snarkjs.bigInt("4338620300185947561074059802482547481416142213883829469920100239455078257889"))); + }); + + it("Should add 2 different numbers", async () => { + + const input={ + x1: snarkjs.bigInt("17777552123799933955779906779655732241715742912184938656739573121738514868268"), + y1: snarkjs.bigInt("2626589144620713026669568689430873010625803728049924121243784502389097019475"), + x2: snarkjs.bigInt("16540640123574156134436876038791482806971768689494387082833631921987005038935"), + y2: snarkjs.bigInt("20819045374670962167435360035096875258406992893633759881276124905556507972311") + }; + + const w = circuitAdd.calculateWitness(input); + + const xout = w[circuitAdd.getSignalIdx("main.xout")]; + const yout = w[circuitAdd.getSignalIdx("main.yout")]; + + /* + console.log(xout.toString()); + console.log(yout.toString()); + */ + + assert(xout.equals(snarkjs.bigInt("7916061937171219682591368294088513039687205273691143098332585753343424131937"))); + assert(yout.equals(snarkjs.bigInt("14035240266687799601661095864649209771790948434046947201833777492504781204499"))); + }); + + it("Should check 0 is a valid poiny", async() => { + const w = circuitTest.calculateWitness({x: 0, y:1}); + assert(circuitTest.checkWitness(w)); + }); + + it("Should check 0 is an invalid poiny", async() => { + try { + circuitTest.calculateWitness({x: 1, y: 0}); + assert(false, "Should be a valid point"); + } catch(err) { + assert(/Constraint\sdoesn't\smatch(.*)168700\s!=\s1/.test(err.message) ); + assert(err.message.indexOf("168700 != 1") >= 0); + } + }); + + it("Should extract the public key from the private one", async () => { + + const rawpvk = Buffer.from("0001020304050607080900010203040506070809000102030405060708090021", "hex"); + const pvk = eddsa.pruneBuffer(createBlakeHash("blake512").update(rawpvk).digest().slice(0,32)); + const S = bigInt.leBuff2int(pvk).shr(3); + + const A = eddsa.prv2pub(rawpvk); + + const input = { + in : S, + Ax : A[0], + Ay : A[1] + } + + const w = circuitPbk.calculateWitness(input); + assert(circuitPbk.checkWitness(w)); + }); + +}); diff --git a/@tornado/circomlib/test/babyjub_js.js b/@tornado/circomlib/test/babyjub_js.js new file mode 100644 index 0000000..2acb378 --- /dev/null +++ b/@tornado/circomlib/test/babyjub_js.js @@ -0,0 +1,166 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); +const babyjub = require("../src/babyjub.js"); + +const assert = chai.assert; + +// const bigInt = require("big-integer"); + + +describe("Baby Jub js test", function () { + + this.timeout(100000); + + it("Should add point (0,1) and (0,1)", () => { + + const p1 = [ + snarkjs.bigInt(0), + snarkjs.bigInt(1)]; + const p2 = [ + snarkjs.bigInt(0), + snarkjs.bigInt(1) + ]; + + const out = babyjub.addPoint(p1, p2) + assert(out[0].equals(0)); + assert(out[1].equals(1)); + }); + + it("Should base be 8*generator", () => { + let res; + res = babyjub.addPoint(babyjub.Generator, babyjub.Generator); + res = babyjub.addPoint(res, res); + res = babyjub.addPoint(res, res); + + assert(res[0].equals(babyjub.Base8[0])); + assert(res[1].equals(babyjub.Base8[1])); + }); + + it("Should add 2 same numbers", () => { + + const p1 = [ + snarkjs.bigInt("17777552123799933955779906779655732241715742912184938656739573121738514868268"), + snarkjs.bigInt("2626589144620713026669568689430873010625803728049924121243784502389097019475"), + ]; + const p2 = [ + snarkjs.bigInt("17777552123799933955779906779655732241715742912184938656739573121738514868268"), + snarkjs.bigInt("2626589144620713026669568689430873010625803728049924121243784502389097019475"), + ]; + + const out = babyjub.addPoint(p1, p2) + assert(out[0].equals(snarkjs.bigInt("6890855772600357754907169075114257697580319025794532037257385534741338397365"))); + assert(out[1].equals(snarkjs.bigInt("4338620300185947561074059802482547481416142213883829469920100239455078257889"))); + }); + + it("Should add 2 different numbers", () => { + + const p1 = [ + snarkjs.bigInt("17777552123799933955779906779655732241715742912184938656739573121738514868268"), + snarkjs.bigInt("2626589144620713026669568689430873010625803728049924121243784502389097019475"), + ]; + const p2 = [ + snarkjs.bigInt("16540640123574156134436876038791482806971768689494387082833631921987005038935"), + snarkjs.bigInt("20819045374670962167435360035096875258406992893633759881276124905556507972311"), + ]; + + const out = babyjub.addPoint(p1, p2) + + assert(out[0].equals(snarkjs.bigInt("7916061937171219682591368294088513039687205273691143098332585753343424131937"))); + assert(out[1].equals(snarkjs.bigInt("14035240266687799601661095864649209771790948434046947201833777492504781204499"))); + }); + + it("should mulPointEscalar 0", () => { + const p = [ + snarkjs.bigInt("17777552123799933955779906779655732241715742912184938656739573121738514868268"), + snarkjs.bigInt("2626589144620713026669568689430873010625803728049924121243784502389097019475"), + ]; + + const r = babyjub.mulPointEscalar(p, snarkjs.bigInt("3")); + let r2 = babyjub.addPoint(p, p); + r2 = babyjub.addPoint(r2, p); + assert.equal(r2[0].toString(), r[0].toString()); + assert.equal(r2[1].toString(), r[1].toString()); + assert.equal(r[0].toString(), "19372461775513343691590086534037741906533799473648040012278229434133483800898"); + assert.equal(r[1].toString(), "9458658722007214007257525444427903161243386465067105737478306991484593958249"); + }); + + it("should mulPointEscalar 1", () => { + const p = [ + snarkjs.bigInt("17777552123799933955779906779655732241715742912184938656739573121738514868268"), + snarkjs.bigInt("2626589144620713026669568689430873010625803728049924121243784502389097019475"), + ]; + + const r = babyjub.mulPointEscalar(p, snarkjs.bigInt("14035240266687799601661095864649209771790948434046947201833777492504781204499")); + assert.equal(r[0].toString(), "17070357974431721403481313912716834497662307308519659060910483826664480189605"); + assert.equal(r[1].toString(), "4014745322800118607127020275658861516666525056516280575712425373174125159339"); + }); + + it("should mulPointEscalar 2", () => { + const p = [ + snarkjs.bigInt("6890855772600357754907169075114257697580319025794532037257385534741338397365"), + snarkjs.bigInt("4338620300185947561074059802482547481416142213883829469920100239455078257889"), + ]; + + const r = babyjub.mulPointEscalar(p, snarkjs.bigInt("20819045374670962167435360035096875258406992893633759881276124905556507972311")); + assert.equal(r[0].toString(), "13563888653650925984868671744672725781658357821216877865297235725727006259983"); + assert.equal(r[1].toString(), "8442587202676550862664528699803615547505326611544120184665036919364004251662"); + }); + + it("should inCurve 1", () => { + const p = [ + snarkjs.bigInt("17777552123799933955779906779655732241715742912184938656739573121738514868268"), + snarkjs.bigInt("2626589144620713026669568689430873010625803728049924121243784502389097019475"), + ]; + assert(babyjub.inCurve(p)); + }); + + it("should inCurve 2", () => { + const p = [ + snarkjs.bigInt("6890855772600357754907169075114257697580319025794532037257385534741338397365"), + snarkjs.bigInt("4338620300185947561074059802482547481416142213883829469920100239455078257889"), + ]; + assert(babyjub.inCurve(p)); + }); + + it("should inSubgroup 1", () => { + const p = [ + snarkjs.bigInt("17777552123799933955779906779655732241715742912184938656739573121738514868268"), + snarkjs.bigInt("2626589144620713026669568689430873010625803728049924121243784502389097019475"), + ]; + assert(babyjub.inSubgroup(p)); + }); + + it("should inSubgroup 2", () => { + const p = [ + snarkjs.bigInt("6890855772600357754907169075114257697580319025794532037257385534741338397365"), + snarkjs.bigInt("4338620300185947561074059802482547481416142213883829469920100239455078257889"), + ]; + assert(babyjub.inSubgroup(p)); + }); + + it("should packPoint - unpackPoint 1", () => { + const p = [ + snarkjs.bigInt("17777552123799933955779906779655732241715742912184938656739573121738514868268"), + snarkjs.bigInt("2626589144620713026669568689430873010625803728049924121243784502389097019475"), + ]; + const buf = babyjub.packPoint(p); + assert.equal(buf.toString('hex'), '53b81ed5bffe9545b54016234682e7b2f699bd42a5e9eae27ff4051bc698ce85'); + const p2 = babyjub.unpackPoint(buf); + assert.equal(p2[0].toString(), "17777552123799933955779906779655732241715742912184938656739573121738514868268"); + assert.equal(p2[1].toString(), "2626589144620713026669568689430873010625803728049924121243784502389097019475"); + }); + + it("should packPoint - unpackPoint 2", () => { + const p = [ + snarkjs.bigInt("6890855772600357754907169075114257697580319025794532037257385534741338397365"), + snarkjs.bigInt("4338620300185947561074059802482547481416142213883829469920100239455078257889"), + ]; + const buf = babyjub.packPoint(p); + assert.equal(buf.toString('hex'), 'e114eb17eddf794f063a68fecac515e3620e131976108555735c8b0773929709'); + const p2 = babyjub.unpackPoint(buf); + assert.equal(p2[0].toString(), "6890855772600357754907169075114257697580319025794532037257385534741338397365"); + assert.equal(p2[1].toString(), "4338620300185947561074059802482547481416142213883829469920100239455078257889"); + }); +}); diff --git a/@tornado/circomlib/test/binsub.js b/@tornado/circomlib/test/binsub.js new file mode 100644 index 0000000..e6023ae --- /dev/null +++ b/@tornado/circomlib/test/binsub.js @@ -0,0 +1,56 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +function print(circuit, w, s) { + console.log(s + ": " + w[circuit.getSignalIdx(s)]); +} + +function checkSub(_a,_b, circuit) { + let a=bigInt(_a); + let b=bigInt(_b); + if (a.lesser(bigInt.zero)) a = a.add(bigInt.one.shl(16)); + if (b.lesser(bigInt.zero)) b = b.add(bigInt.one.shl(16)); + const w = circuit.calculateWitness({a: a, b: b}); + + let res = a.sub(b); + if (res.lesser(bigInt.zero)) res = res.add(bigInt.one.shl(16)); + assert( w[circuit.getSignalIdx("main.out")].equals(bigInt(res)) ); +} + +describe("BinSub test", () => { + let circuit; + before( async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "binsub_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains BinSub: " + circuit.nConstraints); + }); + + it("Should check variuos ege cases", async () => { + checkSub(0,0, circuit); + checkSub(1,0, circuit); + checkSub(-1,0, circuit); + checkSub(2,1, circuit); + checkSub(2,2, circuit); + checkSub(2,3, circuit); + checkSub(2,-1, circuit); + checkSub(2,-2, circuit); + checkSub(2,-3, circuit); + checkSub(-2,-3, circuit); + checkSub(-2,-2, circuit); + checkSub(-2,-1, circuit); + checkSub(-2,0, circuit); + checkSub(-2,1, circuit); + checkSub(-2,2, circuit); + checkSub(-2,3, circuit); + }); + + +}); diff --git a/@tornado/circomlib/test/binsum.js b/@tornado/circomlib/test/binsum.js new file mode 100644 index 0000000..d1b834f --- /dev/null +++ b/@tornado/circomlib/test/binsum.js @@ -0,0 +1,35 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const crypto = require("crypto"); + +const compiler = require("circom"); + +const assert = chai.assert; + +describe("Sum test", () => { + it("Should create a constant circuit", async () => { + + const cirDef = await compiler(path.join(__dirname, "circuits", "constants_test.circom")); + assert.equal(cirDef.nVars, 2); + + const circuit = new snarkjs.Circuit(cirDef); + + const witness = circuit.calculateWitness({ "in": "0xd807aa98" }); + + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt("0xd807aa98"))); + }); + it("Should create a sum circuit", async () => { + + const cirDef = await compiler(path.join(__dirname, "circuits", "sum_test.circom")); + assert.equal(cirDef.nVars, 97); // 32 (in1) + 32(in2) + 32(out) + 1 (carry) + + const circuit = new snarkjs.Circuit(cirDef); + + const witness = circuit.calculateWitness({ "a": "111", "b": "222" }); + + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt("333"))); + }); +}); diff --git a/@tornado/circomlib/test/circuits/aliascheck_test.circom b/@tornado/circomlib/test/circuits/aliascheck_test.circom new file mode 100644 index 0000000..dc2252d --- /dev/null +++ b/@tornado/circomlib/test/circuits/aliascheck_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/aliascheck.circom"; + +component main = AliasCheck() diff --git a/@tornado/circomlib/test/circuits/aliascheckbabyjub_test.circom b/@tornado/circomlib/test/circuits/aliascheckbabyjub_test.circom new file mode 100644 index 0000000..2a3e326 --- /dev/null +++ b/@tornado/circomlib/test/circuits/aliascheckbabyjub_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/aliascheck.circom"; + +component main = AliasCheckBabyJub() diff --git a/@tornado/circomlib/test/circuits/babyadd_tester.circom b/@tornado/circomlib/test/circuits/babyadd_tester.circom new file mode 100644 index 0000000..129acfa --- /dev/null +++ b/@tornado/circomlib/test/circuits/babyadd_tester.circom @@ -0,0 +1,3 @@ +include "../../circuits/babyjub.circom"; + +component main = BabyAdd(); diff --git a/@tornado/circomlib/test/circuits/babycheck_test.circom b/@tornado/circomlib/test/circuits/babycheck_test.circom new file mode 100644 index 0000000..925de65 --- /dev/null +++ b/@tornado/circomlib/test/circuits/babycheck_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/babyjub.circom"; + +component main = BabyCheck(); diff --git a/@tornado/circomlib/test/circuits/babypbk_test.circom b/@tornado/circomlib/test/circuits/babypbk_test.circom new file mode 100644 index 0000000..2583bb9 --- /dev/null +++ b/@tornado/circomlib/test/circuits/babypbk_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/babyjub.circom"; + +component main = BabyPbk(); \ No newline at end of file diff --git a/@tornado/circomlib/test/circuits/binsub_test.circom b/@tornado/circomlib/test/circuits/binsub_test.circom new file mode 100644 index 0000000..a633064 --- /dev/null +++ b/@tornado/circomlib/test/circuits/binsub_test.circom @@ -0,0 +1,26 @@ +include "../../circuits/bitify.circom" +include "../../circuits/binsub.circom" + +template A() { + signal private input a; + signal input b; + signal output out; + + component n2ba = Num2Bits(16); + component n2bb = Num2Bits(16); + component sub = BinSub(16); + component b2n = Bits2Num(16); + + n2ba.in <== a; + n2bb.in <== b; + + for (var i=0; i<16; i++) { + sub.in[0][i] <== n2ba.out[i]; + sub.in[1][i] <== n2bb.out[i]; + b2n.in[i] <== sub.out[i]; + } + + out <== b2n.out; +} + +component main = A(); diff --git a/@tornado/circomlib/test/circuits/constants_test.circom b/@tornado/circomlib/test/circuits/constants_test.circom new file mode 100644 index 0000000..61d392d --- /dev/null +++ b/@tornado/circomlib/test/circuits/constants_test.circom @@ -0,0 +1,18 @@ +include "../../circuits/sha256/constants.circom" + +template A() { + signal input in; + component h0; + h0 = K(8); + + var lc = 0; + var e = 1; + for (var i=0; i<32; i++) { + lc = lc + e*h0.out[i]; + e *= 2; + } + + lc === in; +} + +component main = A(); diff --git a/@tornado/circomlib/test/circuits/eddsa_test.circom b/@tornado/circomlib/test/circuits/eddsa_test.circom new file mode 100644 index 0000000..1ef054e --- /dev/null +++ b/@tornado/circomlib/test/circuits/eddsa_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/eddsa.circom"; + +component main = EdDSAVerifier(80); diff --git a/@tornado/circomlib/test/circuits/eddsamimc_test.circom b/@tornado/circomlib/test/circuits/eddsamimc_test.circom new file mode 100644 index 0000000..8ad48e6 --- /dev/null +++ b/@tornado/circomlib/test/circuits/eddsamimc_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/eddsamimc.circom"; + +component main = EdDSAMiMCVerifier(); diff --git a/@tornado/circomlib/test/circuits/eddsamimcsponge_test.circom b/@tornado/circomlib/test/circuits/eddsamimcsponge_test.circom new file mode 100644 index 0000000..ee27dc5 --- /dev/null +++ b/@tornado/circomlib/test/circuits/eddsamimcsponge_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/eddsamimcsponge.circom"; + +component main = EdDSAMiMCSpongeVerifier(); diff --git a/@tornado/circomlib/test/circuits/eddsaposeidon_test.circom b/@tornado/circomlib/test/circuits/eddsaposeidon_test.circom new file mode 100644 index 0000000..98f96c7 --- /dev/null +++ b/@tornado/circomlib/test/circuits/eddsaposeidon_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/eddsaposeidon.circom"; + +component main = EdDSAPoseidonVerifier(); diff --git a/@tornado/circomlib/test/circuits/edwards2montgomery.circom b/@tornado/circomlib/test/circuits/edwards2montgomery.circom new file mode 100644 index 0000000..960e594 --- /dev/null +++ b/@tornado/circomlib/test/circuits/edwards2montgomery.circom @@ -0,0 +1,3 @@ +include "../../circuits/montgomery.circom"; + +component main = Edwards2Montgomery(); diff --git a/@tornado/circomlib/test/circuits/escalarmul_min_test.circom b/@tornado/circomlib/test/circuits/escalarmul_min_test.circom new file mode 100644 index 0000000..6973701 --- /dev/null +++ b/@tornado/circomlib/test/circuits/escalarmul_min_test.circom @@ -0,0 +1,26 @@ +include "../../circuits/escalarmul.circom"; + + +template Main() { + signal input in[256]; + signal output out[2]; + + var i; + + var base = [5299619240641551281634865583518297030282874472190772894086521144482721001553, + 16950150798460657717958625567821834550301663161624707787222815936182638968203]; + + component escalarMul = EscalarMul(256, base); + + escalarMul.inp[0] <== 0; + escalarMul.inp[1] <== 1; + + for (i=0; i<256; i++) { + in[i] ==> escalarMul.in[i]; + } + + escalarMul.out[0] ==> out[0]; + escalarMul.out[1] ==> out[1]; +} + +component main = Main(); diff --git a/@tornado/circomlib/test/circuits/escalarmul_test.circom b/@tornado/circomlib/test/circuits/escalarmul_test.circom new file mode 100644 index 0000000..c15535d --- /dev/null +++ b/@tornado/circomlib/test/circuits/escalarmul_test.circom @@ -0,0 +1,31 @@ +include "../../circuits/escalarmul.circom"; +include "../../circuits/bitify.circom"; + + +template Main() { + signal input in; + signal output out[2]; + + var base = [5299619240641551281634865583518297030282874472190772894086521144482721001553, + 16950150798460657717958625567821834550301663161624707787222815936182638968203]; + + + component n2b = Num2Bits(253); + component escalarMul = EscalarMul(253, base); + + escalarMul.inp[0] <== 0; + escalarMul.inp[1] <== 1; + + var i; + + in ==> n2b.in; + + for (i=0; i<253; i++) { + n2b.out[i] ==> escalarMul.in[i]; + } + + escalarMul.out[0] ==> out[0]; + escalarMul.out[1] ==> out[1]; +} + +component main = Main(); diff --git a/@tornado/circomlib/test/circuits/escalarmul_test_min.circom b/@tornado/circomlib/test/circuits/escalarmul_test_min.circom new file mode 100644 index 0000000..6973701 --- /dev/null +++ b/@tornado/circomlib/test/circuits/escalarmul_test_min.circom @@ -0,0 +1,26 @@ +include "../../circuits/escalarmul.circom"; + + +template Main() { + signal input in[256]; + signal output out[2]; + + var i; + + var base = [5299619240641551281634865583518297030282874472190772894086521144482721001553, + 16950150798460657717958625567821834550301663161624707787222815936182638968203]; + + component escalarMul = EscalarMul(256, base); + + escalarMul.inp[0] <== 0; + escalarMul.inp[1] <== 1; + + for (i=0; i<256; i++) { + in[i] ==> escalarMul.in[i]; + } + + escalarMul.out[0] ==> out[0]; + escalarMul.out[1] ==> out[1]; +} + +component main = Main(); diff --git a/@tornado/circomlib/test/circuits/escalarmulany_test.circom b/@tornado/circomlib/test/circuits/escalarmulany_test.circom new file mode 100644 index 0000000..c09918d --- /dev/null +++ b/@tornado/circomlib/test/circuits/escalarmulany_test.circom @@ -0,0 +1,28 @@ +include "../../circuits/escalarmulany.circom"; +include "../../circuits/bitify.circom"; + +template Main() { + signal input e; + signal input p[2]; + signal output out[2]; + + component n2b = Num2Bits(253); + component escalarMulAny = EscalarMulAny(253); + + escalarMulAny.p[0] <== p[0]; + escalarMulAny.p[1] <== p[1]; + + var i; + + e ==> n2b.in; + + for (i=0; i<253; i++) { + n2b.out[i] ==> escalarMulAny.e[i]; + } + + escalarMulAny.out[0] ==> out[0]; + escalarMulAny.out[1] ==> out[1]; +} + +component main = Main(); + diff --git a/@tornado/circomlib/test/circuits/escalarmulfix_test.circom b/@tornado/circomlib/test/circuits/escalarmulfix_test.circom new file mode 100644 index 0000000..9a9d777 --- /dev/null +++ b/@tornado/circomlib/test/circuits/escalarmulfix_test.circom @@ -0,0 +1,29 @@ +include "../../circuits/escalarmulfix.circom"; +include "../../circuits/bitify.circom"; + + +template Main() { + signal input e; + signal output out[2]; + + var base = [5299619240641551281634865583518297030282874472190772894086521144482721001553, + 16950150798460657717958625567821834550301663161624707787222815936182638968203] + + + component n2b = Num2Bits(253); + component escalarMul = EscalarMulFix(253, base); + + var i; + + e ==> n2b.in; + + for (i=0; i<253; i++) { + n2b.out[i] ==> escalarMul.e[i]; + } + + escalarMul.out[0] ==> out[0]; + escalarMul.out[1] ==> out[1]; +} + +component main = Main(); + diff --git a/@tornado/circomlib/test/circuits/escalarmulw4table.circom b/@tornado/circomlib/test/circuits/escalarmulw4table.circom new file mode 100644 index 0000000..85c5507 --- /dev/null +++ b/@tornado/circomlib/test/circuits/escalarmulw4table.circom @@ -0,0 +1,6 @@ +include "../../circuits/escalarmulw4table.circom"; + +var base = [5299619240641551281634865583518297030282874472190772894086521144482721001553, + 16950150798460657717958625567821834550301663161624707787222815936182638968203] + +component main = EscalarMulW4Table(base, 0); diff --git a/@tornado/circomlib/test/circuits/escalarmulw4table_test.circom b/@tornado/circomlib/test/circuits/escalarmulw4table_test.circom new file mode 100644 index 0000000..852628d --- /dev/null +++ b/@tornado/circomlib/test/circuits/escalarmulw4table_test.circom @@ -0,0 +1,17 @@ +include "../../circuits/escalarmulw4table.circom"; + + +template Main() { + signal input in; + signal output out[16][2]; + var base = [5299619240641551281634865583518297030282874472190772894086521144482721001553, + 16950150798460657717958625567821834550301663161624707787222815936182638968203]; + + var escalarMul = EscalarMulW4Table(base, 0); + for (var i=0; i<16; i++) { + out[i][0] <== escalarMul[i][0]*in; + out[i][1] <== escalarMul[i][1]*in; + } +} + +component main = Main(); diff --git a/@tornado/circomlib/test/circuits/escalarmulw4table_test3.circom b/@tornado/circomlib/test/circuits/escalarmulw4table_test3.circom new file mode 100644 index 0000000..52933fa --- /dev/null +++ b/@tornado/circomlib/test/circuits/escalarmulw4table_test3.circom @@ -0,0 +1,17 @@ +include "../../circuits/escalarmulw4table.circom"; + + +template Main() { + signal input in; + signal output out[16][2]; + var base = [5299619240641551281634865583518297030282874472190772894086521144482721001553, + 16950150798460657717958625567821834550301663161624707787222815936182638968203]; + + var escalarMul = EscalarMulW4Table(base, 3); + for (var i=0; i<16; i++) { + out[i][0] <== escalarMul[i][0]*in; + out[i][1] <== escalarMul[i][1]*in; + } +} + +component main = Main(); diff --git a/@tornado/circomlib/test/circuits/greatereqthan.circom b/@tornado/circomlib/test/circuits/greatereqthan.circom new file mode 100644 index 0000000..3428ac2 --- /dev/null +++ b/@tornado/circomlib/test/circuits/greatereqthan.circom @@ -0,0 +1,4 @@ + +include "../../circuits/comparators.circom"; + +component main = GreaterEqThan(32); diff --git a/@tornado/circomlib/test/circuits/greaterthan.circom b/@tornado/circomlib/test/circuits/greaterthan.circom new file mode 100644 index 0000000..b890ba8 --- /dev/null +++ b/@tornado/circomlib/test/circuits/greaterthan.circom @@ -0,0 +1,4 @@ + +include "../../circuits/comparators.circom"; + +component main = GreaterThan(32); diff --git a/@tornado/circomlib/test/circuits/isequal.circom b/@tornado/circomlib/test/circuits/isequal.circom new file mode 100644 index 0000000..c14d506 --- /dev/null +++ b/@tornado/circomlib/test/circuits/isequal.circom @@ -0,0 +1,4 @@ + +include "../../circuits/comparators.circom"; + +component main = IsEqual(); diff --git a/@tornado/circomlib/test/circuits/iszero.circom b/@tornado/circomlib/test/circuits/iszero.circom new file mode 100644 index 0000000..0ca0589 --- /dev/null +++ b/@tornado/circomlib/test/circuits/iszero.circom @@ -0,0 +1,5 @@ + + +include "../../circuits/comparators.circom"; + +component main = IsZero(); diff --git a/@tornado/circomlib/test/circuits/lesseqthan.circom b/@tornado/circomlib/test/circuits/lesseqthan.circom new file mode 100644 index 0000000..db2eda4 --- /dev/null +++ b/@tornado/circomlib/test/circuits/lesseqthan.circom @@ -0,0 +1,4 @@ + +include "../../circuits/comparators.circom"; + +component main = LessEqThan(32); diff --git a/@tornado/circomlib/test/circuits/lessthan.circom b/@tornado/circomlib/test/circuits/lessthan.circom new file mode 100644 index 0000000..63944f2 --- /dev/null +++ b/@tornado/circomlib/test/circuits/lessthan.circom @@ -0,0 +1,4 @@ + +include "../../circuits/comparators.circom"; + +component main = LessThan(32); diff --git a/@tornado/circomlib/test/circuits/mimc_sponge_hash_test.circom b/@tornado/circomlib/test/circuits/mimc_sponge_hash_test.circom new file mode 100644 index 0000000..7cda28d --- /dev/null +++ b/@tornado/circomlib/test/circuits/mimc_sponge_hash_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/mimcsponge.circom" + +component main = MiMCSponge(2, 3); diff --git a/@tornado/circomlib/test/circuits/mimc_sponge_test.circom b/@tornado/circomlib/test/circuits/mimc_sponge_test.circom new file mode 100644 index 0000000..92e9df2 --- /dev/null +++ b/@tornado/circomlib/test/circuits/mimc_sponge_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/mimcsponge.circom" + +component main = MiMCFeistel(220); diff --git a/@tornado/circomlib/test/circuits/mimc_test.circom b/@tornado/circomlib/test/circuits/mimc_test.circom new file mode 100644 index 0000000..26b0b01 --- /dev/null +++ b/@tornado/circomlib/test/circuits/mimc_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/mimc.circom" + +component main = MiMC7(91); diff --git a/@tornado/circomlib/test/circuits/montgomery2edwards.circom b/@tornado/circomlib/test/circuits/montgomery2edwards.circom new file mode 100644 index 0000000..39d05a6 --- /dev/null +++ b/@tornado/circomlib/test/circuits/montgomery2edwards.circom @@ -0,0 +1,3 @@ +include "../../circuits/montgomery.circom"; + +component main = Montgomery2Edwards(); diff --git a/@tornado/circomlib/test/circuits/montgomeryadd.circom b/@tornado/circomlib/test/circuits/montgomeryadd.circom new file mode 100644 index 0000000..8caea17 --- /dev/null +++ b/@tornado/circomlib/test/circuits/montgomeryadd.circom @@ -0,0 +1,3 @@ +include "../../circuits/montgomery.circom"; + +component main = MontgomeryAdd(); diff --git a/@tornado/circomlib/test/circuits/montgomerydouble.circom b/@tornado/circomlib/test/circuits/montgomerydouble.circom new file mode 100644 index 0000000..70a3840 --- /dev/null +++ b/@tornado/circomlib/test/circuits/montgomerydouble.circom @@ -0,0 +1,3 @@ +include "../../circuits/montgomery.circom"; + +component main = MontgomeryDouble(); diff --git a/@tornado/circomlib/test/circuits/mux1_1.circom b/@tornado/circomlib/test/circuits/mux1_1.circom new file mode 100644 index 0000000..5a3afee --- /dev/null +++ b/@tornado/circomlib/test/circuits/mux1_1.circom @@ -0,0 +1,31 @@ +include "../../circuits/mux1.circom"; +include "../../circuits/bitify.circom"; + + +template Constants() { + var i; + signal output out[2]; + + out[0] <== 37; + out[1] <== 47; +} + +template Main() { + var i; + signal private input selector; + signal output out; + + component mux = Mux1(); + component n2b = Num2Bits(1); + component cst = Constants(); + + selector ==> n2b.in; + n2b.out[0] ==> mux.s; + for (i=0; i<2; i++) { + cst.out[i] ==> mux.c[i]; + } + + mux.out ==> out; +} + +component main = Main(); diff --git a/@tornado/circomlib/test/circuits/mux2_1.circom b/@tornado/circomlib/test/circuits/mux2_1.circom new file mode 100644 index 0000000..4bb6247 --- /dev/null +++ b/@tornado/circomlib/test/circuits/mux2_1.circom @@ -0,0 +1,35 @@ +include "../../circuits/mux2.circom"; +include "../../circuits/bitify.circom"; + + +template Constants() { + var i; + signal output out[4]; + + out[0] <== 37; + out[1] <== 47; + out[2] <== 53; + out[3] <== 71; +} + +template Main() { + var i; + signal private input selector; + signal output out; + + component mux = Mux2(); + component n2b = Num2Bits(2); + component cst = Constants(); + + selector ==> n2b.in; + for (i=0; i<2; i++) { + n2b.out[i] ==> mux.s[i]; + } + for (i=0; i<4; i++) { + cst.out[i] ==> mux.c[i]; + } + + mux.out ==> out; +} + +component main = Main(); diff --git a/@tornado/circomlib/test/circuits/mux3_1.circom b/@tornado/circomlib/test/circuits/mux3_1.circom new file mode 100644 index 0000000..69f98f2 --- /dev/null +++ b/@tornado/circomlib/test/circuits/mux3_1.circom @@ -0,0 +1,39 @@ +include "../../circuits/mux3.circom"; +include "../../circuits/bitify.circom"; + + +template Constants() { + var i; + signal output out[8]; + + out[0] <== 37; + out[1] <== 47; + out[2] <== 53; + out[3] <== 71; + out[4] <== 89; + out[5] <== 107; + out[6] <== 163; + out[7] <== 191; +} + +template Main() { + var i; + signal private input selector; + signal output out; + + component mux = Mux3(); + component n2b = Num2Bits(3); + component cst = Constants(); + + selector ==> n2b.in; + for (i=0; i<3; i++) { + n2b.out[i] ==> mux.s[i]; + } + for (i=0; i<8; i++) { + cst.out[i] ==> mux.c[i]; + } + + mux.out ==> out; +} + +component main = Main(); diff --git a/@tornado/circomlib/test/circuits/mux4_1.circom b/@tornado/circomlib/test/circuits/mux4_1.circom new file mode 100644 index 0000000..d63e466 --- /dev/null +++ b/@tornado/circomlib/test/circuits/mux4_1.circom @@ -0,0 +1,54 @@ +include "../../circuits/mux4.circom"; +include "../../circuits/bitify.circom"; + + +template Constants() { + var i; + signal output out[16]; + + out[0] <== 123; + out[1] <== 456; + out[2] <== 789; + out[3] <== 012; + out[4] <== 111; + out[5] <== 222; + out[6] <== 333; + out[7] <== 4546; + out[8] <== 134523; + out[9] <== 44356; + out[10] <== 15623; + out[11] <== 4566; + out[12] <== 1223; + out[13] <== 4546; + out[14] <== 4256; + out[15] <== 4456; + +/* + for (i=0;i<16; i++) { + out[i] <== i*2+100; + } +*/ + +} + +template Main() { + var i; + signal private input selector; + signal output out; + + component mux = Mux4(); + component n2b = Num2Bits(4); + component cst = Constants(); + + selector ==> n2b.in; + for (i=0; i<4; i++) { + n2b.out[i] ==> mux.s[i]; + } + for (i=0; i<16; i++) { + cst.out[i] ==> mux.c[i]; + } + + mux.out ==> out; +} + +component main = Main(); diff --git a/@tornado/circomlib/test/circuits/pedersen2_test.circom b/@tornado/circomlib/test/circuits/pedersen2_test.circom new file mode 100644 index 0000000..e13e353 --- /dev/null +++ b/@tornado/circomlib/test/circuits/pedersen2_test.circom @@ -0,0 +1,32 @@ +include "../../circuits/pedersen.circom"; +include "../../circuits/bitify.circom"; + + +template Main() { + signal input in; + signal output out[2]; + + component pedersen = Pedersen(256); + + component n2b; + n2b = Num2Bits(253); + + var i; + + in ==> n2b.in; + + for (i=0; i<253; i++) { + pedersen.in[i] <== n2b.out[i]; + } + + for (i=253; i<256; i++) { + pedersen.in[i] <== 0; + } + + pedersen.out[0] ==> out[0]; + pedersen.out[1] ==> out[1]; +} + +component main = Main(); + + diff --git a/@tornado/circomlib/test/circuits/pedersen_test.circom b/@tornado/circomlib/test/circuits/pedersen_test.circom new file mode 100644 index 0000000..accd484 --- /dev/null +++ b/@tornado/circomlib/test/circuits/pedersen_test.circom @@ -0,0 +1,29 @@ +include "../../circuits/pedersen_old.circom"; +include "../../circuits/bitify.circom"; + + +template Main() { + signal input in[2]; + signal output out[2]; + + component pedersen = Pedersen(250*2); + + component n2b[2]; + n2b[0] = Num2Bits(250); + n2b[1] = Num2Bits(250); + + var i; + + in[0] ==> n2b[0].in; + in[1] ==> n2b[1].in; + + for (i=0; i<250; i++) { + n2b[0].out[i] ==> pedersen.in[i]; + n2b[1].out[i] ==> pedersen.in[250+i]; + } + + pedersen.out[0] ==> out[0]; + pedersen.out[1] ==> out[1]; +} + +component main = Main(); diff --git a/@tornado/circomlib/test/circuits/pointbits_loopback.circom b/@tornado/circomlib/test/circuits/pointbits_loopback.circom new file mode 100644 index 0000000..39dacfb --- /dev/null +++ b/@tornado/circomlib/test/circuits/pointbits_loopback.circom @@ -0,0 +1,23 @@ +include "../../circuits/pointbits.circom"; + + +template Main() { + signal input in[2]; + + var i + + component p2b = Point2Bits_Strict(); + component b2p = Bits2Point_Strict(); + + p2b.in[0] <== in[0]; + p2b.in[1] <== in[1]; + + for (i=0; i<256; i++) { + b2p.in[i] <== p2b.out[i]; + } + + b2p.out[0] === in[0]; + b2p.out[1] === in[1]; +} + +component main = Main(); diff --git a/@tornado/circomlib/test/circuits/poseidon_test.circom b/@tornado/circomlib/test/circuits/poseidon_test.circom new file mode 100644 index 0000000..526bef1 --- /dev/null +++ b/@tornado/circomlib/test/circuits/poseidon_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/poseidon.circom" + +component main = Poseidon(2, 6, 8, 57); diff --git a/@tornado/circomlib/test/circuits/sha256_2_test.circom b/@tornado/circomlib/test/circuits/sha256_2_test.circom new file mode 100644 index 0000000..855423b --- /dev/null +++ b/@tornado/circomlib/test/circuits/sha256_2_test.circom @@ -0,0 +1,15 @@ +include "../../circuits/sha256/sha256_2.circom"; + +template Main() { + signal private input a; + signal private input b; + signal output out; + + component sha256_2 = Sha256_2(); + + sha256_2.a <== a; + sha256_2.b <== b; + out <== sha256_2.out; +} + +component main = Main(); diff --git a/@tornado/circomlib/test/circuits/sha256_test448.circom b/@tornado/circomlib/test/circuits/sha256_test448.circom new file mode 100644 index 0000000..9a5dbdc --- /dev/null +++ b/@tornado/circomlib/test/circuits/sha256_test448.circom @@ -0,0 +1,3 @@ +include "../../circuits/sha256/sha256.circom"; + +component main = Sha256(448); diff --git a/@tornado/circomlib/test/circuits/sha256_test512.circom b/@tornado/circomlib/test/circuits/sha256_test512.circom new file mode 100644 index 0000000..dd8b11d --- /dev/null +++ b/@tornado/circomlib/test/circuits/sha256_test512.circom @@ -0,0 +1,3 @@ +include "../../circuits/sha256/sha256.circom"; + +component main = Sha256(512); diff --git a/@tornado/circomlib/test/circuits/sign_test.circom b/@tornado/circomlib/test/circuits/sign_test.circom new file mode 100644 index 0000000..e6a6e3b --- /dev/null +++ b/@tornado/circomlib/test/circuits/sign_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/sign.circom"; + +component main = Sign(); diff --git a/@tornado/circomlib/test/circuits/smtprocessor10_test.circom b/@tornado/circomlib/test/circuits/smtprocessor10_test.circom new file mode 100644 index 0000000..ecf15d0 --- /dev/null +++ b/@tornado/circomlib/test/circuits/smtprocessor10_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/smt/smtprocessor.circom"; + +component main = SMTProcessor(10); diff --git a/@tornado/circomlib/test/circuits/smtverifier10_test.circom b/@tornado/circomlib/test/circuits/smtverifier10_test.circom new file mode 100644 index 0000000..31a4dd7 --- /dev/null +++ b/@tornado/circomlib/test/circuits/smtverifier10_test.circom @@ -0,0 +1,3 @@ +include "../../circuits/smt/smtverifier.circom"; + +component main = SMTVerifier(10); diff --git a/@tornado/circomlib/test/circuits/sum_test.circom b/@tornado/circomlib/test/circuits/sum_test.circom new file mode 100644 index 0000000..a8b062b --- /dev/null +++ b/@tornado/circomlib/test/circuits/sum_test.circom @@ -0,0 +1,26 @@ +include "../../circuits/bitify.circom" +include "../../circuits/binsum.circom" + +template A() { + signal private input a; + signal input b; + signal output out; + + component n2ba = Num2Bits(32); + component n2bb = Num2Bits(32); + component sum = BinSum(32,2); + component b2n = Bits2Num(32); + + n2ba.in <== a; + n2bb.in <== b; + + for (var i=0; i<32; i++) { + sum.in[0][i] <== n2ba.out[i]; + sum.in[1][i] <== n2bb.out[i]; + b2n.in[i] <== sum.out[i]; + } + + out <== b2n.out; +} + +component main = A(); diff --git a/@tornado/circomlib/test/comparators.js b/@tornado/circomlib/test/comparators.js new file mode 100644 index 0000000..8fa7fb1 --- /dev/null +++ b/@tornado/circomlib/test/comparators.js @@ -0,0 +1,193 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const crypto = require("crypto"); + +const compiler = require("circom"); + +const assert = chai.assert; + +describe("Sum test", () => { + it("Should create a iszero circuit", async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "iszero.circom")); + + const circuit = new snarkjs.Circuit(cirDef); + + let witness; + witness = circuit.calculateWitness({ "in": 111}); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in": 0 }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + }); + it("Should create a isequal circuit", async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "isequal.circom")); + + const circuit = new snarkjs.Circuit(cirDef); + + let witness; + witness = circuit.calculateWitness({ "in[0]": "111", "in[1]": "222" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "444", "in[1]": "444" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + }); + it("Should create a comparison lessthan", async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "lessthan.circom")); + + const circuit = new snarkjs.Circuit(cirDef); + + let witness; + witness = circuit.calculateWitness({ "in[0]": "333", "in[1]": "444" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "1", "in[1]": "1" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "661", "in[1]": "660" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "0", "in[1]": "1" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "0", "in[1]": "444" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "1", "in[1]": "0" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "555", "in[1]": "0" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "0", "in[1]": "0" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + }); + it("Should create a comparison lesseqthan", async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "lesseqthan.circom")); + + const circuit = new snarkjs.Circuit(cirDef); + + let witness; + witness = circuit.calculateWitness({ "in[0]": "333", "in[1]": "444" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "1", "in[1]": "1" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "661", "in[1]": "660" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "0", "in[1]": "1" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "0", "in[1]": "444" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "1", "in[1]": "0" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "555", "in[1]": "0" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "0", "in[1]": "0" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + }); + it("Should create a comparison greaterthan", async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "greaterthan.circom")); + + const circuit = new snarkjs.Circuit(cirDef); + + let witness; + witness = circuit.calculateWitness({ "in[0]": "333", "in[1]": "444" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "1", "in[1]": "1" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "661", "in[1]": "660" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "0", "in[1]": "1" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "0", "in[1]": "444" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "1", "in[1]": "0" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "555", "in[1]": "0" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "0", "in[1]": "0" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + }); + it("Should create a comparison greatereqthan", async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "greatereqthan.circom")); + + const circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstraints BalancesUpdater: " + circuit.nConstraints); + + let witness; + witness = circuit.calculateWitness({ "in[0]": "333", "in[1]": "444" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "1", "in[1]": "1" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "661", "in[1]": "660" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "0", "in[1]": "1" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "0", "in[1]": "444" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(0))); + + witness = circuit.calculateWitness({ "in[0]": "1", "in[1]": "0" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "555", "in[1]": "0" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + + witness = circuit.calculateWitness({ "in[0]": "0", "in[1]": "0" }); + assert(witness[0].equals(snarkjs.bigInt(1))); + assert(witness[1].equals(snarkjs.bigInt(1))); + }); +}); diff --git a/@tornado/circomlib/test/eddsa.js b/@tornado/circomlib/test/eddsa.js new file mode 100644 index 0000000..bf5f5c7 --- /dev/null +++ b/@tornado/circomlib/test/eddsa.js @@ -0,0 +1,74 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); +// const crypto = require("crypto"); + +const eddsa = require("../src/eddsa.js"); +const babyJub = require("../src/babyjub.js"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +function print(circuit, w, s) { + console.log(s + ": " + w[circuit.getSignalIdx(s)]); +} + +function buffer2bits(buff) { + const res = []; + for (let i=0; i>j)&1) { + res.push(bigInt.one); + } else { + res.push(bigInt.zero); + } + } + } + return res; +} + + +describe("EdDSA test", function () { + let circuit; + + this.timeout(100000); + + before( async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "eddsa_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains EdDSA: " + circuit.nConstraints); + }); + + it("Sign a single 10 bytes from 0 to 9", async () => { + const msg = Buffer.from("00010203040506070809", "hex"); + +// const prvKey = crypto.randomBytes(32); + + const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex"); + + const pubKey = eddsa.prv2pub(prvKey); + + const pPubKey = babyJub.packPoint(pubKey); + + const signature = eddsa.sign(prvKey, msg); + + const pSignature = eddsa.packSignature(signature); + const uSignature = eddsa.unpackSignature(pSignature); + + assert(eddsa.verify(msg, uSignature, pubKey)); + + const msgBits = buffer2bits(msg); + const r8Bits = buffer2bits(pSignature.slice(0, 32)); + const sBits = buffer2bits(pSignature.slice(32, 64)); + const aBits = buffer2bits(pPubKey); + + const w = circuit.calculateWitness({A: aBits, R8: r8Bits, S: sBits, msg: msgBits}); + + assert(circuit.checkWitness(w)); + + }); +}); diff --git a/@tornado/circomlib/test/eddsa_js.js b/@tornado/circomlib/test/eddsa_js.js new file mode 100644 index 0000000..bc7ba46 --- /dev/null +++ b/@tornado/circomlib/test/eddsa_js.js @@ -0,0 +1,82 @@ +const chai = require("chai"); +const snarkjs = require("@tornado/snarkjs"); + +const eddsa = require("../src/eddsa.js"); +const babyJub = require("../src/babyjub.js"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +describe("EdDSA js test", function () { + + this.timeout(100000); + + it("Sign (using Mimc7) a single 10 bytes from 0 to 9", () => { + const msgBuf = Buffer.from("00010203040506070809", "hex"); + const msg = bigInt.leBuff2int(msgBuf); + + // const prvKey = crypto.randomBytes(32); + + const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex"); + + const pubKey = eddsa.prv2pub(prvKey); + + assert.equal(pubKey[0].toString(), + "13277427435165878497778222415993513565335242147425444199013288855685581939618"); + assert.equal(pubKey[1].toString(), + "13622229784656158136036771217484571176836296686641868549125388198837476602820"); + + const pPubKey = babyJub.packPoint(pubKey); + + const signature = eddsa.signMiMC(prvKey, msg); + assert.equal(signature.R8[0].toString(), + "11384336176656855268977457483345535180380036354188103142384839473266348197733"); + assert.equal(signature.R8[1].toString(), + "15383486972088797283337779941324724402501462225528836549661220478783371668959"); + assert.equal(signature.S.toString(), + "2523202440825208709475937830811065542425109372212752003460238913256192595070"); + + const pSignature = eddsa.packSignature(signature); + assert.equal(pSignature.toString("hex"), ""+ + "dfedb4315d3f2eb4de2d3c510d7a987dcab67089c8ace06308827bf5bcbe02a2"+ + "7ed40dab29bf993c928e789d007387998901a24913d44fddb64b1f21fc149405"); + + const uSignature = eddsa.unpackSignature(pSignature); + assert(eddsa.verifyMiMC(msg, uSignature, pubKey)); + + }); + + it("Sign (using Poseidon) a single 10 bytes from 0 to 9", () => { + const msgBuf = Buffer.from("00010203040506070809", "hex"); + const msg = bigInt.leBuff2int(msgBuf); + + const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex"); + + const pubKey = eddsa.prv2pub(prvKey); + + assert.equal(pubKey[0].toString(), + "13277427435165878497778222415993513565335242147425444199013288855685581939618"); + assert.equal(pubKey[1].toString(), + "13622229784656158136036771217484571176836296686641868549125388198837476602820"); + + const pPubKey = babyJub.packPoint(pubKey); + + const signature = eddsa.signPoseidon(prvKey, msg); + assert.equal(signature.R8[0].toString(), + "11384336176656855268977457483345535180380036354188103142384839473266348197733"); + assert.equal(signature.R8[1].toString(), + "15383486972088797283337779941324724402501462225528836549661220478783371668959"); + assert.equal(signature.S.toString(), + "248298168863866362217836334079793350221620631973732197668910946177382043688"); + + const pSignature = eddsa.packSignature(signature); + assert.equal(pSignature.toString("hex"), ""+ + "dfedb4315d3f2eb4de2d3c510d7a987dcab67089c8ace06308827bf5bcbe02a2"+ + "28506bce274aa1b3f7e7c2fd7e4fe09bff8f9aa37a42def7994e98f322888c00"); + + const uSignature = eddsa.unpackSignature(pSignature); + assert(eddsa.verifyPoseidon(msg, uSignature, pubKey)); + + }); +}); diff --git a/@tornado/circomlib/test/eddsamimc.js b/@tornado/circomlib/test/eddsamimc.js new file mode 100644 index 0000000..064adc3 --- /dev/null +++ b/@tornado/circomlib/test/eddsamimc.js @@ -0,0 +1,98 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const eddsa = require("../src/eddsa.js"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +describe("EdDSA MiMC test", function () { + let circuit; + + this.timeout(100000); + + before( async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "eddsamimc_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains EdDSA MiMC: " + circuit.nConstraints); + }); + + it("Sign a single number", async () => { + const msg = bigInt(1234); + + const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex"); + + const pubKey = eddsa.prv2pub(prvKey); + + const signature = eddsa.signMiMC(prvKey, msg); + + assert(eddsa.verifyMiMC(msg, signature, pubKey)); + + const w = circuit.calculateWitness({ + enabled: 1, + Ax: pubKey[0], + Ay: pubKey[1], + R8x: signature.R8[0], + R8y: signature.R8[1], + S: signature.S, + M: msg}); + + assert(circuit.checkWitness(w)); + }); + + it("Detect Invalid signature", async () => { + const msg = bigInt(1234); + + const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex"); + + const pubKey = eddsa.prv2pub(prvKey); + + + const signature = eddsa.signMiMC(prvKey, msg); + + assert(eddsa.verifyMiMC(msg, signature, pubKey)); + try { + const w = circuit.calculateWitness({ + enabled: 1, + Ax: pubKey[0], + Ay: pubKey[1], + R8x: signature.R8[0].add(bigInt(1)), + R8y: signature.R8[1], + S: signature.S, + M: msg}); + assert(false); + } catch(err) { + assert(/Constraint\sdoesn't\smatch(.*)1\s!=\s0/.test(err.message) ); + } + }); + + + it("Test a dissabled circuit with a bad signature", async () => { + const msg = bigInt(1234); + + const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex"); + + const pubKey = eddsa.prv2pub(prvKey); + + + const signature = eddsa.signMiMC(prvKey, msg); + + assert(eddsa.verifyMiMC(msg, signature, pubKey)); + + const w = circuit.calculateWitness({ + enabled: 0, + Ax: pubKey[0], + Ay: pubKey[1], + R8x: signature.R8[0].add(bigInt(1)), + R8y: signature.R8[1], + S: signature.S, + M: msg}); + + assert(circuit.checkWitness(w)); + }); +}); diff --git a/@tornado/circomlib/test/eddsamimcsponge.js b/@tornado/circomlib/test/eddsamimcsponge.js new file mode 100644 index 0000000..7953580 --- /dev/null +++ b/@tornado/circomlib/test/eddsamimcsponge.js @@ -0,0 +1,99 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const eddsa = require("../src/eddsa.js"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +describe("EdDSA MiMCSponge test", function () { + let circuit; + + this.timeout(100000); + + before( async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "eddsamimcsponge_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains EdDSA MiMCSponge: " + circuit.nConstraints); + }); + + it("Sign a single number", async () => { + const msg = bigInt(1234); + + const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex"); + + const pubKey = eddsa.prv2pub(prvKey); + + const signature = eddsa.signMiMCSponge(prvKey, msg); + + assert(eddsa.verifyMiMCSponge(msg, signature, pubKey)); + + const w = circuit.calculateWitness({ + enabled: 1, + Ax: pubKey[0], + Ay: pubKey[1], + R8x: signature.R8[0], + R8y: signature.R8[1], + S: signature.S, + M: msg}); + + assert(circuit.checkWitness(w)); + }); + + it("Detect Invalid signature", async () => { + const msg = bigInt(1234); + + const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex"); + + const pubKey = eddsa.prv2pub(prvKey); + + + const signature = eddsa.signMiMCSponge(prvKey, msg); + + assert(eddsa.verifyMiMCSponge(msg, signature, pubKey)); + try { + const w = circuit.calculateWitness({ + enabled: 1, + Ax: pubKey[0], + Ay: pubKey[1], + R8x: signature.R8[0].add(bigInt(1)), + R8y: signature.R8[1], + S: signature.S, + M: msg}); + assert(false); + } catch(err) { + assert(err.message.indexOf("Constraint doesn't match") >= 0); + assert(err.message.indexOf("1 != 0") >= 0); + } + }); + + + it("Test a dissabled circuit with a bad signature", async () => { + const msg = bigInt(1234); + + const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex"); + + const pubKey = eddsa.prv2pub(prvKey); + + + const signature = eddsa.signMiMCSponge(prvKey, msg); + + assert(eddsa.verifyMiMCSponge(msg, signature, pubKey)); + + const w = circuit.calculateWitness({ + enabled: 0, + Ax: pubKey[0], + Ay: pubKey[1], + R8x: signature.R8[0].add(bigInt(1)), + R8y: signature.R8[1], + S: signature.S, + M: msg}); + + assert(circuit.checkWitness(w)); + }); +}); diff --git a/@tornado/circomlib/test/eddsaposeidon.js b/@tornado/circomlib/test/eddsaposeidon.js new file mode 100644 index 0000000..f8c5692 --- /dev/null +++ b/@tornado/circomlib/test/eddsaposeidon.js @@ -0,0 +1,98 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const eddsa = require("../src/eddsa.js"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +describe("EdDSA Poseidon test", function () { + let circuit; + + this.timeout(100000); + + before( async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "eddsaposeidon_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains EdDSA Poseidon: " + circuit.nConstraints); + }); + + it("Sign a single number", async () => { + const msg = bigInt(1234); + + const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex"); + + const pubKey = eddsa.prv2pub(prvKey); + + const signature = eddsa.signPoseidon(prvKey, msg); + + assert(eddsa.verifyPoseidon(msg, signature, pubKey)); + + const w = circuit.calculateWitness({ + enabled: 1, + Ax: pubKey[0], + Ay: pubKey[1], + R8x: signature.R8[0], + R8y: signature.R8[1], + S: signature.S, + M: msg}); + + assert(circuit.checkWitness(w)); + }); + + it("Detect Invalid signature", async () => { + const msg = bigInt(1234); + + const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex"); + + const pubKey = eddsa.prv2pub(prvKey); + + + const signature = eddsa.signPoseidon(prvKey, msg); + + assert(eddsa.verifyPoseidon(msg, signature, pubKey)); + try { + circuit.calculateWitness({ + enabled: 1, + Ax: pubKey[0], + Ay: pubKey[1], + R8x: signature.R8[0].add(bigInt(1)), + R8y: signature.R8[1], + S: signature.S, + M: msg}); + assert(false); + } catch(err) { + assert(/Constraint\sdoesn't\smatch(.*)1\s!=\s0/.test(err.message) ); + } + }); + + + it("Test a dissabled circuit with a bad signature", async () => { + const msg = bigInt(1234); + + const prvKey = Buffer.from("0001020304050607080900010203040506070809000102030405060708090001", "hex"); + + const pubKey = eddsa.prv2pub(prvKey); + + + const signature = eddsa.signPoseidon(prvKey, msg); + + assert(eddsa.verifyPoseidon(msg, signature, pubKey)); + + const w = circuit.calculateWitness({ + enabled: 0, + Ax: pubKey[0], + Ay: pubKey[1], + R8x: signature.R8[0].add(bigInt(1)), + R8y: signature.R8[1], + S: signature.S, + M: msg}); + + assert(circuit.checkWitness(w)); + }); +}); diff --git a/@tornado/circomlib/test/escalarmul.js b/@tornado/circomlib/test/escalarmul.js new file mode 100644 index 0000000..827f133 --- /dev/null +++ b/@tornado/circomlib/test/escalarmul.js @@ -0,0 +1,172 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + + +const q=bigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617"); +function addPoint(a,b) { + const cta = bigInt("168700"); + const d = bigInt("168696"); + + const res = []; + res[0] = bigInt((a[0]*b[1] + b[0]*a[1]) * bigInt(bigInt.one + d*a[0]*b[0]*a[1]*b[1]).inverse(q)).affine(q); + res[1] = bigInt((a[1]*b[1] - cta*a[0]*b[0]) * bigInt(bigInt.one - d*a[0]*b[0]*a[1]*b[1]).inverse(q)).affine(q); + return res; +} + +function print(circuit, w, s) { + console.log(s + ": " + w[circuit.getSignalIdx(s)]); +} + +describe("Exponentioation test", () => { + it("Should generate the Exponentiation table in k=0", async () => { + + const cirDef = await compiler(path.join(__dirname, "circuits", "escalarmulw4table_test.circom")); + +// console.log(JSON.stringify(cirDef, null, 1)); + +// assert.equal(cirDef.nVars, 2); + + const circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains: " + circuit.nConstraints); + + const w = circuit.calculateWitness({in: 1}); + + assert(circuit.checkWitness(w)); + + let g = [bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"), + bigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203")] + + dbl= [bigInt("0"), snarkjs.bigInt("1")]; + + for (let i=0; i<16; i++) { + const xout1 = w[circuit.getSignalIdx(`main.out[${i}][0]`)]; + const yout1 = w[circuit.getSignalIdx(`main.out[${i}][1]`)]; + + // console.log(xout1.toString()); + // console.log(yout1.toString()); + // console.log(dbl[0]); + // console.log(dbl[1]); + + assert(xout1.equals(dbl[0])); + assert(yout1.equals(dbl[1])); + + dbl = addPoint([xout1, yout1],g); + } + + }); + + it("Should generate the Exponentiation table in k=3", async () => { + + const cirDef = await compiler(path.join(__dirname, "circuits", "escalarmulw4table_test3.circom")); + +// console.log(JSON.stringify(cirDef, null, 1)); + +// assert.equal(cirDef.nVars, 2); + + const circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains: " + circuit.nConstraints); + + const w = circuit.calculateWitness({in: 1}); + + assert(circuit.checkWitness(w)); + + let g = [snarkjs.bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"), + snarkjs.bigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203")] + + for (let i=0; i<12;i++) { + g = addPoint(g,g); + } + + dbl= [snarkjs.bigInt("0"), snarkjs.bigInt("1")]; + + for (let i=0; i<16; i++) { + const xout1 = w[circuit.getSignalIdx(`main.out[${i}][0]`)]; + const yout1 = w[circuit.getSignalIdx(`main.out[${i}][1]`)]; + + + // console.log(xout1.toString()); + // console.log(yout1.toString()); + // console.log(dbl[0]); + // console.log(dbl[1]); + + assert(xout1.equals(dbl[0])); + assert(yout1.equals(dbl[1])); + + dbl = addPoint([xout1, yout1],g); + } + + }); + + it("Should exponentiate g^31", async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "escalarmul_test.circom"), {reduceConstraints: true}); + +// console.log(JSON.stringify(cirDef, null, 1)); + +// assert.equal(cirDef.nVars, 2); + + const circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains: " + circuit.nConstraints); + + const w = circuit.calculateWitness({"in": 31}); + + assert(circuit.checkWitness(w)); + + let g = [snarkjs.bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"), + snarkjs.bigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203")] + + let c = [0n, 1n]; + + for (let i=0; i<31;i++) { + c = addPoint(c,g); + } + + const xout = w[circuit.getSignalIdx(`main.out[0]`)]; + const yout = w[circuit.getSignalIdx(`main.out[1]`)]; + +/* + console.log(xout.toString()); + console.log(yout.toString()); +*/ + assert(xout.equals(c[0])); + assert(yout.equals(c[1])); + + console.log("-------") + const w2 = circuit.calculateWitness({"in": (1n<<252n)+1n}); + + const xout2 = w2[circuit.getSignalIdx(`main.out[0]`)]; + const yout2 = w2[circuit.getSignalIdx(`main.out[1]`)]; + + c = [g[0], g[1]]; + for (let i=0; i<252;i++) { + c = addPoint(c,c); + } + c = addPoint(c,g); + + // console.log(xout2.toString()); + // console.log(yout2.toString()); + // console.log(c[0].toString()); + // console.log(c[1].toString()); + + assert(xout2.equals(c[0])); + assert(yout2.equals(c[1])); + + }).timeout(10000000); + + it("Number of constrains for 256 bits", async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "escalarmul_test_min.circom")); + + const circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains: " + circuit.nConstraints); + }).timeout(10000000); + +}); diff --git a/@tornado/circomlib/test/escalarmulany.js b/@tornado/circomlib/test/escalarmulany.js new file mode 100644 index 0000000..6a78a4f --- /dev/null +++ b/@tornado/circomlib/test/escalarmulany.js @@ -0,0 +1,59 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + + +function print(circuit, w, s) { + console.log(s + ": " + w[circuit.getSignalIdx(s)]); +} + +describe("Escalarmul test", function () { + let circuitEMulAny; + + this.timeout(100000); + + let g = [ + snarkjs.bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"), + snarkjs.bigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203") + ]; + + before( async() => { + const cirDefEMulAny = await compiler(path.join(__dirname, "circuits", "escalarmulany_test.circom")); + circuitEMulAny = new snarkjs.Circuit(cirDefEMulAny); + console.log("NConstrains Escalarmul any: " + circuitEMulAny.nConstraints); + }); + + it("Should generate Same escalar mul", async () => { + + const w = circuitEMulAny.calculateWitness({"e": 1, "p": g}); + + assert(circuitEMulAny.checkWitness(w)); + + const xout = w[circuitEMulAny.getSignalIdx("main.out[0]")]; + const yout = w[circuitEMulAny.getSignalIdx("main.out[1]")]; + + assert(xout.equals(g[0])); + assert(yout.equals(g[1])); + }); + + it("If multiply by order should return 0", async () => { + + const r = bigInt("2736030358979909402780800718157159386076813972158567259200215660948447373041"); + const w = circuitEMulAny.calculateWitness({"e": r, "p": g}); + + assert(circuitEMulAny.checkWitness(w)); + + const xout = w[circuitEMulAny.getSignalIdx("main.out[0]")]; + const yout = w[circuitEMulAny.getSignalIdx("main.out[1]")]; + + assert(xout.equals(bigInt.zero)); + assert(yout.equals(bigInt.one)); + }); + +}); + diff --git a/@tornado/circomlib/test/escalarmulfix.js b/@tornado/circomlib/test/escalarmulfix.js new file mode 100644 index 0000000..24a79ab --- /dev/null +++ b/@tornado/circomlib/test/escalarmulfix.js @@ -0,0 +1,112 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); +const babyjub = require("../src/babyjub"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + + +function print(circuit, w, s) { + console.log(s + ": " + w[circuit.getSignalIdx(s)]); +} + +describe("Escalarmul test", function () { + let circuit; + + this.timeout(100000); + + before( async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "escalarmulfix_test.circom")); + circuit = new snarkjs.Circuit(cirDef); + console.log("NConstrains Escalarmul fix: " + circuit.nConstraints); + }); + + it("Should generate Same escalar mul", async () => { + + const w = circuit.calculateWitness({"e": 0}); + + assert(circuit.checkWitness(w)); + + const xout = w[circuit.getSignalIdx("main.out[0]")]; + const yout = w[circuit.getSignalIdx("main.out[1]")]; + + assert(xout.equals(0)); + assert(yout.equals(1)); + }); + + it("Should generate Same escalar mul", async () => { + + const w = circuit.calculateWitness({"e": 1}); + + assert(circuit.checkWitness(w)); + + const xout = w[circuit.getSignalIdx("main.out[0]")]; + const yout = w[circuit.getSignalIdx("main.out[1]")]; + + assert(xout.equals(babyjub.Base8[0])); + assert(yout.equals(babyjub.Base8[1])); + }); + + it("Should generate scalar mul of a specific constant", async () => { + + const s = bigInt("2351960337287830298912035165133676222414898052661454064215017316447594616519"); + const base8 = [ + bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"), + bigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203") + ]; + + const w = circuit.calculateWitness({"e": s}); + + assert(circuit.checkWitness(w)); + + const xout = w[circuit.getSignalIdx("main.out[0]")]; + const yout = w[circuit.getSignalIdx("main.out[1]")]; + + const expectedRes = babyjub.mulPointEscalar(base8, s); + + assert(xout.equals(expectedRes[0])); + assert(yout.equals(expectedRes[1])); + }); + + it("Should generate scalar mul of the firsts 50 elements", async () => { + + const base8 = [ + bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"), + bigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203") + ]; + + for (let i=0; i<50; i++) { + const s = bigInt(i); + + const w = circuit.calculateWitness({"e": s}); + + assert(circuit.checkWitness(w)); + + const xout = w[circuit.getSignalIdx("main.out[0]")]; + const yout = w[circuit.getSignalIdx("main.out[1]")]; + + const expectedRes = babyjub.mulPointEscalar(base8, s); + + assert(xout.equals(expectedRes[0])); + assert(yout.equals(expectedRes[1])); + } + }); + + it("If multiply by order should return 0", async () => { + + const w = circuit.calculateWitness({"e": babyjub.subOrder }); + + assert(circuit.checkWitness(w)); + + const xout = w[circuit.getSignalIdx("main.out[0]")]; + const yout = w[circuit.getSignalIdx("main.out[1]")]; + + assert(xout.equals(bigInt.zero)); + assert(yout.equals(bigInt.one)); + }); + +}); + diff --git a/@tornado/circomlib/test/helpers/printsignal.js b/@tornado/circomlib/test/helpers/printsignal.js new file mode 100644 index 0000000..acc7747 --- /dev/null +++ b/@tornado/circomlib/test/helpers/printsignal.js @@ -0,0 +1,22 @@ + +const snarkjs = require("@tornado/snarkjs"); + +const bigInt = snarkjs.bigInt; + +module.exports = function hexBits(cir, witness, sig, nBits) { + let v = bigInt(0); + for (let i=nBits-1; i>=0; i--) { + v = v.shiftLeft(1); + const name = sig+"["+i+"]"; + const idx = cir.getSignalIdx(name); + const vbit = bigInt(witness[idx].toString()); + if (vbit.equals(bigInt(1))) { + v = v.add(bigInt(1)); + } else if (vbit.equals(bigInt(0))) { + v; + } else { + console.log("Not Binary: "+name); + } + } + return v.toString(16); +}; diff --git a/@tornado/circomlib/test/helpers/sha256.js b/@tornado/circomlib/test/helpers/sha256.js new file mode 100644 index 0000000..ec58ee1 --- /dev/null +++ b/@tornado/circomlib/test/helpers/sha256.js @@ -0,0 +1,178 @@ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* SHA-256 (FIPS 180-4) implementation in JavaScript (c) Chris Veness 2002-2017 */ +/* MIT Licence */ +/* www.movable-type.co.uk/scripts/sha256.html */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +'use strict'; + + +/** + * SHA-256 hash function reference implementation. + * + * This is an annotated direct implementation of FIPS 180-4, without any optimisations. It is + * intended to aid understanding of the algorithm rather than for production use. + * + * While it could be used where performance is not critical, I would recommend using the ‘Web + * Cryptography API’ (developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest) for the browser, + * or the ‘crypto’ library (nodejs.org/api/crypto.html#crypto_class_hash) in Node.js. + * + * See csrc.nist.gov/groups/ST/toolkit/secure_hashing.html + * csrc.nist.gov/groups/ST/toolkit/examples.html + */ +class Sha256 { + + /** + * Generates SHA-256 hash of string. + * + * @param {string} msg - (Unicode) string to be hashed. + * @param {Object} [options] + * @param {string} [options.msgFormat=string] - Message format: 'string' for JavaScript string + * (gets converted to UTF-8 for hashing); 'hex-bytes' for string of hex bytes ('616263' ≡ 'abc') . + * @param {string} [options.outFormat=hex] - Output format: 'hex' for string of contiguous + * hex bytes; 'hex-w' for grouping hex bytes into groups of (4 byte / 8 character) words. + * @returns {string} Hash of msg as hex character string. + */ + static hash(msg, options) { + const defaults = { msgFormat: 'string', outFormat: 'hex' }; + const opt = Object.assign(defaults, options); + + // note use throughout this routine of 'n >>> 0' to coerce Number 'n' to unsigned 32-bit integer + + switch (opt.msgFormat) { + default: // default is to convert string to UTF-8, as SHA only deals with byte-streams + case 'string': msg = utf8Encode(msg); break; + case 'hex-bytes':msg = hexBytesToString(msg); break; // mostly for running tests + } + + // constants [§4.2.2] + const K = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 ]; + + // initial hash value [§5.3.3] + const H = [ + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 ]; + + // PREPROCESSING [§6.2.1] + + msg += String.fromCharCode(0x80); // add trailing '1' bit (+ 0's padding) to string [§5.1.1] + + // convert string msg into 512-bit blocks (array of 16 32-bit integers) [§5.2.1] + const l = msg.length/4 + 2; // length (in 32-bit integers) of msg + ‘1’ + appended length + const N = Math.ceil(l/16); // number of 16-integer (512-bit) blocks required to hold 'l' ints + const M = new Array(N); // message M is N×16 array of 32-bit integers + + for (let i=0; i>> 32, but since JS converts + // bitwise-op args to 32 bits, we need to simulate this by arithmetic operators + const lenHi = ((msg.length-1)*8) / Math.pow(2, 32); + const lenLo = ((msg.length-1)*8) >>> 0; + M[N-1][14] = Math.floor(lenHi); + M[N-1][15] = lenLo; + + // HASH COMPUTATION [§6.2.2] + + for (let i=0; i>> 0; + } + + // 2 - initialise working variables a, b, c, d, e, f, g, h with previous hash value + let a = H[0], b = H[1], c = H[2], d = H[3], e = H[4], f = H[5], g = H[6], h = H[7]; + + // 3 - main loop (note '>>> 0' for 'addition modulo 2^32') + for (let t=0; t<64; t++) { + const T1 = h + Sha256.Σ1(e) + Sha256.Ch(e, f, g) + K[t] + W[t]; + const T2 = Sha256.Σ0(a) + Sha256.Maj(a, b, c); + h = g; + g = f; + f = e; + e = (d + T1) >>> 0; + d = c; + c = b; + b = a; + a = (T1 + T2) >>> 0; + } + + // 4 - compute the new intermediate hash value (note '>>> 0' for 'addition modulo 2^32') + H[0] = (H[0]+a) >>> 0; + H[1] = (H[1]+b) >>> 0; + H[2] = (H[2]+c) >>> 0; + H[3] = (H[3]+d) >>> 0; + H[4] = (H[4]+e) >>> 0; + H[5] = (H[5]+f) >>> 0; + H[6] = (H[6]+g) >>> 0; + H[7] = (H[7]+h) >>> 0; + } + + // convert H0..H7 to hex strings (with leading zeros) + for (let h=0; h prev + String.fromCharCode(curr), ''); + } catch (e) { // no TextEncoder available? + return unescape(encodeURIComponent(str)); // monsur.hossa.in/2012/07/20/utf-8-in-javascript.html + } + } + + function hexBytesToString(hexStr) { // convert string of hex numbers to a string of chars (eg '616263' -> 'abc'). + const str = hexStr.replace(' ', ''); // allow space-separated groups + return str=='' ? '' : str.match(/.{2}/g).map(byte => String.fromCharCode(parseInt(byte, 16))).join(''); + } + } + + + + /** + * Rotates right (circular right shift) value x by n positions [§3.2.4]. + * @private + */ + static ROTR(n, x) { + return (x >>> n) | (x << (32-n)); + } + + + /** + * Logical functions [§4.1.2]. + * @private + */ + static Σ0(x) { return Sha256.ROTR(2, x) ^ Sha256.ROTR(13, x) ^ Sha256.ROTR(22, x); } + static Σ1(x) { return Sha256.ROTR(6, x) ^ Sha256.ROTR(11, x) ^ Sha256.ROTR(25, x); } + static σ0(x) { return Sha256.ROTR(7, x) ^ Sha256.ROTR(18, x) ^ (x>>>3); } + static σ1(x) { return Sha256.ROTR(17, x) ^ Sha256.ROTR(19, x) ^ (x>>>10); } + static Ch(x, y, z) { return (x & y) ^ (~x & z); } // 'choice' + static Maj(x, y, z) { return (x & y) ^ (x & z) ^ (y & z); } // 'majority' + +} + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +if (typeof module != 'undefined' && module.exports) module.exports = Sha256; // ≡ export default Sha256 + diff --git a/@tornado/circomlib/test/mimccircuit.js b/@tornado/circomlib/test/mimccircuit.js new file mode 100644 index 0000000..90a3df7 --- /dev/null +++ b/@tornado/circomlib/test/mimccircuit.js @@ -0,0 +1,35 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const mimcjs = require("../src/mimc7.js"); + +const assert = chai.assert; + +describe("MiMC Circuit test", function () { + let circuit; + + this.timeout(100000); + + before( async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "mimc_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("MiMC constraints: " + circuit.nConstraints); + }); + + it("Should check constrain", async () => { + const w = circuit.calculateWitness({x_in: 1, k: 2}); + + const res = w[circuit.getSignalIdx("main.out")]; + + const res2 = mimcjs.hash(1,2,91); + + assert.equal(res.toString(), res2.toString()); + + assert(circuit.checkWitness(w)); + + }); +}); diff --git a/@tornado/circomlib/test/mimccontract.js b/@tornado/circomlib/test/mimccontract.js new file mode 100644 index 0000000..9c135d5 --- /dev/null +++ b/@tornado/circomlib/test/mimccontract.js @@ -0,0 +1,48 @@ +const ganache = require("ganache-cli"); +const Web3 = require("web3"); +const chai = require("chai"); +const mimcGenContract = require("../src/mimc_gencontract.js"); +const mimcjs = require("../src/mimc7.js"); + + +const assert = chai.assert; +const log = (msg) => { if (process.env.MOCHA_VERBOSE) console.log(msg); }; + +const SEED = "mimc"; + +describe("MiMC Smart contract test", function () { + let testrpc; + let web3; + let mimc; + let accounts; + + this.timeout(100000); + + before(async () => { + web3 = new Web3(ganache.provider(), null, { transactionConfirmationBlocks: 1 }); + accounts = await web3.eth.getAccounts(); + }); + + it("Should deploy the contract", async () => { + const C = new web3.eth.Contract(mimcGenContract.abi); + + mimc = await C.deploy({ + data: mimcGenContract.createCode(SEED, 91), + arguments: [] + }).send({ + gas: 1500000, + gasPrice: '30000000000000', + from: accounts[0] + }).on("error", (error) => { + console.log("ERROR: "+error); + }); + }); + + it("Shold calculate the mimic correctly", async () => { + const res = await mimc.methods.MiMCpe7(1,2).call(); + const res2 = await mimcjs.hash(1,2,91); + + assert.equal(res.toString(), res2.toString()); + }); +}); + diff --git a/@tornado/circomlib/test/mimcspongecircuit.js b/@tornado/circomlib/test/mimcspongecircuit.js new file mode 100644 index 0000000..96049b9 --- /dev/null +++ b/@tornado/circomlib/test/mimcspongecircuit.js @@ -0,0 +1,58 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const mimcjs = require("../src/mimcsponge.js"); + +const assert = chai.assert; + +describe("MiMC Sponge Circuit test", function () { + let circuit; + + this.timeout(100000); + + it("Should check permutation", async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "mimc_sponge_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("MiMC Feistel constraints: " + circuit.nConstraints); + + const w = circuit.calculateWitness({xL_in: 1, xR_in: 2, k: 3}); + + const xLout = w[circuit.getSignalIdx("main.xL_out")]; + const xRout = w[circuit.getSignalIdx("main.xR_out")]; + + const out2 = mimcjs.hash(1,2,3); + + assert.equal(xLout.toString(), out2.xL.toString()); + assert.equal(xRout.toString(), out2.xR.toString()); + + assert(circuit.checkWitness(w)); + + }); + + it("Should check hash", async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "mimc_sponge_hash_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("MiMC Sponge constraints: " + circuit.nConstraints); + + const w = circuit.calculateWitness({ins: [1, 2], k: 0}); + + const o1 = w[circuit.getSignalIdx("main.outs[0]")]; + const o2 = w[circuit.getSignalIdx("main.outs[1]")]; + const o3 = w[circuit.getSignalIdx("main.outs[2]")]; + + const out2 = mimcjs.multiHash([1,2], 0, 3); + + assert.equal(o1.toString(), out2[0].toString()); + assert.equal(o2.toString(), out2[1].toString()); + assert.equal(o3.toString(), out2[2].toString()); + + assert(circuit.checkWitness(w)); + + }); +}); diff --git a/@tornado/circomlib/test/mimcspongecontract.js b/@tornado/circomlib/test/mimcspongecontract.js new file mode 100644 index 0000000..ba2ed75 --- /dev/null +++ b/@tornado/circomlib/test/mimcspongecontract.js @@ -0,0 +1,43 @@ +const ganache = require("ganache-cli"); +const Web3 = require("web3"); +const chai = require("chai"); +const mimcGenContract = require("../src/mimcsponge_gencontract.js"); +const mimcjs = require("../src/mimcsponge.js"); + + +const assert = chai.assert; +const log = (msg) => { if (process.env.MOCHA_VERBOSE) console.log(msg); }; + +const SEED = "mimcsponge"; + +describe("MiMC Sponge Smart contract test", () => { + let testrpc; + let web3; + let mimc; + let accounts; + + before(async () => { + web3 = new Web3(ganache.provider(), null, { transactionConfirmationBlocks: 1 }); + accounts = await web3.eth.getAccounts(); + }); + + it("Should deploy the contract", async () => { + const C = new web3.eth.Contract(mimcGenContract.abi); + + mimc = await C.deploy({ + data: mimcGenContract.createCode(SEED, 220) + }).send({ + gas: 3500000, + from: accounts[0] + }); + }); + + it("Shold calculate the mimc correctly", async () => { + const res = await mimc.methods.MiMCSponge(1,2).call(); + const res2 = await mimcjs.hash(1,2, 0); + + assert.equal(res.xL.toString(), res2.xL.toString()); + assert.equal(res.xR.toString(), res2.xR.toString()); + }); +}); + diff --git a/@tornado/circomlib/test/montgomery.js b/@tornado/circomlib/test/montgomery.js new file mode 100644 index 0000000..d10f2ea --- /dev/null +++ b/@tornado/circomlib/test/montgomery.js @@ -0,0 +1,99 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); +const babyJub = require("../src/babyjub.js"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +describe("Montgomery test", function () { + let circuitE2M; + let circuitM2E; + let circuitMAdd; + let circuitMDouble; + + let g = [ + snarkjs.bigInt("5299619240641551281634865583518297030282874472190772894086521144482721001553"), + snarkjs.bigInt("16950150798460657717958625567821834550301663161624707787222815936182638968203")]; + + let mg, mg2, g2, g3, mg3; + + this.timeout(100000); + before( async() => { + const cirDefE2M = await compiler(path.join(__dirname, "circuits", "edwards2montgomery.circom")); + circuitE2M = new snarkjs.Circuit(cirDefE2M); + console.log("NConstrains Edwards -> Montgomery: " + circuitE2M.nConstraints); + + const cirDefM2E = await compiler(path.join(__dirname, "circuits", "montgomery2edwards.circom")); + circuitM2E = new snarkjs.Circuit(cirDefM2E); + console.log("NConstrains Montgomery -> Edwards: " + circuitM2E.nConstraints); + + const cirDefMAdd = await compiler(path.join(__dirname, "circuits", "montgomeryadd.circom")); + circuitMAdd = new snarkjs.Circuit(cirDefMAdd); + console.log("NConstrains Montgomery Add: " + circuitMAdd.nConstraints); + + const cirDefMDouble = await compiler(path.join(__dirname, "circuits", "montgomerydouble.circom")); + circuitMDouble = new snarkjs.Circuit(cirDefMDouble); + console.log("NConstrains Montgomery Double: " + circuitMDouble.nConstraints); + }); + it("Convert Edwards to Montgomery and back again", async () => { + let w, xout, yout; + + w = circuitE2M.calculateWitness({ in: g}); + + xout = w[circuitE2M.getSignalIdx("main.out[0]")]; + yout = w[circuitE2M.getSignalIdx("main.out[1]")]; + + mg = [xout, yout]; + + w = circuitM2E.calculateWitness({ in: [xout, yout]}); + + xout = w[circuitM2E.getSignalIdx("main.out[0]")]; + yout = w[circuitM2E.getSignalIdx("main.out[1]")]; + + assert(xout.equals(g[0])); + assert(yout.equals(g[1])); + }); + it("Should double a point", async () => { + let w, xout, yout; + + g2 = babyJub.addPoint(g,g); + + w = circuitMDouble.calculateWitness({ in: mg}); + + xout = w[circuitE2M.getSignalIdx("main.out[0]")]; + yout = w[circuitE2M.getSignalIdx("main.out[1]")]; + + mg2 = [xout, yout]; + + w = circuitM2E.calculateWitness({ in: mg2}); + + xout = w[circuitM2E.getSignalIdx("main.out[0]")]; + yout = w[circuitM2E.getSignalIdx("main.out[1]")]; + + assert(xout.equals(g2[0])); + assert(yout.equals(g2[1])); + }); + it("Should add a point", async () => { + let w, xout, yout; + + g3 = babyJub.addPoint(g,g2); + + w = circuitMAdd.calculateWitness({ in1: mg, in2: mg2}); + + xout = w[circuitMAdd.getSignalIdx("main.out[0]")]; + yout = w[circuitMAdd.getSignalIdx("main.out[1]")]; + + mg3 = [xout, yout]; + + w = circuitM2E.calculateWitness({ in: mg3}); + + xout = w[circuitM2E.getSignalIdx("main.out[0]")]; + yout = w[circuitM2E.getSignalIdx("main.out[1]")]; + + assert(xout.equals(g3[0])); + assert(yout.equals(g3[1])); + }); +}); diff --git a/@tornado/circomlib/test/multiplexer.js b/@tornado/circomlib/test/multiplexer.js new file mode 100644 index 0000000..4a6dbf1 --- /dev/null +++ b/@tornado/circomlib/test/multiplexer.js @@ -0,0 +1,133 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + + +describe("Mux4 test", () => { + it("Should create a constant multiplexer 4", async () => { + + const cirDef = await compiler(path.join(__dirname, "circuits", "mux4_1.circom")); + +// console.log(JSON.stringify(cirDef, null, 1)); + +// assert.equal(cirDef.nVars, 2); + + const circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains Mux4: " + circuit.nConstraints); + + const ct16 = [ + bigInt("123"), + bigInt("456"), + bigInt("789"), + bigInt("012"), + bigInt("111"), + bigInt("222"), + bigInt("333"), + bigInt("4546"), + bigInt("134523"), + bigInt("44356"), + bigInt("15623"), + bigInt("4566"), + bigInt("1223"), + bigInt("4546"), + bigInt("4256"), + bigInt("4456") + ]; + + for (let i=0; i<16; i++) { + const w = circuit.calculateWitness({ "selector": i }); + + assert(circuit.checkWitness(w)); + + assert(w[0].equals(bigInt(1))); + + // console.log(i + " -> " + w[circuit.getSignalIdx("main.out")].toString()); + assert(w[circuit.getSignalIdx("main.out")].equals(ct16[i])); + } + }); + + it("Should create a constant multiplexer 3", async () => { + + const cirDef = await compiler(path.join(__dirname, "circuits", "mux3_1.circom")); + + const circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains Mux3: " + circuit.nConstraints); + + const ct8 = [ + bigInt("37"), + bigInt("47"), + bigInt("53"), + bigInt("71"), + bigInt("89"), + bigInt("107"), + bigInt("163"), + bigInt("191") + ]; + + for (let i=0; i<8; i++) { + const w = circuit.calculateWitness({ "selector": i }); + + assert(w[0].equals(bigInt(1))); + + // console.log(i + " -> " + w[circuit.getSignalIdx("main.out")].toString()); + assert(w[circuit.getSignalIdx("main.out")].equals(ct8[i])); + } + }); + it("Should create a constant multiplexer 2", async () => { + + const cirDef = await compiler(path.join(__dirname, "circuits", "mux2_1.circom")); + + const circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains Mux2: " + circuit.nConstraints); + + const ct8 = [ + bigInt("37"), + bigInt("47"), + bigInt("53"), + bigInt("71"), + ]; + + for (let i=0; i<4; i++) { + const w = circuit.calculateWitness({ "selector": i }); + + assert(circuit.checkWitness(w)); + + assert(w[0].equals(bigInt(1))); + + // console.log(i + " -> " + w[circuit.getSignalIdx("main.out")].toString()); + assert(w[circuit.getSignalIdx("main.out")].equals(ct8[i])); + } + }); + it("Should create a constant multiplexer 1", async () => { + + const cirDef = await compiler(path.join(__dirname, "circuits", "mux1_1.circom")); + + const circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains Mux1: " + circuit.nConstraints); + + const ct8 = [ + bigInt("37"), + bigInt("47"), + ]; + + for (let i=0; i<2; i++) { + const w = circuit.calculateWitness({ "selector": i }); + + assert(circuit.checkWitness(w)); + + assert(w[0].equals(bigInt(1))); + + // console.log(i + " -> " + w[circuit.getSignalIdx("main.out")].toString()); + assert(w[circuit.getSignalIdx("main.out")].equals(ct8[i])); + } + }); +}); diff --git a/@tornado/circomlib/test/pedersen.js b/@tornado/circomlib/test/pedersen.js new file mode 100644 index 0000000..f45583b --- /dev/null +++ b/@tornado/circomlib/test/pedersen.js @@ -0,0 +1,100 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +const babyJub = require("../src/babyjub.js"); + +const PBASE = + [ + [bigInt("10457101036533406547632367118273992217979173478358440826365724437999023779287"),bigInt("19824078218392094440610104313265183977899662750282163392862422243483260492317")], + [bigInt("2671756056509184035029146175565761955751135805354291559563293617232983272177"),bigInt("2663205510731142763556352975002641716101654201788071096152948830924149045094")], + [bigInt("5802099305472655231388284418920769829666717045250560929368476121199858275951"),bigInt("5980429700218124965372158798884772646841287887664001482443826541541529227896")], + [bigInt("7107336197374528537877327281242680114152313102022415488494307685842428166594"),bigInt("2857869773864086953506483169737724679646433914307247183624878062391496185654")], + [bigInt("20265828622013100949498132415626198973119240347465898028410217039057588424236"),bigInt("1160461593266035632937973507065134938065359936056410650153315956301179689506")] + ]; + +describe("Double Pedersen test", function() { + let circuit; + this.timeout(100000); + before( async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "pedersen_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains: " + circuit.nConstraints); + }); + it("Should pedersen at zero", async () => { + + let w, xout, yout; + + w = circuit.calculateWitness({ in: ["0", "0"]}); + + xout = w[circuit.getSignalIdx("main.out[0]")]; + yout = w[circuit.getSignalIdx("main.out[1]")]; + + assert(xout.equals("0")); + assert(yout.equals("1")); + }); + it("Should pedersen at one first generator", async () => { + let w, xout, yout; + + w = circuit.calculateWitness({ in: ["1", "0"]}); + + xout = bigInt(w[circuit.getSignalIdx("main.out[0]")]); + yout = bigInt(w[circuit.getSignalIdx("main.out[1]")]); + + assert(xout.equals(PBASE[0][0])); + assert(yout.equals(PBASE[0][1])); + }); + it("Should pedersen at one second generator", async () => { + let w, xout, yout; + + w = circuit.calculateWitness({ in: ["0", "1"]}); + + xout = w[circuit.getSignalIdx("main.out[0]")]; + yout = w[circuit.getSignalIdx("main.out[1]")]; + + assert(xout.equals(PBASE[1][0])); + assert(yout.equals(PBASE[1][1])); + + }); + it("Should pedersen at mixed generators", async () => { + let w, xout, yout; + w = circuit.calculateWitness({ in: ["3", "7"]}); + + xout = w[circuit.getSignalIdx("main.out[0]")]; + yout = w[circuit.getSignalIdx("main.out[1]")]; + + + const r = babyJub.addPoint( + babyJub.mulPointEscalar(PBASE[0], 3), + babyJub.mulPointEscalar(PBASE[1], 7) + ); + + assert(xout.equals(r[0])); + assert(yout.equals(r[1])); + + }); + it("Should pedersen all ones", async () => { + let w, xout, yout; + + const allOnes = bigInt("1").shl(250).sub(bigInt("1")); + w = circuit.calculateWitness({ in: [allOnes, allOnes]}); + + xout = w[circuit.getSignalIdx("main.out[0]")]; + yout = w[circuit.getSignalIdx("main.out[1]")]; + + const r2 = babyJub.addPoint( + babyJub.mulPointEscalar(PBASE[0], allOnes), + babyJub.mulPointEscalar(PBASE[1], allOnes) + ); + + assert(xout.equals(r2[0])); + assert(yout.equals(r2[1])); + }); +}); diff --git a/@tornado/circomlib/test/pedersen2.js b/@tornado/circomlib/test/pedersen2.js new file mode 100644 index 0000000..cac156c --- /dev/null +++ b/@tornado/circomlib/test/pedersen2.js @@ -0,0 +1,74 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +const babyJub = require("../src/babyjub.js"); +const pedersen = require("../src/pedersenHash.js"); + + +describe("Pedersen test", function() { + let circuit; + this.timeout(100000); + before( async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "pedersen2_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains Pedersen2: " + circuit.nConstraints); + }); + it("Should pedersen at zero", async () => { + + let w, xout, yout; + + w = circuit.calculateWitness({ in: 0}); + + xout = w[circuit.getSignalIdx("main.out[0]")]; + yout = w[circuit.getSignalIdx("main.out[1]")]; + + const b = Buffer.alloc(32); + + const h = pedersen.hash(b); + const hP = babyJub.unpackPoint(h); + + /* + console.log(`[${xout.toString()}, ${yout.toString()}]`); + console.log(`[${hP[0].toString()}, ${hP[1].toString()}]`); + */ + + assert(xout.equals(hP[0])); + assert(yout.equals(hP[1])); + }); + it("Should pedersen with 253 ones", async () => { + + let w, xout, yout; + + const n = bigInt.one.shl(253).sub(bigInt.one); + console.log(n.toString(16)); + + w = circuit.calculateWitness({ in: n}); + + xout = w[circuit.getSignalIdx("main.out[0]")]; + yout = w[circuit.getSignalIdx("main.out[1]")]; + + const b = Buffer.alloc(32); + for (let i=0; i<31; i++) b[i] = 0xFF; + b[31] = 0x1F; + + + const h = pedersen.hash(b); + const hP = babyJub.unpackPoint(h); + + /* + console.log(`[${xout.toString()}, ${yout.toString()}]`); + console.log(`[${hP[0].toString()}, ${hP[1].toString()}]`); + */ + + assert(xout.equals(hP[0])); + assert(yout.equals(hP[1])); + }); +}); diff --git a/@tornado/circomlib/test/point2bits.js b/@tornado/circomlib/test/point2bits.js new file mode 100644 index 0000000..a216ba8 --- /dev/null +++ b/@tornado/circomlib/test/point2bits.js @@ -0,0 +1,33 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +const babyJub = require("../src/babyjub.js"); + + +describe("Point 2 bits test", function() { + let circuit; + this.timeout(100000); + before( async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "pointbits_loopback.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains Point2Bits loopback: " + circuit.nConstraints); + }); + it("Should do the both convertions for 8Base", async () => { + const w = circuit.calculateWitness({ in: babyJub.Base8}); + + assert(circuit.checkWitness(w)); + }); + it("Should do the both convertions for Zero point", async () => { + const w = circuit.calculateWitness({ in: [0, 1]}); + + assert(circuit.checkWitness(w)); + }); +}); diff --git a/@tornado/circomlib/test/poseidoncircuit.js b/@tornado/circomlib/test/poseidoncircuit.js new file mode 100644 index 0000000..9d17edf --- /dev/null +++ b/@tornado/circomlib/test/poseidoncircuit.js @@ -0,0 +1,60 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); +var blake2b = require('blake2b'); + +const poseidon = require("../src/poseidon.js"); + +const assert = chai.assert; + +describe("Blake2b version test", function() { + it("Should give the expected output for blake2b version", async () => { + var output = new Uint8Array(32); + var input = Buffer.from('poseidon_constants'); + h = blake2b(output.length).update(input).digest('hex') + assert.equal('e57ba154fb2c47811dc1a2369b27e25a44915b4e4ece4eb8ec74850cb78e01b1', h); + }); +}); + +describe("Poseidon Circuit test", function () { + let circuit; + + this.timeout(100000); + + before( async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "poseidon_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("Poseidon constraints: " + circuit.nConstraints); + }); + + it("Should check constrain of hash([1, 2])", async () => { + const w = circuit.calculateWitness({inputs: [1, 2]}); + + const res = w[circuit.getSignalIdx("main.out")]; + + const hash = poseidon.createHash(6, 8, 57); + + const res2 = hash([1,2]); + assert.equal('12242166908188651009877250812424843524687801523336557272219921456462821518061', res2.toString()); + assert.equal(res.toString(), res2.toString()); + assert(circuit.checkWitness(w)); + }); + + it("Should check constrain of hash([3, 4])", async () => { + const w = circuit.calculateWitness({inputs: [3, 4]}); + + const res = w[circuit.getSignalIdx("main.out")]; + + const hash = poseidon.createHash(6, 8, 57); + + const res2 = hash([3, 4]); + assert.equal('17185195740979599334254027721507328033796809509313949281114643312710535000993', res2.toString()); + + assert.equal(res.toString(), res2.toString()); + + assert(circuit.checkWitness(w)); + }); +}); diff --git a/@tornado/circomlib/test/poseidoncontract.js b/@tornado/circomlib/test/poseidoncontract.js new file mode 100644 index 0000000..b49081d --- /dev/null +++ b/@tornado/circomlib/test/poseidoncontract.js @@ -0,0 +1,49 @@ +const ganache = require("ganache-cli"); +const Web3 = require("web3"); +const chai = require("chai"); +const poseidonGenContract = require("../src/poseidon_gencontract.js"); +const Poseidon = require("../src/poseidon.js"); +const bigInt = require("@tornado/snarkjs").bigInt; + +const assert = chai.assert; +const log = (msg) => { if (process.env.MOCHA_VERBOSE) console.log(msg); }; + +const SEED = "mimc"; + +describe("Poseidon Smart contract test", () => { + let testrpc; + let web3; + let mimc; + let accounts; + + before(async () => { + web3 = new Web3(ganache.provider(), null, { transactionConfirmationBlocks: 1 }); + accounts = await web3.eth.getAccounts(); + }); + + it("Should deploy the contract", async () => { + const C = new web3.eth.Contract(poseidonGenContract.abi); + + mimc = await C.deploy({ + data: poseidonGenContract.createCode() + }).send({ + gas: 2500000, + from: accounts[0] + }); + }); + + it("Shold calculate the mimic correctly", async () => { + + const res = await mimc.methods.poseidon([1,2]).call(); + + // console.log("Cir: " + bigInt(res.toString(16)).toString(16)); + + const hash = Poseidon.createHash(6, 8, 57); + + const res2 = hash([1,2]); + // console.log("Ref: " + bigInt(res2).toString(16)); + + assert.equal(res.toString(), res2.toString()); + }); +}); + diff --git a/@tornado/circomlib/test/rawsmt3.circom b/@tornado/circomlib/test/rawsmt3.circom new file mode 100644 index 0000000..1ac1e40 --- /dev/null +++ b/@tornado/circomlib/test/rawsmt3.circom @@ -0,0 +1,23 @@ + +include "../circuits/smt/smtverifier.circom"; +template SMT(nLevels) { + signal input root; + signal input mtp[nLevels]; + signal input hi; + signal input hv; + + component smtClaimExists = SMTVerifier(nLevels); + smtClaimExists.enabled <== 1; + smtClaimExists.fnc <== 0; + smtClaimExists.root <== root; + for (var i=0; i> (7-j) &1)); + } + } + return res; +} + +function bitArray2buffer(a) { + const len = Math.floor((a.length -1 )/8)+1; + const b = new Buffer.alloc(len); + + for (let i=0; i { + + + it("Should work bits to array and array to bits", async () => { + const b = new Buffer.alloc(64); + for (let i=0; i<64; i++) { + b[i] = i+1; + } + const a = buffer2bitArray(b); + const b2 = bitArray2buffer(a); + + assert.equal(b.toString("hex"), b2.toString("hex")); + }); + + it("Should calculate a hash of 1 compressor", async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "sha256_2_test.circom")); + const circuit = new snarkjs.Circuit(cirDef); + + console.log("Vars: "+circuit.nVars); + console.log("Constraints: "+circuit.nConstraints); + + const witness = circuit.calculateWitness({ "a": "1", "b": "2" }); + + const b = new Buffer.alloc(54); + b[26] = 1; + b[53] = 2; + + const hash = crypto.createHash("sha256") + .update(b) + .digest("hex"); + const r = "0x" + hash.slice(10); + + const hash2 = sha256.hash(b.toString("hex"), {msgFormat: "hex-bytes"}); + + assert.equal(hash, hash2); + + assert(witness[1].equals(snarkjs.bigInt(r))); + }).timeout(1000000); + + it("Should calculate a hash of 2 compressor", async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "sha256_test512.circom"), {reduceConstraints:false} ); + const circuit = new snarkjs.Circuit(cirDef); + + console.log("Vars: "+circuit.nVars); + console.log("Constraints: "+circuit.nConstraints); + +/* + const testStr = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; + + const b = Buffer.from(testStr, 'utf8'); +*/ + const b = new Buffer.alloc(64); + for (let i=0; i<64; i++) { + b[i] = i+1; + } + + const hash = crypto.createHash("sha256") + .update(b) + .digest("hex"); + + const arrIn = buffer2bitArray(b); + const witness = circuit.calculateWitness({ "in": arrIn } /*, {logOutput: true} */); + + const arrOut = witness.slice(1, 257); + const hash2 = bitArray2buffer(arrOut).toString("hex"); + + assert.equal(hash, hash2); + + }).timeout(1000000); + + + it("Should calculate a hash of 2 compressor", async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "sha256_test448.circom"), {reduceConstraints:false} ); + const circuit = new snarkjs.Circuit(cirDef); + + console.log("Vars: "+circuit.nVars); + console.log("Constraints: "+circuit.nConstraints); + + + const testStr = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; + + const b = Buffer.from(testStr, 'utf8'); + for (let i=0; i<64; i++) { + b[i] = i+1; + } + + const hash = crypto.createHash("sha256") + .update(b) + .digest("hex"); + + const arrIn = buffer2bitArray(b); + const witness = circuit.calculateWitness({ "in": arrIn } /*, {logOutput: true} */); + + const arrOut = witness.slice(1, 257); + const hash2 = bitArray2buffer(arrOut).toString("hex"); + + assert.equal(hash, hash2); + + }).timeout(1000000); +}); diff --git a/@tornado/circomlib/test/sign.js b/@tornado/circomlib/test/sign.js new file mode 100644 index 0000000..b794601 --- /dev/null +++ b/@tornado/circomlib/test/sign.js @@ -0,0 +1,88 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +function print(circuit, w, s) { + console.log(s + ": " + w[circuit.getSignalIdx(s)]); +} + +function getBits(v, n) { + const res = []; + for (let i=0; i { + let circuit; + before( async() => { + const cirDef = await compiler(path.join(__dirname, "circuits", "sign_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains: " + circuit.nConstraints); + }); + + it("Sign of 0", async () => { + const inp = getBits(bigInt.zero, 254); + const w = circuit.calculateWitness({in: inp}); + + assert( w[circuit.getSignalIdx("main.sign")].equals(bigInt(0)) ); + }); + + it("Sign of 3", async () => { + const inp = getBits(bigInt(3), 254); + const w = circuit.calculateWitness({in: inp}); + + assert( w[circuit.getSignalIdx("main.sign")].equals(bigInt(0)) ); + }); + + it("Sign of q/2", async () => { + const inp = getBits(q.shr(bigInt.one), 254); + const w = circuit.calculateWitness({in: inp}); + + assert( w[circuit.getSignalIdx("main.sign")].equals(bigInt(0)) ); + }); + + it("Sign of q/2+1", async () => { + const inp = getBits(q.shr(bigInt.one).add(bigInt.one), 254); + const w = circuit.calculateWitness({in: inp}); + + assert( w[circuit.getSignalIdx("main.sign")].equals(bigInt(1)) ); + }); + + it("Sign of q-1", async () => { + const inp = getBits(q.sub(bigInt.one), 254); + const w = circuit.calculateWitness({in: inp}); + + assert( w[circuit.getSignalIdx("main.sign")].equals(bigInt(1)) ); + }); + + it("Sign of q", async () => { + const inp = getBits(q, 254); + const w = circuit.calculateWitness({in: inp}); + + assert( w[circuit.getSignalIdx("main.sign")].equals(bigInt(1)) ); + }); + + it("Sign of all ones", async () => { + const inp = getBits(bigInt(1).shl(254).sub(bigInt(1)), 254); + const w = circuit.calculateWitness({in: inp}); + + assert( w[circuit.getSignalIdx("main.sign")].equals(bigInt(1)) ); + }); + + +}); diff --git a/@tornado/circomlib/test/smtjs.js b/@tornado/circomlib/test/smtjs.js new file mode 100644 index 0000000..fdc9402 --- /dev/null +++ b/@tornado/circomlib/test/smtjs.js @@ -0,0 +1,182 @@ +const chai = require("chai"); +const snarkjs = require("@tornado/snarkjs"); + +const smt = require("../src/smt.js"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + + +function stringifyBigInts(o) { + if ((typeof(o) == "bigint") || (o instanceof bigInt)) { + return o.toString(10); + } else if (Array.isArray(o)) { + return o.map(stringifyBigInts); + } else if (typeof o == "object") { + const res = {}; + for (let k in o) { + res[k] = stringifyBigInts(o[k]); + } + return res; + } else { + return o; + } +} + +describe("SMT Javascript test", function () { + this.timeout(100000); + before( async () => { + }); + + it("Should insert 2 elements and empty them", async () => { + const tree = await smt.newMemEmptyTrie(); + const key1 = bigInt(111); + const value1 = bigInt(222); + const key2 = bigInt(333); + const value2 = bigInt(444); + + await tree.insert(key1,value1); + await tree.insert(key2,value2); + await tree.delete(key2); + await tree.delete(key1); + + assert(tree.root.isZero()); + }); + + it("Should insert 3 elements in dferent order and should be the same", async () => { + const keys = [bigInt(8), bigInt(9), bigInt(32)]; + const values = [bigInt(88), bigInt(99), bigInt(3232)]; + const tree1 = await smt.newMemEmptyTrie(); + const tree2 = await smt.newMemEmptyTrie(); + const tree3 = await smt.newMemEmptyTrie(); + const tree4 = await smt.newMemEmptyTrie(); + const tree5 = await smt.newMemEmptyTrie(); + const tree6 = await smt.newMemEmptyTrie(); + + await tree1.insert(keys[0],values[0]); + await tree1.insert(keys[1],values[1]); + await tree1.insert(keys[2],values[2]); + + await tree2.insert(keys[0],values[0]); + await tree2.insert(keys[2],values[2]); + await tree2.insert(keys[1],values[1]); + + await tree3.insert(keys[1],values[1]); + await tree3.insert(keys[0],values[0]); + await tree3.insert(keys[2],values[2]); + + await tree4.insert(keys[1],values[1]); + await tree4.insert(keys[2],values[2]); + await tree4.insert(keys[0],values[0]); + + await tree5.insert(keys[2],values[2]); + await tree5.insert(keys[0],values[0]); + await tree5.insert(keys[1],values[1]); + + await tree6.insert(keys[2],values[2]); + await tree6.insert(keys[1],values[1]); + await tree6.insert(keys[0],values[0]); + + assert(tree1.root.equals(tree2.root)); + assert(tree2.root.equals(tree3.root)); + assert(tree3.root.equals(tree4.root)); + assert(tree4.root.equals(tree5.root)); + assert(tree5.root.equals(tree6.root)); + + assert.equal(Object.keys(tree1.db.nodes).length, Object.keys(tree2.db.nodes).length); + assert.equal(Object.keys(tree2.db.nodes).length, Object.keys(tree3.db.nodes).length); + assert.equal(Object.keys(tree3.db.nodes).length, Object.keys(tree4.db.nodes).length); + assert.equal(Object.keys(tree4.db.nodes).length, Object.keys(tree5.db.nodes).length); + assert.equal(Object.keys(tree5.db.nodes).length, Object.keys(tree6.db.nodes).length); + + await tree1.delete(keys[0]); + await tree1.delete(keys[1]); + await tree2.delete(keys[1]); + await tree2.delete(keys[0]); + assert(tree1.root.equals(tree2.root)); + + await tree3.delete(keys[0]); + await tree3.delete(keys[2]); + await tree4.delete(keys[2]); + await tree4.delete(keys[0]); + assert(tree3.root.equals(tree4.root)); + + await tree5.delete(keys[1]); + await tree5.delete(keys[2]); + await tree6.delete(keys[2]); + await tree6.delete(keys[1]); + assert(tree5.root.equals(tree6.root)); + + await tree1.delete(keys[2]); + await tree2.delete(keys[2]); + await tree3.delete(keys[1]); + await tree4.delete(keys[1]); + await tree5.delete(keys[0]); + await tree6.delete(keys[0]); + + assert(tree1.root.isZero()); + assert(tree2.root.isZero()); + assert(tree3.root.isZero()); + assert(tree4.root.isZero()); + assert(tree5.root.isZero()); + assert(tree6.root.isZero()); + + assert.equal(Object.keys(tree1.db.nodes).length, 0); + assert.equal(Object.keys(tree2.db.nodes).length, 0); + assert.equal(Object.keys(tree3.db.nodes).length, 0); + assert.equal(Object.keys(tree4.db.nodes).length, 0); + assert.equal(Object.keys(tree5.db.nodes).length, 0); + assert.equal(Object.keys(tree6.db.nodes).length, 0); + }); + + it("Insert and remove 100 numbers randomly", async () => { + function perm(a) { + const arr = a.slice(); + const rArr = []; + for (let i=0; i { + const tree1 = await smt.newMemEmptyTrie(); + const tree2 = await smt.newMemEmptyTrie(); + + await tree1.insert(8,88); + await tree1.insert(9,99,); + await tree1.insert(32,3232); + + await tree2.insert(8,888); + await tree2.insert(9,999); + await tree2.insert(32,323232); + + await tree1.update(8, 888); + await tree1.update(9, 999); + await tree1.update(32, 323232); + + assert(tree1.root.equals(tree2.root)); + }); + +}); diff --git a/@tornado/circomlib/test/smtprocessor.js b/@tornado/circomlib/test/smtprocessor.js new file mode 100644 index 0000000..70c2284 --- /dev/null +++ b/@tornado/circomlib/test/smtprocessor.js @@ -0,0 +1,217 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const smt = require("../src/smt.js"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +function print(circuit, w, s) { + console.log(s + ": " + w[circuit.getSignalIdx(s)]); +} + +async function testInsert(tree, key, value, circuit, log ) { + + const res = await tree.insert(key,value); + let siblings = res.siblings; + while (siblings.length<10) siblings.push(bigInt(0)); + + const w = circuit.calculateWitness({ + fnc: [1,0], + oldRoot: res.oldRoot, + siblings: siblings, + oldKey: res.isOld0 ? 0 : res.oldKey, + oldValue: res.isOld0 ? 0 : res.oldValue, + isOld0: res.isOld0 ? 1 : 0, + newKey: key, + newValue: value + }, log); + + const root1 = w[circuit.getSignalIdx("main.newRoot")]; + assert(circuit.checkWitness(w)); + assert(root1.equals(res.newRoot)); +} + +async function testDelete(tree, key, circuit) { + const res = await tree.delete(key); + let siblings = res.siblings; + while (siblings.length<10) siblings.push(bigInt(0)); + + const w = circuit.calculateWitness({ + fnc: [1,1], + oldRoot: res.oldRoot, + siblings: siblings, + oldKey: res.isOld0 ? 0 : res.oldKey, + oldValue: res.isOld0 ? 0 : res.oldValue, + isOld0: res.isOld0 ? 1 : 0, + newKey: res.delKey, + newValue: res.delValue + }); + + const root1 = w[circuit.getSignalIdx("main.newRoot")]; + + assert(circuit.checkWitness(w)); + assert(root1.equals(res.newRoot)); +} + +async function testUpdate(tree, key, newValue, circuit) { + const res = await tree.update(key, newValue); + let siblings = res.siblings; + while (siblings.length<10) siblings.push(bigInt(0)); + + const w = circuit.calculateWitness({ + fnc: [0,1], + oldRoot: res.oldRoot, + siblings: siblings, + oldKey: res.oldKey, + oldValue: res.oldValue, + isOld0: 0, + newKey: res.newKey, + newValue: res.newValue + }); + + const root1 = w[circuit.getSignalIdx("main.newRoot")]; + + assert(circuit.checkWitness(w)); + assert(root1.equals(res.newRoot)); +} + + +describe("SMT test", function () { + let circuit; + let tree; + + this.timeout(10000000); + + before( async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "smtprocessor10_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains SMTProcessor: " + circuit.nConstraints); + + tree = await smt.newMemEmptyTrie(); + }); + + it("Should verify an insert to an empty tree", async () => { + const key = bigInt(111); + const value = bigInt(222); + + await testInsert(tree, key, value, circuit); + }); + + it("It should add another element", async () => { + const key = bigInt(333); + const value = bigInt(444); + + await testInsert(tree, key, value, circuit); + }); + + + + it("Should remove an element", async () => { + await testDelete(tree, 111, circuit); + await testDelete(tree, 333, circuit); + }); + + it("Should test convination of adding and removing 3 elements", async () => { + const keys = [bigInt(8), bigInt(9), bigInt(32)]; + const values = [bigInt(88), bigInt(99), bigInt(3232)]; + const tree1 = await smt.newMemEmptyTrie(); + const tree2 = await smt.newMemEmptyTrie(); + const tree3 = await smt.newMemEmptyTrie(); + const tree4 = await smt.newMemEmptyTrie(); + const tree5 = await smt.newMemEmptyTrie(); + const tree6 = await smt.newMemEmptyTrie(); + + await testInsert(tree1,keys[0],values[0], circuit); + await testInsert(tree1,keys[1],values[1], circuit); + await testInsert(tree1,keys[2],values[2], circuit); + + await testInsert(tree2,keys[0],values[0], circuit); + await testInsert(tree2,keys[2],values[2], circuit); + await testInsert(tree2,keys[1],values[1], circuit); + + await testInsert(tree3,keys[1],values[1], circuit); + await testInsert(tree3,keys[0],values[0], circuit); + await testInsert(tree3,keys[2],values[2], circuit); + + await testInsert(tree4,keys[1],values[1], circuit); + await testInsert(tree4,keys[2],values[2], circuit); + await testInsert(tree4,keys[0],values[0], circuit); + + await testInsert(tree5,keys[2],values[2], circuit); + await testInsert(tree5,keys[0],values[0], circuit); + await testInsert(tree5,keys[1],values[1], circuit); + + await testInsert(tree6,keys[2],values[2], circuit); + await testInsert(tree6,keys[1],values[1], circuit); + await testInsert(tree6,keys[0],values[0], circuit); + + + await testDelete(tree1, keys[0], circuit); + await testDelete(tree1, keys[1], circuit); + await testDelete(tree2, keys[1], circuit); + await testDelete(tree2, keys[0], circuit); + + await testDelete(tree3, keys[0], circuit); + await testDelete(tree3, keys[2], circuit); + await testDelete(tree4, keys[2], circuit); + await testDelete(tree4, keys[0], circuit); + + + await testDelete(tree5, keys[1], circuit); + await testDelete(tree5, keys[2], circuit); + await testDelete(tree6, keys[2], circuit); + await testDelete(tree6, keys[1], circuit); + + await testDelete(tree1, keys[2], circuit); + await testDelete(tree2, keys[2], circuit); + await testDelete(tree3, keys[1], circuit); + await testDelete(tree4, keys[1], circuit); + await testDelete(tree5, keys[0], circuit); + await testDelete(tree6, keys[0], circuit); + }); + + it("Should match a NOp with random vals", async () => { + let siblings = []; + while (siblings.length<10) siblings.push(bigInt(88)); + const w = circuit.calculateWitness({ + fnc: [0,0], + oldRoot: 11, + siblings: siblings, + oldKey: 33, + oldValue: 44, + isOld0: 55, + newKey: 66, + newValue: 77 + }); + + const root1 = w[circuit.getSignalIdx("main.oldRoot")]; + const root2 = w[circuit.getSignalIdx("main.newRoot")]; + + assert(circuit.checkWitness(w)); + assert(root1.equals(root2)); + + }); + it("Should update an element", async () => { + const tree1 = await smt.newMemEmptyTrie(); + const tree2 = await smt.newMemEmptyTrie(); + + await testInsert(tree1,8,88, circuit); + await testInsert(tree1,9,99, circuit); + await testInsert(tree1,32,3232, circuit); + + await testInsert(tree2,8,888, circuit); + await testInsert(tree2,9,999, circuit); + await testInsert(tree2,32,323232, circuit); + + await testUpdate(tree1, 8, 888, circuit); + await testUpdate(tree1, 9, 999, circuit); + await testUpdate(tree1, 32, 323232, circuit); + }); + +}); diff --git a/@tornado/circomlib/test/smtverifier.js b/@tornado/circomlib/test/smtverifier.js new file mode 100644 index 0000000..417f9e8 --- /dev/null +++ b/@tornado/circomlib/test/smtverifier.js @@ -0,0 +1,138 @@ +const chai = require("chai"); +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); + +const smt = require("../src/smt.js"); + +const assert = chai.assert; + +const bigInt = snarkjs.bigInt; + +function print(circuit, w, s) { + console.log(s + ": " + w[circuit.getSignalIdx(s)]); +} + +async function testInclusion(tree, key, circuit) { + + const res = await tree.find(key); + + assert(res.found); + let siblings = res.siblings; + while (siblings.length<10) siblings.push(bigInt(0)); + + const w = circuit.calculateWitness({ + enabled: 1, + fnc: 0, + root: tree.root, + siblings: siblings, + oldKey: 0, + oldValue: 0, + isOld0: 0, + key: key, + value: res.foundValue + }); + + assert(circuit.checkWitness(w)); +} + +async function testExclusion(tree, key, circuit) { + const res = await tree.find(key); + + assert(!res.found); + let siblings = res.siblings; + while (siblings.length<10) siblings.push(bigInt(0)); + + const w = circuit.calculateWitness({ + enabled: 1, + fnc: 1, + root: tree.root, + siblings: siblings, + oldKey: res.isOld0 ? 0 : res.notFoundKey, + oldValue: res.isOld0 ? 0 : res.notFoundValue, + isOld0: res.isOld0 ? 1 : 0, + key: key, + value: 0 + }); + + assert(circuit.checkWitness(w)); +} + +describe("SMT test", function () { + let circuit; + let tree; + + this.timeout(100000); + + before( async () => { + const cirDef = await compiler(path.join(__dirname, "circuits", "smtverifier10_test.circom")); + + circuit = new snarkjs.Circuit(cirDef); + + console.log("NConstrains SMTVerifier: " + circuit.nConstraints); + + tree = await smt.newMemEmptyTrie(); + await tree.insert(7,77); + await tree.insert(8,88); + await tree.insert(32,3232); + }); + + it("Check inclussion in a tree of 3", async () => { + await testInclusion(tree, 7, circuit); + await testInclusion(tree, 8, circuit); + await testInclusion(tree, 32, circuit); + }); + + it("Check exclussion in a tree of 3", async () => { + await testExclusion(tree, 0, circuit); + await testExclusion(tree, 6, circuit); + await testExclusion(tree, 9, circuit); + await testExclusion(tree, 33, circuit); + await testExclusion(tree, 31, circuit); + await testExclusion(tree, 16, circuit); + await testExclusion(tree, 64, circuit); + }); + + it("Check not enabled accepts any thing", async () => { + let siblings = []; + for (let i=0; i<10; i++) siblings.push(i); + + const w = circuit.calculateWitness({ + enabled: 0, + fnc: 0, + root: 1, + siblings: siblings, + oldKey: 22, + oldValue: 33, + isOld0: 0, + key: 44, + value: 0 + }); + assert(circuit.checkWitness(w)); + }); + + it("Check inclussion Adria case", async () => { + const e1_hi= bigInt("17124152697573569611556136390143205198134245887034837071647643529178599000839"); + const e1_hv= bigInt("19650379996168153643111744440707177573540245771926102415571667548153444658179"); + + const e2ok_hi= bigInt("16498254692537945203721083102154618658340563351558973077349594629411025251262"); + const e2ok_hv= bigInt("19650379996168153643111744440707177573540245771926102415571667548153444658179"); + + const e2fail_hi= bigInt("17195092312975762537892237130737365903429674363577646686847513978084990105579"); + const e2fail_hv= bigInt("19650379996168153643111744440707177573540245771926102415571667548153444658179"); + + const tree1 = await smt.newMemEmptyTrie(); + await tree1.insert(e1_hi,e1_hv); + await tree1.insert(e2ok_hi,e2ok_hv); + + await testInclusion(tree1, e2ok_hi, circuit); + + const tree2 = await smt.newMemEmptyTrie(); + await tree2.insert(e1_hi,e1_hv); + await tree2.insert(e2fail_hi,e2fail_hv); + + await testInclusion(tree2, e2fail_hi, circuit); + }); + + +}); diff --git a/@tornado/circomlib/test/smtverifier_adria.js b/@tornado/circomlib/test/smtverifier_adria.js new file mode 100644 index 0000000..524e497 --- /dev/null +++ b/@tornado/circomlib/test/smtverifier_adria.js @@ -0,0 +1,98 @@ +const path = require("path"); +const snarkjs = require("@tornado/snarkjs"); +const compiler = require("circom"); +const fs = require("fs") + +const bigInt = snarkjs.bigInt; +const smt = require("../src/smt.js"); + +const circuitSource = ` +include "../circuits/smt/smtverifier.circom"; +template SMT(nLevels) { + signal input root; + signal input mtp[nLevels]; + signal input hi; + signal input hv; + + component smtClaimExists = SMTVerifier(nLevels); + smtClaimExists.enabled <== 1; + smtClaimExists.fnc <== 0; + smtClaimExists.root <== root; + for (var i=0; i { + circuitFileName = path.join(__dirname, ".", "rawsmt3.circom"); + fs.writeFileSync(circuitFileName,circuitSource); + }); + + const levels = 4; + async function testsmt3(e1, e2) { + let tree = await smt.newMemEmptyTrie(); + + // insert e1, e2 + await tree.insert(e1.hi, e1.hv); + await tree.insert(e2.hi, e2.hv); + + // generate proof for e1 + const findInfo = await tree.find(e1.hi); + const siblings = findInfo.siblings; + while (siblings.length < levels) siblings.push(bigInt(0)); + + const input = { + root: tree.root, + mtp: siblings, + hi: e1.hi, + hv: e1.hv, + }; + + const compiledCircuit = await compiler( + circuitFileName, + { reduceConstraints: false } + ); + + const circuit = new snarkjs.Circuit(compiledCircuit); + const witness = circuit.calculateWitness(input); + circuit.checkWitness(witness); + } + + it("TestSmts", async () => { + + const e1 = { + hi: bigInt("17124152697573569611556136390143205198134245887034837071647643529178599000839"), + hv: bigInt("19650379996168153643111744440707177573540245771926102415571667548153444658179"), + }; + + const e2ok = { + hi: bigInt("16498254692537945203721083102154618658340563351558973077349594629411025251262"), + hv: bigInt("19650379996168153643111744440707177573540245771926102415571667548153444658179"), + }; + + const e2fail = { + hi: bigInt("17195092312975762537892237130737365903429674363577646686847513978084990105579"), + hv: bigInt("19650379996168153643111744440707177573540245771926102415571667548153444658179"), + }; + + console.log("test e1, e2ok"); + await testsmt3(e1, e2ok); + + console.log("test e1, e2fail"); + await testsmt3(e1, e2fail); + }); +}); + diff --git a/@tornado/circomlib/tsconfig.json b/@tornado/circomlib/tsconfig.json new file mode 100644 index 0000000..8e71090 --- /dev/null +++ b/@tornado/circomlib/tsconfig.json @@ -0,0 +1,22 @@ +{ + // Change this to match your project + "include": ["src/**/*", "calcpedersenbases/*", "index.js"], + "exclude": ["node_modules"], + "compilerOptions": { + // Tells TypeScript to read JS files, as + // normally they are ignored as source files + "allowJs": true, + // Generate d.ts files + "declaration": true, + // This compiler run should + // only output d.ts files + "emitDeclarationOnly": true, + // Types should go into this directory. + // Removing this would place the .d.ts files + // next to the .js files + "outFile": "index.d.ts", + // go to js file when using IDE functions like + // "Go to Definition" in VSCode + "declarationMap": true + } +} diff --git a/@tornado/fixed-merkle-tree/.gitignore b/@tornado/fixed-merkle-tree/.gitignore new file mode 100644 index 0000000..5587e20 --- /dev/null +++ b/@tornado/fixed-merkle-tree/.gitignore @@ -0,0 +1,74 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# next.js build output +.next + +tmp + +.DS_Store + +# yarn v3 +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions \ No newline at end of file diff --git a/@tornado/fixed-merkle-tree/README.md b/@tornado/fixed-merkle-tree/README.md new file mode 100644 index 0000000..2415e53 --- /dev/null +++ b/@tornado/fixed-merkle-tree/README.md @@ -0,0 +1,35 @@ +# @T-Hax/fixed-merkle-tree + +This repository serves to configure the equivalent Tornado Cash repository for npm publishing. Below the rest of the description. + +# Merkle Tree [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/tornadocash/fixed-merkle-tree/build)](https://github.com/tornadocash/fixed-merkle-tree/actions) [![npm](https://img.shields.io/npm/v/fixed-merkle-tree)](https://www.npmjs.com/package/fixed-merkle-tree) + +This is a fixed depth merkle tree implementation with sequential inserts + +## Usage + +```javascript +const MerkleTree = require('MerkleTree') +const tree = new MerkleTree(10, [1, 2, 3, 4, 5]) +tree.insert(6) +tree.update(3, 42) +const path = tree.path(tree.indexOf(2)) +console.log(path) + +// output: +{ + pathIndex: [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], + pathElements: [ + '42', + '19814528709687996974327303300007262407299502847885145507292406548098437687919', + '11545490348087423460235196042660837039811055736960842865648632633825765931887', + '14506027710748750947258687001455876266559341618222612722926156490737302846427', + '4766583705360062980279572762279781527342845808161105063909171241304075622345', + '16640205414190175414380077665118269450294358858897019640557533278896634808665', + '13024477302430254842915163302704885770955784224100349847438808884122720088412', + '11345696205391376769769683860277269518617256738724086786512014734609753488820', + '17235543131546745471991808272245772046758360534180976603221801364506032471936', + '155962837046691114236524362966874066300454611955781275944230309195800494087' + ] +} +``` diff --git a/@tornado/fixed-merkle-tree/index.d.ts b/@tornado/fixed-merkle-tree/index.d.ts new file mode 100644 index 0000000..8f77725 --- /dev/null +++ b/@tornado/fixed-merkle-tree/index.d.ts @@ -0,0 +1,112 @@ +declare module "src/mimc" { + function _exports(left: any, right: any): any; + export = _exports; +} +declare module "fixed-merkle-tree/src/merkleTree" { + export = MerkleTree; + /** + * @callback hashFunction + * @param left Left leaf + * @param right Right leaf + */ + /** + * Merkle tree + */ + export class MerkleTree { + /** + * Deserialize data into a MerkleTree instance + * Make sure to provide the same hashFunction as was used in the source tree, + * otherwise the tree state will be invalid + * + * @param data + * @param hashFunction + * @returns {MerkleTree} + */ + static deserialize(data: any, hashFunction: any): MerkleTree; + /** + * Constructor + * @param {number} levels Number of levels in the tree + * @param {Array} [elements] Initial elements + * @param {Object} options + * @param {hashFunction} [options.hashFunction] Function used to hash 2 leaves + * @param [options.zeroElement] Value for non-existent leaves + */ + constructor(levels: number, elements?: any[], { hashFunction, zeroElement }?: { + hashFunction?: hashFunction; + zeroElement?: any; + }); + levels: number; + capacity: number; + _hash: (left: any, right: any) => any; + zeroElement: any; + _zeros: any[]; + _layers: any[][]; + _rebuild(): void; + /** + * Get tree root + * @returns {*} + */ + root(): any; + /** + * Insert new element into the tree + * @param element Element to insert + */ + insert(element: any): void; + /** + * Insert multiple elements into the tree. + * @param {Array} elements Elements to insert + */ + bulkInsert(elements: any[]): void; + /** + * Change an element in the tree + * @param {number} index Index of element to change + * @param element Updated element value + */ + update(index: number, element: any): void; + /** + * Get merkle path to a leaf + * @param {number} index Leaf index to generate path for + * @returns {{pathElements: Object[], pathIndex: number[]}} An object containing adjacent elements and left-right index + */ + path(index: number): { + pathElements: any[]; + pathIndex: number[]; + }; + /** + * Find an element in the tree + * @param element An element to find + * @param comparator A function that checks leaf value equality + * @returns {number} Index if element is found, otherwise -1 + */ + indexOf(element: any, comparator: any): number; + /** + * Returns a copy of non-zero tree elements + * @returns {Object[]} + */ + elements(): any[]; + /** + * Returns a copy of n-th zero elements array + * @returns {Object[]} + */ + zeros(): any[]; + /** + * Serialize entire tree state including intermediate layers into a plain object + * Deserializing it back will not require to recompute any hashes + * Elements are not converted to a plain type, this is responsibility of the caller + */ + serialize(): { + levels: number; + _zeros: any[]; + _layers: any[][]; + }; + } + namespace MerkleTree { + export { hashFunction }; + } + type hashFunction = (left: any, right: any) => any; +} +declare module "fixed-merkle-tree" { + const _exports: typeof import("fixed-merkle-tree/src/merkleTree"); + export = _exports; +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/@tornado/fixed-merkle-tree/index.d.ts.map b/@tornado/fixed-merkle-tree/index.d.ts.map new file mode 100644 index 0000000..8fc1825 --- /dev/null +++ b/@tornado/fixed-merkle-tree/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/mimc.js","src/merkleTree.js","index.js"],"names":[],"mappings":";IAEiB,8CAA+E;;;;;ICKhG;;;;OAIG;IACH;;OAEG;IACH;QAkLE;;;;;;;;WAQG;QACH,kDAFa,UAAU,CAQtB;QAhMD;;;;;;;WAOG;QACH,oBANW,MAAM;YAGiB,YAAY,GAAnC,YAAY;YACJ,WAAW;WAkB7B;QAfC,eAAoB;QACpB,iBAA2B;QAI3B,sCAAwC;QACxC,iBAA8B;QAC9B,cAAgB;QAKhB,iBAAiB;QAKnB,iBAYC;QAED;;;WAGG;QACH,YAEC;QAED;;;WAGG;QACH,2BAKC;QAED;;;WAGG;QACH,kCAyBC;QAED;;;;WAIG;QACH,cAHW,MAAM,sBAiBhB;QAED;;;;WAIG;QACH,YAHW,MAAM;0BACW,KAAQ;uBAAa,MAAM,EAAE;UAkBxD;QAED;;;;;WAKG;QACH,wCAFa,MAAM,CAQlB;QAED;;;WAGG;QACH,YAFa,KAAQ,CAIpB;QAED;;;WAGG;QACH,SAFa,KAAQ,CAIpB;QAED;;;;WAIG;QACH;;;;UAMC;KAkBF"} \ No newline at end of file diff --git a/@tornado/fixed-merkle-tree/index.js b/@tornado/fixed-merkle-tree/index.js new file mode 100644 index 0000000..423f157 --- /dev/null +++ b/@tornado/fixed-merkle-tree/index.js @@ -0,0 +1 @@ +module.exports = require("./src/merkleTree") diff --git a/@tornado/fixed-merkle-tree/package-lock.json b/@tornado/fixed-merkle-tree/package-lock.json new file mode 100644 index 0000000..14226ad --- /dev/null +++ b/@tornado/fixed-merkle-tree/package-lock.json @@ -0,0 +1,5411 @@ +{ + "name": "@thcydra/fixed-merkle-tree", + "version": "0.6.1-p1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.18.6", + "resolved": "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz", + "integrity": "sha1-OyXTjIlgC6otzCGe36iKdOssQno= sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "requires": { + "@babel/highlight": "^7.18.6" + }, + "dev": true + }, + "@babel/generator": { + "version": "7.21.3", + "resolved": "https://registry.yarnpkg.com/@babel/generator/-/generator-7.21.3.tgz", + "integrity": "sha1-IyNZ0IdLOS3wQEXXLOL9m7UEX84= sha512-QS3iR1GYC/YGUnW7IdggFeN5c1poPUurnGttOV/bZgPGV+izC/D8HnD6DLwod0fsatNyVn1G3EVWMYIF0nHbeA==", + "requires": { + "@babel/types": "^7.21.3", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + }, + "dev": true + }, + "@babel/helper-environment-visitor": { + "version": "7.18.9", + "resolved": "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", + "integrity": "sha1-DAzumzXSyhkEeHVoZbs1KEIvUb4= sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "dev": true + }, + "@babel/helper-function-name": { + "version": "7.21.0", + "resolved": "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", + "integrity": "sha1-1VKCmxDqnxIJaTBAI80GRfoAsbQ= sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", + "requires": { + "@babel/template": "^7.20.7", + "@babel/types": "^7.21.0" + }, + "dev": true + }, + "@babel/helper-hoist-variables": { + "version": "7.18.6", + "resolved": "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", + "integrity": "sha1-1NLI+0uuqlxouZzIJFxWVU+SZng= sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", + "requires": { + "@babel/types": "^7.18.6" + }, + "dev": true + }, + "@babel/helper-split-export-declaration": { + "version": "7.18.6", + "resolved": "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", + "integrity": "sha1-c2eUm8dbIMbVpdSpe7ooJK6O8HU= sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "requires": { + "@babel/types": "^7.18.6" + }, + "dev": true + }, + "@babel/helper-string-parser": { + "version": "7.19.4", + "resolved": "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", + "integrity": "sha1-ONOstlS0cBqbd/sGFalvd1w6nmM= sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", + "dev": true + }, + "@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha1-fuqDTPMpAf/cGn7lVeL5wn4knKI= sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "dev": true + }, + "@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha1-gRWGAek+JWN5Wty/vfXWS+Py7N8= sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "requires": { + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dev": true + }, + "@babel/parser": { + "version": "7.21.3", + "resolved": "https://registry.yarnpkg.com/@babel/parser/-/parser-7.21.3.tgz", + "integrity": "sha1-HShdZ6GRYv+dqjWNTLQdUMBiILM= sha512-lobG0d7aOfQRXh8AyklEAgZGvA4FShxo6xQbUrrT/cNBPUdIDojlokwJsQyCC/eKia7ifqM0yP+2DRZ4WKw2RQ==", + "dev": true + }, + "@babel/template": { + "version": "7.20.7", + "resolved": "https://registry.yarnpkg.com/@babel/template/-/template-7.20.7.tgz", + "integrity": "sha1-oVCQwoOag7AqqZbAtJlABYQf1ag= sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", + "requires": { + "@babel/code-frame": "^7.18.6", + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7" + }, + "dev": true + }, + "@babel/traverse": { + "version": "7.21.3", + "resolved": "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.21.3.tgz", + "integrity": "sha1-R0fF55A9IkvnH5B4iwZ5gzGJb2c= sha512-XLyopNeaTancVitYZe2MlUEvgKb6YVVPXzofHgqHijCImG33b/uTurMS488ht/Hbsb2XK3U2BnSTxKVNGV3nGQ==", + "requires": { + "@babel/code-frame": "^7.18.6", + "@babel/generator": "^7.21.3", + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-function-name": "^7.21.0", + "@babel/helper-hoist-variables": "^7.18.6", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/parser": "^7.21.3", + "@babel/types": "^7.21.3", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz", + "integrity": "sha1-Exn2V5NX8jONMzfSzdSRS7XcyGU= sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + }, + "dev": true + } + }, + "dev": true + }, + "@babel/types": { + "version": "7.21.3", + "resolved": "https://registry.yarnpkg.com/@babel/types/-/types-7.21.3.tgz", + "integrity": "sha1-SGWlNXzkD2TjQAsPO3N9xtT2TQU= sha512-sBGdETxC+/M4o/zKC0sl6sjWv62WFR/uzxrJ6uYyMLZOUlPnwzw0tKgVHOXxaAd5l2g8pEDM5RZ495GPQI77kg==", + "requires": { + "@babel/helper-string-parser": "^7.19.4", + "@babel/helper-validator-identifier": "^7.19.1", + "to-fast-properties": "^2.0.0" + }, + "dev": true + }, + "@eslint/eslintrc": { + "version": "0.4.3", + "resolved": "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", + "integrity": "sha1-nkKYHvA1vrPdSa3ResuW6P9vOUw= sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz", + "integrity": "sha1-Exn2V5NX8jONMzfSzdSRS7XcyGU= sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + }, + "dev": true + }, + "globals": { + "version": "13.20.0", + "resolved": "https://registry.yarnpkg.com/globals/-/globals-13.20.0.tgz", + "integrity": "sha1-6idqHlCP/U8WEoiPnRutHicXv4I= sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "requires": { + "type-fest": "^0.20.2" + }, + "dev": true + } + }, + "dev": true + }, + "@ethereumjs/common": { + "version": "2.5.0", + "resolved": "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.5.0.tgz", + "integrity": "sha1-7GFVGzG+96adHcY02JMkaIZqQmg= sha512-DEHjW6e38o+JmB/NO3GZBpW4lpaiBpkFgXF6jLcJ6gETBYpEyaA5nTimsWBUJR3Vmtm/didUEbNjajskugZORg==", + "requires": { + "crc-32": "^1.2.0", + "ethereumjs-util": "^7.1.1" + }, + "dev": true + }, + "@ethereumjs/tx": { + "version": "3.3.2", + "resolved": "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.3.2.tgz", + "integrity": "sha1-NI1GJL8kiqq2xE/sKuZyZe/j2wA= sha512-6AaJhwg4ucmwTvw/1qLaZUX5miWrwZ4nLOUsKyb/HtzS3BMw/CasKhdi1ims9mBKeK9sOJCH4qGKOBGyJCeeog==", + "requires": { + "@ethereumjs/common": "^2.5.0", + "ethereumjs-util": "^7.1.2" + }, + "dependencies": { + "@ethereumjs/common": { + "version": "2.6.5", + "resolved": "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.6.5.tgz", + "integrity": "sha1-CnWiKgRicledkZGcsS2E8nVujTA= sha512-lRyVQOeCDaIVtgfbowla32pzeDv2Obr8oR8Put5RdUBNRGr1VGPGQNGP6elWIpgK3YdpzqTOh4GyUGOureVeeA==", + "requires": { + "crc-32": "^1.2.0", + "ethereumjs-util": "^7.1.5" + }, + "dev": true + } + }, + "dev": true + }, + "@ethersproject/abi": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz", + "integrity": "sha1-s/PgRbu+7RrzlHM1wketYlpE5Ek= sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", + "requires": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + }, + "dev": true + }, + "@ethersproject/abstract-provider": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", + "integrity": "sha1-sKhVD4i2v51R+Q5HldSClGMMue8= sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", + "requires": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0" + }, + "dev": true + }, + "@ethersproject/abstract-signer": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", + "integrity": "sha1-E/TzIReGhFIZGkZJcjywhtK1lrI= sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", + "requires": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + }, + "dev": true + }, + "@ethersproject/address": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz", + "integrity": "sha1-GbVsTXSjsKRr/bts/MChU/xpfzc= sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", + "requires": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/rlp": "^5.7.0" + }, + "dev": true + }, + "@ethersproject/base64": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz", + "integrity": "sha1-rE7pKqNsFigXPiIdDQH1NpIFnhw= sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", + "requires": { + "@ethersproject/bytes": "^5.7.0" + }, + "dev": true + }, + "@ethersproject/bignumber": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", + "integrity": "sha1-4vA4N/JoumVf+6A6V4U+GKGNycI= sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "bn.js": "^5.2.1" + }, + "dev": true + }, + "@ethersproject/bytes": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz", + "integrity": "sha1-oA9uqNfnU01th/RxiK8RSNcfFV0= sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", + "requires": { + "@ethersproject/logger": "^5.7.0" + }, + "dev": true + }, + "@ethersproject/constants": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz", + "integrity": "sha1-34CpcFp+CJhBYfCQFOoBLRx1KV4= sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", + "requires": { + "@ethersproject/bignumber": "^5.7.0" + }, + "dev": true + }, + "@ethersproject/hash": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.7.0.tgz", + "integrity": "sha1-63rKhKWIUINpVi4W5RS1ObpSQKc= sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", + "requires": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + }, + "dev": true + }, + "@ethersproject/keccak256": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", + "integrity": "sha1-MYY1DG4c1qunlAOE7H1tnbAfM1o= sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "js-sha3": "0.8.0" + }, + "dev": true + }, + "@ethersproject/logger": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz", + "integrity": "sha1-bOmuFo50/s8oe+FwYrWQhSwxGJI= sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", + "dev": true + }, + "@ethersproject/networks": { + "version": "5.7.1", + "resolved": "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz", + "integrity": "sha1-EY4amB11fUXM6mu1jZ/T2dsU6tY= sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", + "requires": { + "@ethersproject/logger": "^5.7.0" + }, + "dev": true + }, + "@ethersproject/properties": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz", + "integrity": "sha1-puEssEObh4qvRw8ZAqF2AzBn7TA= sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", + "requires": { + "@ethersproject/logger": "^5.7.0" + }, + "dev": true + }, + "@ethersproject/rlp": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz", + "integrity": "sha1-3jnk1ZGLnXTUbek6+At2hanCEwQ= sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + }, + "dev": true + }, + "@ethersproject/signing-key": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", + "integrity": "sha1-BrLfOUEbALxXx8CbAdHkHPGxarM= sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "bn.js": "^5.2.1", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + }, + "dev": true + }, + "@ethersproject/strings": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz", + "integrity": "sha1-VMnSp8V66PEgXIip06VkceFNXtI= sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + }, + "dev": true + }, + "@ethersproject/transactions": { + "version": "5.7.0", + "resolved": "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz", + "integrity": "sha1-kTGPwkBj4FeIWmrxP9twPh+ZPTs= sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", + "requires": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0" + }, + "dev": true + }, + "@ethersproject/web": { + "version": "5.7.1", + "resolved": "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz", + "integrity": "sha1-3h8oWzcxSb7lko9Ot7y4fuX7tK4= sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", + "requires": { + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + }, + "dev": true + }, + "@humanwhocodes/config-array": { + "version": "0.5.0", + "resolved": "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", + "integrity": "sha1-FAeWfUxu7Nc4j4Os8er00Mbljvk= sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", + "requires": { + "@humanwhocodes/object-schema": "^1.2.0", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz", + "integrity": "sha1-Exn2V5NX8jONMzfSzdSRS7XcyGU= sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + }, + "dev": true + } + }, + "dev": true + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha1-tSBSnsIdjllFoYUd/Rwy6U45/0U= sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "@jridgewell/gen-mapping": { + "version": "0.3.2", + "resolved": "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", + "integrity": "sha1-wa7cYehT8rufXf5tRELTtWWyU7k= sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", + "requires": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "dev": true + }, + "@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha1-IgOxGMFXchrd/mnUe3BGVGMGbXg= sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha1-fGz5mNbSC5FMClWpGuko/yWWXnI= sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha1-rdTJjTQUcqKJGQtCTvvbCWmRuyQ= sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.17", + "resolved": "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", + "integrity": "sha1-eTBBJ3r5BzsJUaf+Dw2MTJjDaYU= sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", + "requires": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + }, + "dev": true + }, + "@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha1-PHycRuZ4/u/nouW7YJ09vWZf+z8= sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "dev": true + }, + "@szmarczak/http-timer": { + "version": "5.0.1", + "resolved": "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", + "integrity": "sha1-x8G/EUHN1HUbA5nI/HuLZkzVvjo= sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", + "requires": { + "defer-to-connect": "^2.0.1" + }, + "dev": true + }, + "@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha1-tR4bVZIKTKJukoX/eZNrveyRBoI= sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "requires": { + "@types/node": "*" + }, + "dev": true + }, + "@types/cacheable-request": { + "version": "6.0.3", + "resolved": "https://registry.yarnpkg.com/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", + "integrity": "sha1-pDCzJgRmyntcpb/XNWk7Nuep0YM= sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", + "requires": { + "@types/http-cache-semantics": "*", + "@types/keyv": "^3.1.4", + "@types/node": "*", + "@types/responselike": "^1.0.0" + }, + "dev": true + }, + "@types/http-cache-semantics": { + "version": "4.0.1", + "resolved": "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", + "integrity": "sha1-Dqe2FJaQK5WJDcTDoRa2DLja6BI= sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==", + "dev": true + }, + "@types/keyv": { + "version": "3.1.4", + "resolved": "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha1-PM2xxnUbDH5SMAvNrNW8v4+qdbY= sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", + "requires": { + "@types/node": "*" + }, + "dev": true + }, + "@types/node": { + "version": "18.15.3", + "resolved": "https://registry.yarnpkg.com/@types/node/-/node-18.15.3.tgz", + "integrity": "sha1-8LmRwyz8ak5/M5nWy0uM+aAxUBQ= sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw==", + "dev": true + }, + "@types/pbkdf2": { + "version": "3.1.0", + "resolved": "https://registry.yarnpkg.com/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", + "integrity": "sha1-A5oOm2faDNxO5dq4Zcqmsme7ZrE= sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==", + "requires": { + "@types/node": "*" + }, + "dev": true + }, + "@types/responselike": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.0.tgz", + "integrity": "sha1-JR9P59FU0rrRJavhtCmyOv0mLik= sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "requires": { + "@types/node": "*" + }, + "dev": true + }, + "@types/secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.yarnpkg.com/@types/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha1-G45V2OAPCO5yILTVmmq+icN6kBw= sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==", + "requires": { + "@types/node": "*" + }, + "dev": true + }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha1-qlgEJxHW4ydd033Fl+XTHowpCkQ= sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "abortcontroller-polyfill": { + "version": "1.7.5", + "resolved": "https://registry.yarnpkg.com/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz", + "integrity": "sha1-ZzhJX06QH7tXtsBhHQx192xIW+0= sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ==", + "dev": true + }, + "accepts": { + "version": "1.3.8", + "resolved": "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha1-C/C+EltnAUrcsLCSHmLbe//hay4= sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "requires": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "dev": true + }, + "acorn": { + "version": "7.4.1", + "resolved": "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo= sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha1-ftW7VZCLOy8bxVxq8WU7rafweTc= sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ= sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "dev": true + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha1-y7muJWv3UK8eqzRPIpqif+lLo0g= sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha1-h4C5j/nb9WOBUtHx/lwde0RCl2s= sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "dev": true + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha1-CCyyyJyf6GWaMRpTvWpNxTAdswQ= sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc= sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + }, + "dev": true + }, + "anymatch": { + "version": "3.1.3", + "resolved": "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha1-eQxYsZuhcgqEIFtXxhjVrYUklz4= sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE= sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "requires": { + "sprintf-js": "~1.0.2" + }, + "dev": true + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "dev": true + }, + "asn1": { + "version": "0.2.6", + "resolved": "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha1-DTp7tuZOAqkMAwOzHykoaOoJoI0= sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "requires": { + "safer-buffer": "~2.1.0" + }, + "dev": true + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", + "dev": true + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha1-5gtrDo8wG9l+U3UhW9pAbIURjAs= sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha1-SDFDxWeu7UeFdZwIZXhtx319LjE= sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true + }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha1-3TeelPDbgxCwgpH51kwyCXZmF/0= sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k= sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, + "available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha1-kvlWFlAQadB9EO2y/DfT4cZRI7c= sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", + "dev": true + }, + "aws4": { + "version": "1.12.0", + "resolved": "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz", + "integrity": "sha1-zhydFDOJZ54lOzFCQeqapc7JgNM= sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", + "dev": true + }, + "b4a": { + "version": "1.6.2", + "resolved": "https://registry.yarnpkg.com/b4a/-/b4a-1.6.2.tgz", + "integrity": "sha1-09ygrH2nlKoTCT6S3VfP5h1YsH4= sha512-YFqjbZ8iqX/wWJVmF1SSOB5TYDwsPd/sZzhSdu2PskElf55PjEe+0MhsEPgoa5eTK1VS/WqJMz9qwIFwZta+3g==", + "dev": true + }, + "babel-eslint": { + "version": "10.1.0", + "resolved": "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz", + "integrity": "sha1-aWjlaKkQt4+zd5zdi2rC9HmUMjI= sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg==", + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.7.0", + "@babel/traverse": "^7.7.0", + "@babel/types": "^7.7.0", + "eslint-visitor-keys": "^1.0.0", + "resolve": "^1.12.0" + }, + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha1-6D46fj8wCzTLnYf2FfoMvzV2kO4= sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "base-x": { + "version": "3.0.9", + "resolved": "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha1-Y0mqq7WFJjMt6fYJleVIpT/iEyA= sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "requires": { + "safe-buffer": "^5.0.1" + }, + "dev": true + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha1-GxtEAWClv3rUC2UPCVljSBkDkwo= sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", + "requires": { + "tweetnacl": "^0.14.3" + }, + "dev": true + }, + "big-integer": { + "version": "1.6.51", + "resolved": "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha1-DfkqXZiAVg0/8tX9ICRciJ0TBoY= sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", + "dev": true + }, + "bignumber.js": { + "version": "9.1.1", + "resolved": "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz", + "integrity": "sha1-xN99xJa9hJ1MlGQ0TBqnQii02sY= sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==", + "dev": true + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha1-dfUC7q+f/eQvyYgpZFvk6na9ni0= sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha1-EDU8npRTNLwFEabZCzj7x8nFBN8= sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "requires": { + "file-uri-to-path": "1.0.0" + }, + "dev": true + }, + "blake-hash": { + "version": "1.1.1", + "resolved": "https://registry.yarnpkg.com/blake-hash/-/blake-hash-1.1.1.tgz", + "integrity": "sha1-tiUWANeBLdUJf5bLNBzq4kW/nRI= sha512-V93H+FEJuXXZi1eEsMtbcBFP9oL5Ept7SLw3cbXYlPC3nocm9Fr4m18ZhbhdJrZVS9J/Z0oNE4L3oDZvmorHNA==", + "requires": { + "bindings": "^1.2.1", + "inherits": "^2.0.3", + "nan": "^2.2.1" + }, + "dev": true + }, + "blake2b": { + "version": "2.1.4", + "resolved": "https://registry.yarnpkg.com/blake2b/-/blake2b-2.1.4.tgz", + "integrity": "sha1-gX0nhSbdtM1nO/sa8W0a1h45O6M= sha512-AyBuuJNI64gIvwx13qiICz6H6hpmjvYS5DGkG6jbXMOT8Z3WUJ3V1X0FlhIoT1b/5JtHE3ki+xjtMvu1nn+t9A==", + "requires": { + "blake2b-wasm": "^2.4.0", + "nanoassert": "^2.0.0" + }, + "dev": true + }, + "blake2b-wasm": { + "version": "2.4.0", + "resolved": "https://registry.yarnpkg.com/blake2b-wasm/-/blake2b-wasm-2.4.0.tgz", + "integrity": "sha1-kRVkkRHtu9h+skznwEtCfk4r5b4= sha512-S1kwmW2ZhZFFFOghcx73+ZajEfKBqhP82JMssxtLVMxlaPea1p9uoLiUZ5WYyHn0KddwbLc+0vh4wR0KBNoT5w==", + "requires": { + "b4a": "^1.0.1", + "nanoassert": "^2.0.0" + }, + "dev": true + }, + "blakejs": { + "version": "1.2.1", + "resolved": "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha1-UFfkIG6ttKl/fAtuGXpQUEL8OBQ= sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==", + "dev": true + }, + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha1-nyKcFb4nJFT/qXOs4NvueaGww28= sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true + }, + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha1-C8UnpqDRjQqo1bBTjOSnfcz6e3A= sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", + "dev": true + }, + "body-parser": { + "version": "1.20.2", + "resolved": "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha1-b+sOIcRyTQbef/ONo22tT1enR/0= sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "requires": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha1-PH/L9SnYcibz0vUrlm/1Jx60Qd0= sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "dev": true + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz", + "integrity": "sha1-NFThpGLujVmeI23zNs2epPiv4Qc= sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + }, + "dev": true + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", + "dev": true + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha1-uqVZ7hTO1zRSIputcyZGfGH6vWA= sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha1-Mmc0ZC9APavDADIJhTu3CtQo70g= sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "dev": true + }, + "bs58": { + "version": "4.0.1", + "resolved": "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo= sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "requires": { + "base-x": "^3.0.2" + }, + "dev": true + }, + "bs58check": { + "version": "2.1.2", + "resolved": "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha1-U7AYKRIo2CpaoI59eW/a/aVK6/w= sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "requires": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + }, + "dev": true + }, + "buffer": { + "version": "5.7.1", + "resolved": "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha1-umLnwTEzBTWCGXFghRqPZI6Z7tA= sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + }, + "dev": true + }, + "buffer-to-arraybuffer": { + "version": "0.0.5", + "resolved": "https://registry.yarnpkg.com/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", + "integrity": "sha1-YGSkD6dutDxyOrqe+PbhIW0QURo= sha512-3dthu5CYiVB1DEJp61FtApNnNndTckcqe4pFcLdvHtrpG+kcyekCJKg4MRiDcFW7A6AODnXB9U4dwQiCW5kzJQ==", + "dev": true + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==", + "dev": true + }, + "bufferutil": { + "version": "4.0.7", + "resolved": "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.7.tgz", + "integrity": "sha1-YMDRm6LJkt2Cc9P3N3L/yJTBU60= sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", + "requires": { + "node-gyp-build": "^4.3.0" + }, + "dev": true + }, + "bytes": { + "version": "3.1.2", + "resolved": "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha1-iwvuuYYFrfGxKPpDhkA8AJ4CIaU= sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true + }, + "cacheable-lookup": { + "version": "6.1.0", + "resolved": "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-6.1.0.tgz", + "integrity": "sha1-AzClQ0ccYfqk6QNdtYOq11OzY4U= sha512-KJ/Dmo1lDDhmW2XDPMo+9oiy/CeqosPguPCrgcVzKyZrL6pM1gU2GmPY/xo6OQPTUaA/c0kwHuywB4E6nmT9ww==", + "dev": true + }, + "cacheable-request": { + "version": "7.0.2", + "resolved": "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-7.0.2.tgz", + "integrity": "sha1-6g0LiJNkolhUdXMByhKy2nf5HSc= sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + }, + "dependencies": { + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha1-SWaheV7lrOZecGxLe+txJX1uItM= sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + }, + "dev": true + } + }, + "dev": true + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha1-sdTonmiBGcPJqQOtMKuy9qkZvjw= sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "dev": true + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha1-s2MKvYlDQy9Us/BRkjjjPNffL3M= sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha1-VoW5XrIJrJwMF3Rnd4ychN9Yupo= sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", + "dev": true + }, + "chai": { + "version": "4.3.7", + "resolved": "https://registry.yarnpkg.com/chai/-/chai-4.3.7.tgz", + "integrity": "sha1-7GP23wGCkIjov1X8qDm81GSo7FE= sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==", + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^4.1.2", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + }, + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha1-zUJUFnelQzPPVBpJEIwUMrRMlCQ= sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0= sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + }, + "dev": true + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg= sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + }, + "dev": true + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0= sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha1-4uaaRKyHcveKHsCzW2id9lMO/I8= sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + }, + "dev": true + } + }, + "dev": true + }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha1-kAlISfCTfy7twkJdDSip5fDLrZ4= sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII= sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", + "dev": true + }, + "chokidar": { + "version": "3.5.1", + "resolved": "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha1-7pznu+vSt59J8wR5nVRo4x4U5oo= sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", + "requires": { + "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" + }, + "dev": true + }, + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha1-b8nXtC0ypYNZYzdmbn0ICE2izGs= sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, + "cids": { + "version": "0.7.5", + "resolved": "https://registry.yarnpkg.com/cids/-/cids-0.7.5.tgz", + "integrity": "sha1-YKCBOKmb+2m2vkzrY7/vejlrKLI= sha512-zT7mPeghoWAu+ppn8+BS1tQ5qGmbMfB4AregnQjA/qHY3GC1m1ptI9GkWNlgeu38r7CuRdXB47uY2XgAYt6QVA==", + "requires": { + "buffer": "^5.5.0", + "class-is": "^1.1.0", + "multibase": "~0.6.0", + "multicodec": "^1.0.0", + "multihashes": "~0.4.15" + }, + "dependencies": { + "multibase": { + "version": "0.6.1", + "resolved": "https://registry.yarnpkg.com/multibase/-/multibase-0.6.1.tgz", + "integrity": "sha1-t232KYU2zBe59qbbU+yI+F+MwSs= sha512-pFfAwyTjbbQgNc3G7D48JkJxWtoJoBMaR4xQUOuB8RnCgRqaYmWNFeJTTvrJ2w51bjLq2zTby6Rqj9TQ9elSUw==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + }, + "dev": true + }, + "multicodec": { + "version": "1.0.4", + "resolved": "https://registry.yarnpkg.com/multicodec/-/multicodec-1.0.4.tgz", + "integrity": "sha1-RqwGRlfEA4DCg2fJAwTY7RdacU8= sha512-NDd7FeS3QamVtbgfvu5h7fd1IlbaC4EQ0/pgU4zqE2vdHCmBGsUa0TiM8/TdSeG6BMPC92OOCf8F1ocE/Wkrrg==", + "requires": { + "buffer": "^5.6.0", + "varint": "^5.0.0" + }, + "dev": true + } + }, + "dev": true + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha1-h2Dk7MJy9MNjUy+SbYdKriwTl94= sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "dev": true + }, + "class-is": { + "version": "1.1.0", + "resolved": "https://registry.yarnpkg.com/class-is/-/class-is-1.1.0.tgz", + "integrity": "sha1-nTwPugRA0hHYQ87D3t+kgFUAWCU= sha512-rhjH9AG1fvabIDoGRVH587413LPjTZgmDF9fOFCbFJQV4yuocX1mHxxvXI4g3cGwbVY9wAYIoKlg1N79frJKQw==", + "dev": true + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU= sha512-8lgKz8LmCRYZZQDpRyT2m5rKJ08TnU4tR9FFFW2rxpxR1FzWi4PQ/NfyODchAatHaUgnSPVcx/R5w6NuTBzFiw==", + "requires": { + "restore-cursor": "^2.0.0" + }, + "dev": true + }, + "cli-width": { + "version": "2.2.1", + "resolved": "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.1.tgz", + "integrity": "sha1-sEM9C06chH7xiGik7xb9X8gnHEg= sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", + "dev": true + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha1-NIQi2+gtgAswIu709qwQvy5NG0k= sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.1", + "resolved": "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha1-Ej1keekq1FrYl9QFTjx8p9tJROE= sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8= sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", + "requires": { + "ansi-regex": "^3.0.0" + }, + "dev": true + } + }, + "dev": true + }, + "clone-response": { + "version": "1.0.3", + "resolved": "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.3.tgz", + "integrity": "sha1-ryAyqkeBY5nPXwodDbkC9ReruMM= sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", + "requires": { + "mimic-response": "^1.0.0" + }, + "dev": true + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", + "dev": true + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM= sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + }, + "dev": true + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI= sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha1-w9RaizT9cwYxoRCoolIGgrMdWn8= sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + }, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha1-i4K076yCUSoCuwsdzsnSxejrW/4= sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "requires": { + "safe-buffer": "5.2.1" + }, + "dev": true + }, + "content-hash": { + "version": "2.5.2", + "resolved": "https://registry.yarnpkg.com/content-hash/-/content-hash-2.5.2.tgz", + "integrity": "sha1-u8JlXnwh8U/Tv8e31L/m5FTJ4hE= sha512-FvIQKy0S1JaWV10sMsA7TRx8bpU+pqPkhbsfvOJAdjRXvYxEckAwQWGwtRjiaJfh+E0DvcWUGqcdjwMGFjsSdw==", + "requires": { + "cids": "^0.7.1", + "multicodec": "^0.5.5", + "multihashes": "^0.4.15" + }, + "dev": true + }, + "content-type": { + "version": "1.0.5", + "resolved": "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha1-i3cxYmVtHRCGeEyPI6VM5tc9eRg= sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "dev": true + }, + "cookie": { + "version": "0.5.0", + "resolved": "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha1-0fXXGt7GVYxY84mYfDZqpH6ZT4s= sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "dev": true + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw= sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", + "dev": true + }, + "cors": { + "version": "2.8.5", + "resolved": "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz", + "integrity": "sha1-6sEdpRWS3Ya58G9uesKTs9+HXSk= sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "requires": { + "object-assign": "^4", + "vary": "^1" + }, + "dev": true + }, + "crc-32": { + "version": "1.2.2", + "resolved": "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha1-PK01qTS4v3HyXKUkttpR+36s4v8= sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "dev": true + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha1-iJB4rxGmN1a8+1m9IhmWvjqe8ZY= sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + }, + "dev": true + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha1-aRcMeLOrlXFHsriwRXLkfq0iQ/8= sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "dev": true + }, + "cross-fetch": { + "version": "3.1.5", + "resolved": "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha1-4TifRNnnunZ5B/evhFR4eVKrU08= sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "requires": { + "node-fetch": "2.6.7" + }, + "dev": true + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha1-Sl7Hxk364iw6FBJNus3uhG2Ay8Q= sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "which": { + "version": "1.3.1", + "resolved": "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz", + "integrity": "sha1-pFBD1U9YBTFtqNYvn1CRjT2nCwo= sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + }, + "dev": true + } + }, + "dev": true + }, + "d": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz", + "integrity": "sha1-hpgJU3LVjb7jRv/Qxwk/mfj561o= sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "requires": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + }, + "dev": true + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", + "requires": { + "assert-plus": "^1.0.0" + }, + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz", + "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8= sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + }, + "dependencies": { + "ms": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + } + }, + "dev": true + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "dev": true + }, + "decode-uri-component": { + "version": "0.2.2", + "resolved": "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha1-5p2+JdN5QRcd1UDgJMREzVGI4ek= sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", + "dev": true + }, + "decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha1-yjh2Et234QS9FthaqwDV7PCcZvw= sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "requires": { + "mimic-response": "^3.1.0" + }, + "dependencies": { + "mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha1-LR1Zr5wbEpgVrMwsRqAipc4fo8k= sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true + } + }, + "dev": true + }, + "deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha1-fHd1UTCS99+Y2N+Zlt0IXrZozG0= sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "requires": { + "type-detect": "^4.0.0" + }, + "dev": true + }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha1-pvLc5hL63S7x9Rm3NVHxfoUZmDE= sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha1-gBa9tBQ+RjK3ejRJxiNid95SBYc= sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "dev": true + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk= sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true + }, + "depd": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz", + "integrity": "sha1-tpYWPMdXVg0JzyLMj60Vcbeedt8= sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true + }, + "destroy": { + "version": "1.2.0", + "resolved": "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha1-SANzVQmti+VSk0xn32FPlOZvoBU= sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "dev": true + }, + "diff": { + "version": "5.0.0", + "resolved": "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz", + "integrity": "sha1-ftatdthZ0DB4fsNYVfWx2vMdhSs= sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha1-rd6+rXKmV023g2OdyHoSF3OXOWE= sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "requires": { + "esutils": "^2.0.2" + }, + "dev": true + }, + "dom-walk": { + "version": "0.1.2", + "resolved": "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz", + "integrity": "sha1-DFSL7wSPTR8qlySQAiNgYNqj/YQ= sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==", + "dev": true + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + }, + "dev": true + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "dev": true + }, + "elliptic": { + "version": "6.5.4", + "resolved": "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha1-2jfOvTHnmhNn6UG1ku0fvr1Yq7s= sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "requires": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha1-d1s/J477uXGO7HNh9IP7Nvu/6og= sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "dev": true + } + }, + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha1-6Bj9ac5cz8tARZT4QpY79TFkzDc= sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha1-WuZKX0UFe682JuwU2gyl5LJDHrA= sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + }, + "dev": true + }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha1-Kn/l3WNKHkElqXXsmU/1RW3Dc00= sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "requires": { + "ansi-colors": "^4.1.1" + }, + "dependencies": { + "ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha1-N2ETQOsiQ+cMxgTK011jJw1IeBs= sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true + } + }, + "dev": true + }, + "es5-ext": { + "version": "0.10.62", + "resolved": "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.62.tgz", + "integrity": "sha1-XmrcGabaUkvz0eArvIlg5etJqaU= sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", + "requires": { + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.3", + "next-tick": "^1.1.0" + }, + "dev": true + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c= sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + }, + "dev": true + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha1-TrIVlMlyvEBVPSduUQU5FD21Pgo= sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "dev": true + }, + "es6-symbol": { + "version": "3.1.3", + "resolved": "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz", + "integrity": "sha1-utXTwbzawoJp9MszHkMceKxwXRg= sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "requires": { + "d": "^1.0.1", + "ext": "^1.1.2" + }, + "dev": true + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha1-2M/ccACWXFoBdLSoLqpcBVJ0LkA= sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "eslint": { + "version": "7.32.0", + "resolved": "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz", + "integrity": "sha1-xtMooUvj+wjI0dIeEsAv23oqgS0= sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", + "requires": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.3", + "@humanwhocodes/config-array": "^0.5.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.1.2", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.9", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.12.11", + "resolved": "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha1-9K1DWqJj25NbjxDyxVLSP7cWpj8= sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", + "requires": { + "@babel/highlight": "^7.10.4" + }, + "dev": true + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha1-qsTit3NKdAhnrrFr8CqtVWoeegE= sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha1-9zqFudXUHQRVUcF34ogtSshXKKY= sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "dev": true + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz", + "integrity": "sha1-Exn2V5NX8jONMzfSzdSRS7XcyGU= sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + }, + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha1-FLqDpdNz49MR5a/KKc9b+tllvzQ= sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha1-9lMoJZMFknOSyTjtROsKXJsr0wM= sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + }, + "globals": { + "version": "13.20.0", + "resolved": "https://registry.yarnpkg.com/globals/-/globals-13.20.0.tgz", + "integrity": "sha1-6idqHlCP/U8WEoiPnRutHicXv4I= sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "requires": { + "type-fest": "^0.20.2" + }, + "dev": true + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz", + "integrity": "sha1-rkViwAdHO5MqYgDUAyaN0v/8at4= sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U= sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha1-3rxkidem5rDnYRiIzsiAM30xY5Y= sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "semver": { + "version": "7.3.8", + "resolved": "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz", + "integrity": "sha1-B6eP6vs/ezI0fXJeM95+Ki32d5g= sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "requires": { + "lru-cache": "^6.0.0" + }, + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo= sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + }, + "dev": true + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI= sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo= sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + }, + "dev": true + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha1-B7ggO/pwVsBlcFDjzNLDdzC6uPE= sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "requires": { + "prelude-ls": "^1.2.1" + }, + "dev": true + } + }, + "dev": true + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha1-54blmmbLkrP2wfsNUIqrF0hI9Iw= sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "dev": true + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha1-0t5eA0JOcH3BDHQGjd7a5wh0Gyc= sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dev": true + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4= sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + }, + "espree": { + "version": "7.3.1", + "resolved": "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz", + "integrity": "sha1-8t8zC3Usb1UBn4vYm3ZgA5wbu7Y= sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dev": true + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE= sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esquery": { + "version": "1.5.0", + "resolved": "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha1-bOF3ON6Fd2lO3XNhxXGCrIyw2ws= sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha1-LupSkHAvJquP5TcDcP+GyWXSESM= sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + }, + "dev": true + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha1-eteWTWeauyi+5yzsY3WLHF0smSE= sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha1-LupSkHAvJquP5TcDcP+GyWXSESM= sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + }, + "dev": true + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha1-OYrT88WiSUi+dyXoPRGn3ijNvR0= sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q= sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "dev": true + }, + "eth-ens-namehash": { + "version": "2.0.8", + "resolved": "https://registry.yarnpkg.com/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz", + "integrity": "sha1-IprEbsqG1S4MmR58sq74P/D2i88= sha512-VWEI1+KJfz4Km//dadyvBBoBeSQ0MHTXPvr8UIXiLW6IanxvAV+DmlZAijZwAyggqGUfwQBeHf7tc9wzc1piSw==", + "requires": { + "idna-uts46-hx": "^2.3.1", + "js-sha3": "^0.5.7" + }, + "dependencies": { + "js-sha3": { + "version": "0.5.7", + "resolved": "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.7.tgz", + "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc= sha512-GII20kjaPX0zJ8wzkTbNDYMY7msuZcTWk8S5UOh6806Jq/wz1J8/bnr8uGU0DAUmYDjj2Mr4X1cW8v/GLYnR+g==", + "dev": true + } + }, + "dev": true + }, + "eth-lib": { + "version": "0.2.8", + "resolved": "https://registry.yarnpkg.com/eth-lib/-/eth-lib-0.2.8.tgz", + "integrity": "sha1-sZQFi+9LIgrRLqSXQx1stqoGI8g= sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "xhr-request-promise": "^0.1.2" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha1-d1s/J477uXGO7HNh9IP7Nvu/6og= sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "dev": true + } + }, + "dev": true + }, + "ethereum-bloom-filters": { + "version": "1.0.10", + "resolved": "https://registry.yarnpkg.com/ethereum-bloom-filters/-/ethereum-bloom-filters-1.0.10.tgz", + "integrity": "sha1-PKB/Su1pjnW9E0WEhQJgJGpf7Yo= sha512-rxJ5OFN3RwjQxDcFP2Z5+Q9ho4eIdEmSc2ht0fCu8Se9nbXjZ7/031uXoUYJ87KHCOdVeiUuwSnoS7hmYAGVHA==", + "requires": { + "js-sha3": "^0.8.0" + }, + "dev": true + }, + "ethereum-cryptography": { + "version": "0.1.3", + "resolved": "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", + "integrity": "sha1-jWFDz8PXS/ebvY7ezfKeSuIN0ZE= sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "requires": { + "@types/pbkdf2": "^3.0.0", + "@types/secp256k1": "^4.0.1", + "blakejs": "^1.1.0", + "browserify-aes": "^1.2.0", + "bs58check": "^2.1.2", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "hash.js": "^1.1.7", + "keccak": "^3.0.0", + "pbkdf2": "^3.0.17", + "randombytes": "^2.1.0", + "safe-buffer": "^5.1.2", + "scrypt-js": "^3.0.0", + "secp256k1": "^4.0.1", + "setimmediate": "^1.0.5" + }, + "dependencies": { + "keccak": { + "version": "3.0.3", + "resolved": "https://registry.yarnpkg.com/keccak/-/keccak-3.0.3.tgz", + "integrity": "sha1-S8Na2Re+HvVP8kb5BMK7v5rGEnY= sha512-JZrLIAJWuZxKbCilMpNz5Vj7Vtb4scDG3dMXLOsbzBmQGyjwE61BbW7bJkfKKCShXiQZt3T6sBgALRtmd+nZaQ==", + "requires": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0", + "readable-stream": "^3.6.0" + }, + "dev": true + } + }, + "dev": true + }, + "ethereumjs-util": { + "version": "7.1.5", + "resolved": "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", + "integrity": "sha1-ns8Ehh5Pu+7XRl7OXyMxetESkYE= sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", + "requires": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + }, + "dev": true + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk= sha512-/Sn9Y0oKl0uqQuvgFk/zQgR7aw1g36qX/jzSQ5lSwlO0GigPymk4eGQfeNTD03w1dPOqfz8V77Cy43jH56pagw==", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU= sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==", + "dev": true + } + }, + "dev": true + }, + "eventemitter3": { + "version": "4.0.4", + "resolved": "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.4.tgz", + "integrity": "sha1-tUY6zmNaCD0Bi9x8kXtMXxCoU4Q= sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==", + "dev": true + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha1-f8vbGY3HGVlDLv4ThCaE4FJaywI= sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + }, + "dev": true + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz", + "integrity": "sha1-xiNqW7TfbW8V6I5/AXeYIWdJ3dg= sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + }, + "dev": true + }, + "express": { + "version": "4.18.2", + "resolved": "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz", + "integrity": "sha1-P6vggpbpMMeWwZ48UWl5OGup/Vk= sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "requires": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "body-parser": { + "version": "1.20.1", + "resolved": "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha1-sYEqiRLBlc03Gj7l5m+qIzilxmg= sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "requires": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "dev": true + }, + "raw-body": { + "version": "2.5.1", + "resolved": "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha1-/hsWKLGBtwAhXl/UI4n5i3E5KFc= sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "requires": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "dev": true + } + }, + "dev": true + }, + "ext": { + "version": "1.7.0", + "resolved": "https://registry.yarnpkg.com/ext/-/ext-1.7.0.tgz", + "integrity": "sha1-DqQ4PAED1g5wvpnpp/EQJ6M8T18= sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", + "requires": { + "type": "^2.7.2" + }, + "dependencies": { + "type": { + "version": "2.7.2", + "resolved": "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz", + "integrity": "sha1-I3ahWjoose+g9TUNz3LSTfbvmNA= sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==", + "dev": true + } + }, + "dev": true + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz", + "integrity": "sha1-+LETa0Bx+9jrFAr/hYsQGewpFfo= sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha1-ywP3QL764D6k0oPK7SdBqD8zVJU= sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "dev": true + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha1-On1WtVnWy8PrUSMlJE5hmmXGxSU= sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM= sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI= sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==", + "requires": { + "escape-string-regexp": "^1.0.5" + }, + "dev": true + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha1-IRst2WWcsDlLBz5zI6w8kz1SICc= sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "requires": { + "flat-cache": "^3.0.4" + }, + "dev": true + }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha1-VTp7hEb/b2hDWcRF8eN6BdrMM90= sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha1-GRmmp8df44ssfHflGYU12prN2kA= sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + }, + "dev": true + }, + "finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha1-fSP+VzGyB7RkDk/NAK7B+SB6ezI= sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha1-TJKBnstwg1YeT0okCoa+UZj1Nvw= sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "dev": true + }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz", + "integrity": "sha1-jKb+MyBp/6nTJMMnGYxZglnOskE= sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha1-YbAzgwKy/p+Vfcwy/CqH8cMEixE= sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "dev": true + }, + "flatted": { + "version": "3.2.7", + "resolved": "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha1-YJ85IHy2FLidB2W0d8stQ3+/l4c= sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha1-abRH6IoKXTLD5whPPxcQA0shN24= sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + }, + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", + "dev": true + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha1-3M5SwF9kTymManq5Nr1yTO/786Y= sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "dev": true + }, + "form-data-encoder": { + "version": "1.7.1", + "resolved": "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.1.tgz", + "integrity": "sha1-rIBmDk+H7g09PDY4t9qCeN247JY= sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg==", + "dev": true + }, + "forwarded": { + "version": "0.2.0", + "resolved": "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha1-ImmTZCiq1MFcfr6XeahL8LKoGBE= sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "dev": true + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "dev": true + }, + "fs-extra": { + "version": "4.0.3", + "resolved": "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha1-DYUhIuW8W+tFP7Ao6cDJvzY0DJQ= sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "dev": true + }, + "fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha1-zP+FcIQef+QmVpPaiJNsVa7X98c= sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "requires": { + "minipass": "^2.6.0" + }, + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8= sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0= sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", + "dev": true + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha1-+Xj6TJDR3+f/LWvtoqUV5xO9z0o= sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE= sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "dev": true + }, + "get-intrinsic": { + "version": "1.2.0", + "resolved": "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha1-etHcBTXzopBLugdXcnY+UFH20F8= sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + }, + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha1-wbJVV189wh1Zv8ec09K0axw6VLU= sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + }, + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", + "requires": { + "assert-plus": "^1.0.0" + }, + "dev": true + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz", + "integrity": "sha1-uN8PuAK7+o6JvR2Ti04WV47UTys= sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dev": true + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha1-hpgyxYA0/mikCTwX3BXoNA2EAcQ= sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "requires": { + "is-glob": "^4.0.1" + }, + "dev": true + }, + "global": { + "version": "4.4.0", + "resolved": "https://registry.yarnpkg.com/global/-/global-4.4.0.tgz", + "integrity": "sha1-PnsQUXkAajI+1xqvyj6cV6XMZAY= sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==", + "requires": { + "min-document": "^2.19.0", + "process": "^0.11.10" + }, + "dev": true + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz", + "integrity": "sha1-q4eVM4hooLq9hSV1gBjCp+uVxC4= sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "gopd": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha1-Kf923mnax0ibfAkYpXiOVkd8Myw= sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "requires": { + "get-intrinsic": "^1.1.3" + }, + "dev": true + }, + "got": { + "version": "12.1.0", + "resolved": "https://registry.yarnpkg.com/got/-/got-12.1.0.tgz", + "integrity": "sha1-CZ84FTBcaCvk/WsO4HJtjkxrCvQ= sha512-hBv2ty9QN2RdbJJMK3hesmSkFTjVIHyIDDbssCKnSmq62edGgImJWD10Eb1k77TiV1bxloxqcFAVK8+9pkhOig==", + "requires": { + "@sindresorhus/is": "^4.6.0", + "@szmarczak/http-timer": "^5.0.1", + "@types/cacheable-request": "^6.0.2", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^6.0.4", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "form-data-encoder": "1.7.1", + "get-stream": "^6.0.1", + "http2-wrapper": "^2.1.10", + "lowercase-keys": "^3.0.0", + "p-cancelable": "^3.0.0", + "responselike": "^2.0.0" + }, + "dependencies": { + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha1-omLY7vZ6ztV8KFKtYWdSakPL97c= sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, + "lowercase-keys": { + "version": "3.0.0", + "resolved": "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz", + "integrity": "sha1-xefUQuN+rSR66dsRep0KRnyJ1PI= sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==", + "dev": true + } + }, + "dev": true + }, + "graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha1-FH06AG2kyjzhRyjHrvwofDZ9emw= sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "dev": true + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz", + "integrity": "sha1-8nNdwig2dPpnR4sQGBBZNVw2nl4= sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", + "dev": true + }, + "har-validator": { + "version": "5.1.5", + "resolved": "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha1-HwgDufjLIMD6E4It8ezds2veHv0= sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "requires": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz", + "integrity": "sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y= sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + }, + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s= sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha1-u3ssQ0klHc6HsSX3vfh0qnyLOfg= sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha1-fhM4GKfTlHNPlB5zw9P5KR5liyU= sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "requires": { + "has-symbols": "^1.0.2" + }, + "dev": true + }, + "hash-base": { + "version": "3.1.0", + "resolved": "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha1-VcOB2eBuHSmXqIO0o/3f5/DTrzM= sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dev": true + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha1-C6vKU46NTuSg+JiNaIZlN6ADz0I= sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + }, + "dev": true + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz", + "integrity": "sha1-hK5l+n6vsWX922FWauFLrwVmTw8= sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + }, + "dev": true + }, + "http-cache-semantics": { + "version": "4.1.1", + "resolved": "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha1-q+AvyymFRgvwMjvmZENuw0dqbVo= sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", + "dev": true + }, + "http-errors": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha1-t3dKFIbvc892Z6ya4IWMASxXudM= sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "requires": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "dev": true + }, + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs= sha512-o0PWwVCSp3O0wS6FvNr6xfBCHgt0m1tvPLFOCc2iFDKTRAXhB7m8klDf7ErowFH8POa6dVdGatKU5I1YYwzUyg==", + "dev": true + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "dev": true + }, + "http2-wrapper": { + "version": "2.2.0", + "resolved": "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.2.0.tgz", + "integrity": "sha1-uArRmdIWt9NoAZUHe9e5Bg+p1/M= sha512-kZB0wxMo0sh1PehyjJUWRFEd99KC5TLjZ2cULC4f9iqJBAmKQQXEICjxl5iPJRwP40dpeHFqqhm7tYCvODpqpQ==", + "requires": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.2.0" + }, + "dev": true + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha1-ICK0sl+93CHS9SSXSkdKr+czkIs= sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "dev": true + }, + "idna-uts46-hx": { + "version": "2.3.1", + "resolved": "https://registry.yarnpkg.com/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz", + "integrity": "sha1-odxcTfN+7lIr9m2WnMmA4A6HEfk= sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA==", + "requires": { + "punycode": "2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.0", + "resolved": "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz", + "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0= sha512-Yxz2kRwT90aPiWEMHVYnEf4+rhwF1tBmmZ4KepCP+Wkium9JxtWnUm1nqGwpiAHr/tnTSeHqr3wb++jgSkXjhA==", + "dev": true + } + }, + "dev": true + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha1-jrehCmP/8l0VpXsAFYbRd9Gw01I= sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw= sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha1-NxYsJfy566oublPVtNiM4X2eDCs= sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o= sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + }, + "dev": true + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w= sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "inquirer": { + "version": "6.5.2", + "resolved": "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz", + "integrity": "sha1-rVCUI3XQNtMn/1KMCL1fqwiZKMo= sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", + "requires": { + "ansi-escapes": "^3.2.0", + "chalk": "^2.4.2", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^2.0.0", + "lodash": "^4.17.12", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^6.4.0", + "string-width": "^2.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha1-Fk2qyHqy1vbbOimHXi0XZlgtq+0= sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha1-jJpTb+tq/JYr36WxBKUJHBrZwK4= sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + }, + "dev": true + } + }, + "dev": true + }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha1-c5P1r6Weyf9fZ6J2INEcIm4+7AI= sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", + "dev": true + }, + "ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha1-v/OFQ+64mEglB5/zoqjmy9RngbM= sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true + }, + "is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha1-FbP4j9oB8ql/7ITKdhpWDxI++ps= sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha1-6h9/O4DwZCNug0cPhsCcJU+0Wwk= sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "requires": { + "binary-extensions": "^2.0.0" + }, + "dev": true + }, + "is-callable": { + "version": "1.2.7", + "resolved": "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha1-O8KoXqdC2eNiBdys3XLKH9xRsFU= sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true + }, + "is-core-module": { + "version": "2.11.0", + "resolved": "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha1-rUyz44Y+gUUjyW8/WNJsxXD/AUQ= sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "requires": { + "has": "^1.0.3" + }, + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "dev": true + }, + "is-function": { + "version": "1.0.2", + "resolved": "https://registry.yarnpkg.com/is-function/-/is-function-1.0.2.tgz", + "integrity": "sha1-Twl/MKv2762smDOxfKXcA/gUTgg= sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==", + "dev": true + }, + "is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha1-8VWLrxrBfg3up8BBXEODUf8rPHI= sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "requires": { + "has-tostringtag": "^1.0.0" + }, + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha1-ZPYeQsu7LuwgcanawLKLoeZdUIQ= sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "requires": { + "is-extglob": "^2.1.1" + }, + "dev": true + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ= sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha1-dTU0W4lnNNX4DE0GxQlVUnoU8Ss= sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha1-ReQuN/zPH0Dajl927iFRWEDAkoc= sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ= sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "dev": true + }, + "is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha1-NqW1y0GJtXXRo+SwhTa/tIWAHj8= sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", + "dev": true + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha1-ubel2nOvrX3t0PjEY5VMveaBiEA= sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha1-GSA/tZmR35jjoocFDUZHzerzJJk= sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha1-2ugS/bOCX6MGYJqHFzg8UMNqBTc= sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "dev": true + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM= sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", + "dev": true + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha1-gFZNLkg9rPbo7yCWUKZ98/DCg6Q= sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha1-kziAKjDTtmBfvgYT4JQAjKjAWhM= sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "json-schema": { + "version": "0.4.0", + "resolved": "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha1-995M9u+rg4666zI2R0y7paGTCrU= sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha1-afaofZUTq4u4/mO9sJecRI5oRmA= sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true + }, + "jsprim": { + "version": "1.4.2", + "resolved": "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha1-cSxlUzoVyHi6WentXw4m1bd8X+s= sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + }, + "dev": true + }, + "keccak": { + "version": "2.1.0", + "resolved": "https://registry.yarnpkg.com/keccak/-/keccak-2.1.0.tgz", + "integrity": "sha1-c06lPy7c/Q9CzbjV9MNY/vBSdSs= sha512-m1wbJRTo+gWbctZWay9i26v5fFnYkOn7D5PCxJ3fZUGUEb49dE1Pm4BREUYCt/aoO6di7jeoGmhvqN9Nzylm3Q==", + "requires": { + "bindings": "^1.5.0", + "inherits": "^2.0.4", + "nan": "^2.14.0", + "safe-buffer": "^5.2.0" + }, + "dev": true + }, + "keyv": { + "version": "4.5.2", + "resolved": "https://registry.yarnpkg.com/keyv/-/keyv-4.5.2.tgz", + "integrity": "sha1-DjEM5zv3hR7HAvLq9G7E44BczlY= sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==", + "requires": { + "json-buffer": "3.0.1" + }, + "dev": true + }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha1-bvXS32DlL4LrIopMNz6NHzlyU88= sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "requires": { + "invert-kv": "^2.0.0" + }, + "dev": true + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + }, + "dev": true + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha1-VTIeswn+u8WcSAHZMackUqaB0oY= sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "requires": { + "p-locate": "^5.0.0" + }, + "dev": true + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw= sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha1-VYqlO0O2YeGSWgr9+japoQhf5Xo= sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "lodash.truncate": { + "version": "4.4.2", + "resolved": "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", + "dev": true + }, + "log-symbols": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha1-abPMRtIPRI7M23XqH6cz2eghySA= sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "requires": { + "chalk": "^4.0.0" + }, + "dependencies": { + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha1-qsTit3NKdAhnrrFr8CqtVWoeegE= sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo= sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + }, + "dev": true + } + }, + "dev": true + }, + "loupe": { + "version": "2.3.6", + "resolved": "https://registry.yarnpkg.com/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha1-duSvSYEDxTLR7Mm+ECA2oh94e1M= sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "requires": { + "get-func-name": "^2.0.0" + }, + "dev": true + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha1-JgPni3tLAAbLyi+8yKMgJVislHk= sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha1-bW/mVw69lqr5D8rR2vo7JWbbOpQ= sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + }, + "dependencies": { + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha1-m7knkNnA7/7GO+c1GeEaNQGaOnI= sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + }, + "dev": true + }, + "map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha1-fVg6cwZDTAVf5HSw9FB45uG0uSo= sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "requires": { + "p-defer": "^1.0.0" + }, + "dev": true + }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha1-tdB7jjIW4+J81yjXL3DR5qNCAF8= sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + }, + "dev": true + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "dev": true + }, + "mem": { + "version": "4.3.0", + "resolved": "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz", + "integrity": "sha1-Rhr0l7xK4JYIzbLmDu+2m/90QXg= sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^2.0.0", + "p-is-promise": "^2.0.0" + }, + "dev": true + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", + "dev": true + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "dev": true + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz", + "integrity": "sha1-Ms2eXGRVO9WNGaVor0Uqz/BJgbE= sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha1-u6vNwChZ9JhzAchW4zh85exDv3A= sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha1-OBqHG2KnNEUGYK497uRIE/cNlZo= sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + }, + "dev": true + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha1-ftLCzMyvhNP/y3pptXcR/CCDQBs= sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha1-SSNTiHju9CBjy4o+OweYeBSHqxs= sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU= sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==", + "requires": { + "dom-walk": "^0.1.0" + }, + "dev": true + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha1-LhlN4ERibUoQ5/f7wAznPoPk1cc= sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha1-Gc0ZS/0+Qo8EmnCBfAONiatL41s= sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + }, + "dev": true + }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha1-waRk52kzAuCCoHXO4MBXdBrEdyw= sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true + }, + "minipass": { + "version": "2.9.0", + "resolved": "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha1-5xN2Ln0+Mv7YAxFc+T4EvKn8yaY= sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + }, + "dev": true + }, + "minizlib": { + "version": "1.3.3", + "resolved": "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha1-IpDeloGKNMKVUcio0wEha9Zahh0= sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "requires": { + "minipass": "^2.9.0" + }, + "dev": true + }, + "mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha1-fe8D0kMtyuS6HWEURcSDlgYiVfY= sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "requires": { + "minimist": "^1.2.6" + }, + "dev": true + }, + "mkdirp-promise": { + "version": "5.0.1", + "resolved": "https://registry.yarnpkg.com/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz", + "integrity": "sha1-6bj2jlUsaKnBcTuEiD96HdA5uKE= sha512-Hepn5kb1lJPtVW84RFT40YG1OddBNTOVUZR2bzQUHc+Z03en8/3uX0+060JDhcEzyO08HmipsN9DcnFMxhIL9w==", + "requires": { + "mkdirp": "*" + }, + "dependencies": { + "mkdirp": { + "version": "2.1.5", + "resolved": "https://registry.yarnpkg.com/mkdirp/-/mkdirp-2.1.5.tgz", + "integrity": "sha1-eNfq8V4Gm6e2tH123ZTPrfekBi8= sha512-jbjfql+shJtAPrFoKxHOXip4xS+kul9W3OzfzzrqueWK2QMGon2bFH2opl6W9EagBThjEz+iysyi/swOoVfB/w==", + "dev": true + } + }, + "dev": true + }, + "mocha": { + "version": "8.4.0", + "resolved": "https://registry.yarnpkg.com/mocha/-/mocha-8.4.0.tgz", + "integrity": "sha1-Z3voi/FZgKPK4Dpz4QoPw5l/DP8= sha512-hJaO0mwDXmZS4ghXsvPVriOhsxQ7ofcpQdm8dE+jISUOKopitvnXFQmpRR7jd2K6VBG6E26gU3IAbXXGIbu4sQ==", + "requires": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.1", + "debug": "4.3.1", + "diff": "5.0.0", + "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": "4.0.0", + "log-symbols": "4.0.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.20", + "serialize-javascript": "5.0.1", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.1.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha1-JG9Q88p4oyQPbJl+ipvR6sSeSzg= sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz", + "integrity": "sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4= sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk= sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + }, + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha1-FLqDpdNz49MR5a/KKc9b+tllvzQ= sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz", + "integrity": "sha1-FB8zuBp8JJLhJVlDB0gMRmeSeKY= sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha1-Gc0ZS/0+Qo8EmnCBfAONiatL41s= sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + }, + "dev": true + } + }, + "dev": true + }, + "js-yaml": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.0.0.tgz", + "integrity": "sha1-9Ca8D/S0BRkmzViMcRExg0CaEh8= sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", + "requires": { + "argparse": "^2.0.1" + }, + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM= sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + }, + "dev": true + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz", + "integrity": "sha1-V0yBOM4dK1hh8LRFedut1gxmFbI= sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + } + }, + "dev": true + }, + "mock-fs": { + "version": "4.14.0", + "resolved": "https://registry.yarnpkg.com/mock-fs/-/mock-fs-4.14.0.tgz", + "integrity": "sha1-zlEk0sYBQhJVmF5ulNqApzV7Gxg= sha512-qYvlv/exQ4+svI3UOvPUpLDF0OMX5euvUH0Ny4N5QyRyhNdgAgUrVH3iUINSzEPLvx0kbo/Bp28GJKIqvE7URw==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk= sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "multibase": { + "version": "0.7.0", + "resolved": "https://registry.yarnpkg.com/multibase/-/multibase-0.7.0.tgz", + "integrity": "sha1-Gt/BxQq+Be7+tQkawMJyjWuEWBs= sha512-TW8q03O0f6PNFTQDvh3xxH03c8CjGaaYrjkl9UQPG6rz53TQzzxJVCIWVjzcbN/Q5Y53Zd0IBQBMVktVgNx4Fg==", + "requires": { + "base-x": "^3.0.8", + "buffer": "^5.5.0" + }, + "dev": true + }, + "multicodec": { + "version": "0.5.7", + "resolved": "https://registry.yarnpkg.com/multicodec/-/multicodec-0.5.7.tgz", + "integrity": "sha1-H7P53YZqEKVdIm4ZSrui3MHun/0= sha512-PscoRxm3f+88fAtELwUnZxGDkduE2HD9Q6GHUOywQLjOGT/HAdhjLDYNZ1e7VR0s0TP0EwZ16LNUTFpoBGivOA==", + "requires": { + "varint": "^5.0.0" + }, + "dev": true + }, + "multihashes": { + "version": "0.4.21", + "resolved": "https://registry.yarnpkg.com/multihashes/-/multihashes-0.4.21.tgz", + "integrity": "sha1-3ALVJVefM0p5Ca3ooSLau1jM/LU= sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw==", + "requires": { + "buffer": "^5.5.0", + "multibase": "^0.7.0", + "varint": "^5.0.0" + }, + "dev": true + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= sha512-r65nCZhrbXXb6dXOACihYApHw2Q6pV0M3V0PSxd74N0+D8nzAdEAITq2oAjA1jVnKI+tGvEBUpqiMh0+rW6zDQ==", + "dev": true + }, + "nan": { + "version": "2.17.0", + "resolved": "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz", + "integrity": "sha1-wBUKI2ihgvAz6apRlex26kGhmcs= sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", + "dev": true + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.yarnpkg.com/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18= sha512-9MqxMH/BSJC7dnLsEMPyfN5Dvoo49IsPFYMcHw3Bcfc2kN0lpHRBSzlMSVx4HGyJ7s9B31CyBTVehWJoQ8Ctew==", + "dev": true + }, + "nanoassert": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/nanoassert/-/nanoassert-2.0.0.tgz", + "integrity": "sha1-oF+G3mx6UWGAOKYg+Ih47R5JDAk= sha512-7vO7n28+aYO4J+8w96AzhmU8G+Y/xpPDJz/se19ICsqj/momRbb9mh9ZUtkoJ5X3nTnPdhEJyc0qnM6yAsHBaA==", + "dev": true + }, + "nanoid": { + "version": "3.1.20", + "resolved": "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.20.tgz", + "integrity": "sha1-utwmPGsdzxS3HvqoX2q0wdbPx4g= sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "negotiator": { + "version": "0.6.3", + "resolved": "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha1-WOMjpy/twNb5zU0x/kn1FHlZDM0= sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true + }, + "next-tick": { + "version": "1.1.0", + "resolved": "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz", + "integrity": "sha1-GDbuMK1W1n7ygbIr0Zn3CUSbNes= sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha1-ozeKdpbOfSI+iPybdkvX7xCJ42Y= sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha1-Qyz6gpYs5JSxMunXKhWyn3H/XTI= sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", + "dev": true + }, + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha1-JN6fuoJ+O0rkTciyAlajeRYAUq0= sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "requires": { + "whatwg-url": "^5.0.0" + }, + "dev": true + }, + "node-gyp-build": { + "version": "4.6.0", + "resolved": "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.0.tgz", + "integrity": "sha1-DFLky/VLvSi3CYIO97ajwtYgkFU= sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha1-Dc1p/yOhybEf0JeDFmRKA4ghamU= sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha1-QNCIW1Nd7/4/MUe+yHfQX+TFZoo= sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "dev": true + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==", + "requires": { + "path-key": "^2.0.0" + }, + "dev": true + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", + "dev": true + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.yarnpkg.com/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA= sha512-wsJ9gfSz1/s4ZsJN01lyonwuxA1tml6X1yBDnfpMglypcBRFZZkus26EdPSlqS5GJfYddVZa22p3VNb3z5m5Ig==", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU= sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==", + "dev": true + } + }, + "dev": true + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha1-R6ewFrqmi1+g7PPe4IqFxnmsZFU= sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true + }, + "object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha1-umLf/WfuJWyMCG365p4BbNHxmLk= sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "dev": true + }, + "oboe": { + "version": "2.1.5", + "resolved": "https://registry.yarnpkg.com/oboe/-/oboe-2.1.5.tgz", + "integrity": "sha1-VVQoTFQ6ImbXo48X4HOCH73jk80= sha512-zRFWiF+FoicxEs3jNI/WYUrVEgA7DeET/InK0XQuudGHRg8iIob3cNPrJTKaz4004uaA9Pbe+Dwa8iluhjLZWA==", + "requires": { + "http-https": "^1.0.0" + }, + "dev": true + }, + "on-finished": { + "version": "2.4.1", + "resolved": "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha1-WMjEQRblSEWtV/FKsQsDUzGErD8= sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "requires": { + "ee-first": "1.1.1" + }, + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E= sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + }, + "dev": true + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ= sha512-oyyPpiMaKARvvcgip+JV+7zci5L8D1W9RZIz2l1o08AM3pfspitVWnPt3mzHcBPp12oYMTy0pqrFs/C+m3EwsQ==", + "requires": { + "mimic-fn": "^1.0.0" + }, + "dependencies": { + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha1-ggyGo5M0ZA6ZUWkovQP8qIBX0CI= sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + } + }, + "dev": true + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha1-TyNqY3Pa4FZqbUPhMmZ09QwpFJk= sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "dependencies": { + "levn": { + "version": "0.4.1", + "resolved": "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz", + "integrity": "sha1-rkViwAdHO5MqYgDUAyaN0v/8at4= sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "dev": true + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha1-3rxkidem5rDnYRiIzsiAM30xY5Y= sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha1-B7ggO/pwVsBlcFDjzNLDdzC6uPE= sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "requires": { + "prelude-ls": "^1.2.1" + }, + "dev": true + } + }, + "dev": true + }, + "os-locale": { + "version": "3.1.0", + "resolved": "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz", + "integrity": "sha1-qAKm7hfyTBBIOrmTVxnO9O0Wvxo= sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", + "requires": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + }, + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "dev": true + }, + "p-cancelable": { + "version": "3.0.0", + "resolved": "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz", + "integrity": "sha1-Y4JmlLVNYcocIOvLbT7PXhTNgFA= sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw==", + "dev": true + }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw==", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", + "dev": true + }, + "p-is-promise": { + "version": "2.1.0", + "resolved": "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz", + "integrity": "sha1-kYzrrqJIpiz3/6uOO8qMX4gvxC4= sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", + "dev": true + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha1-4drMvnjQ0TiMoYxk/qOOPlfjcGs= sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "requires": { + "yocto-queue": "^0.1.0" + }, + "dev": true + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha1-g8gxXGeFAF470CGDlBHJ4RDm2DQ= sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "requires": { + "p-limit": "^3.0.2" + }, + "dev": true + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY= sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha1-aR0nCeeMefrjoVZiJFLQB2LKqqI= sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "requires": { + "callsites": "^3.0.0" + }, + "dev": true + }, + "parse-headers": { + "version": "2.0.5", + "resolved": "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha1-BpeT+TVqVACFcet/l2EVPmx3Dak= sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==", + "dev": true + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha1-naGee+6NEt/wUT7Vt2lXeTvC6NQ= sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha1-UTvb4tO5XXdi6METfvoZXGxhtbM= sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18= sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w==", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha1-+8EUtgykKzDZ2vWFjkvWi77bZzU= sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==", + "dev": true + }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha1-hTTnenfOesWiUS6iHg/bj89sPY0= sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true + }, + "pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha1-3YIqoIh1gOUvGgOdw+2hCO+uMHU= sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "dev": true + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha1-O6ODNzNkbZ0+SZWUbBNlpn+wekI= sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", + "dev": true + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI= sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz", + "integrity": "sha1-foz42PW48jnBvGi+tOt4Vn1XLvg= sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha1-8Z/mnOqzEe65S0LnDowgcPm6ECU= sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "requires": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "dev": true + }, + "psl": { + "version": "1.9.0", + "resolved": "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz", + "integrity": "sha1-0N8qE38AeUVl/K87LADNCfjVpac= sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", + "dev": true + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz", + "integrity": "sha1-tKIRaBW94vTh6mAjVOjHVWUQemQ= sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + }, + "dev": true + }, + "punycode": { + "version": "2.3.0", + "resolved": "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha1-9n+mfJTaj00M//mBruQRgGQZm48= sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true + }, + "qs": { + "version": "6.11.0", + "resolved": "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz", + "integrity": "sha1-/Q2WNEb3pl4TZ+AavYVClFPww3o= sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "requires": { + "side-channel": "^1.0.4" + }, + "dev": true + }, + "query-string": { + "version": "5.1.1", + "resolved": "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz", + "integrity": "sha1-p4wBK3HBfgXy4/ojGd0zBoLvs8s= sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", + "requires": { + "decode-uri-component": "^0.2.0", + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + }, + "dev": true + }, + "quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha1-NmST5rPkKjpoheLpnRj4D7eoyTI= sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha1-32+ENy8CcNxlzfYpE0mrekc9Tyo= sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "requires": { + "safe-buffer": "^5.1.0" + }, + "dev": true + }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha1-PPNwI9GZ4cJNGlW4SADC8+ZGgDE= sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true + }, + "raw-body": { + "version": "2.5.2", + "resolved": "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha1-mf69g7kOCJdQh+jx+UGaFJNmtoo= sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "requires": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "dev": true + }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha1-VqmzbqllwAxak+8x6xEaDxEFaWc= sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "dev": true + }, + "readdirp": { + "version": "3.5.0", + "resolved": "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha1-m6dMAZsV02UnjS6Ru4xI17TULJ4= sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "requires": { + "picomatch": "^2.2.1" + }, + "dev": true + }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha1-BCWido2PI7rXDKS5BGH6LxIT4bI= sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true + }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz", + "integrity": "sha1-1zyRhzHLWofaBH4gcjQUb2ZNErM= sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "qs": { + "version": "6.5.3", + "resolved": "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz", + "integrity": "sha1-Ou7/yRln7241wOSI70b7KWq3aq0= sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "dev": true + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4= sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true + } + }, + "dev": true + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I= sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha1-iaf92TgmEmcxjq/hT5wy5ZjDaQk= sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug==", + "dev": true + }, + "resolve": { + "version": "1.22.1", + "resolved": "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha1-J8suu1P5GrtJRwqSi7p1WAZqwXc= sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "dev": true + }, + "resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha1-t629rDVGqq7CC0Xn2CZZJwcnJvk= sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", + "dev": true + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha1-SrzYUq0y3Xuqv+m0DgCjbbXzkuY= sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "responselike": { + "version": "2.0.1", + "resolved": "https://registry.yarnpkg.com/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha1-mgvI/cJS8/scymiwFlkQWboUIrw= sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", + "requires": { + "lowercase-keys": "^2.0.0" + }, + "dev": true + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368= sha512-6IzJLuGi4+R14vwagDHX+JrXmPVtPpn4mffDJ1UdR7/Edm87fl6yi8mMBIVvFtJaNTUvjughmW4hwLhRG7gC1Q==", + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + }, + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho= sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "requires": { + "glob": "^7.1.3" + }, + "dev": true + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha1-ocGm9iR1FXe6XQeRTLyShQWFiQw= sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + }, + "dev": true + }, + "rlp": { + "version": "2.2.7", + "resolved": "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz", + "integrity": "sha1-M/McSvrIESSsSyg+K9TZcgswvq8= sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==", + "requires": { + "bn.js": "^5.2.0" + }, + "dev": true + }, + "run-async": { + "version": "2.4.1", + "resolved": "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha1-hEDsz5nqPnC9QJ1JqriOEMGJpFU= sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true + }, + "rxjs": { + "version": "6.6.7", + "resolved": "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha1-kKwBisq/SRv2UEQjXVhjxNq4BMk= sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "requires": { + "tslib": "^1.9.0" + }, + "dev": true + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha1-Hq+fqb2x/dTsdfWPnNtOa3gn7sY= sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo= sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha1-0xSlfCrvadGtmKE4oh/p6vqe4xI= sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==", + "dev": true + }, + "secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha1-xFWezRuNPBgn7S0blBkNac4mcwM= sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", + "requires": { + "elliptic": "^6.5.4", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + }, + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz", + "integrity": "sha1-qVT5Ma66UI0we78Gnv8MAclhFvc= sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "send": { + "version": "0.18.0", + "resolved": "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz", + "integrity": "sha1-ZwFnzGVLBfWqSnZ/kRO7NxvHBr4= sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "requires": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "dependencies": { + "ms": { + "version": "2.1.3", + "resolved": "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz", + "integrity": "sha1-V0yBOM4dK1hh8LRFedut1gxmFbI= sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + } + }, + "dev": true + }, + "serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha1-eIbshIBJpGJGepfT2Rjrsqr5NPQ= sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "requires": { + "randombytes": "^2.1.0" + }, + "dev": true + }, + "serve-static": { + "version": "1.15.0", + "resolved": "https://registry.yarnpkg.com/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha1-+q7wjP/goaYvYMrQxOUTz/CslUA= sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "dev": true + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.yarnpkg.com/servify/-/servify-0.1.12.tgz", + "integrity": "sha1-FCq3vuHx0DO2bQcHCGCFsXwG25U= sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + }, + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc= sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "dev": true + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "dev": true + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha1-ZsmiSnP5/CjL5msJ/tPTPcrxtCQ= sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha1-N6XPC4HsvGlD3hCbopYNGyZYSuc= sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "requires": { + "shebang-regex": "^1.0.0" + }, + "dev": true + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "dev": true + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha1-785cj9wQTudRslxY1CkAEfpeos8= sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "dev": true + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha1-qaF2f4r4QVURTqq9c/mSc8j1mtk= sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha1-9Gl2CCujXCJj8cirXt/ibEHJVS8= sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "dev": true + }, + "simple-get": { + "version": "2.8.2", + "resolved": "https://registry.yarnpkg.com/simple-get/-/simple-get-2.8.2.tgz", + "integrity": "sha1-Vwj7CRnUQGVzJs1f59JZnQdwUBk= sha512-Ijd/rV5o+mSBBs4F/x9oDPtTx9Zb6X9brmnXvMW4J7IR15ngi9q5xxqWBKU744jTZiaXtxaPL7uHG6vtN8kUkw==", + "requires": { + "decompress-response": "^3.3.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + }, + "dependencies": { + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M= sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==", + "requires": { + "mimic-response": "^1.0.0" + }, + "dev": true + } + }, + "dev": true + }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha1-UA6N0P1VsFgVCGJVsxla3ypF/ms= sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0= sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + } + }, + "dev": true + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "sshpk": { + "version": "1.17.0", + "resolved": "https://registry.yarnpkg.com/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha1-V4CC2S1P5hKxMAdJblQ/oPvL5MU= sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "dev": true + }, + "statuses": { + "version": "2.0.1", + "resolved": "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha1-VcsADM8dSHKL0jxoWgY5mM8aG2M= sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4= sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.1", + "resolved": "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha1-Ej1keekq1FrYl9QFTjx8p9tJROE= sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8= sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", + "requires": { + "ansi-regex": "^3.0.0" + }, + "dev": true + } + }, + "dev": true + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha1-QvEUWUpGzxqOMLCoT1bHjD7awh4= sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + }, + "dev": true + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha1-nibGPTD1NEPpSJSVshBdN7Z6hdk= sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + }, + "dev": true + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==", + "dev": true + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428= sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", + "requires": { + "is-hex-prefixed": "1.0.0" + }, + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha1-MfEoGzgyYwQ0gxwxDAHMzajL4AY= sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha1-zW/BfihQDP9WwbhsCn/UpUpzAFw= sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "requires": { + "has-flag": "^4.0.0" + }, + "dev": true + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha1-btpL00SjyUrqN21MwxvHcxEDngk= sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "swarm-js": { + "version": "0.1.42", + "resolved": "https://registry.yarnpkg.com/swarm-js/-/swarm-js-0.1.42.tgz", + "integrity": "sha1-SXmVxi32aW9uIjcvRXEg5D5yeXk= sha512-BV7c/dVlA3R6ya1lMlSSNPLYrntt0LUq4YMgy3iwpCIc6rZnS5W2wUoctarZ5pXlpKtxDDf9hNziEkcfrxdhqQ==", + "requires": { + "bluebird": "^3.5.0", + "buffer": "^5.0.5", + "eth-lib": "^0.1.26", + "fs-extra": "^4.0.2", + "got": "^11.8.5", + "mime-types": "^2.1.16", + "mkdirp-promise": "^5.0.1", + "mock-fs": "^4.1.0", + "setimmediate": "^1.0.5", + "tar": "^4.0.2", + "xhr-request": "^1.0.1" + }, + "dependencies": { + "@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha1-tKkUu2LnwnLU5Zif5EQPgSqx2Ac= sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "requires": { + "defer-to-connect": "^2.0.0" + }, + "dev": true + }, + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha1-d1s/J477uXGO7HNh9IP7Nvu/6og= sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "dev": true + }, + "cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha1-WmuGWyxENXvj1evCpGewMnGacAU= sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", + "dev": true + }, + "eth-lib": { + "version": "0.1.29", + "resolved": "https://registry.yarnpkg.com/eth-lib/-/eth-lib-0.1.29.tgz", + "integrity": "sha1-DBH1Bg1C2p+THqthmQhHNPTb0dk= sha512-bfttrr3/7gG4E02HoWTDUcDDslN003OlOoBxk9virpAZQ1ja/jDgwkWB8QfJF7ojuEowrqy+lzp9VcJG7/k5bQ==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + }, + "dev": true + }, + "got": { + "version": "11.8.6", + "resolved": "https://registry.yarnpkg.com/got/-/got-11.8.6.tgz", + "integrity": "sha1-J26Cfq2Hcu3bz8lxcFkLhBgjIzo= sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", + "requires": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + }, + "dev": true + }, + "http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha1-uPVeDB8l1OvQizsMLAeflZCACz0= sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "requires": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + }, + "dev": true + }, + "p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha1-qrf71BZYL6MqPbSYWcEiSHxe0s8= sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", + "dev": true + } + }, + "dev": true + }, + "table": { + "version": "6.8.1", + "resolved": "https://registry.yarnpkg.com/table/-/table-6.8.1.tgz", + "integrity": "sha1-6itxNZ/gOwF6X7wpYgRHEVgIC98= sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", + "requires": { + "ajv": "^8.0.1", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "dependencies": { + "ajv": { + "version": "8.12.0", + "resolved": "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha1-0aBScyPiL1NWLFZ8AJkVd9++GdE= sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "dev": true + }, + "ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha1-Fk2qyHqy1vbbOimHXi0XZlgtq+0= sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0= sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha1-rnvLNlard6c7pcSb9lTzjmtoYOI= sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha1-InZ74htirxCBV0MG9prFG2IgOWE= sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha1-jJpTb+tq/JYr36WxBKUJHBrZwK4= sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + }, + "dev": true + } + }, + "dev": true + }, + "tar": { + "version": "4.4.19", + "resolved": "https://registry.yarnpkg.com/tar/-/tar-4.4.19.tgz", + "integrity": "sha1-Lk1yY98m8rkU3uEMglqxMhI3QvM= sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==", + "requires": { + "chownr": "^1.1.4", + "fs-minipass": "^1.2.7", + "minipass": "^2.9.0", + "minizlib": "^1.3.3", + "mkdirp": "^0.5.5", + "safe-buffer": "^5.2.1", + "yallist": "^3.1.1" + }, + "dev": true + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8= sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA==", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha1-bTQzWIl2jSGyvNoKonfO07G/rfk= sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "requires": { + "os-tmpdir": "~1.0.2" + }, + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha1-FkjESq58jZiKMmAY7XL1tN0DkuQ= sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + }, + "dev": true + }, + "toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha1-O+NDIaiKgg7RvYDfqjPkefu43TU= sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha1-zZ+yoKodWhK0c72fuW+j3P9lreI= sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "dev": true + }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha1-zy04vcNKE0vK8QkcQfZhni9nLQA= sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "requires": { + "safe-buffer": "^5.0.1" + }, + "dev": true + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", + "dev": true + }, + "type": { + "version": "1.2.0", + "resolved": "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz", + "integrity": "sha1-hI3XaY2vo+VKbEeedZxLw/GIR6A= sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==", + "dev": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", + "requires": { + "prelude-ls": "~1.1.2" + }, + "dev": true + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha1-dkb7XxiHHPu3dJ5pvTmmOI63RQw= sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha1-G/IH9LKPkVg2ZstfvTJ4hzAc1fQ= sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha1-TlUs0F3wlGfcvE73Od6J8s83wTE= sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "dev": true + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha1-qX7nqf9CaRufeD/xvFES/j/KkIA= sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + }, + "dev": true + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha1-n+FTahCmZKZSZqHjzPhf02MCvJw= sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==", + "dev": true + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha1-tkb2m+OULavOzJ1mOcgNwQXvqmY= sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "dev": true + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha1-mxpSWVIlhZ5V9mnZKPiMbFfyp34= sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "requires": { + "punycode": "^2.1.0" + }, + "dev": true + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk= sha512-3AChu4NiXquPfeckE5R5cGdiHCMWJx1dwCWOmWIL4KHAziJNOFIYJlpGFeKDvwLPHovZRCxK3cYlwzqI9Vp+Gg==", + "dev": true + }, + "utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha1-19EOo5MYFxypgnGLa5ao0kQlcaI= sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "requires": { + "node-gyp-build": "^4.3.0" + }, + "dev": true + }, + "utf8": { + "version": "3.0.0", + "resolved": "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz", + "integrity": "sha1-8FLu0TZNaW52nvBYsYPfiMh/adE= sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==", + "dev": true + }, + "util": { + "version": "0.12.5", + "resolved": "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz", + "integrity": "sha1-XxemBZtz22GodWaHgaHCsTa9b7w= sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "requires": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + }, + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "dev": true + }, + "uuid": { + "version": "9.0.0", + "resolved": "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha1-WS9VBlACSjjOsMVi8vaqQ1dh77U= sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "dev": true + }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha1-LeGWGMZtwkfc+2+ZM4A12CRaLO4= sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, + "varint": { + "version": "5.0.2", + "resolved": "https://registry.yarnpkg.com/varint/-/varint-5.0.2.tgz", + "integrity": "sha1-W0f4qUfrZouEjgNNz6h9D/in96Q= sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==", + "dev": true + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "dev": true + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + }, + "dependencies": { + "extsprintf": { + "version": "1.4.1", + "resolved": "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.1.tgz", + "integrity": "sha1-jRcsBkhn8jXAyEpZaAbSeb9LzAc= sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA==", + "dev": true + } + }, + "dev": true + }, + "web3": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3/-/web3-1.8.2.tgz", + "integrity": "sha1-laTlOY/Q8BMlJkv45ejNxpp6/oY= sha512-92h0GdEHW9wqDICQQKyG4foZBYi0OQkyg4CRml2F7XBl/NG+fu9o6J19kzfFXzSBoA4DnJXbyRgj/RHZv5LRiw==", + "requires": { + "web3-bzz": "1.8.2", + "web3-core": "1.8.2", + "web3-eth": "1.8.2", + "web3-eth-personal": "1.8.2", + "web3-net": "1.8.2", + "web3-shh": "1.8.2", + "web3-utils": "1.8.2" + }, + "dev": true + }, + "web3-bzz": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-bzz/-/web3-bzz-1.8.2.tgz", + "integrity": "sha1-Z+ocd1h0BWJQ7s5VHe0ikF7Qh4Q= sha512-1EEnxjPnFnvNWw3XeeKuTR8PBxYd0+XWzvaLK7OJC/Go9O8llLGxrxICbKV+8cgIE0sDRBxiYx02X+6OhoAQ9w==", + "requires": { + "@types/node": "^12.12.6", + "got": "12.1.0", + "swarm-js": "^0.1.40" + }, + "dependencies": { + "@types/node": { + "version": "12.20.55", + "resolved": "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz", + "integrity": "sha1-wynL1DTEIWT4RrkJvW+FtVN/YkA= sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "dev": true + } + }, + "dev": true + }, + "web3-core": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-core/-/web3-core-1.8.2.tgz", + "integrity": "sha1-Mz6T14crGjbv51jti4mnrL3ZYsI= sha512-DJTVEAYcNqxkqruJE+Rxp3CIv0y5AZMwPHQmOkz/cz+MM75SIzMTc0AUdXzGyTS8xMF8h3YWMQGgGEy8SBf1PQ==", + "requires": { + "@types/bn.js": "^5.1.0", + "@types/node": "^12.12.6", + "bignumber.js": "^9.0.0", + "web3-core-helpers": "1.8.2", + "web3-core-method": "1.8.2", + "web3-core-requestmanager": "1.8.2", + "web3-utils": "1.8.2" + }, + "dependencies": { + "@types/node": { + "version": "12.20.55", + "resolved": "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz", + "integrity": "sha1-wynL1DTEIWT4RrkJvW+FtVN/YkA= sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "dev": true + } + }, + "dev": true + }, + "web3-core-helpers": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-core-helpers/-/web3-core-helpers-1.8.2.tgz", + "integrity": "sha1-ggZlYPgIXmx7k7zI6ItEEonqn58= sha512-6B1eLlq9JFrfealZBomd1fmlq1o4A09vrCVQSa51ANoib/jllT3atZrRDr0zt1rfI7TSZTZBXdN/aTdeN99DWw==", + "requires": { + "web3-eth-iban": "1.8.2", + "web3-utils": "1.8.2" + }, + "dev": true + }, + "web3-core-method": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-core-method/-/web3-core-method-1.8.2.tgz", + "integrity": "sha1-ul7GgITpA/BRZBUBBHdhi+AX6sI= sha512-1qnr5mw5wVyULzLOrk4B+ryO3gfGjGd/fx8NR+J2xCGLf1e6OSjxT9vbfuQ3fErk/NjSTWWreieYWLMhaogcRA==", + "requires": { + "@ethersproject/transactions": "^5.6.2", + "web3-core-helpers": "1.8.2", + "web3-core-promievent": "1.8.2", + "web3-core-subscriptions": "1.8.2", + "web3-utils": "1.8.2" + }, + "dev": true + }, + "web3-core-promievent": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-core-promievent/-/web3-core-promievent-1.8.2.tgz", + "integrity": "sha1-5nDWtEU2Mubs/ZrYLaRPd6wVhck= sha512-nvkJWDVgoOSsolJldN33tKW6bKKRJX3MCPDYMwP5SUFOA/mCzDEoI88N0JFofDTXkh1k7gOqp1pvwi9heuaxGg==", + "requires": { + "eventemitter3": "4.0.4" + }, + "dev": true + }, + "web3-core-requestmanager": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-core-requestmanager/-/web3-core-requestmanager-1.8.2.tgz", + "integrity": "sha1-3aleg8pICJSWEqQeVOzqVX947yY= sha512-p1d090RYs5Mu7DK1yyc3GCBVZB/03rBtFhYFoS2EruGzOWs/5Q0grgtpwS/DScdRAm8wB8mYEBhY/RKJWF6B2g==", + "requires": { + "util": "^0.12.5", + "web3-core-helpers": "1.8.2", + "web3-providers-http": "1.8.2", + "web3-providers-ipc": "1.8.2", + "web3-providers-ws": "1.8.2" + }, + "dev": true + }, + "web3-core-subscriptions": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-core-subscriptions/-/web3-core-subscriptions-1.8.2.tgz", + "integrity": "sha1-DIvUlDnYPG8KA8cPALJKkVpwpe0= sha512-vXQogHDmAIQcKpXvGiMddBUeP9lnKgYF64+yQJhPNE5PnWr1sAibXuIPV7mIPihpFr/n/DORRj6Wh1pUv9zaTw==", + "requires": { + "eventemitter3": "4.0.4", + "web3-core-helpers": "1.8.2" + }, + "dev": true + }, + "web3-eth": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-eth/-/web3-eth-1.8.2.tgz", + "integrity": "sha1-hWIoeuGAPDDrVNx9gyCS5XOc4Go= sha512-JoTiWWc4F4TInpbvDUGb0WgDYJsFhuIjJlinc5ByjWD88Gvh+GKLsRjjFdbqe5YtwIGT4NymwoC5LQd1K6u/QQ==", + "requires": { + "web3-core": "1.8.2", + "web3-core-helpers": "1.8.2", + "web3-core-method": "1.8.2", + "web3-core-subscriptions": "1.8.2", + "web3-eth-abi": "1.8.2", + "web3-eth-accounts": "1.8.2", + "web3-eth-contract": "1.8.2", + "web3-eth-ens": "1.8.2", + "web3-eth-iban": "1.8.2", + "web3-eth-personal": "1.8.2", + "web3-net": "1.8.2", + "web3-utils": "1.8.2" + }, + "dev": true + }, + "web3-eth-abi": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-eth-abi/-/web3-eth-abi-1.8.2.tgz", + "integrity": "sha1-FuHpvkDiUnQE8EGkdFERIRSI8xo= sha512-Om9g3kaRNjqiNPAgKwGT16y+ZwtBzRe4ZJFGjLiSs6v5I7TPNF+rRMWuKnR6jq0azQZDj6rblvKFMA49/k48Og==", + "requires": { + "@ethersproject/abi": "^5.6.3", + "web3-utils": "1.8.2" + }, + "dev": true + }, + "web3-eth-accounts": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-eth-accounts/-/web3-eth-accounts-1.8.2.tgz", + "integrity": "sha1-uJT11RWPyuQp2kLeddllINBxKXE= sha512-c367Ij63VCz9YdyjiHHWLFtN85l6QghgwMQH2B1eM/p9Y5lTlTX7t/Eg/8+f1yoIStXbk2w/PYM2lk+IkbqdLA==", + "requires": { + "@ethereumjs/common": "2.5.0", + "@ethereumjs/tx": "3.3.2", + "eth-lib": "0.2.8", + "ethereumjs-util": "^7.1.5", + "scrypt-js": "^3.0.1", + "uuid": "^9.0.0", + "web3-core": "1.8.2", + "web3-core-helpers": "1.8.2", + "web3-core-method": "1.8.2", + "web3-utils": "1.8.2" + }, + "dev": true + }, + "web3-eth-contract": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-eth-contract/-/web3-eth-contract-1.8.2.tgz", + "integrity": "sha1-U4i3Ewkj0reQwJpCA5GoExKoZ/s= sha512-ID5A25tHTSBNwOPjiXSVzxruz006ULRIDbzWTYIFTp7NJ7vXu/kynKK2ag/ObuTqBpMbobP8nXcA9b5EDkIdQA==", + "requires": { + "@types/bn.js": "^5.1.0", + "web3-core": "1.8.2", + "web3-core-helpers": "1.8.2", + "web3-core-method": "1.8.2", + "web3-core-promievent": "1.8.2", + "web3-core-subscriptions": "1.8.2", + "web3-eth-abi": "1.8.2", + "web3-utils": "1.8.2" + }, + "dev": true + }, + "web3-eth-ens": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-eth-ens/-/web3-eth-ens-1.8.2.tgz", + "integrity": "sha1-Cghq1NkZEC4ouf0wNt8kat2d8io= sha512-PWph7C/CnqdWuu1+SH4U4zdrK4t2HNt0I4XzPYFdv9ugE8EuojselioPQXsVGvjql+Nt3jDLvQvggPqlMbvwRw==", + "requires": { + "content-hash": "^2.5.2", + "eth-ens-namehash": "2.0.8", + "web3-core": "1.8.2", + "web3-core-helpers": "1.8.2", + "web3-core-promievent": "1.8.2", + "web3-eth-abi": "1.8.2", + "web3-eth-contract": "1.8.2", + "web3-utils": "1.8.2" + }, + "dev": true + }, + "web3-eth-iban": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-eth-iban/-/web3-eth-iban-1.8.2.tgz", + "integrity": "sha1-XLMCIjSxOYbwhjU7U/A3mogf7q8= sha512-h3vNblDWkWMuYx93Q27TAJz6lhzpP93EiC3+45D6xoz983p6si773vntoQ+H+5aZhwglBtoiBzdh7PSSOnP/xQ==", + "requires": { + "bn.js": "^5.2.1", + "web3-utils": "1.8.2" + }, + "dev": true + }, + "web3-eth-personal": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-eth-personal/-/web3-eth-personal-1.8.2.tgz", + "integrity": "sha1-NSbB66pOe/OgqOx3408GfMmnULI= sha512-Vg4HfwCr7doiUF/RC+Jz0wT4+cYaXcOWMAW2AHIjHX6Z7Xwa8nrURIeQgeEE62qcEHAzajyAdB1u6bJyTfuCXw==", + "requires": { + "@types/node": "^12.12.6", + "web3-core": "1.8.2", + "web3-core-helpers": "1.8.2", + "web3-core-method": "1.8.2", + "web3-net": "1.8.2", + "web3-utils": "1.8.2" + }, + "dependencies": { + "@types/node": { + "version": "12.20.55", + "resolved": "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz", + "integrity": "sha1-wynL1DTEIWT4RrkJvW+FtVN/YkA= sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "dev": true + } + }, + "dev": true + }, + "web3-net": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-net/-/web3-net-1.8.2.tgz", + "integrity": "sha1-l+HgAV+rxM2jEBeBPpjQtUaN0E8= sha512-1itkDMGmbgb83Dg9nporFes9/fxsU7smJ3oRXlFkg4ZHn8YJyP1MSQFPJWWwSc+GrcCFt4O5IrUTvEkHqE3xag==", + "requires": { + "web3-core": "1.8.2", + "web3-core-method": "1.8.2", + "web3-utils": "1.8.2" + }, + "dev": true + }, + "web3-providers-http": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-providers-http/-/web3-providers-http-1.8.2.tgz", + "integrity": "sha1-+9o6O7yNsASvNukb7DX4AnOzeIU= sha512-2xY94IIEQd16+b+vIBF4IC1p7GVaz9q4EUFscvMUjtEq4ru4Atdzjs9GP+jmcoo49p70II0UV3bqQcz0TQfVyQ==", + "requires": { + "abortcontroller-polyfill": "^1.7.3", + "cross-fetch": "^3.1.4", + "es6-promise": "^4.2.8", + "web3-core-helpers": "1.8.2" + }, + "dev": true + }, + "web3-providers-ipc": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-providers-ipc/-/web3-providers-ipc-1.8.2.tgz", + "integrity": "sha1-5SpyUPQMg7maJILsW0zycoN3rlw= sha512-p6fqKVGFg+WiXGHWnB1hu43PbvPkDHTz4RgoEzbXugv5rtv5zfYLqm8Ba6lrJOS5ks9kGKR21a0y3NzE3u7V4w==", + "requires": { + "oboe": "2.1.5", + "web3-core-helpers": "1.8.2" + }, + "dev": true + }, + "web3-providers-ws": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-providers-ws/-/web3-providers-ws-1.8.2.tgz", + "integrity": "sha1-VqK3AThwEaypFUykvAbqS18n5O8= sha512-3s/4K+wHgbiN+Zrp9YjMq2eqAF6QGABw7wFftPdx+m5hWImV27/MoIx57c6HffNRqZXmCHnfWWFCNHHsi7wXnA==", + "requires": { + "eventemitter3": "4.0.4", + "web3-core-helpers": "1.8.2", + "websocket": "^1.0.32" + }, + "dev": true + }, + "web3-shh": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-shh/-/web3-shh-1.8.2.tgz", + "integrity": "sha1-IXpBfw1uJD3U1EGEj/wr0WTOqKA= sha512-uZ+3MAoNcaJsXXNCDnizKJ5viBNeHOFYsCbFhV755Uu52FswzTOw6DtE7yK9nYXMtIhiSgi7nwl1RYzP8pystw==", + "requires": { + "web3-core": "1.8.2", + "web3-core-method": "1.8.2", + "web3-core-subscriptions": "1.8.2", + "web3-net": "1.8.2" + }, + "dev": true + }, + "web3-utils": { + "version": "1.8.2", + "resolved": "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.8.2.tgz", + "integrity": "sha1-wy3sXpuVWsurIg7v13FbxUC3XMk= sha512-v7j6xhfLQfY7xQDrUP0BKbaNrmZ2/+egbqP9q3KYmOiPpnvAfol+32slgL0WX/5n8VPvKCK5EZ1HGrAVICSToA==", + "requires": { + "bn.js": "^5.2.1", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "dev": true + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true + }, + "websocket": { + "version": "1.0.34", + "resolved": "https://registry.yarnpkg.com/websocket/-/websocket-1.0.34.tgz", + "integrity": "sha1-K9wmAsCL8sgiU7cwZVwO99yrMRE= sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==", + "requires": { + "bufferutil": "^4.0.1", + "debug": "^2.2.0", + "es5-ext": "^0.10.50", + "typedarray-to-buffer": "^3.1.5", + "utf-8-validate": "^5.0.2", + "yaeti": "^0.0.6" + }, + "dev": true + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0= sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + }, + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz", + "integrity": "sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE= sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + }, + "dev": true + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==", + "dev": true + }, + "which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha1-MHz4mAJYSM+ZXnlehCPH8zfvveY= sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + }, + "dev": true + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha1-rgdOa9wMFKQx6ATmJFScYzsABFc= sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "requires": { + "string-width": "^1.0.2 || 2" + }, + "dev": true + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha1-YQY29rH3A4kb00dxzLF/uTtHB5w= sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "workerpool": { + "version": "6.1.0", + "resolved": "https://registry.yarnpkg.com/workerpool/-/workerpool-6.1.0.tgz", + "integrity": "sha1-qOA4tMlFaVloUt56jqQiju/es3s= sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg==", + "dev": true + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= sha512-vAaEaDM946gbNpH5pLVNR+vX2ht6n0Bt3GXwVB1AuAqZosOvHNF3P7wDnh8KLkSqgUh0uh77le7Owgoz+Z9XBw==", + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8= sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs= sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "requires": { + "number-is-nan": "^1.0.0" + }, + "dev": true + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "requires": { + "ansi-regex": "^2.0.0" + }, + "dev": true + } + }, + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz", + "integrity": "sha1-CADhRSO5I6OH5BUSPIZWFqrg9cM= sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "requires": { + "mkdirp": "^0.5.1" + }, + "dev": true + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz", + "integrity": "sha1-8c+E/i1ekB686U767OeF8YeiKPI= sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0= sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + } + }, + "dev": true + }, + "xhr": { + "version": "2.6.0", + "resolved": "https://registry.yarnpkg.com/xhr/-/xhr-2.6.0.tgz", + "integrity": "sha1-tp1DleeStBc9a33wd/D8Xk4rJJ0= sha512-/eCGLb5rxjx5e3mF1A7s+pLlR6CGyqWN91fv1JgER5mVWg1MZmlhBvy9kjcsOdRk8RrIujotWyJamfyrp+WIcA==", + "requires": { + "global": "~4.4.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + }, + "dev": true + }, + "xhr-request": { + "version": "1.1.0", + "resolved": "https://registry.yarnpkg.com/xhr-request/-/xhr-request-1.1.0.tgz", + "integrity": "sha1-9KfBhoufGYcjRE2C3K4xdkPy4u0= sha512-Y7qzEaR3FDtL3fP30k9wO/e+FBnBByZeybKOhASsGP30NIkRAAkKD/sCnLvgEfAIEC1rcmK7YG8f4oEnIrrWzA==", + "requires": { + "buffer-to-arraybuffer": "^0.0.5", + "object-assign": "^4.1.1", + "query-string": "^5.0.1", + "simple-get": "^2.7.0", + "timed-out": "^4.0.1", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + }, + "dev": true + }, + "xhr-request-promise": { + "version": "0.1.3", + "resolved": "https://registry.yarnpkg.com/xhr-request-promise/-/xhr-request-promise-0.1.3.tgz", + "integrity": "sha1-LV9LFtjGyJO+l/GmKw7Uzzyl+Ww= sha512-YUBytBsuwgitWtdRzXDDkWAXzhdGB8bYm0sSzMPZT7Z2MBjMSTHFsyCT1yCRATY+XC69DUrQraRAEgcoCRaIPg==", + "requires": { + "xhr-request": "^1.1.0" + }, + "dev": true + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha1-u3J3n1+kZRhrH0OPZ0+jR/2121Q= sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true + }, + "y18n": { + "version": "4.0.3", + "resolved": "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha1-tfJZyCzW4zaSHv17/Yv1YN6e7t8= sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc= sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha1-27fa+b/YusmrRev2ArjLrQ1dCP0= sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha1-HIK/D2tqZur85+8w43b0mhJHf2Y= sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "dependencies": { + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha1-oCZe5lVHb8gHrqnfPfjfd4OAi08= sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + }, + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha1-T5RBKoLbMvNuOwuXQfipf+sDH34= sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha1-8Rb4Bk/pCz94RKOJl8C3UFEmnx0= sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha1-JpxxF9J7Ba0uU2gwqOyJXvnG0BA= sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "dev": true + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha1-Z+FFz/UQpqaYS98RUpEdadLrnkM= sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dev": true + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha1-f0k00PfKjFb5UxSTndzS3ZHOHVU= sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha1-LrfcOwKJcY/ClfNidThFxBoMlO4= sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true + } + }, + "dev": true + }, + "yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha1-tCiQ8UVmeW+Fro46JSkNIF8VSlQ= sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true + }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha1-8TH5ImkRrl2a04xDL+gJNmwjJes= sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "dependencies": { + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha1-qkcte/Zg6xXzSU79UxyrfypwmDc= sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true + } + }, + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha1-ApTrPe4FAo0x7hpfosVWpqrxChs= sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + } + } +} \ No newline at end of file diff --git a/@tornado/fixed-merkle-tree/package.json b/@tornado/fixed-merkle-tree/package.json new file mode 100644 index 0000000..94617f4 --- /dev/null +++ b/@tornado/fixed-merkle-tree/package.json @@ -0,0 +1,32 @@ +{ + "name": "@tornado/fixed-merkle-tree", + "version": "0.6.1-p1", + "description": "Fixed depth merkle tree implementation with sequential inserts", + "repository": { + "type": "git", + "url": "https://github.com/tornadocash/fixed-merkle-tree.git" + }, + "main": "index.js", + "scripts": { + "test": "mocha", + "lint": "eslint ." + }, + "keywords": [ + "merkle", + "tree", + "merkleTree" + ], + "author": "Roman Semenov ", + "license": "ISC", + "dependencies": { + "@tornado/circomlib": "workspace:*", + "@tornado/snarkjs": "workspace:*" + }, + "devDependencies": { + "babel-eslint": "^10.1.0", + "chai": "^4.2.0", + "eslint": "^7.5.0", + "mocha": "^8.1.0", + "typescript": "^5.0.2" + } +} diff --git a/@tornado/fixed-merkle-tree/src/merkleTree.js b/@tornado/fixed-merkle-tree/src/merkleTree.js new file mode 100644 index 0000000..ee93697 --- /dev/null +++ b/@tornado/fixed-merkle-tree/src/merkleTree.js @@ -0,0 +1,212 @@ +// keccak256("tornado") % BN254_FIELD_SIZE +const DEFAULT_ZERO = '21663839004416932945382355908790599225266501822907911457504978515578255421292' +const defaultHash = require('./mimc') + +// todo ensure consistent types in tree and inserted elements? +// todo make sha3 default hasher (and update tests) to get rid of mimc/snarkjs/circomlib dependency + +/** + * @callback hashFunction + * @param left Left leaf + * @param right Right leaf + */ +/** + * Merkle tree + */ +class MerkleTree { + /** + * Constructor + * @param {number} levels Number of levels in the tree + * @param {Array} [elements] Initial elements + * @param {Object} options + * @param {hashFunction} [options.hashFunction] Function used to hash 2 leaves + * @param [options.zeroElement] Value for non-existent leaves + */ + constructor(levels, elements = [], { hashFunction, zeroElement = DEFAULT_ZERO } = {}) { + this.levels = levels + this.capacity = 2 ** levels + if (elements.length > this.capacity) { + throw new Error('Tree is full') + } + this._hash = hashFunction || defaultHash + this.zeroElement = zeroElement + this._zeros = [] + this._zeros[0] = zeroElement + for (let i = 1; i <= levels; i++) { + this._zeros[i] = this._hash(this._zeros[i - 1], this._zeros[i - 1]) + } + this._layers = [] + this._layers[0] = elements.slice() + this._rebuild() + } + + _rebuild() { + for (let level = 1; level <= this.levels; level++) { + this._layers[level] = [] + for (let i = 0; i < Math.ceil(this._layers[level - 1].length / 2); i++) { + this._layers[level][i] = this._hash( + this._layers[level - 1][i * 2], + i * 2 + 1 < this._layers[level - 1].length + ? this._layers[level - 1][i * 2 + 1] + : this._zeros[level - 1], + ) + } + } + } + + /** + * Get tree root + * @returns {*} + */ + root() { + return this._layers[this.levels].length > 0 ? this._layers[this.levels][0] : this._zeros[this.levels] + } + + /** + * Insert new element into the tree + * @param element Element to insert + */ + insert(element) { + if (this._layers[0].length >= this.capacity) { + throw new Error('Tree is full') + } + this.update(this._layers[0].length, element) + } + + /** + * Insert multiple elements into the tree. + * @param {Array} elements Elements to insert + */ + bulkInsert(elements) { + if (!elements.length) { + return + } + + if (this._layers[0].length + elements.length > this.capacity) { + throw new Error('Tree is full') + } + // First we insert all elements except the last one + // updating only full subtree hashes (all layers where inserted element has odd index) + // the last element will update the full path to the root making the tree consistent again + for (let i = 0; i < elements.length - 1; i++) { + this._layers[0].push(elements[i]) + let level = 0 + let index = this._layers[0].length - 1 + while (index % 2 === 1) { + level++ + index >>= 1 + this._layers[level][index] = this._hash( + this._layers[level - 1][index * 2], + this._layers[level - 1][index * 2 + 1], + ) + } + } + this.insert(elements[elements.length - 1]) + } + + /** + * Change an element in the tree + * @param {number} index Index of element to change + * @param element Updated element value + */ + update(index, element) { + if (isNaN(Number(index)) || index < 0 || index > this._layers[0].length || index >= this.capacity) { + throw new Error('Insert index out of bounds: ' + index) + } + this._layers[0][index] = element + for (let level = 1; level <= this.levels; level++) { + index >>= 1 + this._layers[level][index] = this._hash( + this._layers[level - 1][index * 2], + index * 2 + 1 < this._layers[level - 1].length + ? this._layers[level - 1][index * 2 + 1] + : this._zeros[level - 1], + ) + } + } + + /** + * Get merkle path to a leaf + * @param {number} index Leaf index to generate path for + * @returns {{pathElements: Object[], pathIndex: number[]}} An object containing adjacent elements and left-right index + */ + path(index) { + if (isNaN(Number(index)) || index < 0 || index >= this._layers[0].length) { + throw new Error('Index out of bounds: ' + index) + } + const pathElements = [] + const pathIndices = [] + for (let level = 0; level < this.levels; level++) { + pathIndices[level] = index % 2 + pathElements[level] = + (index ^ 1) < this._layers[level].length ? this._layers[level][index ^ 1] : this._zeros[level] + index >>= 1 + } + return { + pathElements, + pathIndices, + } + } + + /** + * Find an element in the tree + * @param element An element to find + * @param comparator A function that checks leaf value equality + * @returns {number} Index if element is found, otherwise -1 + */ + indexOf(element, comparator) { + if (comparator) { + return this._layers[0].findIndex((el) => comparator(element, el)) + } else { + return this._layers[0].indexOf(element) + } + } + + /** + * Returns a copy of non-zero tree elements + * @returns {Object[]} + */ + elements() { + return this._layers[0].slice() + } + + /** + * Returns a copy of n-th zero elements array + * @returns {Object[]} + */ + zeros() { + return this._zeros.slice() + } + + /** + * Serialize entire tree state including intermediate layers into a plain object + * Deserializing it back will not require to recompute any hashes + * Elements are not converted to a plain type, this is responsibility of the caller + */ + serialize() { + return { + levels: this.levels, + _zeros: this._zeros, + _layers: this._layers, + } + } + + /** + * Deserialize data into a MerkleTree instance + * Make sure to provide the same hashFunction as was used in the source tree, + * otherwise the tree state will be invalid + * + * @param data + * @param hashFunction + * @returns {MerkleTree} + */ + static deserialize(data, hashFunction) { + const instance = Object.assign(Object.create(this.prototype), data) + instance._hash = hashFunction || defaultHash + instance.capacity = 2 ** instance.levels + instance.zeroElement = instance._zeros[0] + return instance + } +} + +module.exports = MerkleTree diff --git a/@tornado/fixed-merkle-tree/src/mimc.js b/@tornado/fixed-merkle-tree/src/mimc.js new file mode 100644 index 0000000..46f237d --- /dev/null +++ b/@tornado/fixed-merkle-tree/src/mimc.js @@ -0,0 +1,3 @@ +const { mimcsponge } = require('circomlib') +const { bigInt } = require('@tornado/snarkjs') +module.exports = (left, right) => mimcsponge.multiHash([bigInt(left), bigInt(right)]).toString() diff --git a/@tornado/fixed-merkle-tree/tsconfig.json b/@tornado/fixed-merkle-tree/tsconfig.json new file mode 100644 index 0000000..eabbd01 --- /dev/null +++ b/@tornado/fixed-merkle-tree/tsconfig.json @@ -0,0 +1,22 @@ +{ + // Change this to match your project + "include": ["src/**/*", "index.js"], + "exclude": ["node_modules"], + "compilerOptions": { + // Tells TypeScript to read JS files, as + // normally they are ignored as source files + "allowJs": true, + // Generate d.ts files + "declaration": true, + // This compiler run should + // only output d.ts files + "emitDeclarationOnly": true, + // Types should go into this directory. + // Removing this would place the .d.ts files + // next to the .js files + "outFile": "index.d.ts", + // go to js file when using IDE functions like + // "Go to Definition" in VSCode + "declarationMap": true + } +} \ No newline at end of file diff --git a/@tornado/snarkjs/.eslintrc.js b/@tornado/snarkjs/.eslintrc.js new file mode 100644 index 0000000..2f45ad9 --- /dev/null +++ b/@tornado/snarkjs/.eslintrc.js @@ -0,0 +1,33 @@ +module.exports = { + "plugins": [ + "mocha" + ], + "env": { + "es6": true, + "node": true, + "mocha": true + }, + "parserOptions": { + "ecmaVersion": 2017 + }, + "extends": "eslint:recommended", + "rules": { + "indent": [ + "error", + 4 + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "double" + ], + "semi": [ + "error", + "always" + ], + "mocha/no-exclusive-tests": "error" + } +}; diff --git a/@tornado/snarkjs/.gitignore b/@tornado/snarkjs/.gitignore new file mode 100644 index 0000000..2be8e00 --- /dev/null +++ b/@tornado/snarkjs/.gitignore @@ -0,0 +1,77 @@ +vk_proof.json +vk_verifier.json + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# next.js build output +.next + +tmp + +.DS_Store + +# yarn v3 +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions \ No newline at end of file diff --git a/@tornado/snarkjs/COPYING b/@tornado/snarkjs/COPYING new file mode 100644 index 0000000..9cecc1d --- /dev/null +++ b/@tornado/snarkjs/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/@tornado/snarkjs/README.md b/@tornado/snarkjs/README.md new file mode 100644 index 0000000..581a45a --- /dev/null +++ b/@tornado/snarkjs/README.md @@ -0,0 +1,138 @@ +# @T-Hax/snarkjs + +This repository serves to configure the equivalent Tornado Cash repository for npm publishing. Below the rest of the description. + +# snarkjs: JavaScript implementation of zkSNARKs. + +This is a JavaScript implementation of zkSNARK schemes. It allows the original 8points protocol +and the Groth Protocol (3 point only and 3 pairings) + +This library allows to do the trusted setup, generate proofs and verify the proofs. + +This library uses the compiled circuits generated by the jaz compiler. + +### Tutorial. + +A good starting point [is this tutorial](https://github.com/iden3/circom/blob/master/TUTORIAL.md) + +Also this [video](https://www.youtube.com/watch?v=-9TJa1hVsKA) is a good starting point. + +## Install. + +```sh +npm install snarkjs +``` + +## Usage from command line. + + +```sh +snarkjs --help +``` + +Will show all the info in how to use the cli. + +## Usage from javascript + + +### Import. + +```js +const zkSnark = require("snarkjs"); +``` + +### Load a circuit. + +```js +// "myCircuit.cir" is the output of the jaz compiler + +const circuitDef = JSON.parse(fs.readFileSync("myCircuit.cir", "utf8")); +const circuit = new zkSnark.Circuit(circuitDef); +``` + +### Inspect the circuit. + +```js + // `signalId` can always be a number or an alias string + + circuit.nConstraints; // number of constraints + circuit.nSignals; // number of signals + circuit.nPublic; // number of public signals (nOutputs + nPublicInputs) + + // The array of signals is always sorted in this order: + // [ 1, outputs, publicInputs, privateInputs, internalSignals, constants] + + // returns a,b and c coeficients of the `signalId` on a given `constraint` + circuit.a(constraint, signalId) + circuit.b(constraint, signalId) + circuit.c(constraint, signalId) + + circuit.nOutputs // number of public outputs + circuit.pubInputs // number of public inputs + circuit.nPrvInputs // number of private inputs + circuit.nInputs // number of inputs ( nPublicInputs + nPrivateInputs) + circuit.nVars // number of variables ( not including constants (one is a variable) ) + circuit.nSignals // number of signals ( including constants ) + + circuit.outputIdx(i) // returns the index of the i'th output + circuit.inputIdx(i) // returns the index of the i'th input + circuit.pubInputIdx(i) // returns the index of the i'th public input + circuit.prvInputIdx(i) // returns the index of the i'th private input + circuit.varIdx(i) // returns the index of the i'th variable + circuit.constantIdx(i) // returns the index of the i'th constant + circuit.signalIdx(i) // returns the index of the i'th signal + + // returns signal Idx given a signalId + // if the idx >= n , it is a constant + // if the idx == -1, the signal does not exist + circuit.getSignalIdx(name); + + // returns an array aliases names of the i'th signal + circuit.signalNames(i) + + // input is a key value object where keys are the signal names + // of all the inputs (public and private) + // returns an array of values representing the witness + circuit.calculateWitness(input) +``` + +### Trusted setup. + +```js +const setup = zkSnark.setup(circuit); +fs.writeFileSync("myCircuit.vk_proof", JSON.stringify(setup.vk_proof), "utf8"); +fs.writeFileSync("myCircuit.vk_verifier", JSON.stringify(setup.vk_verifier), "utf8"); +setup.toxic // Must be discarded. +``` + +### Generate proof. + +```js +const circuitDef = JSON.parse(fs.readFileSync("myCircuit.cir", "utf8")); +const circuit = new zkSnark.Circuit(circuitDef); +const input = { + "main.pubIn1": "123", + "main.out1": "456" +} +const witness = circuit.calculateWitness(input); +const vk_proof = JSON.parse(fs.readFileSync("myCircuit.vk_proof", "utf8")); + +const {proof, publicSignals} = zkSnark.genProof(vk_proof, witness); +``` + +### Verifier. + +```js +const vk_verifier = JSON.parse(fs.readFileSync("myCircuit.vk_verifier", "utf8")); + +if (zkSnark.isValid(vk_verifier, proof, publicSignals)) { + console.log("The proof is valid"); +} else { + console.log("The proof is not valid"); +} +``` + +## License + +snarkjs is part of the iden3 project copyright 2018 0KIMS association and published with GPL-3 license. Please check the COPYING file for more details. + diff --git a/@tornado/snarkjs/cli.js b/@tornado/snarkjs/cli.js new file mode 100755 index 0000000..17f24cc --- /dev/null +++ b/@tornado/snarkjs/cli.js @@ -0,0 +1,544 @@ +#!/usr/bin/env node + +/* + Copyright 2018 0KIMS association. + + This file is part of jaz (Zero Knowledge Circuit Compiler). + + jaz is a free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + jaz is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with jaz. If not, see . +*/ + +/* eslint-disable no-console */ + +const fs = require("fs"); +const path = require("path"); + +const zkSnark = require("./index.js"); +const {stringifyBigInts, unstringifyBigInts} = require("./src/stringifybigint.js"); + + +const version = require("./package").version; + +const argv = require("yargs") + .version(version) + .usage(`snarkjs + +setup command +============= + + snarkjs setup