diff --git a/AltBn128.sol b/AltBn128.sol new file mode 100644 index 0000000..4ef6b6a --- /dev/null +++ b/AltBn128.sol @@ -0,0 +1,134 @@ +pragma solidity >=0.4.0 <0.6.0; + +/** + * Heavily referenced from https://github.com/ethereum/py_ecc/blob/master/py_ecc/bn128/bn128_curve.py +*/ + +library AltBn128 { + uint256 constant public G1x = uint256(0x01); + uint256 constant public G1y = uint256(0x02); + + // Number of elements in the field (often called `q`) + // n = n(u) = 36u^4 + 36u^3 + 18u^2 + 6u + 1 + uint256 constant public N = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001; + + // p = p(u) = 36u^4 + 36u^3 + 24u^2 + 6u + 1 + // Field Order + uint256 constant public P = 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47; + + // (p+1) / 4 + uint256 constant public A = 0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52; + + /* ECC Functions */ + function ecAdd(uint256[2] memory p0, uint256[2] memory p1) public view + returns (uint256[2] memory retP) + { + uint256[4] memory i = [p0[0], p0[1], p1[0], p1[1]]; + + assembly { + // call ecadd precompile + // inputs are: x1, y1, x2, y2 + if iszero(staticcall(not(0), 0x06, i, 0x80, retP, 0x40)) { + revert(0, 0) + } + } + } + + function ecMul(uint256[2] memory p, uint256 s) public view + returns (uint256[2] memory retP) + { + // With a public key (x, y), this computes p = scalar * (x, y). + uint256[3] memory i = [p[0], p[1], s]; + + assembly { + // call ecmul precompile + // inputs are: x, y, scalar + if iszero(staticcall(not(0), 0x07, i, 0x60, retP, 0x40)) { + revert(0, 0) + } + } + } + + function ecMulG(uint256 s) public view + returns (uint256[2] memory retP) + { + return ecMul([G1x, G1y], s); + } + + function powmod(uint256 base, uint256 e, uint256 m) public view + returns (uint256 o) + { + // returns pow(base, e) % m + assembly { + // define pointer + let p := mload(0x40) + + // Store data assembly-favouring ways + mstore(p, 0x20) // Length of Base + mstore(add(p, 0x20), 0x20) // Length of Exponent + mstore(add(p, 0x40), 0x20) // Length of Modulus + mstore(add(p, 0x60), base) // Base + mstore(add(p, 0x80), e) // Exponent + mstore(add(p, 0xa0), m) // Modulus + + // call modexp precompile! -- old school gas handling + let success := staticcall(sub(gas, 2000), 0x05, p, 0xc0, p, 0x20) + + // gas fiddling + switch success case 0 { + revert(0, 0) + } + + // data + o := mload(p) + } + } + + // Keep everything contained within this lib + function addmodn(uint256 x, uint256 n) public pure + returns (uint256) + { + return addmod(x, n, N); + } + + function modn(uint256 x) public pure + returns (uint256) + { + return x % N; + } + + /* + Checks if the points x, y exists on alt_bn_128 curve + */ + function onCurve(uint256 x, uint256 y) public pure + returns(bool) + { + uint256 beta = mulmod(x, x, P); + beta = mulmod(beta, x, P); + beta = addmod(beta, 3, P); + + return onCurveBeta(beta, y); + } + + function onCurveBeta(uint256 beta, uint256 y) public pure + returns(bool) + { + return beta == mulmod(y, y, P); + } + + /* + * Calculates point y value given x + */ + function evalCurve(uint256 x) public view + returns (uint256, uint256) + { + uint256 beta = mulmod(x, x, P); + beta = mulmod(beta, x, P); + beta = addmod(beta, 3, P); + + uint256 y = powmod(beta, A, P); + + // require(beta == mulmod(y, y, P), "Invalid x for evalCurve"); + return (beta, y); + } +} \ No newline at end of file diff --git a/Anonymous-e-voting b/Anonymous-e-voting deleted file mode 160000 index 392a831..0000000 --- a/Anonymous-e-voting +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 392a831ea573e07c943b9a04ad26e185a86671e8 diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..b5b9d6a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Fernando Lobato + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LSAG.sol b/LSAG.sol new file mode 100644 index 0000000..75913d7 --- /dev/null +++ b/LSAG.sol @@ -0,0 +1,158 @@ +pragma solidity >=0.4.0 <0.6.0; + +import "./AltBn128.sol"; + +/* +Linkable Spontaneous Anonymous Groups + +https://eprint.iacr.org/2004/027.pdf +*/ + +library LSAG { + // abi.encodePacked is the "concat" or "serialization" + // of all supplied arguments into one long bytes value + // i.e. abi.encodePacked :: [a] -> bytes + + /** + * Converts an integer to an elliptic curve point + */ + function intToPoint(uint256 _x) public view + returns (uint256[2] memory) + { + uint256 x = _x; + uint256 y; + uint256 beta; + + while (true) { + (beta, y) = AltBn128.evalCurve(x); + + if (AltBn128.onCurveBeta(beta, y)) { + return [x, y]; + } + + x = AltBn128.addmodn(x, 1); + } + } + + /** + * Returns an integer representation of the hash + * of the input + */ + function H1(bytes memory b) public pure + returns (uint256) + { + return AltBn128.modn(uint256(keccak256(b))); + } + + /** + * Returns elliptic curve point of the integer representation + * of the hash of the input + */ + function H2(bytes memory b) public view + returns (uint256[2] memory) + { + return intToPoint(H1(b)); + } + + /** + * Helper function to calculate Z1 + * Avoids stack too deep problem + */ + function ringCalcZ1( + uint256[2] memory pubKey, + uint256 c, + uint256 s + ) public view + returns (uint256[2] memory) + { + return AltBn128.ecAdd( + AltBn128.ecMulG(s), + AltBn128.ecMul(pubKey, c) + ); + } + + /** + * Helper function to calculate Z2 + * Avoids stack too deep problem + */ + function ringCalcZ2( + uint256[2] memory keyImage, + uint256[2] memory h, + uint256 s, + uint256 c + ) public view + returns (uint256[2] memory) + { + return AltBn128.ecAdd( + AltBn128.ecMul(h, s), + AltBn128.ecMul(keyImage, c) + ); + } + + + /** + * Verifies the ring signature + * Section 4.2 of the paper https://eprint.iacr.org/2004/027.pdf + */ + function verify( + bytes memory message, + uint256 c0, + uint256[2] memory keyImage, + uint256[] memory s, + uint256[2][] memory publicKeys + ) public view + returns (bool) + { + require(publicKeys.length >= 2, "Signature size too small"); + require(publicKeys.length == s.length, "Signature sizes do not match!"); + + uint256 c = c0; + uint256 i = 0; + + // Step 1 + // Extract out public key bytes + bytes memory hBytes = ""; + + require(1==0, "Working till this point"); + for (i = 0; i < publicKeys.length; i++) { + hBytes = abi.encodePacked( + hBytes, + publicKeys[i] + ); + } + + uint256[2] memory h = H2(hBytes); + + // Step 2 + uint256[2] memory z_1; + uint256[2] memory z_2; + + + for (i = 0; i < publicKeys.length; i++) { + z_1 = ringCalcZ1(publicKeys[i], c, s[i]); + z_2 = ringCalcZ2(keyImage, h, s[i], c); + + if (i != publicKeys.length - 1) { + c = H1( + abi.encodePacked( + hBytes, + keyImage, + message, + z_1, + z_2 + ) + ); + } + } + + return c0 == H1( + abi.encodePacked( + hBytes, + keyImage, + message, + z_1, + z_2 + ) + ); + } +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a6d6b3b --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Anonymous EVoting diff --git a/__init__.py b/__init__.py new file mode 100755 index 0000000..49fc863 --- /dev/null +++ b/__init__.py @@ -0,0 +1,4 @@ +import sys +import os + +sys.path.insert(0, os.path.realpath('./ecc_linkable_ring_signatures')) \ No newline at end of file diff --git a/build/contracts/AltBn128.json b/build/contracts/AltBn128.json new file mode 100644 index 0000000..0ba92c5 --- /dev/null +++ b/build/contracts/AltBn128.json @@ -0,0 +1,7008 @@ +{ + "contractName": "AltBn128", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "P", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "G1y", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "G1x", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "N", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "A", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "p0", + "type": "uint256[2]" + }, + { + "name": "p1", + "type": "uint256[2]" + } + ], + "name": "ecAdd", + "outputs": [ + { + "name": "retP", + "type": "uint256[2]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "p", + "type": "uint256[2]" + }, + { + "name": "s", + "type": "uint256" + } + ], + "name": "ecMul", + "outputs": [ + { + "name": "retP", + "type": "uint256[2]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "s", + "type": "uint256" + } + ], + "name": "ecMulG", + "outputs": [ + { + "name": "retP", + "type": "uint256[2]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "base", + "type": "uint256" + }, + { + "name": "e", + "type": "uint256" + }, + { + "name": "m", + "type": "uint256" + } + ], + "name": "powmod", + "outputs": [ + { + "name": "o", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "x", + "type": "uint256" + }, + { + "name": "n", + "type": "uint256" + } + ], + "name": "addmodn", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "x", + "type": "uint256" + } + ], + "name": "modn", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "x", + "type": "uint256" + }, + { + "name": "y", + "type": "uint256" + } + ], + "name": "onCurve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "beta", + "type": "uint256" + }, + { + "name": "y", + "type": "uint256" + } + ], + "name": "onCurveBeta", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "x", + "type": "uint256" + } + ], + "name": "evalCurve", + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"name\":\"base\",\"type\":\"uint256\"},{\"name\":\"e\",\"type\":\"uint256\"},{\"name\":\"m\",\"type\":\"uint256\"}],\"name\":\"powmod\",\"outputs\":[{\"name\":\"o\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"s\",\"type\":\"uint256\"}],\"name\":\"ecMulG\",\"outputs\":[{\"name\":\"retP\",\"type\":\"uint256[2]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"modn\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"x\",\"type\":\"uint256\"},{\"name\":\"y\",\"type\":\"uint256\"}],\"name\":\"onCurve\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"p\",\"type\":\"uint256[2]\"},{\"name\":\"s\",\"type\":\"uint256\"}],\"name\":\"ecMul\",\"outputs\":[{\"name\":\"retP\",\"type\":\"uint256[2]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"beta\",\"type\":\"uint256\"},{\"name\":\"y\",\"type\":\"uint256\"}],\"name\":\"onCurveBeta\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"P\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"G1y\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"p0\",\"type\":\"uint256[2]\"},{\"name\":\"p1\",\"type\":\"uint256[2]\"}],\"name\":\"ecAdd\",\"outputs\":[{\"name\":\"retP\",\"type\":\"uint256[2]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"G1x\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"evalCurve\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"N\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"x\",\"type\":\"uint256\"},{\"name\":\"n\",\"type\":\"uint256\"}],\"name\":\"addmodn\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"A\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{},\"notice\":\"Heavily referenced from https://github.com/ethereum/py_ecc/blob/master/py_ecc/bn128/bn128_curve.py\"}},\"settings\":{\"compilationTarget\":{\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/AltBn128.sol\":\"AltBn128\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/AltBn128.sol\":{\"keccak256\":\"0x7f2a04ce897b704ff86ef183077997a99149a7dc00d5c83270b651e2297169ea\",\"urls\":[\"bzzr://df6a6c3aff1ad2854afb736b3e24af3e7d74084afd72d3241e8add0760c69dce\"]}},\"version\":1}", + "bytecode": "0x610a05610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100f45760003560e01c8063a1807b9c11610096578063c690219b11610070578063c690219b14610482578063c9e525df146104cb578063e76ee242146104e9578063f446c1d014610535576100f4565b8063a1807b9c14610364578063a867d0ca14610382578063b93af8e014610464576100f4565b8063669d9448116100d2578063669d9448146101fb57806371de37241461024b57806381dd69fe146102f65780638b8fbd9214610346576100f4565b8063309ef832146100f957806345c373181461014f5780634f06f279146101b9575b600080fd5b6101396004803603606081101561010f57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050610553565b6040518082815260200191505060405180910390f35b61017b6004803603602081101561016557600080fd5b81019080803590602001909291905050506105aa565b6040518082600260200280838360005b838110156101a657808201518184015260208101905061018b565b5050505090500191505060405180910390f35b6101e5600480360360208110156101cf57600080fd5b81019080803590602001909291905050506105d9565b6040518082815260200191505060405180910390f35b6102316004803603604081101561021157600080fd5b81019080803590602001909291908035906020019092919050505061060c565b604051808215151515815260200191505060405180910390f35b6102b86004803603606081101561026157600080fd5b8101908080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050509192919290803590602001909291905050506106aa565b6040518082600260200280838360005b838110156102e35780820151818401526020810190506102c8565b5050505090500191505060405180910390f35b61032c6004803603604081101561030c57600080fd5b810190808035906020019092919080359060200190929190505050610715565b604051808215151515815260200191505060405180910390f35b61034e61074c565b6040518082815260200191505060405180910390f35b61036c610770565b6040518082815260200191505060405180910390f35b6104266004803603608081101561039857600080fd5b8101908080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f820116905080830192505050505050919291929080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050509192919290505050610775565b6040518082600260200280838360005b83811015610451578082015181840152602081019050610436565b5050505090500191505060405180910390f35b61046c610808565b6040518082815260200191505060405180910390f35b6104ae6004803603602081101561049857600080fd5b810190808035906020019092919050505061080d565b604051808381526020018281526020019250505060405180910390f35b6104d36108f6565b6040518082815260200191505060405180910390f35b61051f600480360360408110156104ff57600080fd5b81019080803590602001909291908035906020019092919050505061091a565b6040518082815260200191505060405180910390f35b61053d61094f565b6040518082815260200191505060405180910390f35b600060405160208152602080820152602060408201528460608201528360808201528260a082015260208160c08360056107d05a03fa80600081146105975761059c565b600080fd5b508151925050509392505050565b6105b2610973565b6105d26040518060400160405280600181526020016002815250836106aa565b9050919050565b60007f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001828161060457fe5b069050919050565b6000807f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061063757fe5b84850990507f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061066457fe5b84820990507f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061069157fe5b6003820890506106a18184610715565b91505092915050565b6106b2610973565b6106ba610995565b6040518060600160405280856000600281106106d257fe5b60200201518152602001856001600281106106e957fe5b602002015181526020018481525090506040826060836007600019fa61070e57600080fd5b5092915050565b60007f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061073f57fe5b8283098314905092915050565b7f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4781565b600281565b61077d610973565b6107856109b7565b60405180608001604052808560006002811061079d57fe5b60200201518152602001856001600281106107b457fe5b60200201518152602001846000600281106107cb57fe5b60200201518152602001846001600281106107e257fe5b602002015181525090506040826080836006600019fa61080157600080fd5b5092915050565b600181565b60008060007f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061083a57fe5b84850990507f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061086757fe5b84820990507f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061089457fe5b60038208905060006108e7827f0c19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47610553565b90508181935093505050915091565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000181565b60007f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000018061094457fe5b828408905092915050565b7f0c19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f5281565b6040518060400160405280600290602082028038833980820191505090505090565b6040518060600160405280600390602082028038833980820191505090505090565b604051806080016040528060049060208202803883398082019150509050509056fea165627a7a7230582098438052835814d0ed4ca87193aac06da64292050ef30a067f77f0abd77bde4b0029", + "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100f45760003560e01c8063a1807b9c11610096578063c690219b11610070578063c690219b14610482578063c9e525df146104cb578063e76ee242146104e9578063f446c1d014610535576100f4565b8063a1807b9c14610364578063a867d0ca14610382578063b93af8e014610464576100f4565b8063669d9448116100d2578063669d9448146101fb57806371de37241461024b57806381dd69fe146102f65780638b8fbd9214610346576100f4565b8063309ef832146100f957806345c373181461014f5780634f06f279146101b9575b600080fd5b6101396004803603606081101561010f57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050610553565b6040518082815260200191505060405180910390f35b61017b6004803603602081101561016557600080fd5b81019080803590602001909291905050506105aa565b6040518082600260200280838360005b838110156101a657808201518184015260208101905061018b565b5050505090500191505060405180910390f35b6101e5600480360360208110156101cf57600080fd5b81019080803590602001909291905050506105d9565b6040518082815260200191505060405180910390f35b6102316004803603604081101561021157600080fd5b81019080803590602001909291908035906020019092919050505061060c565b604051808215151515815260200191505060405180910390f35b6102b86004803603606081101561026157600080fd5b8101908080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050509192919290803590602001909291905050506106aa565b6040518082600260200280838360005b838110156102e35780820151818401526020810190506102c8565b5050505090500191505060405180910390f35b61032c6004803603604081101561030c57600080fd5b810190808035906020019092919080359060200190929190505050610715565b604051808215151515815260200191505060405180910390f35b61034e61074c565b6040518082815260200191505060405180910390f35b61036c610770565b6040518082815260200191505060405180910390f35b6104266004803603608081101561039857600080fd5b8101908080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f820116905080830192505050505050919291929080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050509192919290505050610775565b6040518082600260200280838360005b83811015610451578082015181840152602081019050610436565b5050505090500191505060405180910390f35b61046c610808565b6040518082815260200191505060405180910390f35b6104ae6004803603602081101561049857600080fd5b810190808035906020019092919050505061080d565b604051808381526020018281526020019250505060405180910390f35b6104d36108f6565b6040518082815260200191505060405180910390f35b61051f600480360360408110156104ff57600080fd5b81019080803590602001909291908035906020019092919050505061091a565b6040518082815260200191505060405180910390f35b61053d61094f565b6040518082815260200191505060405180910390f35b600060405160208152602080820152602060408201528460608201528360808201528260a082015260208160c08360056107d05a03fa80600081146105975761059c565b600080fd5b508151925050509392505050565b6105b2610973565b6105d26040518060400160405280600181526020016002815250836106aa565b9050919050565b60007f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001828161060457fe5b069050919050565b6000807f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061063757fe5b84850990507f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061066457fe5b84820990507f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061069157fe5b6003820890506106a18184610715565b91505092915050565b6106b2610973565b6106ba610995565b6040518060600160405280856000600281106106d257fe5b60200201518152602001856001600281106106e957fe5b602002015181526020018481525090506040826060836007600019fa61070e57600080fd5b5092915050565b60007f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061073f57fe5b8283098314905092915050565b7f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd4781565b600281565b61077d610973565b6107856109b7565b60405180608001604052808560006002811061079d57fe5b60200201518152602001856001600281106107b457fe5b60200201518152602001846000600281106107cb57fe5b60200201518152602001846001600281106107e257fe5b602002015181525090506040826080836006600019fa61080157600080fd5b5092915050565b600181565b60008060007f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061083a57fe5b84850990507f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061086757fe5b84820990507f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd478061089457fe5b60038208905060006108e7827f0c19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f527f30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47610553565b90508181935093505050915091565b7f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f000000181565b60007f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000018061094457fe5b828408905092915050565b7f0c19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f5281565b6040518060400160405280600290602082028038833980820191505090505090565b6040518060600160405280600390602082028038833980820191505090505090565b604051806080016040528060049060208202803883398082019150509050509056fea165627a7a7230582098438052835814d0ed4ca87193aac06da64292050ef30a067f77f0abd77bde4b0029", + "sourceMap": "144:4383:0:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24", + "deployedSourceMap": "144:4383:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2488:914;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2488:914:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;2354:128;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2354:128:0;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;2354:128:0;;;;;;;;;;;;;;;;3583:96;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3583:96:0;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;3759:232;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3759:232:0;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1889:459;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1889:459:0;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;1889:459:0;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1889:459:0;;;;;;;;;;;;;;;;3997:131;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3997:131:0;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1227:94;;;:::i;:::-;;;;;;;;;;;;;;;;;;;901:43;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1469:414;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;1469:414:0;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;1469:414:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;1469:414:0;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1469:414:0;;;;;;;;;;;;;;;;852:43;;;:::i;:::-;;;;;;;;;;;;;;;;;;;4187:338;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;4187:338:0;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;1058:94;;;:::i;:::-;;;;;;;;;;;;;;;;;;;3457:120;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3457:120:0;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1345:93;;;:::i;:::-;;;;;;;;;;;;;;;;;;;2488:914;2569:9;2698:4;2692:11;2777:4;2774:1;2767:15;2846:4;2839;2836:1;2832:12;2825:26;2908:4;2901;2898:1;2894:12;2887:26;2969:4;2962;2959:1;2955:12;2948:26;3017:1;3010:4;3007:1;3003:12;2996:23;3069:1;3062:4;3059:1;3055:12;3048:23;3226:4;3223:1;3217:4;3214:1;3208:4;3201;3196:3;3192:14;3181:50;3280:7;3293:1;3288:51;;;;3273:66;;3288:51;3323:1;3320;3313:12;3273:66;;3384:1;3378:8;3373:13;;2639:757;;;;;;;:::o;2354:128::-;2410:22;;:::i;:::-;2455:20;;;;;;;;;890:4;2455:20;;;;939:4;2455:20;;;2473:1;2455:5;:20::i;:::-;2448:27;;2354:128;;;:::o;3583:96::-;3637:7;1086:66;3667:1;:5;;;;;;3660:12;;3583:96;;;:::o;3759:232::-;3826:4;3846:12;1255:66;3861:15;;;;;3871:1;3868;3861:15;3846:30;;1255:66;3893:18;;;;;3906:1;3900:4;3893:18;3886:25;;1255:66;3928:18;;;;;3941:1;3935:4;3928:18;3921:25;;3964:20;3976:4;3982:1;3964:11;:20::i;:::-;3957:27;;;3759:232;;;;:::o;1889:459::-;1965:22;;:::i;:::-;2075:19;;:::i;:::-;:37;;;;;;;;2098:1;2100;2098:4;;;;;;;;;;;2075:37;;;;2104:1;2106;2104:4;;;;;;;;;;;2075:37;;;;2110:1;2075:37;;;;;2281:4;2275;2269;2266:1;2260:4;2256:1;2252:6;2241:45;2231:2;;2316:1;2313;2306:12;2231:2;2140:202;;;;;:::o;3997:131::-;4071:4;1255:66;4106:15;;;;;4116:1;4113;4106:15;4098:4;:23;4091:30;;3997:131;;;;:::o;1227:94::-;1255:66;1227:94;:::o;901:43::-;939:4;901:43;:::o;1469:414::-;1557:22;;:::i;:::-;1595:19;;:::i;:::-;:50;;;;;;;;1618:2;1621:1;1618:5;;;;;;;;;;;1595:50;;;;1625:2;1628:1;1625:5;;;;;;;;;;;1595:50;;;;1632:2;1635:1;1632:5;;;;;;;;;;;1595:50;;;;1639:2;1642:1;1639:5;;;;;;;;;;;1595:50;;;;;1816:4;1810;1804;1801:1;1795:4;1791:1;1787:6;1776:45;1766:2;;1851:1;1848;1841:12;1766:2;1673:204;;;;;:::o;852:43::-;890:4;852:43;:::o;4187:338::-;4246:7;4255;4278:12;1255:66;4293:15;;;;;4303:1;4300;4293:15;4278:30;;1255:66;4325:18;;;;;4338:1;4332:4;4325:18;4318:25;;1255:66;4360:18;;;;;4373:1;4367:4;4360:18;4353:25;;4389:9;4401:18;4408:4;1373:65;1255:66;4401:6;:18::i;:::-;4389:30;;4510:4;4516:1;4502:16;;;;;;4187:338;;;:::o;1058:94::-;1086:66;1058:94;:::o;3457:120::-;3525:7;1086:66;3555:15;;;;;3565:1;3562;3555:15;3548:22;;3457:120;;;;:::o;1345:93::-;1373:65;1345:93;:::o;144:4383::-;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;144:4383:0;;;;:::o;:::-;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;144:4383:0;;;;:::o;:::-;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;144:4383:0;;;;:::o", + "source": "pragma solidity >=0.4.0 <0.6.0;\n\n/** \n * Heavily referenced from https://github.com/ethereum/py_ecc/blob/master/py_ecc/bn128/bn128_curve.py\n*/\n\nlibrary AltBn128 {\n // uint256 constant public G1x = uint256(0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798);\n // uint256 constant public G1y = uint256(0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8);\n\n // // Number of elements in the field (often called `q`)\n // // n = n(u) = 36u^4 + 36u^3 + 18u^2 + 6u + 1\n // uint256 constant public N = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141;\n\n // // p = p(u) = 36u^4 + 36u^3 + 24u^2 + 6u + 1\n // // Field Order\n // uint256 constant public P = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F;\n\n // // (p+1) / 4\n // uint256 constant public A = 0x0;\n\n uint256 constant public G1x = uint256(0x01);\n uint256 constant public G1y = uint256(0x02);\n\n // Number of elements in the field (often called `q`)\n // n = n(u) = 36u^4 + 36u^3 + 18u^2 + 6u + 1\n uint256 constant public N = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001;\n\n // p = p(u) = 36u^4 + 36u^3 + 24u^2 + 6u + 1\n // Field Order\n uint256 constant public P = 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47;\n\n // (p+1) / 4\n uint256 constant public A = 0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52;\n\n /* ECC Functions */\n function ecAdd(uint256[2] memory p0, uint256[2] memory p1) public view\n returns (uint256[2] memory retP)\n {\n uint256[4] memory i = [p0[0], p0[1], p1[0], p1[1]];\n \n assembly {\n // call ecadd precompile\n // inputs are: x1, y1, x2, y2\n if iszero(staticcall(not(0), 0x06, i, 0x80, retP, 0x40)) {\n revert(0, 0)\n }\n }\n }\n\n function ecMul(uint256[2] memory p, uint256 s) public view\n returns (uint256[2] memory retP)\n {\n // With a public key (x, y), this computes p = scalar * (x, y).\n uint256[3] memory i = [p[0], p[1], s];\n \n assembly {\n // call ecmul precompile\n // inputs are: x, y, scalar\n if iszero(staticcall(not(0), 0x07, i, 0x60, retP, 0x40)) {\n revert(0, 0)\n }\n }\n }\n\n function ecMulG(uint256 s) public view\n returns (uint256[2] memory retP)\n {\n return ecMul([G1x, G1y], s);\n }\n\n function powmod(uint256 base, uint256 e, uint256 m) public view\n returns (uint256 o)\n {\n // returns pow(base, e) % m\n assembly {\n // define pointer\n let p := mload(0x40)\n\n // Store data assembly-favouring ways\n mstore(p, 0x20) // Length of Base\n mstore(add(p, 0x20), 0x20) // Length of Exponent\n mstore(add(p, 0x40), 0x20) // Length of Modulus\n mstore(add(p, 0x60), base) // Base\n mstore(add(p, 0x80), e) // Exponent\n mstore(add(p, 0xa0), m) // Modulus\n\n // call modexp precompile! -- old school gas handling\n let success := staticcall(sub(gas, 2000), 0x05, p, 0xc0, p, 0x20)\n\n // gas fiddling\n switch success case 0 {\n revert(0, 0)\n }\n\n // data\n o := mload(p)\n }\n }\n\n // Keep everything contained within this lib\n function addmodn(uint256 x, uint256 n) public pure\n returns (uint256)\n {\n return addmod(x, n, N);\n }\n\n function modn(uint256 x) public pure\n returns (uint256)\n {\n return x % N;\n }\n\n /*\n Checks if the points x, y exists on alt_bn_128 curve\n */\n function onCurve(uint256 x, uint256 y) public pure\n returns(bool)\n {\n uint256 beta = mulmod(x, x, P);\n beta = mulmod(beta, x, P);\n beta = addmod(beta, 3, P);\n\n return onCurveBeta(beta, y);\n }\n\n function onCurveBeta(uint256 beta, uint256 y) public pure\n returns(bool)\n {\n return beta == mulmod(y, y, P);\n }\n\n /*\n * Calculates point y value given x\n */\n function evalCurve(uint256 x) public view\n returns (uint256, uint256)\n {\n uint256 beta = mulmod(x, x, P);\n beta = mulmod(beta, x, P);\n beta = addmod(beta, 3, P);\n\n uint256 y = powmod(beta, A, P);\n\n // require(beta == mulmod(y, y, P), \"Invalid x for evalCurve\");\n return (beta, y);\n }\n}", + "sourcePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/AltBn128.sol", + "ast": { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/AltBn128.sol", + "exportedSymbols": { + "AltBn128": [ + 247 + ] + }, + "id": 248, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + ">=", + "0.4", + ".0", + "<", + "0.6", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:31:0" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": "Heavily referenced from https://github.com/ethereum/py_ecc/blob/master/py_ecc/bn128/bn128_curve.py", + "fullyImplemented": true, + "id": 247, + "linearizedBaseContracts": [ + 247 + ], + "name": "AltBn128", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": true, + "id": 6, + "name": "G1x", + "nodeType": "VariableDeclaration", + "scope": 247, + "src": "852:43:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "852:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "30783031", + "id": 4, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "890:4:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "0x01" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + } + ], + "id": 3, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "882:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": "uint256" + }, + "id": 5, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "882:13:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "public" + }, + { + "constant": true, + "id": 11, + "name": "G1y", + "nodeType": "VariableDeclaration", + "scope": 247, + "src": "901:43:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "901:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "30783032", + "id": 9, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "939:4:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "0x02" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + } + ], + "id": 8, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "931:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": "uint256" + }, + "id": 10, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "931:13:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "public" + }, + { + "constant": true, + "id": 14, + "name": "N", + "nodeType": "VariableDeclaration", + "scope": 247, + "src": "1058:94:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 12, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1058:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "307833303634346537326531333161303239623835303435623638313831353835643238333365383438373962393730393134336531663539336630303030303031", + "id": 13, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1086:66:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_21888242871839275222246405745257275088548364400416034343698204186575808495617_by_1", + "typeString": "int_const 2188...(69 digits omitted)...5617" + }, + "value": "0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001" + }, + "visibility": "public" + }, + { + "constant": true, + "id": 17, + "name": "P", + "nodeType": "VariableDeclaration", + "scope": 247, + "src": "1227:94:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 15, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1227:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "307833303634346537326531333161303239623835303435623638313831353835643937383136613931363837316361386433633230386331366438376366643437", + "id": 16, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1255:66:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_21888242871839275222246405745257275088696311157297823662689037894645226208583_by_1", + "typeString": "int_const 2188...(69 digits omitted)...8583" + }, + "value": "0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47" + }, + "visibility": "public" + }, + { + "constant": true, + "id": 20, + "name": "A", + "nodeType": "VariableDeclaration", + "scope": 247, + "src": "1345:93:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 18, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1345:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "3078633139313339636238346336383061366531343131366461303630353631373635653035616134356131633732613334663038323330356236316633663532", + "id": 19, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1373:65:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_5472060717959818805561601436314318772174077789324455915672259473661306552146_by_1", + "typeString": "int_const 5472...(68 digits omitted)...2146" + }, + "value": "0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52" + }, + "visibility": "public" + }, + { + "body": { + "id": 55, + "nodeType": "Block", + "src": "1585:298:0", + "statements": [ + { + "assignments": [ + 39 + ], + "declarations": [ + { + "constant": false, + "id": 39, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 55, + "src": "1595:19:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4]" + }, + "typeName": { + "baseType": { + "id": 37, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1595:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 38, + "length": { + "argumentTypes": null, + "hexValue": "34", + "id": 36, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1603:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "nodeType": "ArrayTypeName", + "src": "1595:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_storage_ptr", + "typeString": "uint256[4]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 53, + "initialValue": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 40, + "name": "p0", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "1618:2:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 42, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 41, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1621:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1618:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 43, + "name": "p0", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "1625:2:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 45, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 44, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1628:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1625:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 46, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 28, + "src": "1632:2:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 48, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 47, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1635:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1632:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 49, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 28, + "src": "1639:2:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 51, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 50, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1642:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1639:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 52, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1617:28:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1595:50:0" + }, + { + "externalReferences": [ + { + "i": { + "declaration": 39, + "isOffset": false, + "isSlot": false, + "src": "1801:1:0", + "valueSize": 1 + } + }, + { + "retP": { + "declaration": 33, + "isOffset": false, + "isSlot": false, + "src": "1810:4:0", + "valueSize": 1 + } + } + ], + "id": 54, + "nodeType": "InlineAssembly", + "operations": "{\n if iszero(staticcall(not(0), 0x06, i, 0x80, retP, 0x40))\n {\n revert(0, 0)\n }\n}", + "src": "1664:213:0" + } + ] + }, + "documentation": null, + "id": 56, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecAdd", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 29, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 24, + "name": "p0", + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "1484:20:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 21, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1484:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 23, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 22, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1492:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1484:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 28, + "name": "p1", + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "1506:20:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 25, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1506:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 27, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 26, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1514:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1506:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1483:44:0" + }, + "returnParameters": { + "id": 34, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 33, + "name": "retP", + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "1557:22:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 30, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1557:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 32, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 31, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1565:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1557:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1556:24:0" + }, + "scope": 247, + "src": "1469:414:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 84, + "nodeType": "Block", + "src": "1993:355:0", + "statements": [ + { + "assignments": [ + 73 + ], + "declarations": [ + { + "constant": false, + "id": 73, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 84, + "src": "2075:19:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3]" + }, + "typeName": { + "baseType": { + "id": 71, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2075:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 72, + "length": { + "argumentTypes": null, + "hexValue": "33", + "id": 70, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2083:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "nodeType": "ArrayTypeName", + "src": "2075:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_storage_ptr", + "typeString": "uint256[3]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 82, + "initialValue": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 74, + "name": "p", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 60, + "src": "2098:1:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 76, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 75, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2100:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2098:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 77, + "name": "p", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 60, + "src": "2104:1:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 79, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 78, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2106:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2104:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 80, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 62, + "src": "2110:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 81, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2097:15:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2075:37:0" + }, + { + "externalReferences": [ + { + "i": { + "declaration": 73, + "isOffset": false, + "isSlot": false, + "src": "2266:1:0", + "valueSize": 1 + } + }, + { + "retP": { + "declaration": 67, + "isOffset": false, + "isSlot": false, + "src": "2275:4:0", + "valueSize": 1 + } + } + ], + "id": 83, + "nodeType": "InlineAssembly", + "operations": "{\n if iszero(staticcall(not(0), 0x07, i, 0x60, retP, 0x40))\n {\n revert(0, 0)\n }\n}", + "src": "2131:211:0" + } + ] + }, + "documentation": null, + "id": 85, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecMul", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 63, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 60, + "name": "p", + "nodeType": "VariableDeclaration", + "scope": 85, + "src": "1904:19:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 57, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1904:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 59, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 58, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1912:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1904:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 62, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 85, + "src": "1925:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 61, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1925:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1903:32:0" + }, + "returnParameters": { + "id": 68, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 67, + "name": "retP", + "nodeType": "VariableDeclaration", + "scope": 85, + "src": "1965:22:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 64, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1965:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 66, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 65, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1973:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1965:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1964:24:0" + }, + "scope": 247, + "src": "1889:459:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 101, + "nodeType": "Block", + "src": "2438:44:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 95, + "name": "G1x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6, + "src": "2462:3:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 96, + "name": "G1y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "2467:3:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 97, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2461:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 98, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 87, + "src": "2473:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 94, + "name": "ecMul", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 85, + "src": "2455:5:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_array$_t_uint256_$2_memory_ptr_$_t_uint256_$returns$_t_array$_t_uint256_$2_memory_ptr_$", + "typeString": "function (uint256[2] memory,uint256) view returns (uint256[2] memory)" + } + }, + "id": 99, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2455:20:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "functionReturnParameters": 93, + "id": 100, + "nodeType": "Return", + "src": "2448:27:0" + } + ] + }, + "documentation": null, + "id": 102, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecMulG", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 88, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 87, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 102, + "src": "2370:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 86, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2370:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2369:11:0" + }, + "returnParameters": { + "id": 93, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 92, + "name": "retP", + "nodeType": "VariableDeclaration", + "scope": 102, + "src": "2410:22:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 89, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2410:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 91, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 90, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2418:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2410:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2409:24:0" + }, + "scope": 247, + "src": "2354:128:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 114, + "nodeType": "Block", + "src": "2584:818:0", + "statements": [ + { + "externalReferences": [ + { + "e": { + "declaration": 106, + "isOffset": false, + "isSlot": false, + "src": "3017:1:0", + "valueSize": 1 + } + }, + { + "m": { + "declaration": 108, + "isOffset": false, + "isSlot": false, + "src": "3069:1:0", + "valueSize": 1 + } + }, + { + "o": { + "declaration": 111, + "isOffset": false, + "isSlot": false, + "src": "3373:1:0", + "valueSize": 1 + } + }, + { + "base": { + "declaration": 104, + "isOffset": false, + "isSlot": false, + "src": "2969:4:0", + "valueSize": 1 + } + } + ], + "id": 113, + "nodeType": "InlineAssembly", + "operations": "{\n let p := mload(0x40)\n mstore(p, 0x20)\n mstore(add(p, 0x20), 0x20)\n mstore(add(p, 0x40), 0x20)\n mstore(add(p, 0x60), base)\n mstore(add(p, 0x80), e)\n mstore(add(p, 0xa0), m)\n let success := staticcall(sub(gas(), 2000), 0x05, p, 0xc0, p, 0x20)\n switch success\n case 0 {\n revert(0, 0)\n }\n o := mload(p)\n}", + "src": "2630:766:0" + } + ] + }, + "documentation": null, + "id": 115, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "powmod", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 109, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 104, + "name": "base", + "nodeType": "VariableDeclaration", + "scope": 115, + "src": "2504:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 103, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2504:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 106, + "name": "e", + "nodeType": "VariableDeclaration", + "scope": 115, + "src": "2518:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 105, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2518:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 108, + "name": "m", + "nodeType": "VariableDeclaration", + "scope": 115, + "src": "2529:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 107, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2529:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2503:36:0" + }, + "returnParameters": { + "id": 112, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 111, + "name": "o", + "nodeType": "VariableDeclaration", + "scope": 115, + "src": "2569:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 110, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2569:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2568:11:0" + }, + "scope": 247, + "src": "2488:914:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 130, + "nodeType": "Block", + "src": "3538:39:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 125, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 117, + "src": "3562:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 126, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 119, + "src": "3565:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 127, + "name": "N", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "3568:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 124, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "3555:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 128, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3555:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 123, + "id": 129, + "nodeType": "Return", + "src": "3548:22:0" + } + ] + }, + "documentation": null, + "id": 131, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "addmodn", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 120, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 117, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 131, + "src": "3474:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 116, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3474:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 119, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 131, + "src": "3485:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 118, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3485:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3473:22:0" + }, + "returnParameters": { + "id": 123, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 122, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 131, + "src": "3525:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 121, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3525:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3524:9:0" + }, + "scope": 247, + "src": "3457:120:0", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 142, + "nodeType": "Block", + "src": "3650:29:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 140, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 138, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 133, + "src": "3667:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "id": 139, + "name": "N", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "3671:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3667:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 137, + "id": 141, + "nodeType": "Return", + "src": "3660:12:0" + } + ] + }, + "documentation": null, + "id": 143, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "modn", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 134, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 133, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 143, + "src": "3597:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 132, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3597:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3596:11:0" + }, + "returnParameters": { + "id": 137, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 136, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 143, + "src": "3637:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 135, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3637:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3636:9:0" + }, + "scope": 247, + "src": "3583:96:0", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 181, + "nodeType": "Block", + "src": "3836:155:0", + "statements": [ + { + "assignments": [ + 153 + ], + "declarations": [ + { + "constant": false, + "id": 153, + "name": "beta", + "nodeType": "VariableDeclaration", + "scope": 181, + "src": "3846:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 152, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3846:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 159, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 155, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 145, + "src": "3868:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 156, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 145, + "src": "3871:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 157, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "3874:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 154, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2497, + "src": "3861:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 158, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3861:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3846:30:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 166, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 160, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 153, + "src": "3886:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 162, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 153, + "src": "3900:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 163, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 145, + "src": "3906:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 164, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "3909:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 161, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2497, + "src": "3893:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 165, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3893:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3886:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 167, + "nodeType": "ExpressionStatement", + "src": "3886:25:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 174, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 168, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 153, + "src": "3921:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 170, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 153, + "src": "3935:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "33", + "id": 171, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3941:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + { + "argumentTypes": null, + "id": 172, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "3944:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 169, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "3928:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 173, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3928:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3921:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 175, + "nodeType": "ExpressionStatement", + "src": "3921:25:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 177, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 153, + "src": "3976:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 178, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 147, + "src": "3982:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 176, + "name": "onCurveBeta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 200, + "src": "3964:11:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_bool_$", + "typeString": "function (uint256,uint256) pure returns (bool)" + } + }, + "id": 179, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3964:20:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 151, + "id": 180, + "nodeType": "Return", + "src": "3957:27:0" + } + ] + }, + "documentation": null, + "id": 182, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "onCurve", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 148, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 145, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 182, + "src": "3776:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 144, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3776:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 147, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 182, + "src": "3787:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 146, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3787:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3775:22:0" + }, + "returnParameters": { + "id": 151, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 150, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 182, + "src": "3826:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 149, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3826:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3825:6:0" + }, + "scope": 247, + "src": "3759:232:0", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 199, + "nodeType": "Block", + "src": "4081:47:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 197, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 191, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 184, + "src": "4098:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 193, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 186, + "src": "4113:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 194, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 186, + "src": "4116:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 195, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "4119:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 192, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2497, + "src": "4106:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4106:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4098:23:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 190, + "id": 198, + "nodeType": "Return", + "src": "4091:30:0" + } + ] + }, + "documentation": null, + "id": 200, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "onCurveBeta", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 187, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 184, + "name": "beta", + "nodeType": "VariableDeclaration", + "scope": 200, + "src": "4018:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 183, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4018:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 186, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 200, + "src": "4032:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 185, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4032:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4017:25:0" + }, + "returnParameters": { + "id": 190, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 189, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 200, + "src": "4071:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 188, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4071:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4070:6:0" + }, + "scope": 247, + "src": "3997:131:0", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 245, + "nodeType": "Block", + "src": "4268:257:0", + "statements": [ + { + "assignments": [ + 210 + ], + "declarations": [ + { + "constant": false, + "id": 210, + "name": "beta", + "nodeType": "VariableDeclaration", + "scope": 245, + "src": "4278:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 209, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4278:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 216, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 212, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "4300:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 213, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "4303:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 214, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "4306:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 211, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2497, + "src": "4293:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 215, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4293:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4278:30:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 223, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 217, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 210, + "src": "4318:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 219, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 210, + "src": "4332:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 220, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "4338:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 221, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "4341:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 218, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2497, + "src": "4325:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 222, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4325:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4318:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 224, + "nodeType": "ExpressionStatement", + "src": "4318:25:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 231, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 225, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 210, + "src": "4353:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 227, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 210, + "src": "4367:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "33", + "id": 228, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4373:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + { + "argumentTypes": null, + "id": 229, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "4376:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 226, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4360:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 230, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4360:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4353:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 232, + "nodeType": "ExpressionStatement", + "src": "4353:25:0" + }, + { + "assignments": [ + 234 + ], + "declarations": [ + { + "constant": false, + "id": 234, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 245, + "src": "4389:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 233, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4389:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 240, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 236, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 210, + "src": "4408:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 237, + "name": "A", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 20, + "src": "4414:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 238, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "4417:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 235, + "name": "powmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 115, + "src": "4401:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) view returns (uint256)" + } + }, + "id": 239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4401:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4389:30:0" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 241, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 210, + "src": "4510:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 242, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 234, + "src": "4516:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 243, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "4509:9:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 208, + "id": 244, + "nodeType": "Return", + "src": "4502:16:0" + } + ] + }, + "documentation": null, + "id": 246, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "evalCurve", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 203, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 202, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 246, + "src": "4206:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 201, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4206:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4205:11:0" + }, + "returnParameters": { + "id": 208, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 205, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 246, + "src": "4246:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 204, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4246:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 207, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 246, + "src": "4255:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 206, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4255:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4245:18:0" + }, + "scope": 247, + "src": "4187:338:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 248, + "src": "144:4383:0" + } + ], + "src": "0:4527:0" + }, + "legacyAST": { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/AltBn128.sol", + "exportedSymbols": { + "AltBn128": [ + 247 + ] + }, + "id": 248, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + ">=", + "0.4", + ".0", + "<", + "0.6", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:31:0" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": "Heavily referenced from https://github.com/ethereum/py_ecc/blob/master/py_ecc/bn128/bn128_curve.py", + "fullyImplemented": true, + "id": 247, + "linearizedBaseContracts": [ + 247 + ], + "name": "AltBn128", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": true, + "id": 6, + "name": "G1x", + "nodeType": "VariableDeclaration", + "scope": 247, + "src": "852:43:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "852:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "30783031", + "id": 4, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "890:4:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "0x01" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + } + ], + "id": 3, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "882:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": "uint256" + }, + "id": 5, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "882:13:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "public" + }, + { + "constant": true, + "id": 11, + "name": "G1y", + "nodeType": "VariableDeclaration", + "scope": 247, + "src": "901:43:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 7, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "901:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "30783032", + "id": 9, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "939:4:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "0x02" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + } + ], + "id": 8, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "931:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": "uint256" + }, + "id": 10, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "931:13:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "public" + }, + { + "constant": true, + "id": 14, + "name": "N", + "nodeType": "VariableDeclaration", + "scope": 247, + "src": "1058:94:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 12, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1058:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "307833303634346537326531333161303239623835303435623638313831353835643238333365383438373962393730393134336531663539336630303030303031", + "id": 13, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1086:66:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_21888242871839275222246405745257275088548364400416034343698204186575808495617_by_1", + "typeString": "int_const 2188...(69 digits omitted)...5617" + }, + "value": "0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001" + }, + "visibility": "public" + }, + { + "constant": true, + "id": 17, + "name": "P", + "nodeType": "VariableDeclaration", + "scope": 247, + "src": "1227:94:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 15, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1227:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "307833303634346537326531333161303239623835303435623638313831353835643937383136613931363837316361386433633230386331366438376366643437", + "id": 16, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1255:66:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_21888242871839275222246405745257275088696311157297823662689037894645226208583_by_1", + "typeString": "int_const 2188...(69 digits omitted)...8583" + }, + "value": "0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47" + }, + "visibility": "public" + }, + { + "constant": true, + "id": 20, + "name": "A", + "nodeType": "VariableDeclaration", + "scope": 247, + "src": "1345:93:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 18, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1345:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "3078633139313339636238346336383061366531343131366461303630353631373635653035616134356131633732613334663038323330356236316633663532", + "id": 19, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1373:65:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_5472060717959818805561601436314318772174077789324455915672259473661306552146_by_1", + "typeString": "int_const 5472...(68 digits omitted)...2146" + }, + "value": "0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52" + }, + "visibility": "public" + }, + { + "body": { + "id": 55, + "nodeType": "Block", + "src": "1585:298:0", + "statements": [ + { + "assignments": [ + 39 + ], + "declarations": [ + { + "constant": false, + "id": 39, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 55, + "src": "1595:19:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4]" + }, + "typeName": { + "baseType": { + "id": 37, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1595:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 38, + "length": { + "argumentTypes": null, + "hexValue": "34", + "id": 36, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1603:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "nodeType": "ArrayTypeName", + "src": "1595:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_storage_ptr", + "typeString": "uint256[4]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 53, + "initialValue": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 40, + "name": "p0", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "1618:2:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 42, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 41, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1621:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1618:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 43, + "name": "p0", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "1625:2:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 45, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 44, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1628:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1625:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 46, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 28, + "src": "1632:2:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 48, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 47, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1635:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1632:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 49, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 28, + "src": "1639:2:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 51, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 50, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1642:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1639:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 52, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1617:28:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1595:50:0" + }, + { + "externalReferences": [ + { + "i": { + "declaration": 39, + "isOffset": false, + "isSlot": false, + "src": "1801:1:0", + "valueSize": 1 + } + }, + { + "retP": { + "declaration": 33, + "isOffset": false, + "isSlot": false, + "src": "1810:4:0", + "valueSize": 1 + } + } + ], + "id": 54, + "nodeType": "InlineAssembly", + "operations": "{\n if iszero(staticcall(not(0), 0x06, i, 0x80, retP, 0x40))\n {\n revert(0, 0)\n }\n}", + "src": "1664:213:0" + } + ] + }, + "documentation": null, + "id": 56, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecAdd", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 29, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 24, + "name": "p0", + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "1484:20:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 21, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1484:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 23, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 22, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1492:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1484:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 28, + "name": "p1", + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "1506:20:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 25, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1506:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 27, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 26, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1514:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1506:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1483:44:0" + }, + "returnParameters": { + "id": 34, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 33, + "name": "retP", + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "1557:22:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 30, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1557:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 32, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 31, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1565:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1557:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1556:24:0" + }, + "scope": 247, + "src": "1469:414:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 84, + "nodeType": "Block", + "src": "1993:355:0", + "statements": [ + { + "assignments": [ + 73 + ], + "declarations": [ + { + "constant": false, + "id": 73, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 84, + "src": "2075:19:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3]" + }, + "typeName": { + "baseType": { + "id": 71, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2075:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 72, + "length": { + "argumentTypes": null, + "hexValue": "33", + "id": 70, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2083:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "nodeType": "ArrayTypeName", + "src": "2075:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_storage_ptr", + "typeString": "uint256[3]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 82, + "initialValue": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 74, + "name": "p", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 60, + "src": "2098:1:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 76, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 75, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2100:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2098:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 77, + "name": "p", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 60, + "src": "2104:1:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 79, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 78, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2106:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2104:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 80, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 62, + "src": "2110:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 81, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2097:15:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2075:37:0" + }, + { + "externalReferences": [ + { + "i": { + "declaration": 73, + "isOffset": false, + "isSlot": false, + "src": "2266:1:0", + "valueSize": 1 + } + }, + { + "retP": { + "declaration": 67, + "isOffset": false, + "isSlot": false, + "src": "2275:4:0", + "valueSize": 1 + } + } + ], + "id": 83, + "nodeType": "InlineAssembly", + "operations": "{\n if iszero(staticcall(not(0), 0x07, i, 0x60, retP, 0x40))\n {\n revert(0, 0)\n }\n}", + "src": "2131:211:0" + } + ] + }, + "documentation": null, + "id": 85, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecMul", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 63, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 60, + "name": "p", + "nodeType": "VariableDeclaration", + "scope": 85, + "src": "1904:19:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 57, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1904:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 59, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 58, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1912:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1904:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 62, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 85, + "src": "1925:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 61, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1925:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1903:32:0" + }, + "returnParameters": { + "id": 68, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 67, + "name": "retP", + "nodeType": "VariableDeclaration", + "scope": 85, + "src": "1965:22:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 64, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1965:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 66, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 65, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1973:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1965:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1964:24:0" + }, + "scope": 247, + "src": "1889:459:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 101, + "nodeType": "Block", + "src": "2438:44:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 95, + "name": "G1x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 6, + "src": "2462:3:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 96, + "name": "G1y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "2467:3:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 97, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2461:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 98, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 87, + "src": "2473:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 94, + "name": "ecMul", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 85, + "src": "2455:5:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_array$_t_uint256_$2_memory_ptr_$_t_uint256_$returns$_t_array$_t_uint256_$2_memory_ptr_$", + "typeString": "function (uint256[2] memory,uint256) view returns (uint256[2] memory)" + } + }, + "id": 99, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2455:20:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "functionReturnParameters": 93, + "id": 100, + "nodeType": "Return", + "src": "2448:27:0" + } + ] + }, + "documentation": null, + "id": 102, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecMulG", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 88, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 87, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 102, + "src": "2370:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 86, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2370:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2369:11:0" + }, + "returnParameters": { + "id": 93, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 92, + "name": "retP", + "nodeType": "VariableDeclaration", + "scope": 102, + "src": "2410:22:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 89, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2410:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 91, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 90, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2418:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2410:10:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2409:24:0" + }, + "scope": 247, + "src": "2354:128:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 114, + "nodeType": "Block", + "src": "2584:818:0", + "statements": [ + { + "externalReferences": [ + { + "e": { + "declaration": 106, + "isOffset": false, + "isSlot": false, + "src": "3017:1:0", + "valueSize": 1 + } + }, + { + "m": { + "declaration": 108, + "isOffset": false, + "isSlot": false, + "src": "3069:1:0", + "valueSize": 1 + } + }, + { + "o": { + "declaration": 111, + "isOffset": false, + "isSlot": false, + "src": "3373:1:0", + "valueSize": 1 + } + }, + { + "base": { + "declaration": 104, + "isOffset": false, + "isSlot": false, + "src": "2969:4:0", + "valueSize": 1 + } + } + ], + "id": 113, + "nodeType": "InlineAssembly", + "operations": "{\n let p := mload(0x40)\n mstore(p, 0x20)\n mstore(add(p, 0x20), 0x20)\n mstore(add(p, 0x40), 0x20)\n mstore(add(p, 0x60), base)\n mstore(add(p, 0x80), e)\n mstore(add(p, 0xa0), m)\n let success := staticcall(sub(gas(), 2000), 0x05, p, 0xc0, p, 0x20)\n switch success\n case 0 {\n revert(0, 0)\n }\n o := mload(p)\n}", + "src": "2630:766:0" + } + ] + }, + "documentation": null, + "id": 115, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "powmod", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 109, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 104, + "name": "base", + "nodeType": "VariableDeclaration", + "scope": 115, + "src": "2504:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 103, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2504:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 106, + "name": "e", + "nodeType": "VariableDeclaration", + "scope": 115, + "src": "2518:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 105, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2518:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 108, + "name": "m", + "nodeType": "VariableDeclaration", + "scope": 115, + "src": "2529:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 107, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2529:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2503:36:0" + }, + "returnParameters": { + "id": 112, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 111, + "name": "o", + "nodeType": "VariableDeclaration", + "scope": 115, + "src": "2569:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 110, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2569:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2568:11:0" + }, + "scope": 247, + "src": "2488:914:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 130, + "nodeType": "Block", + "src": "3538:39:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 125, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 117, + "src": "3562:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 126, + "name": "n", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 119, + "src": "3565:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 127, + "name": "N", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "3568:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 124, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "3555:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 128, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3555:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 123, + "id": 129, + "nodeType": "Return", + "src": "3548:22:0" + } + ] + }, + "documentation": null, + "id": 131, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "addmodn", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 120, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 117, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 131, + "src": "3474:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 116, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3474:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 119, + "name": "n", + "nodeType": "VariableDeclaration", + "scope": 131, + "src": "3485:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 118, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3485:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3473:22:0" + }, + "returnParameters": { + "id": 123, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 122, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 131, + "src": "3525:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 121, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3525:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3524:9:0" + }, + "scope": 247, + "src": "3457:120:0", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 142, + "nodeType": "Block", + "src": "3650:29:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 140, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 138, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 133, + "src": "3667:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "id": 139, + "name": "N", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "3671:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3667:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 137, + "id": 141, + "nodeType": "Return", + "src": "3660:12:0" + } + ] + }, + "documentation": null, + "id": 143, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "modn", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 134, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 133, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 143, + "src": "3597:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 132, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3597:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3596:11:0" + }, + "returnParameters": { + "id": 137, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 136, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 143, + "src": "3637:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 135, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3637:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3636:9:0" + }, + "scope": 247, + "src": "3583:96:0", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 181, + "nodeType": "Block", + "src": "3836:155:0", + "statements": [ + { + "assignments": [ + 153 + ], + "declarations": [ + { + "constant": false, + "id": 153, + "name": "beta", + "nodeType": "VariableDeclaration", + "scope": 181, + "src": "3846:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 152, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3846:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 159, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 155, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 145, + "src": "3868:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 156, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 145, + "src": "3871:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 157, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "3874:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 154, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2497, + "src": "3861:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 158, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3861:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3846:30:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 166, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 160, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 153, + "src": "3886:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 162, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 153, + "src": "3900:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 163, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 145, + "src": "3906:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 164, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "3909:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 161, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2497, + "src": "3893:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 165, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3893:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3886:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 167, + "nodeType": "ExpressionStatement", + "src": "3886:25:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 174, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 168, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 153, + "src": "3921:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 170, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 153, + "src": "3935:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "33", + "id": 171, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3941:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + { + "argumentTypes": null, + "id": 172, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "3944:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 169, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "3928:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 173, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3928:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3921:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 175, + "nodeType": "ExpressionStatement", + "src": "3921:25:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 177, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 153, + "src": "3976:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 178, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 147, + "src": "3982:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 176, + "name": "onCurveBeta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 200, + "src": "3964:11:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_bool_$", + "typeString": "function (uint256,uint256) pure returns (bool)" + } + }, + "id": 179, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3964:20:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 151, + "id": 180, + "nodeType": "Return", + "src": "3957:27:0" + } + ] + }, + "documentation": null, + "id": 182, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "onCurve", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 148, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 145, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 182, + "src": "3776:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 144, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3776:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 147, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 182, + "src": "3787:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 146, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3787:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3775:22:0" + }, + "returnParameters": { + "id": 151, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 150, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 182, + "src": "3826:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 149, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3826:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3825:6:0" + }, + "scope": 247, + "src": "3759:232:0", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 199, + "nodeType": "Block", + "src": "4081:47:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 197, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 191, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 184, + "src": "4098:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 193, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 186, + "src": "4113:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 194, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 186, + "src": "4116:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 195, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "4119:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 192, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2497, + "src": "4106:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4106:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4098:23:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 190, + "id": 198, + "nodeType": "Return", + "src": "4091:30:0" + } + ] + }, + "documentation": null, + "id": 200, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "onCurveBeta", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 187, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 184, + "name": "beta", + "nodeType": "VariableDeclaration", + "scope": 200, + "src": "4018:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 183, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4018:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 186, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 200, + "src": "4032:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 185, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4032:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4017:25:0" + }, + "returnParameters": { + "id": 190, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 189, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 200, + "src": "4071:4:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 188, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4071:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4070:6:0" + }, + "scope": 247, + "src": "3997:131:0", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 245, + "nodeType": "Block", + "src": "4268:257:0", + "statements": [ + { + "assignments": [ + 210 + ], + "declarations": [ + { + "constant": false, + "id": 210, + "name": "beta", + "nodeType": "VariableDeclaration", + "scope": 245, + "src": "4278:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 209, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4278:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 216, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 212, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "4300:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 213, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "4303:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 214, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "4306:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 211, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2497, + "src": "4293:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 215, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4293:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4278:30:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 223, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 217, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 210, + "src": "4318:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 219, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 210, + "src": "4332:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 220, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "4338:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 221, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "4341:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 218, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2497, + "src": "4325:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 222, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4325:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4318:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 224, + "nodeType": "ExpressionStatement", + "src": "4318:25:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 231, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 225, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 210, + "src": "4353:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 227, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 210, + "src": "4367:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "33", + "id": 228, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4373:1:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + { + "argumentTypes": null, + "id": 229, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "4376:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 226, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2484, + "src": "4360:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 230, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4360:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4353:25:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 232, + "nodeType": "ExpressionStatement", + "src": "4353:25:0" + }, + { + "assignments": [ + 234 + ], + "declarations": [ + { + "constant": false, + "id": 234, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 245, + "src": "4389:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 233, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4389:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 240, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 236, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 210, + "src": "4408:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 237, + "name": "A", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 20, + "src": "4414:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 238, + "name": "P", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "4417:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 235, + "name": "powmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 115, + "src": "4401:6:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) view returns (uint256)" + } + }, + "id": 239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4401:18:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4389:30:0" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 241, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 210, + "src": "4510:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 242, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 234, + "src": "4516:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 243, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "4509:9:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 208, + "id": 244, + "nodeType": "Return", + "src": "4502:16:0" + } + ] + }, + "documentation": null, + "id": 246, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "evalCurve", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 203, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 202, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 246, + "src": "4206:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 201, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4206:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4205:11:0" + }, + "returnParameters": { + "id": 208, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 205, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 246, + "src": "4246:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 204, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4246:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 207, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 246, + "src": "4255:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 206, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4255:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4245:18:0" + }, + "scope": 247, + "src": "4187:338:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 248, + "src": "144:4383:0" + } + ], + "src": "0:4527:0" + }, + "compiler": { + "name": "solc", + "version": "0.5.8+commit.23d335f2.Emscripten.clang" + }, + "networks": { + "1570892867630": { + "events": {}, + "links": {}, + "address": "0xB3D8962B6e2EE1Ea92e915437B05904c4BFb405a", + "transactionHash": "0x5dd59a0bd98c15e4d5f48eaf8ce2ea819eeebd3a930fe4a2c0313bfaa6c7231c" + }, + "1570921815108": { + "events": {}, + "links": {}, + "address": "0x4E85ebd453c75dd7ED5C47D35c6511fE9BfD6527", + "transactionHash": "0x7cb8e28586d64e5462e0f64e9d1ca77049764f7ac192a13849b92b4e375d6c8b" + }, + "1570922470877": { + "events": {}, + "links": {}, + "address": "0x3a2E75212344761155848563a43c7f1fb2C32ceD", + "transactionHash": "0xc953062d2c43c70aa76c5dfff383e8462031a825cc8498db1ecd9f6eda67b332" + }, + "1570923244533": { + "events": {}, + "links": {}, + "address": "0x952C306A57457C5Ab7d5b5fB7130c149deC76f66", + "transactionHash": "0xbc5f2ae87d72d1a243c5ccc1b5eb99e7deafa04a1bd62aa3010e8d2b34345a64" + } + }, + "schemaVersion": "3.0.16", + "updatedAt": "2019-10-12T23:34:13.055Z", + "devdoc": { + "methods": {} + }, + "userdoc": { + "methods": {}, + "notice": "Heavily referenced from https://github.com/ethereum/py_ecc/blob/master/py_ecc/bn128/bn128_curve.py" + } +} \ No newline at end of file diff --git a/build/contracts/EVoting.json b/build/contracts/EVoting.json new file mode 100644 index 0000000..653d909 --- /dev/null +++ b/build/contracts/EVoting.json @@ -0,0 +1,10917 @@ +{ + "contractName": "EVoting", + "abi": [ + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "constant": false, + "inputs": [ + { + "name": "_common", + "type": "address" + } + ], + "name": "setCommon", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "message", + "type": "uint256" + }, + { + "name": "c0", + "type": "uint256" + }, + { + "name": "keyImage", + "type": "uint256[2]" + }, + { + "name": "s", + "type": "uint256[]" + }, + { + "name": "pub_keys", + "type": "uint256[2][]" + } + ], + "name": "vote", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "winningProposal", + "outputs": [ + { + "name": "_winningProposal", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "x", + "type": "uint256" + } + ], + "name": "toBytes", + "outputs": [ + { + "name": "b", + "type": "bytes" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"winningProposal\",\"outputs\":[{\"name\":\"_winningProposal\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"toBytes\",\"outputs\":[{\"name\":\"b\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"message\",\"type\":\"uint256\"},{\"name\":\"c0\",\"type\":\"uint256\"},{\"name\":\"keyImage\",\"type\":\"uint256[2]\"},{\"name\":\"s\",\"type\":\"uint256[]\"},{\"name\":\"pub_keys\",\"type\":\"uint256[2][]\"}],\"name\":\"vote\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_common\",\"type\":\"address\"}],\"name\":\"setCommon\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{\"constructor\":\"Create a new ballot with $(_numProposals, Proposals[] prop, uint256[2][] pubkeys) different proposals. Initializing Public Keys, Proposal length\",\"vote(uint256,uint256,uint256[2],uint256[],uint256[2][])\":{\"notice\":\"Give a single vote to proposal $(toProposal).\"}}}},\"settings\":{\"compilationTarget\":{\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/e_voting.sol\":\"EVoting\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/AltBn128.sol\":{\"keccak256\":\"0x7f2a04ce897b704ff86ef183077997a99149a7dc00d5c83270b651e2297169ea\",\"urls\":[\"bzzr://df6a6c3aff1ad2854afb736b3e24af3e7d74084afd72d3241e8add0760c69dce\"]},\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/EllipticCurve.sol\":{\"keccak256\":\"0x266a80e64a3a30ac323911cfe04db54b397ba50301bf889172dbe2363c9c6ac6\",\"urls\":[\"bzzr://430d8d98304bb333e393bbc864df528b56a26375b138711049a30d33d5cc2925\"]},\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/LSAG.sol\":{\"keccak256\":\"0x767bcf9fea22f21fb5d0e067df5a562dc5d28ab7ea2c4c59ac33503f964268e8\",\"urls\":[\"bzzr://29da86072cb9a283677acb46960934e343b919abfc3c38f1fa5a0b25d188af16\"]},\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/e_voting.sol\":{\"keccak256\":\"0xb5ffa1988c81a255d67902d6c1d3b23e51aa4092710c06e0676bea5b961caa8d\",\"urls\":[\"bzzr://808e259efc66e9779216e2f6e38ddcd60bb48e5e4df93dd34befb314db50201b\"]},\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/secp256k1.sol\":{\"keccak256\":\"0x22177ffc23e5a8bf0ca84b50e07cdae72102fe969f6eb287f6dd6e093a20dd9b\",\"urls\":[\"bzzr://78243287b410cfac54b97316d074571fe70916e9090e3e85d271d25c8bb66cff\"]}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600a600281620000cb9190620004c8565b5060405180610140016040528060405180604001604052807fa9ed5780be853a5682cc61389142df496809b747e423e472f1a61a47c9bfe18281526020017f4572d073b7955b7c847949c20ed2000450c8f52ad9b83a3ce24dd409cbc01d21815250815260200160405180604001604052807f54dc4bde844f233ad9b5fb43e71e8bcfd4c21d175d3b670991c30faba893dc3981526020017f0da8513dacf59a9384c47c1e9e934cb118e5a3ef4c58f7891ed068d8a4a14c0a815250815260200160405180604001604052807ff213f5a27836ab995d5d5183f0d771efc9383b3d0cf574f93b77eb4000de685681526020017fc361d91274ebf0a258f3baf6ce87f3c32d6a9ba4808c856ba105e89063ab19c9815250815260200160405180604001604052807f892090c9177551b29be614e60d8d4a54a805f3f850a5e13d5d44719873691add81526020017f26be2f213b9b0cb84b13fdfa9d28b042f60ded4150c82d9806d192887d2303fd815250815260200160405180604001604052807f8cdee0841aaa3dbf14530817a3e2e7c209c28e58894f884846f3c656b136909981526020017fb4ec71964b78059552b51eb4578b3a5d02edccdb43eab21f1d3ade827659c3e7815250815260200160405180604001604052807fd0e6aaf83cb6f7570a8b0d28ad0f33f08d0c5b5bcf02ceb4e60444ad9ebbc04281526020017fa612fdff207927dea42b83a60eccefcd08db09f69861d09aa93c44b426e827bc815250815260200160405180604001604052807f9f57f0f71ec5ab1dc86bba409164816d8312db8f7ad15870666be1f3f57b9d9b81526020017fc2934331a462c24b0d706ecdb774eff221bbf570dcef39e7f98da2e7c4c1d916815250815260200160405180604001604052807f9937ead84c1bed46defcd039152635f32ea92c728fd7e4f242d749148fe9c65e81526020017fa890ea307c37f1db4d21a1b19584eac4c82bd9f7ec87fd7e42570d3b739395a2815250815260200160405180604001604052807f2e90e70604590f72fa855a80336779aef09dc09fd4accad48a1bf5ba58de459981526020017fc5a6c0640e92c37033b64d2e0d2dde60567b90921dbdae2efb0f20ec6a4360fc815250815260200160405180604001604052807f1909b3749b0799f3dadb9b0daff18b49a5a163fe026981c37f64f448226b601c81526020017f69ca46a41007cd4cdc5e84dc42971b97dc8cf653e1a6b670c5733f038ea93b54815250815250600390600a6200046c929190620004f7565b507317458104da8654e7c067e3410a65080d9ddb14f3600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555062000632565b815481835581811115620004f257818360005260206000209182019101620004f191906200055c565b5b505050565b82805482825590600052602060002090600202810192821562000549579160200282015b8281111562000548578251829060026200053792919062000586565b50916020019190600201906200051b565b5b509050620005589190620005cb565b5090565b6200058391905b808211156200057f576000808201600090555060010162000563565b5090565b90565b8260028101928215620005b8579160200282015b82811115620005b75782518255916020019190600101906200059a565b5b509050620005c79190620005fc565b5090565b620005f991905b80821115620005f55760008181620005eb919062000624565b50600201620005d2565b5090565b90565b6200062191905b808211156200061d57600081600090555060010162000603565b5090565b90565b506000815560010160009055565b610b1b80620006426000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063609ff1bd14610051578063775a8f5e14610075578063d647534f1461011c578063f63cf9421461030d575b600080fd5b610059610351565b604051808260ff1660ff16815260200191505060405180910390f35b6100a16004803603602081101561008b57600080fd5b81019080803590602001909291905050506103c9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100e15780820151818401526020810190506100c6565b50505050905090810190601f16801561010e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102f7600480360360c081101561013257600080fd5b81019080803590602001909291908035906020019092919080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050509192919290803590602001906401000000008111156101a457600080fd5b8201836020820111156101b657600080fd5b803590602001918460208302840111640100000000831117156101d857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561023857600080fd5b82018360208201111561024a57600080fd5b8035906020019184604083028401116401000000008311171561026c57600080fd5b9190808060200260200160405190810160405280939291908181526020016000905b828210156102e5578484839050604002016002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050508152602001906001019061028e565b5050505050919291929050505061040d565b6040518082815260200191505060405180910390f35b61034f6004803603602081101561032357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061063c565b005b6000806000905060008090505b6002805490508160ff1610156103c4578160028260ff168154811061037f57fe5b906000526020600020016000015411156103b75760028160ff16815481106103a357fe5b906000526020600020016000015491508092505b808060010191505061035e565b505090565b606060206040519080825280601f01601f1916602001820160405280156103ff5781602001600182028038833980820191505090505b509050816020820152919050565b6000606061041a876103c9565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f73656e646572206973206e6f742074686520636f6d6d6f6e206164647265737381525060200191505060405180910390fd5b6104ec8187878787610725565b61055e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f6c73616720766572696669636174696f6e206469646e277420776f726b00000081525060200191505060405180910390fd5b60006001146105d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f576f726b696e672074696c6c206865726500000000000000000000000000000081525060200191505060405180910390fd5b600260016105e283610a43565b03815481106105ed57fe5b90600052602060002001600001600081548092919060010191905055506002600161061783610a43565b038154811061062257fe5b906000526020600020016000015491505095945050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180610ab6603a913960400191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008073__LSAG__________________________________63fe46a2b288888888886040518663ffffffff1660e01b8152600401808060200186815260200185600260200280838360005b8381101561078b578082015181840152602081019050610770565b505050509050018060200180602001848103845289818151815260200191508051906020019080838360005b838110156107d25780820151818401526020810190506107b7565b50505050905090810190601f1680156107ff5780820380516001836020036101000a031916815260200191505b50848103835286818151815260200191508051906020019060200280838360005b8381101561083b578082015181840152602081019050610820565b505050509050018481038252858181518152602001915080516000925b818410156108a15782846020026020010151600260200280838360005b83811015610890578082015181840152602081019050610875565b505050509050019260010192610858565b925050509850505050505050505060206040518083038186803b1580156108c757600080fd5b505af41580156108db573d6000803e3d6000fd5b505050506040513d60208110156108f157600080fd5b8101908080519060200190929190505050905080610913576000915050610a3a565b60008090505b6004805490508110156109af576004818154811061093357fe5b9060005260206000209060020201600001548660006002811061095257fe5b602002015114801561099257506004818154811061096c57fe5b9060005260206000209060020201600101548660016002811061098b57fe5b6020020151145b156109a257600092505050610a3a565b8080600101915050610919565b506109b8610a9b565b856000600281106109c557fe5b6020020151816000018181525050856001600281106109e057fe5b60200201518160200181815250506004819080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000155602082015181600101555050506001925050505b95945050505050565b60008060008090505b8351811015610a91576001810184510360080260020a848281518110610a6e57fe5b602001015160f81c60f81b60f81c60ff1602820191508080600101915050610a4c565b5080915050919050565b60405180604001604052806000815260200160008152509056fe73656e646572206973206e6f7420746865206368616972706572736f6e2e2063616e74207365742074686520636f6d6d6f6e2061646472657373a165627a7a72305820e79400384533a6514b7f9e9053f4900de1b87fc0b515b6f51c70d579120a0e390029", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063609ff1bd14610051578063775a8f5e14610075578063d647534f1461011c578063f63cf9421461030d575b600080fd5b610059610351565b604051808260ff1660ff16815260200191505060405180910390f35b6100a16004803603602081101561008b57600080fd5b81019080803590602001909291905050506103c9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100e15780820151818401526020810190506100c6565b50505050905090810190601f16801561010e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102f7600480360360c081101561013257600080fd5b81019080803590602001909291908035906020019092919080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050509192919290803590602001906401000000008111156101a457600080fd5b8201836020820111156101b657600080fd5b803590602001918460208302840111640100000000831117156101d857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561023857600080fd5b82018360208201111561024a57600080fd5b8035906020019184604083028401116401000000008311171561026c57600080fd5b9190808060200260200160405190810160405280939291908181526020016000905b828210156102e5578484839050604002016002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050508152602001906001019061028e565b5050505050919291929050505061040d565b6040518082815260200191505060405180910390f35b61034f6004803603602081101561032357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061063c565b005b6000806000905060008090505b6002805490508160ff1610156103c4578160028260ff168154811061037f57fe5b906000526020600020016000015411156103b75760028160ff16815481106103a357fe5b906000526020600020016000015491508092505b808060010191505061035e565b505090565b606060206040519080825280601f01601f1916602001820160405280156103ff5781602001600182028038833980820191505090505b509050816020820152919050565b6000606061041a876103c9565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f73656e646572206973206e6f742074686520636f6d6d6f6e206164647265737381525060200191505060405180910390fd5b6104ec8187878787610725565b61055e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f6c73616720766572696669636174696f6e206469646e277420776f726b00000081525060200191505060405180910390fd5b60006001146105d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f576f726b696e672074696c6c206865726500000000000000000000000000000081525060200191505060405180910390fd5b600260016105e283610a43565b03815481106105ed57fe5b90600052602060002001600001600081548092919060010191905055506002600161061783610a43565b038154811061062257fe5b906000526020600020016000015491505095945050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146106e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180610ab6603a913960400191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008073__LSAG__________________________________63fe46a2b288888888886040518663ffffffff1660e01b8152600401808060200186815260200185600260200280838360005b8381101561078b578082015181840152602081019050610770565b505050509050018060200180602001848103845289818151815260200191508051906020019080838360005b838110156107d25780820151818401526020810190506107b7565b50505050905090810190601f1680156107ff5780820380516001836020036101000a031916815260200191505b50848103835286818151815260200191508051906020019060200280838360005b8381101561083b578082015181840152602081019050610820565b505050509050018481038252858181518152602001915080516000925b818410156108a15782846020026020010151600260200280838360005b83811015610890578082015181840152602081019050610875565b505050509050019260010192610858565b925050509850505050505050505060206040518083038186803b1580156108c757600080fd5b505af41580156108db573d6000803e3d6000fd5b505050506040513d60208110156108f157600080fd5b8101908080519060200190929190505050905080610913576000915050610a3a565b60008090505b6004805490508110156109af576004818154811061093357fe5b9060005260206000209060020201600001548660006002811061095257fe5b602002015114801561099257506004818154811061096c57fe5b9060005260206000209060020201600101548660016002811061098b57fe5b6020020151145b156109a257600092505050610a3a565b8080600101915050610919565b506109b8610a9b565b856000600281106109c557fe5b6020020151816000018181525050856001600281106109e057fe5b60200201518160200181815250506004819080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000155602082015181600101555050506001925050505b95945050505050565b60008060008090505b8351811015610a91576001810184510360080260020a848281518110610a6e57fe5b602001015160f81c60f81b60f81c60ff1602820191508080600101915050610a4c565b5080915050919050565b60405180604001604052806000815260200160008152509056fe73656e646572206973206e6f7420746865206368616972706572736f6e2e2063616e74207365742074686520636f6d6d6f6e2061646472657373a165627a7a72305820e79400384533a6514b7f9e9053f4900de1b87fc0b515b6f51c70d579120a0e390029", + "sourceMap": "91:6348:4:-;;;677:2363;8:9:-1;5:2;;;30:1;27;20:12;5:2;677:2363:4;817:10;803:11;;:24;;;;;;;;;;;;;;;;;;866:1;837:6;:19;844:11;;;;;;;;;;;837:19;;;;;;;;;;;;;;;:26;;:30;;;;896:2;877:9;:21;;;;;:::i;:::-;;1016:1594;;;;;;;;;;;;;;;;1031:77;1016:1594;;;;1109:77;1016:1594;;;;;;;;;;;;;;;1189:77;1016:1594;;;;1267:76;1016:1594;;;;;;;;;;;;;;;1346:78;1016:1594;;;;1425:77;1016:1594;;;;;;;;;;;;;;;1505:77;1016:1594;;;;1583:77;1016:1594;;;;;;;;;;;;;;;1663:77;1016:1594;;;;1741:77;1016:1594;;;;;;;;;;;;;;;1821:77;1016:1594;;;;1899:77;1016:1594;;;;;;;;;;;;;;;1979:77;1016:1594;;;;2057:77;1016:1594;;;;;;;;;;;;;;;2137:77;1016:1594;;;;2215:77;1016:1594;;;;;;;;;;;;;;;2295:77;1016:1594;;;;2373:77;1016:1594;;;;;;;;;;;;;;;2453:77;1016:1594;;;;2531:77;1016:1594;;;;;;:9;:1594;;;;;;;:::i;:::-;;2982:42;2973:6;;:51;;;;;;;;;;;;;;;;;;91:6348;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;:::o;:::-;;;;;;;", + "deployedSourceMap": "91:6348:4:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;91:6348:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5903:360;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;6311:125;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;6311:125:4;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;6311:125:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5112:785;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;5112:785:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;5112:785:4;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;5112:785:4;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;5112:785:4;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;39:11;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;5112:785:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;5112:785:4;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;5112:785:4;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;5112:785:4;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;39:11;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;5112:785:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;5112:785:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;3050:182;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3050:182:4;;;;;;;;;;;;;;;;;;;:::i;:::-;;5903:360;5951:22;5985:24;6012:1;5985:28;;6028:10;6041:1;6028:14;;6023:234;6051:9;:16;;;;6044:4;:23;;;6023:234;;;6121:16;6093:9;6103:4;6093:15;;;;;;;;;;;;;;;;;:25;;;:44;6089:168;;;6176:9;6186:4;6176:15;;;;;;;;;;;;;;;;;:25;;;6157:44;;6238:4;6219:23;;6089:168;6069:6;;;;;;;6023:234;;;;5903:360;;:::o;6311:125::-;6355:14;6391:2;6381:13;;;;;;;;;;;;;;;;;;;;;;;;;29:1:-1;21:6;17:14;116:4;104:10;96:6;87:34;147:4;139:6;135:17;125:27;;0:156;6381:13:4;;;;6377:17;;6430:1;6425:2;6422:1;6418:10;6411:21;6409:25;;;:::o;5112:785::-;5246:4;5261:20;5284:16;5292:7;5284;:16::i;:::-;5261:39;;5332:6;;;;;;;;;;;5318:20;;:10;:20;;;5310:65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5394:47;5406:7;5415:2;5419:8;5429:1;5432:8;5394:11;:47::i;:::-;5386:89;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5497:1;5494;:4;5486:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5530:9;5561:1;5540:20;5552:7;5540:11;:20::i;:::-;:22;5530:33;;;;;;;;;;;;;;;:43;;;:45;;;;;;;;;;;;;5592:9;5623:1;5602:20;5614:7;5602:11;:20::i;:::-;:22;5592:33;;;;;;;;;;;;;;;:43;;;5585:50;;;5112:785;;;;;;;:::o;3050:182::-;3125:11;;;;;;;;;;;3111:25;;:10;:25;;;3103:96;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3218:7;3209:6;;:16;;;;;;;;;;;;;;;;;;3050:182;:::o;4445:603::-;4598:4;4614:11;4628:4;:11;4640:7;4649:2;4653:8;4663:1;4666:10;4628:49;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;4628:49:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;4628:49:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;4628:49:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;4628:49:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4628:49:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;4628:49:4;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;4628:49:4;;;;;;;;;;;;;;;;4614:63;;4701:6;4696:25;;4716:5;4709:12;;;;;4696:25;4735:6;4742:1;4735:8;;4731:138;4747:7;:14;;;;4745:1;:16;4731:138;;;4801:7;4809:1;4801:10;;;;;;;;;;;;;;;;;;:12;;;4786:8;4795:1;4786:11;;;;;;;;;;;:27;:58;;;;;4832:7;4840:1;4832:10;;;;;;;;;;;;;;;;;;:12;;;4817:8;4826:1;4817:11;;;;;;;;;;;:27;4786:58;4782:76;;;4853:5;4846:12;;;;;;4782:76;4763:3;;;;;;;4731:138;;;;4878:29;;:::i;:::-;4934:8;4943:1;4934:11;;;;;;;;;;;4917:12;:14;;:28;;;;;4972:8;4981:1;4972:11;;;;;;;;;;;4955:12;:14;;:28;;;;;4993:7;5006:12;4993:26;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;4993:26:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5036:4;5029:11;;;;4445:603;;;;;;;;:::o;3238:234::-;3293:7;3311:14;3339:6;3346:1;3339:8;;3335:108;3350:1;:8;3348:1;:10;3335:108;;;3427:1;3425;:3;3415:1;:8;:14;3412:1;:18;3408:1;:23;3401:1;3403;3401:4;;;;;;;;;;;;;;;;3395:11;;:37;;;3386:6;:46;3377:55;;3359:3;;;;;;;3335:108;;;;3459:6;3452:13;;;3238:234;;;:::o;91:6348::-;;;;;;;;;;;;;;;;;;;:::o", + "source": "pragma solidity >=0.4.0 <0.6.0;\n// pragma experimental ABIEncoderV2;\nimport \"./LSAG.sol\";\n\ncontract EVoting {\n\n struct Voter {\n uint weight;\n bool voted;\n uint8 vote;\n address delegate;\n }\n\n struct Proposal {\n uint voteCount;\n }\n \n struct keyImages {\n uint256 x;\n uint256 y;\n }\n\n address chairperson;\n mapping(address => Voter) voters;\n Proposal[] proposals;\n uint256[2][] _pub_keys;\n keyImages[] I_array;\n address common;\n\n /// Create a new ballot with $(_numProposals, Proposals[] prop, uint256[2][] pubkeys) different proposals.\n /// Initializing Public Keys, Proposal length\n constructor(/*uint8 _proposals, address common_address, uint256[2][] memory _pubkeys, uint256 num_members*/) public {\n chairperson = msg.sender;\n voters[chairperson].weight = 1;\n proposals.length = 10;\n // for (uint i = 0; i < num_members; i++) {\n // pub_keys.push(_pubkeys[i]);\n // }\n _pub_keys = [[76860218087793983084535703376981386467447611172084071853258931251531655143810,31412445800597707204000296306981535369487689728022294203473644188534598278433],[38383509265263568403091993992632738089196255623116815243548433385026133154873,6177458042690818063654998812321100640246417077410401798821997202074455067658],[109494974759407544115980221650269989415835863198723097195991870480545591748694,88373887815570028484318636992066972615473624433958557212898599653752288516553],[62024398634874066443962845630678733310841268459352721513836874076957014825693,17523914466505763903401497950553046259382636897003925910700830930167415374845],[63717588402740889593319833542751400718873158538928593038126726953424863531161,81834072601552631999151743416373775064561835219024365947336813467257575949287],[94488627319558170444192963521553866738182271320922938361822272954834163056706,75117489132020203438334222530089728350198927250708518444467009567047301998524],[72073121700845816532409909568957092975560328036852544806670390063697244167579,88008882899030566411419232439265353825316367124231879120604152247564011428118],[69302663261811420267463647311565591458354544084275858903094017435028909835870,76244600855121168108544883604098564729610790293645164381848998871531984754082],[21062411477782016300649284598637628528529199124745416083435916321565775381913,89400255616484687868490880757687246913068397762041460105517838105693640679676],[11324961394441086302516068549805884234494603864143349084821232258857030082588,47850239753691939370379379177679604685639311272023121432695464273305267682132]];\n\n // pub_keys = [[57821270388025671679082986323759317106236019579646704630239591681422142402873, 81852641370837570497548634207073850211297355610253263906104967633874362469602], [25712850812449497645081724081388342780477851750572903542985504942115721367043, 7928418776134213981488203910441805777302498711166840436627074750328926186440]];\n \n common = 0x17458104Da8654E7C067e3410a65080D9dDB14F3;\n \n }\n \n function setCommon(address _common) public {\n require(msg.sender == chairperson, \"sender is not the chairperson. cant set the common address\");\n common = _common;\n }\n\n function bytesToUint(bytes memory b) internal returns (uint256){\n uint256 number;\n for(uint i=0;i= proposals.length) return;\n // sender.voted = true;\n // sender.vote = toProposal;\n // proposals[toProposal].voteCount += sender.weight;\n }\n\n function winningProposal() public view returns (uint8 _winningProposal) {\n uint256 winningVoteCount = 0;\n for (uint8 prop = 0; prop < proposals.length; prop++)\n if (proposals[prop].voteCount > winningVoteCount) {\n winningVoteCount = proposals[prop].voteCount;\n _winningProposal = prop;\n }\n }\n\n\n // function to convert uint to bytes\n function toBytes(uint256 x) public returns (bytes memory b) {\n b = new bytes(32);\n assembly { mstore(add(b, 32), x) }\n}\n\n}\n", + "sourcePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/e_voting.sol", + "ast": { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/e_voting.sol", + "exportedSymbols": { + "EVoting": [ + 2347 + ] + }, + "id": 2348, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1952, + "literals": [ + "solidity", + ">=", + "0.4", + ".0", + "<", + "0.6", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:31:4" + }, + { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/LSAG.sol", + "file": "./LSAG.sol", + "id": 1953, + "nodeType": "ImportDirective", + "scope": 2348, + "sourceUnit": 1894, + "src": "69:20:4", + "symbolAliases": [], + "unitAlias": "" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 2347, + "linearizedBaseContracts": [ + 2347 + ], + "name": "EVoting", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "EVoting.Voter", + "id": 1962, + "members": [ + { + "constant": false, + "id": 1955, + "name": "weight", + "nodeType": "VariableDeclaration", + "scope": 1962, + "src": "138:11:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1954, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "138:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1957, + "name": "voted", + "nodeType": "VariableDeclaration", + "scope": 1962, + "src": "159:10:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 1956, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "159:4:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1959, + "name": "vote", + "nodeType": "VariableDeclaration", + "scope": 1962, + "src": "179:10:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 1958, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "179:5:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1961, + "name": "delegate", + "nodeType": "VariableDeclaration", + "scope": 1962, + "src": "199:16:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 1960, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "199:7:4", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "Voter", + "nodeType": "StructDefinition", + "scope": 2347, + "src": "115:107:4", + "visibility": "public" + }, + { + "canonicalName": "EVoting.Proposal", + "id": 1965, + "members": [ + { + "constant": false, + "id": 1964, + "name": "voteCount", + "nodeType": "VariableDeclaration", + "scope": 1965, + "src": "254:14:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1963, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "254:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "Proposal", + "nodeType": "StructDefinition", + "scope": 2347, + "src": "228:47:4", + "visibility": "public" + }, + { + "canonicalName": "EVoting.keyImages", + "id": 1970, + "members": [ + { + "constant": false, + "id": 1967, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 1970, + "src": "312:9:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1966, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "312:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1969, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 1970, + "src": "331:9:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1968, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "331:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "keyImages", + "nodeType": "StructDefinition", + "scope": 2347, + "src": "285:62:4", + "visibility": "public" + }, + { + "constant": false, + "id": 1972, + "name": "chairperson", + "nodeType": "VariableDeclaration", + "scope": 2347, + "src": "353:19:4", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 1971, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "353:7:4", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1976, + "name": "voters", + "nodeType": "VariableDeclaration", + "scope": 2347, + "src": "378:32:4", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Voter_$1962_storage_$", + "typeString": "mapping(address => struct EVoting.Voter)" + }, + "typeName": { + "id": 1975, + "keyType": { + "id": 1973, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "386:7:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "378:25:4", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Voter_$1962_storage_$", + "typeString": "mapping(address => struct EVoting.Voter)" + }, + "valueType": { + "contractScope": null, + "id": 1974, + "name": "Voter", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 1962, + "src": "397:5:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Voter_$1962_storage_ptr", + "typeString": "struct EVoting.Voter" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1979, + "name": "proposals", + "nodeType": "VariableDeclaration", + "scope": 2347, + "src": "416:20:4", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal[]" + }, + "typeName": { + "baseType": { + "contractScope": null, + "id": 1977, + "name": "Proposal", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 1965, + "src": "416:8:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Proposal_$1965_storage_ptr", + "typeString": "struct EVoting.Proposal" + } + }, + "id": 1978, + "length": null, + "nodeType": "ArrayTypeName", + "src": "416:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage_ptr", + "typeString": "struct EVoting.Proposal[]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1984, + "name": "_pub_keys", + "nodeType": "VariableDeclaration", + "scope": 2347, + "src": "442:22:4", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage", + "typeString": "uint256[2][]" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 1980, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "442:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1982, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1981, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "450:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "442:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "id": 1983, + "length": null, + "nodeType": "ArrayTypeName", + "src": "442:12:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage_ptr", + "typeString": "uint256[2][]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1987, + "name": "I_array", + "nodeType": "VariableDeclaration", + "scope": 2347, + "src": "470:19:4", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_keyImages_$1970_storage_$dyn_storage", + "typeString": "struct EVoting.keyImages[]" + }, + "typeName": { + "baseType": { + "contractScope": null, + "id": 1985, + "name": "keyImages", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 1970, + "src": "470:9:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_storage_ptr", + "typeString": "struct EVoting.keyImages" + } + }, + "id": 1986, + "length": null, + "nodeType": "ArrayTypeName", + "src": "470:11:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_keyImages_$1970_storage_$dyn_storage_ptr", + "typeString": "struct EVoting.keyImages[]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1989, + "name": "common", + "nodeType": "VariableDeclaration", + "scope": 2347, + "src": "495:14:4", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 1988, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "495:7:4", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "body": { + "id": 2048, + "nodeType": "Block", + "src": "793:2247:4", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1995, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1992, + "name": "chairperson", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1972, + "src": "803:11:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1993, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2496, + "src": "817:3:4", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 1994, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "817:10:4", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "src": "803:24:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 1996, + "nodeType": "ExpressionStatement", + "src": "803:24:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2002, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1997, + "name": "voters", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1976, + "src": "837:6:4", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Voter_$1962_storage_$", + "typeString": "mapping(address => struct EVoting.Voter storage ref)" + } + }, + "id": 1999, + "indexExpression": { + "argumentTypes": null, + "id": 1998, + "name": "chairperson", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1972, + "src": "844:11:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "837:19:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Voter_$1962_storage", + "typeString": "struct EVoting.Voter storage ref" + } + }, + "id": 2000, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "weight", + "nodeType": "MemberAccess", + "referencedDeclaration": 1955, + "src": "837:26:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "31", + "id": 2001, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "866:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "837:30:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2003, + "nodeType": "ExpressionStatement", + "src": "837:30:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2008, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2004, + "name": "proposals", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1979, + "src": "877:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal storage ref[] storage ref" + } + }, + "id": 2006, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "877:16:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "3130", + "id": 2007, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "896:2:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "src": "877:21:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2009, + "nodeType": "ExpressionStatement", + "src": "877:21:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2042, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2010, + "name": "_pub_keys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1984, + "src": "1016:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage", + "typeString": "uint256[2] storage ref[] storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3736383630323138303837373933393833303834353335373033333736393831333836343637343437363131313732303834303731383533323538393331323531353331363535313433383130", + "id": 2011, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1031:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_76860218087793983084535703376981386467447611172084071853258931251531655143810_by_1", + "typeString": "int_const 7686...(69 digits omitted)...3810" + }, + "value": "76860218087793983084535703376981386467447611172084071853258931251531655143810" + }, + { + "argumentTypes": null, + "hexValue": "3331343132343435383030353937373037323034303030323936333036393831353335333639343837363839373238303232323934323033343733363434313838353334353938323738343333", + "id": 2012, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1109:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_31412445800597707204000296306981535369487689728022294203473644188534598278433_by_1", + "typeString": "int_const 3141...(69 digits omitted)...8433" + }, + "value": "31412445800597707204000296306981535369487689728022294203473644188534598278433" + } + ], + "id": 2013, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1030:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3338333833353039323635323633353638343033303931393933393932363332373338303839313936323535363233313136383135323433353438343333333835303236313333313534383733", + "id": 2014, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1189:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_38383509265263568403091993992632738089196255623116815243548433385026133154873_by_1", + "typeString": "int_const 3838...(69 digits omitted)...4873" + }, + "value": "38383509265263568403091993992632738089196255623116815243548433385026133154873" + }, + { + "argumentTypes": null, + "hexValue": "36313737343538303432363930383138303633363534393938383132333231313030363430323436343137303737343130343031373938383231393937323032303734343535303637363538", + "id": 2015, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1267:76:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_6177458042690818063654998812321100640246417077410401798821997202074455067658_by_1", + "typeString": "int_const 6177...(68 digits omitted)...7658" + }, + "value": "6177458042690818063654998812321100640246417077410401798821997202074455067658" + } + ], + "id": 2016, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1188:156:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "313039343934393734373539343037353434313135393830323231363530323639393839343135383335383633313938373233303937313935393931383730343830353435353931373438363934", + "id": 2017, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1346:78:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_109494974759407544115980221650269989415835863198723097195991870480545591748694_by_1", + "typeString": "int_const 1094...(70 digits omitted)...8694" + }, + "value": "109494974759407544115980221650269989415835863198723097195991870480545591748694" + }, + { + "argumentTypes": null, + "hexValue": "3838333733383837383135353730303238343834333138363336393932303636393732363135343733363234343333393538353537323132383938353939363533373532323838353136353533", + "id": 2018, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1425:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_88373887815570028484318636992066972615473624433958557212898599653752288516553_by_1", + "typeString": "int_const 8837...(69 digits omitted)...6553" + }, + "value": "88373887815570028484318636992066972615473624433958557212898599653752288516553" + } + ], + "id": 2019, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1345:158:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3632303234333938363334383734303636343433393632383435363330363738373333333130383431323638343539333532373231353133383336383734303736393537303134383235363933", + "id": 2020, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1505:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_62024398634874066443962845630678733310841268459352721513836874076957014825693_by_1", + "typeString": "int_const 6202...(69 digits omitted)...5693" + }, + "value": "62024398634874066443962845630678733310841268459352721513836874076957014825693" + }, + { + "argumentTypes": null, + "hexValue": "3137353233393134343636353035373633393033343031343937393530353533303436323539333832363336383937303033393235393130373030383330393330313637343135333734383435", + "id": 2021, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1583:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_17523914466505763903401497950553046259382636897003925910700830930167415374845_by_1", + "typeString": "int_const 1752...(69 digits omitted)...4845" + }, + "value": "17523914466505763903401497950553046259382636897003925910700830930167415374845" + } + ], + "id": 2022, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1504:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3633373137353838343032373430383839353933333139383333353432373531343030373138383733313538353338393238353933303338313236373236393533343234383633353331313631", + "id": 2023, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1663:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_63717588402740889593319833542751400718873158538928593038126726953424863531161_by_1", + "typeString": "int_const 6371...(69 digits omitted)...1161" + }, + "value": "63717588402740889593319833542751400718873158538928593038126726953424863531161" + }, + { + "argumentTypes": null, + "hexValue": "3831383334303732363031353532363331393939313531373433343136333733373735303634353631383335323139303234333635393437333336383133343637323537353735393439323837", + "id": 2024, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1741:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_81834072601552631999151743416373775064561835219024365947336813467257575949287_by_1", + "typeString": "int_const 8183...(69 digits omitted)...9287" + }, + "value": "81834072601552631999151743416373775064561835219024365947336813467257575949287" + } + ], + "id": 2025, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1662:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3934343838363237333139353538313730343434313932393633353231353533383636373338313832323731333230393232393338333631383232323732393534383334313633303536373036", + "id": 2026, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1821:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_94488627319558170444192963521553866738182271320922938361822272954834163056706_by_1", + "typeString": "int_const 9448...(69 digits omitted)...6706" + }, + "value": "94488627319558170444192963521553866738182271320922938361822272954834163056706" + }, + { + "argumentTypes": null, + "hexValue": "3735313137343839313332303230323033343338333334323232353330303839373238333530313938393237323530373038353138343434343637303039353637303437333031393938353234", + "id": 2027, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1899:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_75117489132020203438334222530089728350198927250708518444467009567047301998524_by_1", + "typeString": "int_const 7511...(69 digits omitted)...8524" + }, + "value": "75117489132020203438334222530089728350198927250708518444467009567047301998524" + } + ], + "id": 2028, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1820:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3732303733313231373030383435383136353332343039393039353638393537303932393735353630333238303336383532353434383036363730333930303633363937323434313637353739", + "id": 2029, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1979:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_72073121700845816532409909568957092975560328036852544806670390063697244167579_by_1", + "typeString": "int_const 7207...(69 digits omitted)...7579" + }, + "value": "72073121700845816532409909568957092975560328036852544806670390063697244167579" + }, + { + "argumentTypes": null, + "hexValue": "3838303038383832383939303330353636343131343139323332343339323635333533383235333136333637313234323331383739313230363034313532323437353634303131343238313138", + "id": 2030, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2057:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_88008882899030566411419232439265353825316367124231879120604152247564011428118_by_1", + "typeString": "int_const 8800...(69 digits omitted)...8118" + }, + "value": "88008882899030566411419232439265353825316367124231879120604152247564011428118" + } + ], + "id": 2031, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1978:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3639333032363633323631383131343230323637343633363437333131353635353931343538333534353434303834323735383538393033303934303137343335303238393039383335383730", + "id": 2032, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2137:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_69302663261811420267463647311565591458354544084275858903094017435028909835870_by_1", + "typeString": "int_const 6930...(69 digits omitted)...5870" + }, + "value": "69302663261811420267463647311565591458354544084275858903094017435028909835870" + }, + { + "argumentTypes": null, + "hexValue": "3736323434363030383535313231313638313038353434383833363034303938353634373239363130373930323933363435313634333831383438393938383731353331393834373534303832", + "id": 2033, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2215:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_76244600855121168108544883604098564729610790293645164381848998871531984754082_by_1", + "typeString": "int_const 7624...(69 digits omitted)...4082" + }, + "value": "76244600855121168108544883604098564729610790293645164381848998871531984754082" + } + ], + "id": 2034, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2136:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3231303632343131343737373832303136333030363439323834353938363337363238353238353239313939313234373435343136303833343335393136333231353635373735333831393133", + "id": 2035, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2295:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_21062411477782016300649284598637628528529199124745416083435916321565775381913_by_1", + "typeString": "int_const 2106...(69 digits omitted)...1913" + }, + "value": "21062411477782016300649284598637628528529199124745416083435916321565775381913" + }, + { + "argumentTypes": null, + "hexValue": "3839343030323535363136343834363837383638343930383830373537363837323436393133303638333937373632303431343630313035353137383338313035363933363430363739363736", + "id": 2036, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2373:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_89400255616484687868490880757687246913068397762041460105517838105693640679676_by_1", + "typeString": "int_const 8940...(69 digits omitted)...9676" + }, + "value": "89400255616484687868490880757687246913068397762041460105517838105693640679676" + } + ], + "id": 2037, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2294:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3131333234393631333934343431303836333032353136303638353439383035383834323334343934363033383634313433333439303834383231323332323538383537303330303832353838", + "id": 2038, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2453:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_11324961394441086302516068549805884234494603864143349084821232258857030082588_by_1", + "typeString": "int_const 1132...(69 digits omitted)...2588" + }, + "value": "11324961394441086302516068549805884234494603864143349084821232258857030082588" + }, + { + "argumentTypes": null, + "hexValue": "3437383530323339373533363931393339333730333739333739313737363739363034363835363339333131323732303233313231343332363935343634323733333035323637363832313332", + "id": 2039, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2531:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_47850239753691939370379379177679604685639311272023121432695464273305267682132_by_1", + "typeString": "int_const 4785...(69 digits omitted)...2132" + }, + "value": "47850239753691939370379379177679604685639311272023121432695464273305267682132" + } + ], + "id": 2040, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2452:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + } + ], + "id": 2041, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1029:1581:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$10_memory_ptr", + "typeString": "uint256[2] memory[10] memory" + } + }, + "src": "1016:1594:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage", + "typeString": "uint256[2] storage ref[] storage ref" + } + }, + "id": 2043, + "nodeType": "ExpressionStatement", + "src": "1016:1594:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2046, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2044, + "name": "common", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1989, + "src": "2973:6:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "307831373435383130344461383635344537433036376533343130613635303830443964444231344633", + "id": 2045, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2982:42:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + }, + "value": "0x17458104Da8654E7C067e3410a65080D9dDB14F3" + }, + "src": "2973:51:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 2047, + "nodeType": "ExpressionStatement", + "src": "2973:51:4" + } + ] + }, + "documentation": "Create a new ballot with $(_numProposals, Proposals[] prop, uint256[2][] pubkeys) different proposals.\n Initializing Public Keys, Proposal length", + "id": 2049, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1990, + "nodeType": "ParameterList", + "parameters": [], + "src": "688:97:4" + }, + "returnParameters": { + "id": 1991, + "nodeType": "ParameterList", + "parameters": [], + "src": "793:0:4" + }, + "scope": 2347, + "src": "677:2363:4", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2066, + "nodeType": "Block", + "src": "3093:139:4", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 2058, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2055, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2496, + "src": "3111:3:4", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2056, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3111:10:4", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 2057, + "name": "chairperson", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1972, + "src": "3125:11:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3111:25:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "73656e646572206973206e6f7420746865206368616972706572736f6e2e2063616e74207365742074686520636f6d6d6f6e2061646472657373", + "id": 2059, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3138:60:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_3945a0ebdf4f94d01e520ed1f4979f167d76124b71e6da5be0d718b2c4f77deb", + "typeString": "literal_string \"sender is not the chairperson. cant set the common address\"" + }, + "value": "sender is not the chairperson. cant set the common address" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_3945a0ebdf4f94d01e520ed1f4979f167d76124b71e6da5be0d718b2c4f77deb", + "typeString": "literal_string \"sender is not the chairperson. cant set the common address\"" + } + ], + "id": 2054, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2499, + 2500 + ], + "referencedDeclaration": 2500, + "src": "3103:7:4", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2060, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3103:96:4", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2061, + "nodeType": "ExpressionStatement", + "src": "3103:96:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2064, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2062, + "name": "common", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1989, + "src": "3209:6:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 2063, + "name": "_common", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2051, + "src": "3218:7:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3209:16:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 2065, + "nodeType": "ExpressionStatement", + "src": "3209:16:4" + } + ] + }, + "documentation": null, + "id": 2067, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "setCommon", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2052, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2051, + "name": "_common", + "nodeType": "VariableDeclaration", + "scope": 2067, + "src": "3069:15:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2050, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3069:7:4", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3068:17:4" + }, + "returnParameters": { + "id": 2053, + "nodeType": "ParameterList", + "parameters": [], + "src": "3093:0:4" + }, + "scope": 2347, + "src": "3050:182:4", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2117, + "nodeType": "Block", + "src": "3301:171:4", + "statements": [ + { + "assignments": [ + 2075 + ], + "declarations": [ + { + "constant": false, + "id": 2075, + "name": "number", + "nodeType": "VariableDeclaration", + "scope": 2117, + "src": "3311:14:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2074, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3311:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2076, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "3311:14:4" + }, + { + "body": { + "id": 2113, + "nodeType": "Block", + "src": "3363:80:4", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2111, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2088, + "name": "number", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2075, + "src": "3377:6:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2110, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 2089, + "name": "number", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2075, + "src": "3386:6:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2109, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2091, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2069, + "src": "3401:1:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2093, + "indexExpression": { + "argumentTypes": null, + "id": 2092, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2078, + "src": "3403:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3401:4:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 2090, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3395:5:4", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": "uint8" + }, + "id": 2094, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3395:11:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 2095, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3408:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2105, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "hexValue": "38", + "id": 2096, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3412:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2103, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2097, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2069, + "src": "3415:1:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2098, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3415:8:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2101, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 2099, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2078, + "src": "3425:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2100, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3427:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "3425:3:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2102, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "3424:5:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3415:14:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2104, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "3414:16:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3412:18:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2106, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "3411:20:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3408:23:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2108, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "3407:25:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3395:37:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3386:46:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3377:55:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2112, + "nodeType": "ExpressionStatement", + "src": "3377:55:4" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2084, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 2081, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2078, + "src": "3348:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2082, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2069, + "src": "3350:1:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2083, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3350:8:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3348:10:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2114, + "initializationExpression": { + "assignments": [ + 2078 + ], + "declarations": [ + { + "constant": false, + "id": 2078, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 2114, + "src": "3339:6:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2077, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3339:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2080, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 2079, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3346:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "3339:8:4" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 2086, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "3359:3:4", + "subExpression": { + "argumentTypes": null, + "id": 2085, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2078, + "src": "3359:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2087, + "nodeType": "ExpressionStatement", + "src": "3359:3:4" + }, + "nodeType": "ForStatement", + "src": "3335:108:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2115, + "name": "number", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2075, + "src": "3459:6:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2073, + "id": 2116, + "nodeType": "Return", + "src": "3452:13:4" + } + ] + }, + "documentation": null, + "id": 2118, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "bytesToUint", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2070, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2069, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 2118, + "src": "3259:14:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2068, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3259:5:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3258:16:4" + }, + "returnParameters": { + "id": 2073, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2072, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 2118, + "src": "3293:7:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2071, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3293:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3292:9:4" + }, + "scope": 2347, + "src": "3238:234:4", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 2215, + "nodeType": "Block", + "src": "4604:444:4", + "statements": [ + { + "assignments": [ + 2140 + ], + "declarations": [ + { + "constant": false, + "id": 2140, + "name": "status", + "nodeType": "VariableDeclaration", + "scope": 2215, + "src": "4614:11:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2139, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4614:4:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2149, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2143, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2120, + "src": "4640:7:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 2144, + "name": "c0", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2122, + "src": "4649:2:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2145, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2126, + "src": "4653:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 2146, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2129, + "src": "4663:1:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + { + "argumentTypes": null, + "id": 2147, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2134, + "src": "4666:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + }, + { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 2141, + "name": "LSAG", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1893, + "src": "4628:4:4", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_LSAG_$1893_$", + "typeString": "type(library LSAG)" + } + }, + "id": 2142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "verify", + "nodeType": "MemberAccess", + "referencedDeclaration": 1892, + "src": "4628:11:4", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_view$_t_bytes_memory_ptr_$_t_uint256_$_t_array$_t_uint256_$2_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr_$returns$_t_bool_$", + "typeString": "function (bytes memory,uint256,uint256[2] memory,uint256[] memory,uint256[2] memory[] memory) view returns (bool)" + } + }, + "id": 2148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4628:49:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4614:63:4" + }, + { + "condition": { + "argumentTypes": null, + "id": 2151, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "4700:7:4", + "subExpression": { + "argumentTypes": null, + "id": 2150, + "name": "status", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2140, + "src": "4701:6:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 2154, + "nodeType": "IfStatement", + "src": "4696:25:4", + "trueBody": { + "expression": { + "argumentTypes": null, + "hexValue": "66616c7365", + "id": 2152, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4716:5:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + "functionReturnParameters": 2138, + "id": 2153, + "nodeType": "Return", + "src": "4709:12:4" + } + }, + { + "body": { + "id": 2186, + "nodeType": "Block", + "src": "4768:101:4", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2182, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2173, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2166, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2126, + "src": "4786:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2168, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 2167, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4795:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4786:11:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2169, + "name": "I_array", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1987, + "src": "4801:7:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_keyImages_$1970_storage_$dyn_storage", + "typeString": "struct EVoting.keyImages storage ref[] storage ref" + } + }, + "id": 2171, + "indexExpression": { + "argumentTypes": null, + "id": 2170, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2156, + "src": "4809:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4801:10:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_storage", + "typeString": "struct EVoting.keyImages storage ref" + } + }, + "id": 2172, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "x", + "nodeType": "MemberAccess", + "referencedDeclaration": 1967, + "src": "4801:12:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4786:27:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2181, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2174, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2126, + "src": "4817:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2176, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2175, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4826:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4817:11:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2177, + "name": "I_array", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1987, + "src": "4832:7:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_keyImages_$1970_storage_$dyn_storage", + "typeString": "struct EVoting.keyImages storage ref[] storage ref" + } + }, + "id": 2179, + "indexExpression": { + "argumentTypes": null, + "id": 2178, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2156, + "src": "4840:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4832:10:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_storage", + "typeString": "struct EVoting.keyImages storage ref" + } + }, + "id": 2180, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "y", + "nodeType": "MemberAccess", + "referencedDeclaration": 1969, + "src": "4832:12:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4817:27:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "4786:58:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 2185, + "nodeType": "IfStatement", + "src": "4782:76:4", + "trueBody": { + "expression": { + "argumentTypes": null, + "hexValue": "66616c7365", + "id": 2183, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4853:5:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + "functionReturnParameters": 2138, + "id": 2184, + "nodeType": "Return", + "src": "4846:12:4" + } + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2162, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 2159, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2156, + "src": "4745:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2160, + "name": "I_array", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1987, + "src": "4747:7:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_keyImages_$1970_storage_$dyn_storage", + "typeString": "struct EVoting.keyImages storage ref[] storage ref" + } + }, + "id": 2161, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4747:14:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4745:16:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2187, + "initializationExpression": { + "assignments": [ + 2156 + ], + "declarations": [ + { + "constant": false, + "id": 2156, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 2187, + "src": "4735:6:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2155, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4735:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2158, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 2157, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4742:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4735:8:4" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 2164, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "4763:3:4", + "subExpression": { + "argumentTypes": null, + "id": 2163, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2156, + "src": "4763:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2165, + "nodeType": "ExpressionStatement", + "src": "4763:3:4" + }, + "nodeType": "ForStatement", + "src": "4731:138:4" + }, + { + "assignments": [ + 2189 + ], + "declarations": [ + { + "constant": false, + "id": 2189, + "name": "new_keyimage", + "nodeType": "VariableDeclaration", + "scope": 2215, + "src": "4878:29:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_memory_ptr", + "typeString": "struct EVoting.keyImages" + }, + "typeName": { + "contractScope": null, + "id": 2188, + "name": "keyImages", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 1970, + "src": "4878:9:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_storage_ptr", + "typeString": "struct EVoting.keyImages" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2190, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "4878:29:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2197, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2191, + "name": "new_keyimage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2189, + "src": "4917:12:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_memory_ptr", + "typeString": "struct EVoting.keyImages memory" + } + }, + "id": 2193, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "x", + "nodeType": "MemberAccess", + "referencedDeclaration": 1967, + "src": "4917:14:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2194, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2126, + "src": "4934:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2196, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 2195, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4943:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4934:11:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4917:28:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2198, + "nodeType": "ExpressionStatement", + "src": "4917:28:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2205, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2199, + "name": "new_keyimage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2189, + "src": "4955:12:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_memory_ptr", + "typeString": "struct EVoting.keyImages memory" + } + }, + "id": 2201, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "y", + "nodeType": "MemberAccess", + "referencedDeclaration": 1969, + "src": "4955:14:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2202, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2126, + "src": "4972:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2204, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2203, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4981:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4972:11:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4955:28:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2206, + "nodeType": "ExpressionStatement", + "src": "4955:28:4" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2210, + "name": "new_keyimage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2189, + "src": "5006:12:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_memory_ptr", + "typeString": "struct EVoting.keyImages memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_keyImages_$1970_memory_ptr", + "typeString": "struct EVoting.keyImages memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 2207, + "name": "I_array", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1987, + "src": "4993:7:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_keyImages_$1970_storage_$dyn_storage", + "typeString": "struct EVoting.keyImages storage ref[] storage ref" + } + }, + "id": 2209, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4993:12:4", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_struct$_keyImages_$1970_storage_$returns$_t_uint256_$", + "typeString": "function (struct EVoting.keyImages storage ref) returns (uint256)" + } + }, + "id": 2211, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4993:26:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2212, + "nodeType": "ExpressionStatement", + "src": "4993:26:4" + }, + { + "expression": { + "argumentTypes": null, + "hexValue": "74727565", + "id": 2213, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5036:4:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 2138, + "id": 2214, + "nodeType": "Return", + "src": "5029:11:4" + } + ] + }, + "documentation": "Delegate your vote to the voter $(to).", + "id": 2216, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "LSAG_verify", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2135, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2120, + "name": "message", + "nodeType": "VariableDeclaration", + "scope": 2216, + "src": "4466:20:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2119, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4466:5:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2122, + "name": "c0", + "nodeType": "VariableDeclaration", + "scope": 2216, + "src": "4488:10:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2121, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4488:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2126, + "name": "keyImage", + "nodeType": "VariableDeclaration", + "scope": 2216, + "src": "4500:26:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 2123, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4500:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2125, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2124, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4508:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "4500:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2129, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 2216, + "src": "4528:18:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 2127, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4528:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2128, + "length": null, + "nodeType": "ArrayTypeName", + "src": "4528:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2134, + "name": "publicKeys", + "nodeType": "VariableDeclaration", + "scope": 2216, + "src": "4548:30:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2][]" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 2130, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4548:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2132, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2131, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4556:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "4548:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "id": 2133, + "length": null, + "nodeType": "ArrayTypeName", + "src": "4548:12:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage_ptr", + "typeString": "uint256[2][]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4465:114:4" + }, + "returnParameters": { + "id": 2138, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2137, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 2216, + "src": "4598:4:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2136, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4598:4:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4597:6:4" + }, + "scope": 2347, + "src": "4445:603:4", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 2288, + "nodeType": "Block", + "src": "5251:646:4", + "statements": [ + { + "assignments": [ + 2238 + ], + "declarations": [ + { + "constant": false, + "id": 2238, + "name": "message", + "nodeType": "VariableDeclaration", + "scope": 2288, + "src": "5261:20:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2237, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5261:5:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2242, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2240, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2218, + "src": "5292:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2239, + "name": "toBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2346, + "src": "5284:7:4", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) returns (bytes memory)" + } + }, + "id": 2241, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5284:16:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5261:39:4" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 2247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2244, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2496, + "src": "5318:3:4", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5318:10:4", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 2246, + "name": "common", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1989, + "src": "5332:6:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "5318:20:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "73656e646572206973206e6f742074686520636f6d6d6f6e2061646472657373", + "id": 2248, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5340:34:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_68fd146e033c69fcdb55a38b3dbe8c2e718fabdd7e10cdc123b1892c46d26ca8", + "typeString": "literal_string \"sender is not the common address\"" + }, + "value": "sender is not the common address" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_68fd146e033c69fcdb55a38b3dbe8c2e718fabdd7e10cdc123b1892c46d26ca8", + "typeString": "literal_string \"sender is not the common address\"" + } + ], + "id": 2243, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2499, + 2500 + ], + "referencedDeclaration": 2500, + "src": "5310:7:4", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5310:65:4", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2250, + "nodeType": "ExpressionStatement", + "src": "5310:65:4" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2253, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2238, + "src": "5406:7:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 2254, + "name": "c0", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2220, + "src": "5415:2:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2255, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2224, + "src": "5419:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 2256, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2227, + "src": "5429:1:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + { + "argumentTypes": null, + "id": 2257, + "name": "pub_keys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2232, + "src": "5432:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + }, + { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + ], + "id": 2252, + "name": "LSAG_verify", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2216, + "src": "5394:11:4", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes_memory_ptr_$_t_uint256_$_t_array$_t_uint256_$2_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr_$returns$_t_bool_$", + "typeString": "function (bytes memory,uint256,uint256[2] memory,uint256[] memory,uint256[2] memory[] memory) returns (bool)" + } + }, + "id": 2258, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5394:47:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "6c73616720766572696669636174696f6e206469646e277420776f726b", + "id": 2259, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5443:31:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_f37ccde4e43e46cf8408f14afdb5b92c86a7d7926676c424054ff7fd7e40b7fb", + "typeString": "literal_string \"lsag verification didn't work\"" + }, + "value": "lsag verification didn't work" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_f37ccde4e43e46cf8408f14afdb5b92c86a7d7926676c424054ff7fd7e40b7fb", + "typeString": "literal_string \"lsag verification didn't work\"" + } + ], + "id": 2251, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2499, + 2500 + ], + "referencedDeclaration": 2500, + "src": "5386:7:4", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2260, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5386:89:4", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2261, + "nodeType": "ExpressionStatement", + "src": "5386:89:4" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2265, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2263, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5494:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 2264, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5497:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "5494:4:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "576f726b696e672074696c6c2068657265", + "id": 2266, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5500:19:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_20ce0dc11e700e7a9c946d9e18e3c14c06f2e5d8797d8745378da6399a5a3c4a", + "typeString": "literal_string \"Working till here\"" + }, + "value": "Working till here" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_20ce0dc11e700e7a9c946d9e18e3c14c06f2e5d8797d8745378da6399a5a3c4a", + "typeString": "literal_string \"Working till here\"" + } + ], + "id": 2262, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2499, + 2500 + ], + "referencedDeclaration": 2500, + "src": "5486:7:4", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2267, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5486:34:4", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2268, + "nodeType": "ExpressionStatement", + "src": "5486:34:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "5530:45:4", + "subExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2269, + "name": "proposals", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1979, + "src": "5530:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal storage ref[] storage ref" + } + }, + "id": 2275, + "indexExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2271, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2238, + "src": "5552:7:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 2270, + "name": "bytesToUint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2118, + "src": "5540:11:4", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes_memory_ptr_$returns$_t_uint256_$", + "typeString": "function (bytes memory) returns (uint256)" + } + }, + "id": 2272, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5540:20:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2273, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5561:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "5540:22:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "5530:33:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Proposal_$1965_storage", + "typeString": "struct EVoting.Proposal storage ref" + } + }, + "id": 2276, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "voteCount", + "nodeType": "MemberAccess", + "referencedDeclaration": 1964, + "src": "5530:43:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2278, + "nodeType": "ExpressionStatement", + "src": "5530:45:4" + }, + { + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2279, + "name": "proposals", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1979, + "src": "5592:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal storage ref[] storage ref" + } + }, + "id": 2285, + "indexExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2281, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2238, + "src": "5614:7:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 2280, + "name": "bytesToUint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2118, + "src": "5602:11:4", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes_memory_ptr_$returns$_t_uint256_$", + "typeString": "function (bytes memory) returns (uint256)" + } + }, + "id": 2282, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5602:20:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2283, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5623:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "5602:22:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "5592:33:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Proposal_$1965_storage", + "typeString": "struct EVoting.Proposal storage ref" + } + }, + "id": 2286, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "voteCount", + "nodeType": "MemberAccess", + "referencedDeclaration": 1964, + "src": "5592:43:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2236, + "id": 2287, + "nodeType": "Return", + "src": "5585:50:4" + } + ] + }, + "documentation": "Give a single vote to proposal $(toProposal).", + "id": 2289, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "vote", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2233, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2218, + "name": "message", + "nodeType": "VariableDeclaration", + "scope": 2289, + "src": "5126:12:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2217, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "5126:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2220, + "name": "c0", + "nodeType": "VariableDeclaration", + "scope": 2289, + "src": "5140:10:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2219, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5140:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2224, + "name": "keyImage", + "nodeType": "VariableDeclaration", + "scope": 2289, + "src": "5152:26:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 2221, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5152:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2223, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2222, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5160:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "5152:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2227, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 2289, + "src": "5180:18:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 2225, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5180:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2226, + "length": null, + "nodeType": "ArrayTypeName", + "src": "5180:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2232, + "name": "pub_keys", + "nodeType": "VariableDeclaration", + "scope": 2289, + "src": "5200:28:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2][]" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 2228, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5200:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2230, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2229, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5208:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "5200:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "id": 2231, + "length": null, + "nodeType": "ArrayTypeName", + "src": "5200:12:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage_ptr", + "typeString": "uint256[2][]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "5125:104:4" + }, + "returnParameters": { + "id": 2236, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2235, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 2289, + "src": "5246:4:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2234, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "5246:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "5245:6:4" + }, + "scope": 2347, + "src": "5112:785:4", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2329, + "nodeType": "Block", + "src": "5975:288:4", + "statements": [ + { + "assignments": [ + 2295 + ], + "declarations": [ + { + "constant": false, + "id": 2295, + "name": "winningVoteCount", + "nodeType": "VariableDeclaration", + "scope": 2329, + "src": "5985:24:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2294, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5985:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2297, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 2296, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6012:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "5985:28:4" + }, + { + "body": { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2314, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2309, + "name": "proposals", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1979, + "src": "6093:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal storage ref[] storage ref" + } + }, + "id": 2311, + "indexExpression": { + "argumentTypes": null, + "id": 2310, + "name": "prop", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2299, + "src": "6103:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "6093:15:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Proposal_$1965_storage", + "typeString": "struct EVoting.Proposal storage ref" + } + }, + "id": 2312, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "voteCount", + "nodeType": "MemberAccess", + "referencedDeclaration": 1964, + "src": "6093:25:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "argumentTypes": null, + "id": 2313, + "name": "winningVoteCount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2295, + "src": "6121:16:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6093:44:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 2327, + "nodeType": "IfStatement", + "src": "6089:168:4", + "trueBody": { + "id": 2326, + "nodeType": "Block", + "src": "6139:118:4", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2315, + "name": "winningVoteCount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2295, + "src": "6157:16:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2316, + "name": "proposals", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1979, + "src": "6176:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal storage ref[] storage ref" + } + }, + "id": 2318, + "indexExpression": { + "argumentTypes": null, + "id": 2317, + "name": "prop", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2299, + "src": "6186:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "6176:15:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Proposal_$1965_storage", + "typeString": "struct EVoting.Proposal storage ref" + } + }, + "id": 2319, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "voteCount", + "nodeType": "MemberAccess", + "referencedDeclaration": 1964, + "src": "6176:25:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6157:44:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2321, + "nodeType": "ExpressionStatement", + "src": "6157:44:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2324, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2322, + "name": "_winningProposal", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2292, + "src": "6219:16:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 2323, + "name": "prop", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2299, + "src": "6238:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "6219:23:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 2325, + "nodeType": "ExpressionStatement", + "src": "6219:23:4" + } + ] + } + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 2302, + "name": "prop", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2299, + "src": "6044:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2303, + "name": "proposals", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1979, + "src": "6051:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal storage ref[] storage ref" + } + }, + "id": 2304, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "6051:16:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6044:23:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2328, + "initializationExpression": { + "assignments": [ + 2299 + ], + "declarations": [ + { + "constant": false, + "id": 2299, + "name": "prop", + "nodeType": "VariableDeclaration", + "scope": 2328, + "src": "6028:10:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 2298, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "6028:5:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2301, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 2300, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6041:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "6028:14:4" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 2307, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "6069:6:4", + "subExpression": { + "argumentTypes": null, + "id": 2306, + "name": "prop", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2299, + "src": "6069:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 2308, + "nodeType": "ExpressionStatement", + "src": "6069:6:4" + }, + "nodeType": "ForStatement", + "src": "6023:234:4" + } + ] + }, + "documentation": null, + "id": 2330, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "winningProposal", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2290, + "nodeType": "ParameterList", + "parameters": [], + "src": "5927:2:4" + }, + "returnParameters": { + "id": 2293, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2292, + "name": "_winningProposal", + "nodeType": "VariableDeclaration", + "scope": 2330, + "src": "5951:22:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 2291, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "5951:5:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "5950:24:4" + }, + "scope": 2347, + "src": "5903:360:4", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2345, + "nodeType": "Block", + "src": "6371:65:4", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2337, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2335, + "src": "6377:1:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "3332", + "id": 2340, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6391:2:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + } + ], + "id": 2339, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "6381:9:4", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 2338, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6385:5:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 2341, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6381:13:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory", + "typeString": "bytes memory" + } + }, + "src": "6377:17:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2343, + "nodeType": "ExpressionStatement", + "src": "6377:17:4" + }, + { + "externalReferences": [ + { + "x": { + "declaration": 2332, + "isOffset": false, + "isSlot": false, + "src": "6430:1:4", + "valueSize": 1 + } + }, + { + "b": { + "declaration": 2335, + "isOffset": false, + "isSlot": false, + "src": "6422:1:4", + "valueSize": 1 + } + } + ], + "id": 2344, + "nodeType": "InlineAssembly", + "operations": "{\n mstore(add(b, 32), x)\n}", + "src": "6400:34:4" + } + ] + }, + "documentation": null, + "id": 2346, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toBytes", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2333, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2332, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 2346, + "src": "6328:9:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2331, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6328:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "6327:11:4" + }, + "returnParameters": { + "id": 2336, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2335, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 2346, + "src": "6355:14:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2334, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6355:5:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "6354:16:4" + }, + "scope": 2347, + "src": "6311:125:4", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 2348, + "src": "91:6348:4" + } + ], + "src": "0:6440:4" + }, + "legacyAST": { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/e_voting.sol", + "exportedSymbols": { + "EVoting": [ + 2347 + ] + }, + "id": 2348, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1952, + "literals": [ + "solidity", + ">=", + "0.4", + ".0", + "<", + "0.6", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:31:4" + }, + { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/LSAG.sol", + "file": "./LSAG.sol", + "id": 1953, + "nodeType": "ImportDirective", + "scope": 2348, + "sourceUnit": 1894, + "src": "69:20:4", + "symbolAliases": [], + "unitAlias": "" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 2347, + "linearizedBaseContracts": [ + 2347 + ], + "name": "EVoting", + "nodeType": "ContractDefinition", + "nodes": [ + { + "canonicalName": "EVoting.Voter", + "id": 1962, + "members": [ + { + "constant": false, + "id": 1955, + "name": "weight", + "nodeType": "VariableDeclaration", + "scope": 1962, + "src": "138:11:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1954, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "138:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1957, + "name": "voted", + "nodeType": "VariableDeclaration", + "scope": 1962, + "src": "159:10:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 1956, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "159:4:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1959, + "name": "vote", + "nodeType": "VariableDeclaration", + "scope": 1962, + "src": "179:10:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 1958, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "179:5:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1961, + "name": "delegate", + "nodeType": "VariableDeclaration", + "scope": 1962, + "src": "199:16:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 1960, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "199:7:4", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "Voter", + "nodeType": "StructDefinition", + "scope": 2347, + "src": "115:107:4", + "visibility": "public" + }, + { + "canonicalName": "EVoting.Proposal", + "id": 1965, + "members": [ + { + "constant": false, + "id": 1964, + "name": "voteCount", + "nodeType": "VariableDeclaration", + "scope": 1965, + "src": "254:14:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1963, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "254:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "Proposal", + "nodeType": "StructDefinition", + "scope": 2347, + "src": "228:47:4", + "visibility": "public" + }, + { + "canonicalName": "EVoting.keyImages", + "id": 1970, + "members": [ + { + "constant": false, + "id": 1967, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 1970, + "src": "312:9:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1966, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "312:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1969, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 1970, + "src": "331:9:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1968, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "331:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "keyImages", + "nodeType": "StructDefinition", + "scope": 2347, + "src": "285:62:4", + "visibility": "public" + }, + { + "constant": false, + "id": 1972, + "name": "chairperson", + "nodeType": "VariableDeclaration", + "scope": 2347, + "src": "353:19:4", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 1971, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "353:7:4", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1976, + "name": "voters", + "nodeType": "VariableDeclaration", + "scope": 2347, + "src": "378:32:4", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Voter_$1962_storage_$", + "typeString": "mapping(address => struct EVoting.Voter)" + }, + "typeName": { + "id": 1975, + "keyType": { + "id": 1973, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "386:7:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "378:25:4", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Voter_$1962_storage_$", + "typeString": "mapping(address => struct EVoting.Voter)" + }, + "valueType": { + "contractScope": null, + "id": 1974, + "name": "Voter", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 1962, + "src": "397:5:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Voter_$1962_storage_ptr", + "typeString": "struct EVoting.Voter" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1979, + "name": "proposals", + "nodeType": "VariableDeclaration", + "scope": 2347, + "src": "416:20:4", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal[]" + }, + "typeName": { + "baseType": { + "contractScope": null, + "id": 1977, + "name": "Proposal", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 1965, + "src": "416:8:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Proposal_$1965_storage_ptr", + "typeString": "struct EVoting.Proposal" + } + }, + "id": 1978, + "length": null, + "nodeType": "ArrayTypeName", + "src": "416:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage_ptr", + "typeString": "struct EVoting.Proposal[]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1984, + "name": "_pub_keys", + "nodeType": "VariableDeclaration", + "scope": 2347, + "src": "442:22:4", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage", + "typeString": "uint256[2][]" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 1980, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "442:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1982, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1981, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "450:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "442:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "id": 1983, + "length": null, + "nodeType": "ArrayTypeName", + "src": "442:12:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage_ptr", + "typeString": "uint256[2][]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1987, + "name": "I_array", + "nodeType": "VariableDeclaration", + "scope": 2347, + "src": "470:19:4", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_keyImages_$1970_storage_$dyn_storage", + "typeString": "struct EVoting.keyImages[]" + }, + "typeName": { + "baseType": { + "contractScope": null, + "id": 1985, + "name": "keyImages", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 1970, + "src": "470:9:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_storage_ptr", + "typeString": "struct EVoting.keyImages" + } + }, + "id": 1986, + "length": null, + "nodeType": "ArrayTypeName", + "src": "470:11:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_keyImages_$1970_storage_$dyn_storage_ptr", + "typeString": "struct EVoting.keyImages[]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1989, + "name": "common", + "nodeType": "VariableDeclaration", + "scope": 2347, + "src": "495:14:4", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 1988, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "495:7:4", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "body": { + "id": 2048, + "nodeType": "Block", + "src": "793:2247:4", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1995, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1992, + "name": "chairperson", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1972, + "src": "803:11:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1993, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2496, + "src": "817:3:4", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 1994, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "817:10:4", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "src": "803:24:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 1996, + "nodeType": "ExpressionStatement", + "src": "803:24:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2002, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1997, + "name": "voters", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1976, + "src": "837:6:4", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Voter_$1962_storage_$", + "typeString": "mapping(address => struct EVoting.Voter storage ref)" + } + }, + "id": 1999, + "indexExpression": { + "argumentTypes": null, + "id": 1998, + "name": "chairperson", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1972, + "src": "844:11:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "837:19:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Voter_$1962_storage", + "typeString": "struct EVoting.Voter storage ref" + } + }, + "id": 2000, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "weight", + "nodeType": "MemberAccess", + "referencedDeclaration": 1955, + "src": "837:26:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "31", + "id": 2001, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "866:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "837:30:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2003, + "nodeType": "ExpressionStatement", + "src": "837:30:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2008, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2004, + "name": "proposals", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1979, + "src": "877:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal storage ref[] storage ref" + } + }, + "id": 2006, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "877:16:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "3130", + "id": 2007, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "896:2:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_10_by_1", + "typeString": "int_const 10" + }, + "value": "10" + }, + "src": "877:21:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2009, + "nodeType": "ExpressionStatement", + "src": "877:21:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2042, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2010, + "name": "_pub_keys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1984, + "src": "1016:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage", + "typeString": "uint256[2] storage ref[] storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3736383630323138303837373933393833303834353335373033333736393831333836343637343437363131313732303834303731383533323538393331323531353331363535313433383130", + "id": 2011, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1031:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_76860218087793983084535703376981386467447611172084071853258931251531655143810_by_1", + "typeString": "int_const 7686...(69 digits omitted)...3810" + }, + "value": "76860218087793983084535703376981386467447611172084071853258931251531655143810" + }, + { + "argumentTypes": null, + "hexValue": "3331343132343435383030353937373037323034303030323936333036393831353335333639343837363839373238303232323934323033343733363434313838353334353938323738343333", + "id": 2012, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1109:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_31412445800597707204000296306981535369487689728022294203473644188534598278433_by_1", + "typeString": "int_const 3141...(69 digits omitted)...8433" + }, + "value": "31412445800597707204000296306981535369487689728022294203473644188534598278433" + } + ], + "id": 2013, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1030:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3338333833353039323635323633353638343033303931393933393932363332373338303839313936323535363233313136383135323433353438343333333835303236313333313534383733", + "id": 2014, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1189:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_38383509265263568403091993992632738089196255623116815243548433385026133154873_by_1", + "typeString": "int_const 3838...(69 digits omitted)...4873" + }, + "value": "38383509265263568403091993992632738089196255623116815243548433385026133154873" + }, + { + "argumentTypes": null, + "hexValue": "36313737343538303432363930383138303633363534393938383132333231313030363430323436343137303737343130343031373938383231393937323032303734343535303637363538", + "id": 2015, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1267:76:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_6177458042690818063654998812321100640246417077410401798821997202074455067658_by_1", + "typeString": "int_const 6177...(68 digits omitted)...7658" + }, + "value": "6177458042690818063654998812321100640246417077410401798821997202074455067658" + } + ], + "id": 2016, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1188:156:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "313039343934393734373539343037353434313135393830323231363530323639393839343135383335383633313938373233303937313935393931383730343830353435353931373438363934", + "id": 2017, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1346:78:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_109494974759407544115980221650269989415835863198723097195991870480545591748694_by_1", + "typeString": "int_const 1094...(70 digits omitted)...8694" + }, + "value": "109494974759407544115980221650269989415835863198723097195991870480545591748694" + }, + { + "argumentTypes": null, + "hexValue": "3838333733383837383135353730303238343834333138363336393932303636393732363135343733363234343333393538353537323132383938353939363533373532323838353136353533", + "id": 2018, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1425:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_88373887815570028484318636992066972615473624433958557212898599653752288516553_by_1", + "typeString": "int_const 8837...(69 digits omitted)...6553" + }, + "value": "88373887815570028484318636992066972615473624433958557212898599653752288516553" + } + ], + "id": 2019, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1345:158:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3632303234333938363334383734303636343433393632383435363330363738373333333130383431323638343539333532373231353133383336383734303736393537303134383235363933", + "id": 2020, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1505:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_62024398634874066443962845630678733310841268459352721513836874076957014825693_by_1", + "typeString": "int_const 6202...(69 digits omitted)...5693" + }, + "value": "62024398634874066443962845630678733310841268459352721513836874076957014825693" + }, + { + "argumentTypes": null, + "hexValue": "3137353233393134343636353035373633393033343031343937393530353533303436323539333832363336383937303033393235393130373030383330393330313637343135333734383435", + "id": 2021, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1583:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_17523914466505763903401497950553046259382636897003925910700830930167415374845_by_1", + "typeString": "int_const 1752...(69 digits omitted)...4845" + }, + "value": "17523914466505763903401497950553046259382636897003925910700830930167415374845" + } + ], + "id": 2022, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1504:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3633373137353838343032373430383839353933333139383333353432373531343030373138383733313538353338393238353933303338313236373236393533343234383633353331313631", + "id": 2023, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1663:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_63717588402740889593319833542751400718873158538928593038126726953424863531161_by_1", + "typeString": "int_const 6371...(69 digits omitted)...1161" + }, + "value": "63717588402740889593319833542751400718873158538928593038126726953424863531161" + }, + { + "argumentTypes": null, + "hexValue": "3831383334303732363031353532363331393939313531373433343136333733373735303634353631383335323139303234333635393437333336383133343637323537353735393439323837", + "id": 2024, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1741:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_81834072601552631999151743416373775064561835219024365947336813467257575949287_by_1", + "typeString": "int_const 8183...(69 digits omitted)...9287" + }, + "value": "81834072601552631999151743416373775064561835219024365947336813467257575949287" + } + ], + "id": 2025, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1662:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3934343838363237333139353538313730343434313932393633353231353533383636373338313832323731333230393232393338333631383232323732393534383334313633303536373036", + "id": 2026, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1821:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_94488627319558170444192963521553866738182271320922938361822272954834163056706_by_1", + "typeString": "int_const 9448...(69 digits omitted)...6706" + }, + "value": "94488627319558170444192963521553866738182271320922938361822272954834163056706" + }, + { + "argumentTypes": null, + "hexValue": "3735313137343839313332303230323033343338333334323232353330303839373238333530313938393237323530373038353138343434343637303039353637303437333031393938353234", + "id": 2027, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1899:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_75117489132020203438334222530089728350198927250708518444467009567047301998524_by_1", + "typeString": "int_const 7511...(69 digits omitted)...8524" + }, + "value": "75117489132020203438334222530089728350198927250708518444467009567047301998524" + } + ], + "id": 2028, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1820:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3732303733313231373030383435383136353332343039393039353638393537303932393735353630333238303336383532353434383036363730333930303633363937323434313637353739", + "id": 2029, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1979:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_72073121700845816532409909568957092975560328036852544806670390063697244167579_by_1", + "typeString": "int_const 7207...(69 digits omitted)...7579" + }, + "value": "72073121700845816532409909568957092975560328036852544806670390063697244167579" + }, + { + "argumentTypes": null, + "hexValue": "3838303038383832383939303330353636343131343139323332343339323635333533383235333136333637313234323331383739313230363034313532323437353634303131343238313138", + "id": 2030, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2057:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_88008882899030566411419232439265353825316367124231879120604152247564011428118_by_1", + "typeString": "int_const 8800...(69 digits omitted)...8118" + }, + "value": "88008882899030566411419232439265353825316367124231879120604152247564011428118" + } + ], + "id": 2031, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1978:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3639333032363633323631383131343230323637343633363437333131353635353931343538333534353434303834323735383538393033303934303137343335303238393039383335383730", + "id": 2032, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2137:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_69302663261811420267463647311565591458354544084275858903094017435028909835870_by_1", + "typeString": "int_const 6930...(69 digits omitted)...5870" + }, + "value": "69302663261811420267463647311565591458354544084275858903094017435028909835870" + }, + { + "argumentTypes": null, + "hexValue": "3736323434363030383535313231313638313038353434383833363034303938353634373239363130373930323933363435313634333831383438393938383731353331393834373534303832", + "id": 2033, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2215:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_76244600855121168108544883604098564729610790293645164381848998871531984754082_by_1", + "typeString": "int_const 7624...(69 digits omitted)...4082" + }, + "value": "76244600855121168108544883604098564729610790293645164381848998871531984754082" + } + ], + "id": 2034, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2136:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3231303632343131343737373832303136333030363439323834353938363337363238353238353239313939313234373435343136303833343335393136333231353635373735333831393133", + "id": 2035, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2295:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_21062411477782016300649284598637628528529199124745416083435916321565775381913_by_1", + "typeString": "int_const 2106...(69 digits omitted)...1913" + }, + "value": "21062411477782016300649284598637628528529199124745416083435916321565775381913" + }, + { + "argumentTypes": null, + "hexValue": "3839343030323535363136343834363837383638343930383830373537363837323436393133303638333937373632303431343630313035353137383338313035363933363430363739363736", + "id": 2036, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2373:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_89400255616484687868490880757687246913068397762041460105517838105693640679676_by_1", + "typeString": "int_const 8940...(69 digits omitted)...9676" + }, + "value": "89400255616484687868490880757687246913068397762041460105517838105693640679676" + } + ], + "id": 2037, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2294:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "hexValue": "3131333234393631333934343431303836333032353136303638353439383035383834323334343934363033383634313433333439303834383231323332323538383537303330303832353838", + "id": 2038, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2453:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_11324961394441086302516068549805884234494603864143349084821232258857030082588_by_1", + "typeString": "int_const 1132...(69 digits omitted)...2588" + }, + "value": "11324961394441086302516068549805884234494603864143349084821232258857030082588" + }, + { + "argumentTypes": null, + "hexValue": "3437383530323339373533363931393339333730333739333739313737363739363034363835363339333131323732303233313231343332363935343634323733333035323637363832313332", + "id": 2039, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2531:77:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_47850239753691939370379379177679604685639311272023121432695464273305267682132_by_1", + "typeString": "int_const 4785...(69 digits omitted)...2132" + }, + "value": "47850239753691939370379379177679604685639311272023121432695464273305267682132" + } + ], + "id": 2040, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2452:157:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + } + ], + "id": 2041, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1029:1581:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$10_memory_ptr", + "typeString": "uint256[2] memory[10] memory" + } + }, + "src": "1016:1594:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage", + "typeString": "uint256[2] storage ref[] storage ref" + } + }, + "id": 2043, + "nodeType": "ExpressionStatement", + "src": "1016:1594:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2046, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2044, + "name": "common", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1989, + "src": "2973:6:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "307831373435383130344461383635344537433036376533343130613635303830443964444231344633", + "id": 2045, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2982:42:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + }, + "value": "0x17458104Da8654E7C067e3410a65080D9dDB14F3" + }, + "src": "2973:51:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 2047, + "nodeType": "ExpressionStatement", + "src": "2973:51:4" + } + ] + }, + "documentation": "Create a new ballot with $(_numProposals, Proposals[] prop, uint256[2][] pubkeys) different proposals.\n Initializing Public Keys, Proposal length", + "id": 2049, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1990, + "nodeType": "ParameterList", + "parameters": [], + "src": "688:97:4" + }, + "returnParameters": { + "id": 1991, + "nodeType": "ParameterList", + "parameters": [], + "src": "793:0:4" + }, + "scope": 2347, + "src": "677:2363:4", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2066, + "nodeType": "Block", + "src": "3093:139:4", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 2058, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2055, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2496, + "src": "3111:3:4", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2056, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3111:10:4", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 2057, + "name": "chairperson", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1972, + "src": "3125:11:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3111:25:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "73656e646572206973206e6f7420746865206368616972706572736f6e2e2063616e74207365742074686520636f6d6d6f6e2061646472657373", + "id": 2059, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3138:60:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_3945a0ebdf4f94d01e520ed1f4979f167d76124b71e6da5be0d718b2c4f77deb", + "typeString": "literal_string \"sender is not the chairperson. cant set the common address\"" + }, + "value": "sender is not the chairperson. cant set the common address" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_3945a0ebdf4f94d01e520ed1f4979f167d76124b71e6da5be0d718b2c4f77deb", + "typeString": "literal_string \"sender is not the chairperson. cant set the common address\"" + } + ], + "id": 2054, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2499, + 2500 + ], + "referencedDeclaration": 2500, + "src": "3103:7:4", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2060, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3103:96:4", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2061, + "nodeType": "ExpressionStatement", + "src": "3103:96:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2064, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2062, + "name": "common", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1989, + "src": "3209:6:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 2063, + "name": "_common", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2051, + "src": "3218:7:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "3209:16:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 2065, + "nodeType": "ExpressionStatement", + "src": "3209:16:4" + } + ] + }, + "documentation": null, + "id": 2067, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "setCommon", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2052, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2051, + "name": "_common", + "nodeType": "VariableDeclaration", + "scope": 2067, + "src": "3069:15:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2050, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "3069:7:4", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3068:17:4" + }, + "returnParameters": { + "id": 2053, + "nodeType": "ParameterList", + "parameters": [], + "src": "3093:0:4" + }, + "scope": 2347, + "src": "3050:182:4", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2117, + "nodeType": "Block", + "src": "3301:171:4", + "statements": [ + { + "assignments": [ + 2075 + ], + "declarations": [ + { + "constant": false, + "id": 2075, + "name": "number", + "nodeType": "VariableDeclaration", + "scope": 2117, + "src": "3311:14:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2074, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3311:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2076, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "3311:14:4" + }, + { + "body": { + "id": 2113, + "nodeType": "Block", + "src": "3363:80:4", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2111, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2088, + "name": "number", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2075, + "src": "3377:6:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2110, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 2089, + "name": "number", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2075, + "src": "3386:6:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2109, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2091, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2069, + "src": "3401:1:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2093, + "indexExpression": { + "argumentTypes": null, + "id": 2092, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2078, + "src": "3403:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3401:4:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + ], + "id": 2090, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "3395:5:4", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint8_$", + "typeString": "type(uint8)" + }, + "typeName": "uint8" + }, + "id": 2094, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3395:11:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2107, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 2095, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3408:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2105, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "hexValue": "38", + "id": 2096, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3412:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2103, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2097, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2069, + "src": "3415:1:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2098, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3415:8:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2101, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 2099, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2078, + "src": "3425:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2100, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3427:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "3425:3:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2102, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "3424:5:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3415:14:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2104, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "3414:16:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3412:18:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2106, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "3411:20:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3408:23:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2108, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "3407:25:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3395:37:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3386:46:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3377:55:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2112, + "nodeType": "ExpressionStatement", + "src": "3377:55:4" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2084, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 2081, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2078, + "src": "3348:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2082, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2069, + "src": "3350:1:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2083, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3350:8:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3348:10:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2114, + "initializationExpression": { + "assignments": [ + 2078 + ], + "declarations": [ + { + "constant": false, + "id": 2078, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 2114, + "src": "3339:6:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2077, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3339:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2080, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 2079, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3346:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "3339:8:4" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 2086, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "3359:3:4", + "subExpression": { + "argumentTypes": null, + "id": 2085, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2078, + "src": "3359:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2087, + "nodeType": "ExpressionStatement", + "src": "3359:3:4" + }, + "nodeType": "ForStatement", + "src": "3335:108:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2115, + "name": "number", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2075, + "src": "3459:6:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2073, + "id": 2116, + "nodeType": "Return", + "src": "3452:13:4" + } + ] + }, + "documentation": null, + "id": 2118, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "bytesToUint", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2070, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2069, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 2118, + "src": "3259:14:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2068, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3259:5:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3258:16:4" + }, + "returnParameters": { + "id": 2073, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2072, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 2118, + "src": "3293:7:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2071, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3293:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3292:9:4" + }, + "scope": 2347, + "src": "3238:234:4", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 2215, + "nodeType": "Block", + "src": "4604:444:4", + "statements": [ + { + "assignments": [ + 2140 + ], + "declarations": [ + { + "constant": false, + "id": 2140, + "name": "status", + "nodeType": "VariableDeclaration", + "scope": 2215, + "src": "4614:11:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2139, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4614:4:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2149, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2143, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2120, + "src": "4640:7:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 2144, + "name": "c0", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2122, + "src": "4649:2:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2145, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2126, + "src": "4653:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 2146, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2129, + "src": "4663:1:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + { + "argumentTypes": null, + "id": 2147, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2134, + "src": "4666:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + }, + { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 2141, + "name": "LSAG", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1893, + "src": "4628:4:4", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_LSAG_$1893_$", + "typeString": "type(library LSAG)" + } + }, + "id": 2142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "verify", + "nodeType": "MemberAccess", + "referencedDeclaration": 1892, + "src": "4628:11:4", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_view$_t_bytes_memory_ptr_$_t_uint256_$_t_array$_t_uint256_$2_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr_$returns$_t_bool_$", + "typeString": "function (bytes memory,uint256,uint256[2] memory,uint256[] memory,uint256[2] memory[] memory) view returns (bool)" + } + }, + "id": 2148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4628:49:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4614:63:4" + }, + { + "condition": { + "argumentTypes": null, + "id": 2151, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "4700:7:4", + "subExpression": { + "argumentTypes": null, + "id": 2150, + "name": "status", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2140, + "src": "4701:6:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 2154, + "nodeType": "IfStatement", + "src": "4696:25:4", + "trueBody": { + "expression": { + "argumentTypes": null, + "hexValue": "66616c7365", + "id": 2152, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4716:5:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + "functionReturnParameters": 2138, + "id": 2153, + "nodeType": "Return", + "src": "4709:12:4" + } + }, + { + "body": { + "id": 2186, + "nodeType": "Block", + "src": "4768:101:4", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 2182, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2173, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2166, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2126, + "src": "4786:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2168, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 2167, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4795:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4786:11:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2169, + "name": "I_array", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1987, + "src": "4801:7:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_keyImages_$1970_storage_$dyn_storage", + "typeString": "struct EVoting.keyImages storage ref[] storage ref" + } + }, + "id": 2171, + "indexExpression": { + "argumentTypes": null, + "id": 2170, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2156, + "src": "4809:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4801:10:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_storage", + "typeString": "struct EVoting.keyImages storage ref" + } + }, + "id": 2172, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "x", + "nodeType": "MemberAccess", + "referencedDeclaration": 1967, + "src": "4801:12:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4786:27:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2181, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2174, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2126, + "src": "4817:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2176, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2175, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4826:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4817:11:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2177, + "name": "I_array", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1987, + "src": "4832:7:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_keyImages_$1970_storage_$dyn_storage", + "typeString": "struct EVoting.keyImages storage ref[] storage ref" + } + }, + "id": 2179, + "indexExpression": { + "argumentTypes": null, + "id": 2178, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2156, + "src": "4840:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4832:10:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_storage", + "typeString": "struct EVoting.keyImages storage ref" + } + }, + "id": 2180, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "y", + "nodeType": "MemberAccess", + "referencedDeclaration": 1969, + "src": "4832:12:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4817:27:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "4786:58:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 2185, + "nodeType": "IfStatement", + "src": "4782:76:4", + "trueBody": { + "expression": { + "argumentTypes": null, + "hexValue": "66616c7365", + "id": 2183, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4853:5:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + "functionReturnParameters": 2138, + "id": 2184, + "nodeType": "Return", + "src": "4846:12:4" + } + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2162, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 2159, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2156, + "src": "4745:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2160, + "name": "I_array", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1987, + "src": "4747:7:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_keyImages_$1970_storage_$dyn_storage", + "typeString": "struct EVoting.keyImages storage ref[] storage ref" + } + }, + "id": 2161, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4747:14:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4745:16:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2187, + "initializationExpression": { + "assignments": [ + 2156 + ], + "declarations": [ + { + "constant": false, + "id": 2156, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 2187, + "src": "4735:6:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2155, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4735:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2158, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 2157, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4742:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4735:8:4" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 2164, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "4763:3:4", + "subExpression": { + "argumentTypes": null, + "id": 2163, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2156, + "src": "4763:1:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2165, + "nodeType": "ExpressionStatement", + "src": "4763:3:4" + }, + "nodeType": "ForStatement", + "src": "4731:138:4" + }, + { + "assignments": [ + 2189 + ], + "declarations": [ + { + "constant": false, + "id": 2189, + "name": "new_keyimage", + "nodeType": "VariableDeclaration", + "scope": 2215, + "src": "4878:29:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_memory_ptr", + "typeString": "struct EVoting.keyImages" + }, + "typeName": { + "contractScope": null, + "id": 2188, + "name": "keyImages", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 1970, + "src": "4878:9:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_storage_ptr", + "typeString": "struct EVoting.keyImages" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2190, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "4878:29:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2197, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2191, + "name": "new_keyimage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2189, + "src": "4917:12:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_memory_ptr", + "typeString": "struct EVoting.keyImages memory" + } + }, + "id": 2193, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "x", + "nodeType": "MemberAccess", + "referencedDeclaration": 1967, + "src": "4917:14:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2194, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2126, + "src": "4934:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2196, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 2195, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4943:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4934:11:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4917:28:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2198, + "nodeType": "ExpressionStatement", + "src": "4917:28:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2205, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2199, + "name": "new_keyimage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2189, + "src": "4955:12:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_memory_ptr", + "typeString": "struct EVoting.keyImages memory" + } + }, + "id": 2201, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "y", + "nodeType": "MemberAccess", + "referencedDeclaration": 1969, + "src": "4955:14:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2202, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2126, + "src": "4972:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2204, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2203, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4981:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4972:11:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4955:28:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2206, + "nodeType": "ExpressionStatement", + "src": "4955:28:4" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2210, + "name": "new_keyimage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2189, + "src": "5006:12:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_keyImages_$1970_memory_ptr", + "typeString": "struct EVoting.keyImages memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_keyImages_$1970_memory_ptr", + "typeString": "struct EVoting.keyImages memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 2207, + "name": "I_array", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1987, + "src": "4993:7:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_keyImages_$1970_storage_$dyn_storage", + "typeString": "struct EVoting.keyImages storage ref[] storage ref" + } + }, + "id": 2209, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4993:12:4", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_struct$_keyImages_$1970_storage_$returns$_t_uint256_$", + "typeString": "function (struct EVoting.keyImages storage ref) returns (uint256)" + } + }, + "id": 2211, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4993:26:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2212, + "nodeType": "ExpressionStatement", + "src": "4993:26:4" + }, + { + "expression": { + "argumentTypes": null, + "hexValue": "74727565", + "id": 2213, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5036:4:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 2138, + "id": 2214, + "nodeType": "Return", + "src": "5029:11:4" + } + ] + }, + "documentation": "Delegate your vote to the voter $(to).", + "id": 2216, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "LSAG_verify", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2135, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2120, + "name": "message", + "nodeType": "VariableDeclaration", + "scope": 2216, + "src": "4466:20:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2119, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "4466:5:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2122, + "name": "c0", + "nodeType": "VariableDeclaration", + "scope": 2216, + "src": "4488:10:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2121, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4488:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2126, + "name": "keyImage", + "nodeType": "VariableDeclaration", + "scope": 2216, + "src": "4500:26:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 2123, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4500:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2125, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2124, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4508:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "4500:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2129, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 2216, + "src": "4528:18:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 2127, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4528:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2128, + "length": null, + "nodeType": "ArrayTypeName", + "src": "4528:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2134, + "name": "publicKeys", + "nodeType": "VariableDeclaration", + "scope": 2216, + "src": "4548:30:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2][]" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 2130, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4548:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2132, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2131, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4556:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "4548:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "id": 2133, + "length": null, + "nodeType": "ArrayTypeName", + "src": "4548:12:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage_ptr", + "typeString": "uint256[2][]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4465:114:4" + }, + "returnParameters": { + "id": 2138, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2137, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 2216, + "src": "4598:4:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2136, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4598:4:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4597:6:4" + }, + "scope": 2347, + "src": "4445:603:4", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 2288, + "nodeType": "Block", + "src": "5251:646:4", + "statements": [ + { + "assignments": [ + 2238 + ], + "declarations": [ + { + "constant": false, + "id": 2238, + "name": "message", + "nodeType": "VariableDeclaration", + "scope": 2288, + "src": "5261:20:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2237, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "5261:5:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2242, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2240, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2218, + "src": "5292:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2239, + "name": "toBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2346, + "src": "5284:7:4", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_uint256_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (uint256) returns (bytes memory)" + } + }, + "id": 2241, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5284:16:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5261:39:4" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 2247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2244, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2496, + "src": "5318:3:4", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "5318:10:4", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 2246, + "name": "common", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1989, + "src": "5332:6:4", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "5318:20:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "73656e646572206973206e6f742074686520636f6d6d6f6e2061646472657373", + "id": 2248, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5340:34:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_68fd146e033c69fcdb55a38b3dbe8c2e718fabdd7e10cdc123b1892c46d26ca8", + "typeString": "literal_string \"sender is not the common address\"" + }, + "value": "sender is not the common address" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_68fd146e033c69fcdb55a38b3dbe8c2e718fabdd7e10cdc123b1892c46d26ca8", + "typeString": "literal_string \"sender is not the common address\"" + } + ], + "id": 2243, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2499, + 2500 + ], + "referencedDeclaration": 2500, + "src": "5310:7:4", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5310:65:4", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2250, + "nodeType": "ExpressionStatement", + "src": "5310:65:4" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2253, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2238, + "src": "5406:7:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 2254, + "name": "c0", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2220, + "src": "5415:2:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2255, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2224, + "src": "5419:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 2256, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2227, + "src": "5429:1:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + { + "argumentTypes": null, + "id": 2257, + "name": "pub_keys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2232, + "src": "5432:8:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + }, + { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + ], + "id": 2252, + "name": "LSAG_verify", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2216, + "src": "5394:11:4", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes_memory_ptr_$_t_uint256_$_t_array$_t_uint256_$2_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr_$returns$_t_bool_$", + "typeString": "function (bytes memory,uint256,uint256[2] memory,uint256[] memory,uint256[2] memory[] memory) returns (bool)" + } + }, + "id": 2258, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5394:47:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "6c73616720766572696669636174696f6e206469646e277420776f726b", + "id": 2259, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5443:31:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_f37ccde4e43e46cf8408f14afdb5b92c86a7d7926676c424054ff7fd7e40b7fb", + "typeString": "literal_string \"lsag verification didn't work\"" + }, + "value": "lsag verification didn't work" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_f37ccde4e43e46cf8408f14afdb5b92c86a7d7926676c424054ff7fd7e40b7fb", + "typeString": "literal_string \"lsag verification didn't work\"" + } + ], + "id": 2251, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2499, + 2500 + ], + "referencedDeclaration": 2500, + "src": "5386:7:4", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2260, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5386:89:4", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2261, + "nodeType": "ExpressionStatement", + "src": "5386:89:4" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 2265, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2263, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5494:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 2264, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5497:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "5494:4:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "576f726b696e672074696c6c2068657265", + "id": 2266, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5500:19:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_20ce0dc11e700e7a9c946d9e18e3c14c06f2e5d8797d8745378da6399a5a3c4a", + "typeString": "literal_string \"Working till here\"" + }, + "value": "Working till here" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_20ce0dc11e700e7a9c946d9e18e3c14c06f2e5d8797d8745378da6399a5a3c4a", + "typeString": "literal_string \"Working till here\"" + } + ], + "id": 2262, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2499, + 2500 + ], + "referencedDeclaration": 2500, + "src": "5486:7:4", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2267, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5486:34:4", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2268, + "nodeType": "ExpressionStatement", + "src": "5486:34:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2277, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "5530:45:4", + "subExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2269, + "name": "proposals", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1979, + "src": "5530:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal storage ref[] storage ref" + } + }, + "id": 2275, + "indexExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2271, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2238, + "src": "5552:7:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 2270, + "name": "bytesToUint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2118, + "src": "5540:11:4", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes_memory_ptr_$returns$_t_uint256_$", + "typeString": "function (bytes memory) returns (uint256)" + } + }, + "id": 2272, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5540:20:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2273, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5561:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "5540:22:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "5530:33:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Proposal_$1965_storage", + "typeString": "struct EVoting.Proposal storage ref" + } + }, + "id": 2276, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "voteCount", + "nodeType": "MemberAccess", + "referencedDeclaration": 1964, + "src": "5530:43:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2278, + "nodeType": "ExpressionStatement", + "src": "5530:45:4" + }, + { + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2279, + "name": "proposals", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1979, + "src": "5592:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal storage ref[] storage ref" + } + }, + "id": 2285, + "indexExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2281, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2238, + "src": "5614:7:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 2280, + "name": "bytesToUint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2118, + "src": "5602:11:4", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes_memory_ptr_$returns$_t_uint256_$", + "typeString": "function (bytes memory) returns (uint256)" + } + }, + "id": 2282, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5602:20:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2283, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5623:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "5602:22:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "5592:33:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Proposal_$1965_storage", + "typeString": "struct EVoting.Proposal storage ref" + } + }, + "id": 2286, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "voteCount", + "nodeType": "MemberAccess", + "referencedDeclaration": 1964, + "src": "5592:43:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2236, + "id": 2287, + "nodeType": "Return", + "src": "5585:50:4" + } + ] + }, + "documentation": "Give a single vote to proposal $(toProposal).", + "id": 2289, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "vote", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2233, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2218, + "name": "message", + "nodeType": "VariableDeclaration", + "scope": 2289, + "src": "5126:12:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2217, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "5126:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2220, + "name": "c0", + "nodeType": "VariableDeclaration", + "scope": 2289, + "src": "5140:10:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2219, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5140:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2224, + "name": "keyImage", + "nodeType": "VariableDeclaration", + "scope": 2289, + "src": "5152:26:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 2221, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5152:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2223, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2222, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5160:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "5152:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2227, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 2289, + "src": "5180:18:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 2225, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5180:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2226, + "length": null, + "nodeType": "ArrayTypeName", + "src": "5180:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2232, + "name": "pub_keys", + "nodeType": "VariableDeclaration", + "scope": 2289, + "src": "5200:28:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2][]" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 2228, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5200:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2230, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2229, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5208:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "5200:10:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "id": 2231, + "length": null, + "nodeType": "ArrayTypeName", + "src": "5200:12:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage_ptr", + "typeString": "uint256[2][]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "5125:104:4" + }, + "returnParameters": { + "id": 2236, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2235, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 2289, + "src": "5246:4:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2234, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "5246:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "5245:6:4" + }, + "scope": 2347, + "src": "5112:785:4", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2329, + "nodeType": "Block", + "src": "5975:288:4", + "statements": [ + { + "assignments": [ + 2295 + ], + "declarations": [ + { + "constant": false, + "id": 2295, + "name": "winningVoteCount", + "nodeType": "VariableDeclaration", + "scope": 2329, + "src": "5985:24:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2294, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5985:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2297, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 2296, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6012:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "5985:28:4" + }, + { + "body": { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2314, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2309, + "name": "proposals", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1979, + "src": "6093:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal storage ref[] storage ref" + } + }, + "id": 2311, + "indexExpression": { + "argumentTypes": null, + "id": 2310, + "name": "prop", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2299, + "src": "6103:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "6093:15:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Proposal_$1965_storage", + "typeString": "struct EVoting.Proposal storage ref" + } + }, + "id": 2312, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "voteCount", + "nodeType": "MemberAccess", + "referencedDeclaration": 1964, + "src": "6093:25:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "argumentTypes": null, + "id": 2313, + "name": "winningVoteCount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2295, + "src": "6121:16:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6093:44:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 2327, + "nodeType": "IfStatement", + "src": "6089:168:4", + "trueBody": { + "id": 2326, + "nodeType": "Block", + "src": "6139:118:4", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2315, + "name": "winningVoteCount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2295, + "src": "6157:16:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2316, + "name": "proposals", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1979, + "src": "6176:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal storage ref[] storage ref" + } + }, + "id": 2318, + "indexExpression": { + "argumentTypes": null, + "id": 2317, + "name": "prop", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2299, + "src": "6186:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "6176:15:4", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Proposal_$1965_storage", + "typeString": "struct EVoting.Proposal storage ref" + } + }, + "id": 2319, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "voteCount", + "nodeType": "MemberAccess", + "referencedDeclaration": 1964, + "src": "6176:25:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6157:44:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2321, + "nodeType": "ExpressionStatement", + "src": "6157:44:4" + }, + { + "expression": { + "argumentTypes": null, + "id": 2324, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2322, + "name": "_winningProposal", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2292, + "src": "6219:16:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 2323, + "name": "prop", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2299, + "src": "6238:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "6219:23:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 2325, + "nodeType": "ExpressionStatement", + "src": "6219:23:4" + } + ] + } + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2305, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 2302, + "name": "prop", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2299, + "src": "6044:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 2303, + "name": "proposals", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1979, + "src": "6051:9:4", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_struct$_Proposal_$1965_storage_$dyn_storage", + "typeString": "struct EVoting.Proposal storage ref[] storage ref" + } + }, + "id": 2304, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "6051:16:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "6044:23:4", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2328, + "initializationExpression": { + "assignments": [ + 2299 + ], + "declarations": [ + { + "constant": false, + "id": 2299, + "name": "prop", + "nodeType": "VariableDeclaration", + "scope": 2328, + "src": "6028:10:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 2298, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "6028:5:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 2301, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 2300, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6041:1:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "6028:14:4" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 2307, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "6069:6:4", + "subExpression": { + "argumentTypes": null, + "id": 2306, + "name": "prop", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2299, + "src": "6069:4:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 2308, + "nodeType": "ExpressionStatement", + "src": "6069:6:4" + }, + "nodeType": "ForStatement", + "src": "6023:234:4" + } + ] + }, + "documentation": null, + "id": 2330, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "winningProposal", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2290, + "nodeType": "ParameterList", + "parameters": [], + "src": "5927:2:4" + }, + "returnParameters": { + "id": 2293, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2292, + "name": "_winningProposal", + "nodeType": "VariableDeclaration", + "scope": 2330, + "src": "5951:22:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 2291, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "5951:5:4", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "5950:24:4" + }, + "scope": 2347, + "src": "5903:360:4", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2345, + "nodeType": "Block", + "src": "6371:65:4", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 2337, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2335, + "src": "6377:1:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "3332", + "id": 2340, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6391:2:4", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + } + ], + "id": 2339, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "6381:9:4", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 2338, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6385:5:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 2341, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6381:13:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory", + "typeString": "bytes memory" + } + }, + "src": "6377:17:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 2343, + "nodeType": "ExpressionStatement", + "src": "6377:17:4" + }, + { + "externalReferences": [ + { + "x": { + "declaration": 2332, + "isOffset": false, + "isSlot": false, + "src": "6430:1:4", + "valueSize": 1 + } + }, + { + "b": { + "declaration": 2335, + "isOffset": false, + "isSlot": false, + "src": "6422:1:4", + "valueSize": 1 + } + } + ], + "id": 2344, + "nodeType": "InlineAssembly", + "operations": "{\n mstore(add(b, 32), x)\n}", + "src": "6400:34:4" + } + ] + }, + "documentation": null, + "id": 2346, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toBytes", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2333, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2332, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 2346, + "src": "6328:9:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2331, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6328:7:4", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "6327:11:4" + }, + "returnParameters": { + "id": 2336, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2335, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 2346, + "src": "6355:14:4", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 2334, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "6355:5:4", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "6354:16:4" + }, + "scope": 2347, + "src": "6311:125:4", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 2348, + "src": "91:6348:4" + } + ], + "src": "0:6440:4" + }, + "compiler": { + "name": "solc", + "version": "0.5.8+commit.23d335f2.Emscripten.clang" + }, + "networks": { + "1570892867630": { + "events": {}, + "links": { + "LSAG": "0xE17E5581e0cbf613d63b9Cc5Ae56A4011eE63b85" + }, + "address": "0x5247bF375abb6F1Ee99b7ddC6c74bD8785c956A8", + "transactionHash": "0x330a0cbe6ed9cb5e3310451c5355b454508a330b504f8ea32137ef39009c78e6" + }, + "1570921815108": { + "events": {}, + "links": { + "LSAG": "0x7A4f782e8D568EB7ADcA2cE77D1078eD9379f61f" + }, + "address": "0xfbf0f850bf8371a02f4D1054D87D1f1A3723cB9A", + "transactionHash": "0xba676936a6193be133c665f75e3957aa8bb3e600d024b0d9bdef1b2304b5188b" + }, + "1570922470877": { + "events": {}, + "links": { + "LSAG": "0xC2AD255B0BAfe57C867271b0D6ccCE6694030EB8" + }, + "address": "0xD1B9CD857358474FD72c18e1D06D30211b9cA413", + "transactionHash": "0x7e4c75684591831214e9b381a4a79809f7afce8b45bcc1189b767b45e8940d2e" + }, + "1570923244533": { + "events": {}, + "links": { + "LSAG": "0xEA7be366e4733E1c7d9183788a19613DbA79FF3d" + }, + "address": "0x0AdD976Cf9323090c9739f877A67F5a21f18e6E9", + "transactionHash": "0x0b13ebc7ada5d28a3a7b2593295f172be795cf6663a70818a46499167dc6391d" + } + }, + "schemaVersion": "3.0.16", + "updatedAt": "2019-10-12T23:34:13.041Z", + "devdoc": { + "methods": {} + }, + "userdoc": { + "methods": { + "constructor": "Create a new ballot with $(_numProposals, Proposals[] prop, uint256[2][] pubkeys) different proposals. Initializing Public Keys, Proposal length", + "vote(uint256,uint256,uint256[2],uint256[],uint256[2][])": { + "notice": "Give a single vote to proposal $(toProposal)." + } + } + } +} \ No newline at end of file diff --git a/build/contracts/EllipticCurve.json b/build/contracts/EllipticCurve.json new file mode 100644 index 0000000..1983054 --- /dev/null +++ b/build/contracts/EllipticCurve.json @@ -0,0 +1,34734 @@ +{ + "contractName": "EllipticCurve", + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "_x", + "type": "uint256" + }, + { + "name": "_pp", + "type": "uint256" + } + ], + "name": "invMod", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_base", + "type": "uint256" + }, + { + "name": "_exp", + "type": "uint256" + }, + { + "name": "_pp", + "type": "uint256" + } + ], + "name": "expMod", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_x", + "type": "uint256" + }, + { + "name": "_y", + "type": "uint256" + }, + { + "name": "_z", + "type": "uint256" + }, + { + "name": "_pp", + "type": "uint256" + } + ], + "name": "toAffine", + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_prefix", + "type": "uint8" + }, + { + "name": "_x", + "type": "uint256" + }, + { + "name": "_aa", + "type": "uint256" + }, + { + "name": "_bb", + "type": "uint256" + }, + { + "name": "_pp", + "type": "uint256" + } + ], + "name": "deriveY", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_x", + "type": "uint256" + }, + { + "name": "_y", + "type": "uint256" + }, + { + "name": "_aa", + "type": "uint256" + }, + { + "name": "_bb", + "type": "uint256" + }, + { + "name": "_pp", + "type": "uint256" + } + ], + "name": "isOnCurve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_x", + "type": "uint256" + }, + { + "name": "_y", + "type": "uint256" + }, + { + "name": "_pp", + "type": "uint256" + } + ], + "name": "ecInv", + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_x1", + "type": "uint256" + }, + { + "name": "_y1", + "type": "uint256" + }, + { + "name": "_x2", + "type": "uint256" + }, + { + "name": "_y2", + "type": "uint256" + }, + { + "name": "_aa", + "type": "uint256" + }, + { + "name": "_pp", + "type": "uint256" + } + ], + "name": "ecAdd", + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_x1", + "type": "uint256" + }, + { + "name": "_y1", + "type": "uint256" + }, + { + "name": "_x2", + "type": "uint256" + }, + { + "name": "_y2", + "type": "uint256" + }, + { + "name": "_aa", + "type": "uint256" + }, + { + "name": "_pp", + "type": "uint256" + } + ], + "name": "ecSub", + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_k", + "type": "uint256" + }, + { + "name": "_x", + "type": "uint256" + }, + { + "name": "_y", + "type": "uint256" + }, + { + "name": "_aa", + "type": "uint256" + }, + { + "name": "_pp", + "type": "uint256" + } + ], + "name": "ecMul", + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"name\":\"_x\",\"type\":\"uint256\"},{\"name\":\"_pp\",\"type\":\"uint256\"}],\"name\":\"invMod\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_k\",\"type\":\"uint256\"},{\"name\":\"_x\",\"type\":\"uint256\"},{\"name\":\"_y\",\"type\":\"uint256\"},{\"name\":\"_aa\",\"type\":\"uint256\"},{\"name\":\"_pp\",\"type\":\"uint256\"}],\"name\":\"ecMul\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_x\",\"type\":\"uint256\"},{\"name\":\"_y\",\"type\":\"uint256\"},{\"name\":\"_aa\",\"type\":\"uint256\"},{\"name\":\"_bb\",\"type\":\"uint256\"},{\"name\":\"_pp\",\"type\":\"uint256\"}],\"name\":\"isOnCurve\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_x1\",\"type\":\"uint256\"},{\"name\":\"_y1\",\"type\":\"uint256\"},{\"name\":\"_x2\",\"type\":\"uint256\"},{\"name\":\"_y2\",\"type\":\"uint256\"},{\"name\":\"_aa\",\"type\":\"uint256\"},{\"name\":\"_pp\",\"type\":\"uint256\"}],\"name\":\"ecSub\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_x\",\"type\":\"uint256\"},{\"name\":\"_y\",\"type\":\"uint256\"},{\"name\":\"_pp\",\"type\":\"uint256\"}],\"name\":\"ecInv\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_prefix\",\"type\":\"uint8\"},{\"name\":\"_x\",\"type\":\"uint256\"},{\"name\":\"_aa\",\"type\":\"uint256\"},{\"name\":\"_bb\",\"type\":\"uint256\"},{\"name\":\"_pp\",\"type\":\"uint256\"}],\"name\":\"deriveY\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_base\",\"type\":\"uint256\"},{\"name\":\"_exp\",\"type\":\"uint256\"},{\"name\":\"_pp\",\"type\":\"uint256\"}],\"name\":\"expMod\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_x\",\"type\":\"uint256\"},{\"name\":\"_y\",\"type\":\"uint256\"},{\"name\":\"_z\",\"type\":\"uint256\"},{\"name\":\"_pp\",\"type\":\"uint256\"}],\"name\":\"toAffine\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_x1\",\"type\":\"uint256\"},{\"name\":\"_y1\",\"type\":\"uint256\"},{\"name\":\"_x2\",\"type\":\"uint256\"},{\"name\":\"_y2\",\"type\":\"uint256\"},{\"name\":\"_aa\",\"type\":\"uint256\"},{\"name\":\"_pp\",\"type\":\"uint256\"}],\"name\":\"ecAdd\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Witnet Foundation\",\"details\":\"Library providing arithmetic operations over elliptic curves.\",\"methods\":{\"deriveY(uint8,uint256,uint256,uint256,uint256)\":{\"details\":\"Derives the y coordinate from a compressed-format point x.\",\"params\":{\"_aa\":\"constant of curve\",\"_bb\":\"constant of curve\",\"_pp\":\"the modulus\",\"_prefix\":\"parity byte (0x02 even, 0x03 odd)\",\"_x\":\"coordinate x\"},\"return\":\"y coordinate y\"},\"ecAdd(uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Add two points (x1, y1) and (x2, y2) in affine coordinates.\",\"params\":{\"_aa\":\"constant of the curve\",\"_pp\":\"the modulus\",\"_x1\":\"coordinate x of P1\",\"_x2\":\"coordinate x of P2\",\"_y1\":\"coordinate y of P1\",\"_y2\":\"coordinate y of P2\"},\"return\":\"(qx, qy) = P1+P2 in affine coordinates\"},\"ecInv(uint256,uint256,uint256)\":{\"details\":\"Calculate inverse (x, -y) of point (x, y).\",\"params\":{\"_pp\":\"the modulus\",\"_x\":\"coordinate x of P1\",\"_y\":\"coordinate y of P1\"},\"return\":\"(x, -y)\"},\"ecMul(uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Multiply point (x1, y1, z1) times d in affine coordinates.\",\"params\":{\"_aa\":\"constant of the curve\",\"_k\":\"scalar to multiply\",\"_pp\":\"the modulus\",\"_x\":\"coordinate x of P1\",\"_y\":\"coordinate y of P1\"},\"return\":\"(qx, qy) = d*P in affine coordinates\"},\"ecSub(uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Substract two points (x1, y1) and (x2, y2) in affine coordinates.\",\"params\":{\"_aa\":\"constant of the curve\",\"_pp\":\"the modulus\",\"_x1\":\"coordinate x of P1\",\"_x2\":\"coordinate x of P2\",\"_y1\":\"coordinate y of P1\",\"_y2\":\"coordinate y of P2\"},\"return\":\"(qx, qy) = P1-P2 in affine coordinates\"},\"expMod(uint256,uint256,uint256)\":{\"details\":\"Modular exponentiation, b^e % _pp. Source: https://github.com/androlo/standard-contracts/blob/master/contracts/src/crypto/ECCMath.sol\",\"params\":{\"_base\":\"base\",\"_exp\":\"exponent\",\"_pp\":\"modulus\"},\"return\":\"r such that r = b**e (mod _pp)\"},\"invMod(uint256,uint256)\":{\"details\":\"Modular euclidean inverse of a number (mod p).\",\"params\":{\"_pp\":\"The modulus\",\"_x\":\"The number\"},\"return\":\"q such that x*q = 1 (mod _pp)\"},\"isOnCurve(uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Check whether point (x,y) is on curve defined by a, b, and _pp.\",\"params\":{\"_aa\":\"constant of curve\",\"_bb\":\"constant of curve\",\"_pp\":\"the modulus\",\"_x\":\"coordinate x of P1\",\"_y\":\"coordinate y of P1\"},\"return\":\"true if x,y in the curve, false else\"},\"toAffine(uint256,uint256,uint256,uint256)\":{\"details\":\"Converts a point (x, y, z) expressed in Jacobian coordinates to affine coordinates (x', y', 1).\",\"params\":{\"_pp\":\"the modulus\",\"_x\":\"coordinate x\",\"_y\":\"coordinate y\",\"_z\":\"coordinate z\"},\"return\":\"(x', y') affine coordinates\"}},\"title\":\"Elliptic Curve Library\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/EllipticCurve.sol\":\"EllipticCurve\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/EllipticCurve.sol\":{\"keccak256\":\"0x266a80e64a3a30ac323911cfe04db54b397ba50301bf889172dbe2363c9c6ac6\",\"urls\":[\"bzzr://430d8d98304bb333e393bbc864df528b56a26375b138711049a30d33d5cc2925\"]}},\"version\":1}", + "bytecode": "0x6111fb610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361061009d5760003560e01c80637559d550116100705780637559d550146102485780638ba5ceeb146102a5578063ad69caa514610312578063c4371a1c14610368578063c5e45aa4146103cf5761009d565b80631b54f824146100a2578063364b62d5146100ee57806337103a671461015f5780635bf11ed3146101cd575b600080fd5b6100d8600480360360408110156100b857600080fd5b81019080803590602001909291908035906020019092919050505061044a565b6040518082815260200191505060405180910390f35b610142600480360360a081101561010457600080fd5b810190808035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610544565b604051808381526020018281526020019250505060405180910390f35b6101b3600480360360a081101561017557600080fd5b81019080803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919050505061057e565b604051808215151515815260200191505060405180910390f35b61022b600480360360c08110156101e357600080fd5b81019080803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610620565b604051808381526020018281526020019250505060405180910390f35b6102886004803603606081101561025e57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050610654565b604051808381526020018281526020019250505060405180910390f35b6102fc600480360360a08110156102bb57600080fd5b81019080803560ff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610670565b6040518082815260200191505060405180910390f35b6103526004803603606081101561032857600080fd5b810190808035906020019092919080359060200190929190803590602001909291905050506106f4565b6040518082815260200191505060405180910390f35b6103b26004803603608081101561037e57600080fd5b8101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610822565b604051808381526020018281526020019250505060405180910390f35b61042d600480360360c08110156103e557600080fd5b8101908080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919050505061087d565b604051808381526020018281526020019250505060405180910390f35b60008083148061045957508183145b806104645750600082145b156104d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c6964206e756d62657200000000000000000000000000000000000081525060200191505060405180910390fd5b60008090506000600190506000849050600086905060005b600082146105365781838161050057fe5b04905083878061050c57fe5b888061051457fe5b86840989038708809550819650505081828202840380935081945050506104ef565b849550505050505092915050565b600080600080600061055b8a8a8a60018b8b6108f2565b92509250925061056d83838389610822565b945094505050509550959350505050565b6000856000148061058e57508186145b806105995750846000145b806105a357508185145b156105b15760009050610617565b600082806105bb57fe5b8687099050600083806105ca57fe5b8885806105d357fe5b8a8b09099050600086146105f95783806105e957fe5b84806105f157fe5b878a09820890505b6000851461060f57838061060957fe5b85820890505b808214925050505b95945050505050565b600080600080610631888887610654565b915091506106438a8a84848a8a61087d565b935093505050965096945050505050565b60008084838585038161066357fe5b0691509150935093915050565b600080828061067b57fe5b838061068357fe5b85858061068c57fe5b888a0908848061069857fe5b85806106a057fe5b898a0989090890506106c081600460018601816106b957fe5b04856106f4565b905060008060028960ff168401816106d457fe5b06146106e2578184036106e4565b815b9050809250505095945050505050565b600080841415610707576000905061081b565b6000831415610719576001905061081b565b6000821415610790576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4d6f64756c7573206973207a65726f000000000000000000000000000000000081525060200191505060405180910390fd5b60006001905060007f800000000000000000000000000000000000000000000000000000000000000090505b600081111561081557838186161515870a85848509099150836002820486161515870a85848509099150836004820486161515870a85848509099150836008820486161515870a858485090991506010810490506107bc565b81925050505b9392505050565b6000806000610831858561044a565b90506000848061083d57fe5b82830990506000858061084c57fe5b828a0990506000868061085b57fe5b878061086357fe5b8486098a0990508181955095505050505094509492505050565b600080600080905060008090506000809050888b14156108b6576108a58b8b60018a8a610a86565b8093508194508295505050506108d4565b6108c78b8b60018c8c60018c610c50565b8093508194508295505050505b6108e083838389610822565b94509450505050965096945050505050565b60008060008089905061090361118b565b898160006003811061091157fe5b602002018181525050888160016003811061092857fe5b602002018181525050878160026003811061093f57fe5b6020020181815250506000809050600080905060006001905060008e1415610974578282829750975097505050505050610a7a565b5b60008514610a6b57600060018616146109d7576109ca8383838760006003811061099b57fe5b6020020151886001600381106109ad57fe5b6020020151896002600381106109bf57fe5b60200201518f610c50565b8093508194508295505050505b600285816109e157fe5b049450610a24846000600381106109f457fe5b602002015185600160038110610a0657fe5b602002015186600260038110610a1857fe5b60200201518d8d610a86565b86600060038110610a3157fe5b6020020187600160038110610a4257fe5b6020020188600260038110610a5357fe5b60200201838152508381525083815250505050610975565b82828297509750975050505050505b96509650969350505050565b600080600080861415610aa157878787925092509250610c45565b610aa961118b565b8480610ab157fe5b898a0981600060038110610ac157fe5b6020020181815250508480610ad257fe5b88890981600160038110610ae257fe5b6020020181815250508480610af357fe5b87880981600260038110610b0357fe5b60200201818152505060008580610b1657fe5b8680610b1e57fe5b83600160038110610b2b57fe5b60200201518c09600409905060008680610b4157fe5b8780610b4957fe5b8880610b5157fe5b85600260038110610b5e57fe5b602002015186600260038110610b7057fe5b6020020151098a098880610b8057fe5b85600060038110610b8d57fe5b602002015160030908905060008780610ba257fe5b8880610baa57fe5b84850889038980610bb757fe5b84850908905060008880610bc757fe5b8980610bcf57fe5b8a80610bd757fe5b87600160038110610be457fe5b602002015188600160038110610bf657fe5b6020020151096008098a038a80610c0957fe5b8b80610c1157fe5b858d038808860908905060008980610c2557fe5b8a80610c2d57fe5b8d8f0960020990508282829850985098505050505050505b955095509592505050565b6000806000808a148015610c645750600089145b15610c775786868692509250925061117e565b600087148015610c875750600086145b15610c9a5789898992509250925061117e565b610ca26111ad565b8480610caa57fe5b898a0981600060048110610cba57fe5b6020020181815250508480610ccb57fe5b81600060048110610cd857fe5b60200201518a0981600160048110610cec57fe5b6020020181815250508480610cfd57fe5b86870981600260048110610d0d57fe5b6020020181815250508480610d1e57fe5b81600260048110610d2b57fe5b6020020151870981600360048110610d3f57fe5b60200201818152505060405180608001604052808680610d5b57fe5b83600260048110610d6857fe5b60200201518e0981526020018680610d7c57fe5b83600360048110610d8957fe5b60200201518d0981526020018680610d9d57fe5b83600060048110610daa57fe5b60200201518b0981526020018680610dbe57fe5b83600160048110610dcb57fe5b60200201518a09815250905080600260048110610de457fe5b602002015181600060048110610df657fe5b60200201511415610f065780600360048110610e0e57fe5b602002015181600160048110610e2057fe5b602002015114610e98576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f57726f6e6720646174610000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f55736520646f75626c6520696e7374656164000000000000000000000000000081525060200191505060405180910390fd5b610f0e6111ad565b8580610f1657fe5b82600060048110610f2357fe5b6020020151870383600260048110610f3757fe5b60200201510881600060048110610f4a57fe5b6020020181815250508580610f5b57fe5b82600160048110610f6857fe5b6020020151870383600360048110610f7c57fe5b60200201510881600160048110610f8f57fe5b6020020181815250508580610fa057fe5b81600060048110610fad57fe5b602002015182600060048110610fbf57fe5b60200201510981600260048110610fd257fe5b6020020181815250508580610fe357fe5b81600060048110610ff057fe5b60200201518260026004811061100257fe5b6020020151098160036004811061101557fe5b6020020181815250506000868061102857fe5b8260036004811061103557fe5b60200201518803888061104457fe5b8460016004811061105157fe5b60200201518560016004811061106357fe5b602002015109089050868061107457fe5b878061107c57fe5b888061108457fe5b8460026004811061109157fe5b6020020151866000600481106110a357fe5b602002015109600209880382089050600087806110bc57fe5b88806110c457fe5b838a038a806110cf57fe5b866002600481106110dc57fe5b6020020151886000600481106110ee57fe5b602002015109088460016004811061110257fe5b6020020151099050878061111257fe5b888061111a57fe5b8460036004811061112757fe5b60200201518660016004811061113957fe5b6020020151098903820890506000888061114f57fe5b898061115757fe5b8b8f098560006004811061116757fe5b602002015109905082828297509750975050505050505b9750975097945050505050565b6040518060600160405280600390602082028038833980820191505090505090565b604051806080016040528060049060208202803883398082019150509050509056fea165627a7a72305820c2fe36eaa81e8342d1298ba17f8c67f6ead4e97ef6f9e92995077752ba773b0b0029", + "deployedBytecode": "0x730000000000000000000000000000000000000000301460806040526004361061009d5760003560e01c80637559d550116100705780637559d550146102485780638ba5ceeb146102a5578063ad69caa514610312578063c4371a1c14610368578063c5e45aa4146103cf5761009d565b80631b54f824146100a2578063364b62d5146100ee57806337103a671461015f5780635bf11ed3146101cd575b600080fd5b6100d8600480360360408110156100b857600080fd5b81019080803590602001909291908035906020019092919050505061044a565b6040518082815260200191505060405180910390f35b610142600480360360a081101561010457600080fd5b810190808035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610544565b604051808381526020018281526020019250505060405180910390f35b6101b3600480360360a081101561017557600080fd5b81019080803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919050505061057e565b604051808215151515815260200191505060405180910390f35b61022b600480360360c08110156101e357600080fd5b81019080803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610620565b604051808381526020018281526020019250505060405180910390f35b6102886004803603606081101561025e57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050610654565b604051808381526020018281526020019250505060405180910390f35b6102fc600480360360a08110156102bb57600080fd5b81019080803560ff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610670565b6040518082815260200191505060405180910390f35b6103526004803603606081101561032857600080fd5b810190808035906020019092919080359060200190929190803590602001909291905050506106f4565b6040518082815260200191505060405180910390f35b6103b26004803603608081101561037e57600080fd5b8101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610822565b604051808381526020018281526020019250505060405180910390f35b61042d600480360360c08110156103e557600080fd5b8101908080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919050505061087d565b604051808381526020018281526020019250505060405180910390f35b60008083148061045957508183145b806104645750600082145b156104d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c6964206e756d62657200000000000000000000000000000000000081525060200191505060405180910390fd5b60008090506000600190506000849050600086905060005b600082146105365781838161050057fe5b04905083878061050c57fe5b888061051457fe5b86840989038708809550819650505081828202840380935081945050506104ef565b849550505050505092915050565b600080600080600061055b8a8a8a60018b8b6108f2565b92509250925061056d83838389610822565b945094505050509550959350505050565b6000856000148061058e57508186145b806105995750846000145b806105a357508185145b156105b15760009050610617565b600082806105bb57fe5b8687099050600083806105ca57fe5b8885806105d357fe5b8a8b09099050600086146105f95783806105e957fe5b84806105f157fe5b878a09820890505b6000851461060f57838061060957fe5b85820890505b808214925050505b95945050505050565b600080600080610631888887610654565b915091506106438a8a84848a8a61087d565b935093505050965096945050505050565b60008084838585038161066357fe5b0691509150935093915050565b600080828061067b57fe5b838061068357fe5b85858061068c57fe5b888a0908848061069857fe5b85806106a057fe5b898a0989090890506106c081600460018601816106b957fe5b04856106f4565b905060008060028960ff168401816106d457fe5b06146106e2578184036106e4565b815b9050809250505095945050505050565b600080841415610707576000905061081b565b6000831415610719576001905061081b565b6000821415610790576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4d6f64756c7573206973207a65726f000000000000000000000000000000000081525060200191505060405180910390fd5b60006001905060007f800000000000000000000000000000000000000000000000000000000000000090505b600081111561081557838186161515870a85848509099150836002820486161515870a85848509099150836004820486161515870a85848509099150836008820486161515870a858485090991506010810490506107bc565b81925050505b9392505050565b6000806000610831858561044a565b90506000848061083d57fe5b82830990506000858061084c57fe5b828a0990506000868061085b57fe5b878061086357fe5b8486098a0990508181955095505050505094509492505050565b600080600080905060008090506000809050888b14156108b6576108a58b8b60018a8a610a86565b8093508194508295505050506108d4565b6108c78b8b60018c8c60018c610c50565b8093508194508295505050505b6108e083838389610822565b94509450505050965096945050505050565b60008060008089905061090361118b565b898160006003811061091157fe5b602002018181525050888160016003811061092857fe5b602002018181525050878160026003811061093f57fe5b6020020181815250506000809050600080905060006001905060008e1415610974578282829750975097505050505050610a7a565b5b60008514610a6b57600060018616146109d7576109ca8383838760006003811061099b57fe5b6020020151886001600381106109ad57fe5b6020020151896002600381106109bf57fe5b60200201518f610c50565b8093508194508295505050505b600285816109e157fe5b049450610a24846000600381106109f457fe5b602002015185600160038110610a0657fe5b602002015186600260038110610a1857fe5b60200201518d8d610a86565b86600060038110610a3157fe5b6020020187600160038110610a4257fe5b6020020188600260038110610a5357fe5b60200201838152508381525083815250505050610975565b82828297509750975050505050505b96509650969350505050565b600080600080861415610aa157878787925092509250610c45565b610aa961118b565b8480610ab157fe5b898a0981600060038110610ac157fe5b6020020181815250508480610ad257fe5b88890981600160038110610ae257fe5b6020020181815250508480610af357fe5b87880981600260038110610b0357fe5b60200201818152505060008580610b1657fe5b8680610b1e57fe5b83600160038110610b2b57fe5b60200201518c09600409905060008680610b4157fe5b8780610b4957fe5b8880610b5157fe5b85600260038110610b5e57fe5b602002015186600260038110610b7057fe5b6020020151098a098880610b8057fe5b85600060038110610b8d57fe5b602002015160030908905060008780610ba257fe5b8880610baa57fe5b84850889038980610bb757fe5b84850908905060008880610bc757fe5b8980610bcf57fe5b8a80610bd757fe5b87600160038110610be457fe5b602002015188600160038110610bf657fe5b6020020151096008098a038a80610c0957fe5b8b80610c1157fe5b858d038808860908905060008980610c2557fe5b8a80610c2d57fe5b8d8f0960020990508282829850985098505050505050505b955095509592505050565b6000806000808a148015610c645750600089145b15610c775786868692509250925061117e565b600087148015610c875750600086145b15610c9a5789898992509250925061117e565b610ca26111ad565b8480610caa57fe5b898a0981600060048110610cba57fe5b6020020181815250508480610ccb57fe5b81600060048110610cd857fe5b60200201518a0981600160048110610cec57fe5b6020020181815250508480610cfd57fe5b86870981600260048110610d0d57fe5b6020020181815250508480610d1e57fe5b81600260048110610d2b57fe5b6020020151870981600360048110610d3f57fe5b60200201818152505060405180608001604052808680610d5b57fe5b83600260048110610d6857fe5b60200201518e0981526020018680610d7c57fe5b83600360048110610d8957fe5b60200201518d0981526020018680610d9d57fe5b83600060048110610daa57fe5b60200201518b0981526020018680610dbe57fe5b83600160048110610dcb57fe5b60200201518a09815250905080600260048110610de457fe5b602002015181600060048110610df657fe5b60200201511415610f065780600360048110610e0e57fe5b602002015181600160048110610e2057fe5b602002015114610e98576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f57726f6e6720646174610000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f55736520646f75626c6520696e7374656164000000000000000000000000000081525060200191505060405180910390fd5b610f0e6111ad565b8580610f1657fe5b82600060048110610f2357fe5b6020020151870383600260048110610f3757fe5b60200201510881600060048110610f4a57fe5b6020020181815250508580610f5b57fe5b82600160048110610f6857fe5b6020020151870383600360048110610f7c57fe5b60200201510881600160048110610f8f57fe5b6020020181815250508580610fa057fe5b81600060048110610fad57fe5b602002015182600060048110610fbf57fe5b60200201510981600260048110610fd257fe5b6020020181815250508580610fe357fe5b81600060048110610ff057fe5b60200201518260026004811061100257fe5b6020020151098160036004811061101557fe5b6020020181815250506000868061102857fe5b8260036004811061103557fe5b60200201518803888061104457fe5b8460016004811061105157fe5b60200201518560016004811061106357fe5b602002015109089050868061107457fe5b878061107c57fe5b888061108457fe5b8460026004811061109157fe5b6020020151866000600481106110a357fe5b602002015109600209880382089050600087806110bc57fe5b88806110c457fe5b838a038a806110cf57fe5b866002600481106110dc57fe5b6020020151886000600481106110ee57fe5b602002015109088460016004811061110257fe5b6020020151099050878061111257fe5b888061111a57fe5b8460036004811061112757fe5b60200201518660016004811061113957fe5b6020020151098903820890506000888061114f57fe5b898061115757fe5b8b8f098560006004811061116757fe5b602002015109905082828297509750975050505050505b9750975097945050505050565b6040518060600160405280600390602082028038833980820191505090505090565b604051806080016040528060049060208202803883398082019150509050509056fea165627a7a72305820c2fe36eaa81e8342d1298ba17f8c67f6ead4e97ef6f9e92995077752ba773b0b0029", + "sourceMap": "174:10911:1:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24", + "deployedSourceMap": "174:10911:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;359:436;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;359:436:1;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;6170:378;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;6170:378:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;3422:522;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;3422:522:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;5537:335;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;5537:335:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;4123:148;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;4123:148:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;2703:420;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;2703:420:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1071:741;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1071:741:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;2081:336;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;2081:336:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;4611:580;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;4611:580:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;359:436;421:7;446:1;440:2;:7;:20;;;;457:3;451:2;:9;440:20;:32;;;;471:1;464:3;:8;440:32;436:77;;;482:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;436:77;518:9;530:1;518:13;;537:12;552:1;537:16;;559:9;571:3;559:15;;580:12;595:2;580:17;;603:9;618:158;633:1;625:4;:9;618:158;;652:4;648:1;:8;;;;;;644:12;;677:4;723:3;683:44;;;;;716:3;700:20;;;;;710:4;707:1;700:20;694:3;:26;690:1;683:44;664:64;;;;;;;;749:4;763;759:1;:8;755:1;:12;736:33;;;;;;;;618:158;;;789:1;782:8;;;;;;;359:436;;;;:::o;6170:378::-;6290:7;6299;6348:10;6360;6372;6386:68;6400:2;6410;6420;6430:1;6439:3;6450;6386:6;:68::i;:::-;6347:107;;;;;;6493:50;6509:2;6519;6529;6539:3;6493:8;:50::i;:::-;6486:57;;;;;;;6170:378;;;;;;;;:::o;3422:522::-;3533:4;3556:2;3551:1;:7;:20;;;;3568:3;3562:2;:9;3551:20;:31;;;;3580:2;3575:1;:7;3551:31;:44;;;;3592:3;3586:2;:9;3551:44;3547:77;;;3612:5;3605:12;;;;3547:77;3640:8;3666:3;3651:19;;;;;3662:2;3658;3651:19;3640:30;;3687:8;3730:3;3698:36;;;;;3726:2;3720:3;3705:19;;;;;3716:2;3712;3705:19;3698:36;3687:47;;3751:1;3744:3;:8;3740:92;;3821:3;3787:38;;;;;3815:3;3799:20;;;;;3810:3;3806:2;3799:20;3794:3;3787:38;3781:44;;3740:92;3848:1;3841:3;:8;3837:79;;3905:3;3888:21;;;;;3900:3;3895;3888:21;3882:27;;3837:79;3936:3;3929;:10;3922:17;;;;3422:522;;;;;;;;:::o;5537:335::-;5677:7;5686;5725:9;5736;5749:20;5755:3;5760;5765;5749:5;:20::i;:::-;5724:45;;;;5799:68;5812:3;5823;5834:1;5843;5852:3;5863;5799:5;:68::i;:::-;5792:75;;;;;;5537:335;;;;;;;;;:::o;4123:148::-;4211:7;4220;4245:2;4262:3;4256:2;4250:3;:8;4249:16;;;;;;4237:29;;;;4123:148;;;;;;:::o;2703:420::-;2830:7;2867:10;2965:3;2880:89;;;;;2959:3;2925:38;;;;;2954:3;2948;2932:20;;;;;2943:3;2939:2;2932:20;2925:38;2919:3;2887:36;;;;;2913:3;2898:19;;;;;2909:2;2905;2898:19;2894:2;2887:36;2880:89;2867:102;;2980:30;2987:2;3003:1;2998;2992:3;:7;2991:13;;;;;;3006:3;2980:6;:30::i;:::-;2975:35;;3052:9;3086:1;3081;3070:7;3065:12;;:2;:12;3064:18;;;;;;:23;:39;;3101:2;3095:3;:8;3064:39;;;3090:2;3064:39;3052:51;;3117:1;3110:8;;;;2703:420;;;;;;;:::o;1071:741::-;1150:7;1178:1;1169:5;:10;1165:30;;;1194:1;1187:8;;;;1165:30;1213:1;1205:4;:9;1201:29;;;1229:1;1222:8;;;;1201:29;1247:1;1240:3;:8;1236:45;;;1256:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1236:45;1287:9;1299:1;1287:13;;1306:11;1320:8;1306:22;;1352:435;1368:1;1363:3;1360:10;1352:435;;;1459:3;1450;1444:4;1440:14;1433:22;1426:30;1419:5;1415:42;1409:3;1406:1;1403;1396:17;1389:74;1384:79;;1555:3;1547:1;1542:3;1538:11;1532:4;1528:22;1521:30;1514:38;1507:5;1503:50;1497:3;1494:1;1491;1484:17;1477:82;1472:87;;1651:3;1643:1;1638:3;1634:11;1628:4;1624:22;1617:30;1610:38;1603:5;1599:50;1593:3;1590:1;1587;1580:17;1573:82;1568:87;;1747:3;1739:1;1734:3;1730:11;1724:4;1720:22;1713:30;1706:38;1699:5;1695:50;1689:3;1686:1;1683;1676:17;1669:82;1664:87;;1776:2;1771:3;1767:12;1760:19;;1352:435;;;1806:1;1799:8;;;;1071:741;;;;;;:::o;2081:336::-;2188:7;2197;2214:12;2229:15;2236:2;2240:3;2229:6;:15::i;:::-;2214:30;;2250:13;2285:3;2266:23;;;;;2279:4;2273;2266:23;2250:39;;2295:10;2326:3;2308:22;;;;;2319:5;2315:2;2308:22;2295:35;;2336:10;2386:3;2349:41;;;;;2380:3;2360:24;;;;;2373:5;2367:4;2360:24;2356:2;2349:41;2336:54;;2405:2;2409;2397:15;;;;;;;;2081:336;;;;;;;:::o;4611:580::-;4753:7;4762;4779:6;4788:1;4779:10;;4795:6;4804:1;4795:10;;4811:6;4820:1;4811:10;;4869:3;4864;:8;4860:241;;;4894:73;4913:3;4926;4939:1;4950:3;4963;4894:9;:73::i;:::-;4882:85;;;;;;;;;;;;4860:241;;;5000:94;5016:3;5029;5042:1;5053:3;5066;5079:1;5090:3;5000:6;:94::i;:::-;4988:106;;;;;;;;;;;;4860:241;5139:47;5155:1;5164;5173;5182:3;5139:8;:47::i;:::-;5132:54;;;;;;;4611:580;;;;;;;;;:::o;10235:848::-;10375:7;10384;10393;10410:17;10430:2;10410:22;;10438:23;;:::i;:::-;10478:2;10467:5;10473:1;10467:8;;;;;;;;;;:13;;;;;10497:2;10486:5;10492:1;10486:8;;;;;;;;;;:13;;;;;10516:2;10505:5;10511:1;10505:8;;;;;;;;;;:13;;;;;10524:10;10537:1;10524:14;;10544:10;10557:1;10544:14;;10564:10;10577:1;10564:14;;10595:1;10589:2;:7;10585:47;;;10614:2;10618;10622;10606:19;;;;;;;;;;;;;10585:47;10669:385;10689:1;10676:9;:14;10669:385;;10723:1;10717;10705:9;:13;10704:20;10700:184;;10751:124;10769:2;10783;10797;10811:5;10817:1;10811:8;;;;;;;;;;;10831:5;10837:1;10831:8;;;;;;;;;;;10851:5;10857:1;10851:8;;;;;;;;;;;10871:3;10751:6;:124::i;:::-;10736:139;;;;;;;;;;;;10700:184;10915:1;10903:9;:13;;;;;;10891:25;;10957:90;10976:5;10982:1;10976:8;;;;;;;;;;;10994:5;11000:1;10994:8;;;;;;;;;;;11012:5;11018:1;11012:8;;;;;;;;;;;11030:3;11043;10957:9;:90::i;:::-;10925:5;10931:1;10925:8;;;;;;;;;;10935:5;10941:1;10935:8;;;;;;;;;;10945:5;10951:1;10945:8;;;;;;;;;;10924:123;;;;;;;;;;;;;;;10669:385;;;11067:2;11071;11075;11059:19;;;;;;;;;;;10235:848;;;;;;;;;;;:::o;8826:1112::-;8953:7;8962;8971;8998:1;8992:2;:7;8988:38;;;9015:2;9019;9023;9007:19;;;;;;;;8988:38;9032:24;;:::i;:::-;9310:3;9295:19;;;;;9306:2;9302;9295:19;9283:6;9290:1;9283:9;;;;;;;;;;:31;;;;;9354:3;9339:19;;;;;9350:2;9346;9339:19;9327:6;9334:1;9327:9;;;;;;;;;;:31;;;;;9398:3;9383:19;;;;;9394:2;9390;9383:19;9371:6;9378:1;9371:9;;;;;;;;;;:31;;;;;9425:6;9472:3;9434:42;;;;;9466:3;9444:26;;;;;9455:6;9462:1;9455:9;;;;;;;;;;;9451:2;9444:26;9441:1;9434:42;9425:51;;9491:6;9587:3;9500:91;;;;;9581:3;9534:51;;;;;9575:3;9546:33;;;;;9564:6;9571:1;9564:9;;;;;;;;;;;9553:6;9560:1;9553:9;;;;;;;;;;;9546:33;9541:3;9534:51;9528:3;9507:25;;;;;9517:6;9524:1;9517:9;;;;;;;;;;;9514:1;9507:25;9500:91;9491:100;;9607:10;9671:3;9620:55;;;;;9665:3;9652:17;;;;;9662:1;9659;9652:17;9646:3;:23;9640:3;9627:17;;;;;9637:1;9634;9627:17;9620:55;9607:68;;9710:10;9829:3;9723:110;;;;;9823:3;9778:49;;;;;9817:3;9788:33;;;;;9806:6;9813:1;9806:9;;;;;;;;;;;9795:6;9802:1;9795:9;;;;;;;;;;;9788:33;9785:1;9778:49;9772:3;:55;9766:3;9730:40;;;;;9760:3;9740:24;;;;;9756:2;9750:3;:8;9747:1;9740:24;9737:1;9730:40;9723:110;9710:123;;9859:10;9903:3;9872:35;;;;;9897:3;9882:19;;;;;9893:2;9889;9882:19;9879:1;9872:35;9859:48;;9922:2;9926;9930;9914:19;;;;;;;;;;;;8826:1112;;;;;;;;;;:::o;6915:1640::-;7076:7;7085;7094;7121:1;7116:3;:6;7115:18;;;;;7131:1;7126:3;:6;7115:18;7111:52;;;7149:3;7154;7159;7141:22;;;;;;;;7111:52;7179:1;7174:3;:6;7173:18;;;;;7189:1;7184:3;:6;7173:18;7169:52;;;7207:3;7212;7217;7199:22;;;;;;;;7169:52;7361:17;;:::i;:::-;7435:3;7418:21;;;;;7430:3;7425;7418:21;7410:2;7413:1;7410:5;;;;;;;;;;:29;;;;;7472:3;7453:23;;;;;7465:2;7468:1;7465:5;;;;;;;;;;;7460:3;7453:23;7445:2;7448:1;7445:5;;;;;;;;;;:31;;;;;7507:3;7490:21;;;;;7502:3;7497;7490:21;7482:2;7485:1;7482:5;;;;;;;;;;:29;;;;;7544:3;7525:23;;;;;7537:2;7540:1;7537:5;;;;;;;;;;;7532:3;7525:23;7517:2;7520:1;7517:5;;;;;;;;;;:31;;;;;7577:135;;;;;;;;7609:3;7590:23;;;;;7602:2;7605:1;7602:5;;;;;;;;;;;7597:3;7590:23;7577:135;;;;7640:3;7621:23;;;;;7633:2;7636:1;7633:5;;;;;;;;;;;7628:3;7621:23;7577:135;;;;7671:3;7652:23;;;;;7664:2;7667:1;7664:5;;;;;;;;;;;7659:3;7652:23;7577:135;;;;7702:3;7683:23;;;;;7695:2;7698:1;7695:5;;;;;;;;;;;7690:3;7683:23;7577:135;;;;;7731:2;7734:1;7731:5;;;;;;;;;;;7722:2;7725:1;7722:5;;;;;;;;;;;:14;7718:142;;;7759:2;7762:1;7759:5;;;;;;;;;;;7750:2;7753:1;7750:5;;;;;;;;;;;:14;7746:108;;7774:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7746:108;7817:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7718:142;7865:17;;:::i;:::-;7931:3;7904:31;;;;;7924:2;7927:1;7924:5;;;;;;;;;;;7918:3;:11;7911:2;7914:1;7911:5;;;;;;;;;;;7904:31;7896:2;7899:1;7896:5;;;;;;;;;;:39;;;;;7984:3;7957:31;;;;;7977:2;7980:1;7977:5;;;;;;;;;;;7971:3;:11;7964:2;7967:1;7964:5;;;;;;;;;;;7957:31;7949:2;7952:1;7949:5;;;;;;;;;;:39;;;;;8033:3;8012:25;;;;;8026:2;8029:1;8026:5;;;;;;;;;;;8019:2;8022:1;8019:5;;;;;;;;;;;8012:25;8004:2;8007:1;8004:5;;;;;;;;;;:33;;;;;8083:3;8062:25;;;;;8076:2;8079:1;8076:5;;;;;;;;;;;8069:2;8072:1;8069:5;;;;;;;;;;;8062:25;8054:2;8057:1;8054:5;;;;;;;;;;:33;;;;;8123:10;8183:3;8136:51;;;;;8176:2;8179:1;8176:5;;;;;;;;;;;8170:3;:11;8164:3;8143:25;;;;;8157:2;8160:1;8157:5;;;;;;;;;;;8150:2;8153:1;8150:5;;;;;;;;;;;8143:25;8136:51;8123:64;;8258:3;8198:64;;;;;8252:3;8215:41;;;;;8246:3;8225:25;;;;;8239:2;8242:1;8239:5;;;;;;;;;;;8232:2;8235:1;8232:5;;;;;;;;;;;8225:25;8222:1;8215:41;8209:3;:47;8205:2;8198:64;8193:69;;8306:10;8383:3;8319:68;;;;;8377:3;8333:48;;;;;8373:2;8367:3;:8;8361:3;8340:25;;;;;8354:2;8357:1;8354:5;;;;;;;;;;;8347:2;8350:1;8347:5;;;;;;;;;;;8340:25;8333:48;8326:2;8329:1;8326:5;;;;;;;;;;;8319:68;8306:81;;8442:3;8398:48;;;;;8436:3;8415:25;;;;;8429:2;8432:1;8429:5;;;;;;;;;;;8422:2;8425:1;8422:5;;;;;;;;;;;8415:25;8409:3;:31;8405:2;8398:48;8393:53;;8472:10;8522:3;8485:41;;;;;8516:3;8499:21;;;;;8511:3;8506;8499:21;8492:2;8495:1;8492:5;;;;;;;;;;;8485:41;8472:54;;8539:2;8543;8547;8532:18;;;;;;;;;;;6915:1640;;;;;;;;;;;;:::o;174:10911::-;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;174:10911:1;;;;:::o;:::-;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;174:10911:1;;;;:::o", + "source": "pragma solidity >=0.4.0 <0.6.0;\n\n\n/**\n * @title Elliptic Curve Library\n * @dev Library providing arithmetic operations over elliptic curves.\n * @author Witnet Foundation\n */\nlibrary EllipticCurve {\n\n /// @dev Modular euclidean inverse of a number (mod p).\n /// @param _x The number\n /// @param _pp The modulus\n /// @return q such that x*q = 1 (mod _pp)\n function invMod(uint256 _x, uint256 _pp) public pure returns (uint256) {\n if (_x == 0 || _x == _pp || _pp == 0) {\n revert(\"Invalid number\");\n }\n uint256 q = 0;\n uint256 newT = 1;\n uint256 r = _pp;\n uint256 newR = _x;\n uint256 t;\n while (newR != 0) {\n t = r / newR;\n (q, newT) = (newT, addmod(q, (_pp - mulmod(t, newT, _pp)), _pp));\n (r, newR) = (newR, r - t * newR );\n }\n\n return q;\n }\n\n /// @dev Modular exponentiation, b^e % _pp.\n /// Source: https://github.com/androlo/standard-contracts/blob/master/contracts/src/crypto/ECCMath.sol\n /// @param _base base\n /// @param _exp exponent\n /// @param _pp modulus\n /// @return r such that r = b**e (mod _pp)\n function expMod(uint256 _base, uint256 _exp, uint256 _pp) public pure returns (uint256) {\n if (_base == 0)\n return 0;\n if (_exp == 0)\n return 1;\n if (_pp == 0)\n revert(\"Modulus is zero\");\n uint256 r = 1;\n uint256 bit = 2 ** 255;\n\n assembly {\n for { } gt(bit, 0) { }{\n r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, bit)))), _pp)\n r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, div(bit, 2))))), _pp)\n r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, div(bit, 4))))), _pp)\n r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, div(bit, 8))))), _pp)\n bit := div(bit, 16)\n }\n }\n\n return r;\n }\n\n /// @dev Converts a point (x, y, z) expressed in Jacobian coordinates to affine coordinates (x', y', 1).\n /// @param _x coordinate x\n /// @param _y coordinate y\n /// @param _z coordinate z\n /// @param _pp the modulus\n /// @return (x', y') affine coordinates\n function toAffine(\n uint256 _x,\n uint256 _y,\n uint256 _z,\n uint256 _pp)\n public pure returns (uint256, uint256)\n {\n uint256 zInv = invMod(_z, _pp);\n uint256 zInv2 = mulmod(zInv, zInv, _pp);\n uint256 x2 = mulmod(_x, zInv2, _pp);\n uint256 y2 = mulmod(_y, mulmod(zInv, zInv2, _pp), _pp);\n\n return (x2, y2);\n }\n\n /// @dev Derives the y coordinate from a compressed-format point x.\n /// @param _prefix parity byte (0x02 even, 0x03 odd)\n /// @param _x coordinate x\n /// @param _aa constant of curve\n /// @param _bb constant of curve\n /// @param _pp the modulus\n /// @return y coordinate y\n function deriveY(\n uint8 _prefix,\n uint256 _x,\n uint256 _aa,\n uint256 _bb,\n uint256 _pp)\n public pure returns (uint256)\n {\n // x^3 + ax + b\n uint256 y2 = addmod(mulmod(_x, mulmod(_x, _x, _pp), _pp), addmod(mulmod(_x, _aa, _pp), _bb, _pp), _pp);\n y2 = expMod(y2, (_pp + 1) / 4, _pp);\n // uint256 cmp = yBit ^ y_ & 1;\n uint256 y = (y2 + _prefix) % 2 == 0 ? y2 : _pp - y2;\n\n return y;\n }\n\n /// @dev Check whether point (x,y) is on curve defined by a, b, and _pp.\n /// @param _x coordinate x of P1\n /// @param _y coordinate y of P1\n /// @param _aa constant of curve\n /// @param _bb constant of curve\n /// @param _pp the modulus\n /// @return true if x,y in the curve, false else\n function isOnCurve(\n uint _x,\n uint _y,\n uint _aa,\n uint _bb,\n uint _pp)\n public pure returns (bool)\n {\n if (0 == _x || _x == _pp || 0 == _y || _y == _pp) {\n return false;\n }\n // y^2\n uint lhs = mulmod(_y, _y, _pp);\n // x^3\n uint rhs = mulmod(mulmod(_x, _x, _pp), _x, _pp);\n if (_aa != 0) {\n // x^3 + a*x\n rhs = addmod(rhs, mulmod(_x, _aa, _pp), _pp);\n }\n if (_bb != 0) {\n // x^3 + a*x + b\n rhs = addmod(rhs, _bb, _pp);\n }\n\n return lhs == rhs;\n }\n\n /// @dev Calculate inverse (x, -y) of point (x, y).\n /// @param _x coordinate x of P1\n /// @param _y coordinate y of P1\n /// @param _pp the modulus\n /// @return (x, -y)\n function ecInv(\n uint256 _x,\n uint256 _y,\n uint256 _pp)\n public pure returns (uint256, uint256)\n {\n return (_x, (_pp - _y) % _pp);\n }\n\n /// @dev Add two points (x1, y1) and (x2, y2) in affine coordinates.\n /// @param _x1 coordinate x of P1\n /// @param _y1 coordinate y of P1\n /// @param _x2 coordinate x of P2\n /// @param _y2 coordinate y of P2\n /// @param _aa constant of the curve\n /// @param _pp the modulus\n /// @return (qx, qy) = P1+P2 in affine coordinates\n function ecAdd(\n uint256 _x1,\n uint256 _y1,\n uint256 _x2,\n uint256 _y2,\n uint256 _aa,\n uint256 _pp)\n public pure returns(uint256, uint256)\n {\n uint x = 0;\n uint y = 0;\n uint z = 0;\n // Double if x1==x2 else add\n if (_x1==_x2) {\n (x, y, z) = jacDouble(\n _x1,\n _y1,\n 1,\n _aa,\n _pp);\n } else {\n (x, y, z) = jacAdd(\n _x1,\n _y1,\n 1,\n _x2,\n _y2,\n 1,\n _pp);\n }\n // Get back to affine\n return toAffine(\n x,\n y,\n z,\n _pp);\n }\n\n /// @dev Substract two points (x1, y1) and (x2, y2) in affine coordinates.\n /// @param _x1 coordinate x of P1\n /// @param _y1 coordinate y of P1\n /// @param _x2 coordinate x of P2\n /// @param _y2 coordinate y of P2\n /// @param _aa constant of the curve\n /// @param _pp the modulus\n /// @return (qx, qy) = P1-P2 in affine coordinates\n function ecSub(\n uint256 _x1,\n uint256 _y1,\n uint256 _x2,\n uint256 _y2,\n uint256 _aa,\n uint256 _pp)\n public pure returns(uint256, uint256)\n {\n // invert square\n (uint256 x, uint256 y) = ecInv(_x2, _y2, _pp);\n // P1-square\n return ecAdd(\n _x1,\n _y1,\n x,\n y,\n _aa,\n _pp);\n }\n\n /// @dev Multiply point (x1, y1, z1) times d in affine coordinates.\n /// @param _k scalar to multiply\n /// @param _x coordinate x of P1\n /// @param _y coordinate y of P1\n /// @param _aa constant of the curve\n /// @param _pp the modulus\n /// @return (qx, qy) = d*P in affine coordinates\n function ecMul(\n uint256 _k,\n uint256 _x,\n uint256 _y,\n uint256 _aa,\n uint256 _pp)\n public pure returns(uint256, uint256)\n {\n // Jacobian multiplication\n (uint256 x1, uint256 y1, uint256 z1) = jacMul(\n _k,\n _x,\n _y,\n 1,\n _aa,\n _pp);\n // Get back to affine\n return toAffine(\n x1,\n y1,\n z1,\n _pp);\n }\n\n /// @dev Adds two points (x1, y1, z1) and (x2 y2, z2).\n /// @param _x1 coordinate x of P1\n /// @param _y1 coordinate y of P1\n /// @param _z1 coordinate z of P1\n /// @param _x2 coordinate x of square\n /// @param _y2 coordinate y of square\n /// @param _z2 coordinate z of square\n /// @param _pp the modulus\n /// @return (qx, qy, qz) P1+square in Jacobian\n function jacAdd(\n uint256 _x1,\n uint256 _y1,\n uint256 _z1,\n uint256 _x2,\n uint256 _y2,\n uint256 _z2,\n uint256 _pp)\n internal pure returns (uint256, uint256, uint256)\n {\n if ((_x1==0)&&(_y1==0))\n return (_x2, _y2, _z2);\n if ((_x2==0)&&(_y2==0))\n return (_x1, _y1, _z1);\n // We follow the equations described in https://pdfs.semanticscholar.org/5c64/29952e08025a9649c2b0ba32518e9a7fb5c2.pdf Section 5\n\n uint[4] memory zs; // z1^2, z1^3, z2^2, z2^3\n zs[0] = mulmod(_z1, _z1, _pp);\n zs[1] = mulmod(_z1, zs[0], _pp);\n zs[2] = mulmod(_z2, _z2, _pp);\n zs[3] = mulmod(_z2, zs[2], _pp);\n\n // u1, s1, u2, s2\n zs = [\n mulmod(_x1, zs[2], _pp),\n mulmod(_y1, zs[3], _pp),\n mulmod(_x2, zs[0], _pp),\n mulmod(_y2, zs[1], _pp)\n ];\n if (zs[0] == zs[2]) {\n if (zs[1] != zs[3])\n revert(\"Wrong data\");\n else {\n revert(\"Use double instead\");\n }\n }\n uint[4] memory hr;\n //h\n hr[0] = addmod(zs[2], _pp - zs[0], _pp);\n //r\n hr[1] = addmod(zs[3], _pp - zs[1], _pp);\n //h^2\n hr[2] = mulmod(hr[0], hr[0], _pp);\n // h^3\n hr[3] = mulmod(hr[2], hr[0], _pp);\n // qx = -h^3 -2u1h^2+r^2\n uint256 qx = addmod(mulmod(hr[1], hr[1], _pp), _pp - hr[3], _pp);\n qx = addmod(qx, _pp - mulmod(2, mulmod(zs[0], hr[2], _pp), _pp), _pp);\n // qy = -s1*z1*h^3+r(u1*h^2 -x^3)\n uint256 qy = mulmod(hr[1], addmod(mulmod(zs[0], hr[2], _pp), _pp - qx, _pp), _pp);\n qy = addmod(qy, _pp - mulmod(zs[1], hr[3], _pp), _pp);\n // qz = h*z1*z2\n uint256 qz = mulmod(hr[0], mulmod(_z1, _z2, _pp), _pp);\n return(qx, qy, qz);\n }\n\n /// @dev Doubles a points (x, y, z).\n /// @param _x coordinate x of P1\n /// @param _y coordinate y of P1\n /// @param _z coordinate z of P1\n /// @param _pp the modulus\n /// @param _aa the a scalar in the curve equation\n /// @return (qx, qy, qz) 2P in Jacobian\n function jacDouble(\n uint256 _x,\n uint256 _y,\n uint256 _z,\n uint256 _aa,\n uint256 _pp)\n internal pure returns (uint256, uint256, uint256)\n {\n if (_z == 0)\n return (_x, _y, _z);\n uint256[3] memory square;\n // We follow the equations described in https://pdfs.semanticscholar.org/5c64/29952e08025a9649c2b0ba32518e9a7fb5c2.pdf Section 5\n // Note: there is a bug in the paper regarding the m parameter, M=3*(x1^2)+a*(z1^4)\n square[0] = mulmod(_x, _x, _pp); //x1^2\n square[1] = mulmod(_y, _y, _pp); //y1^2\n square[2] = mulmod(_z, _z, _pp); //z1^2\n\n // s\n uint s = mulmod(4, mulmod(_x, square[1], _pp), _pp);\n // m\n uint m = addmod(mulmod(3, square[0], _pp), mulmod(_aa, mulmod(square[2], square[2], _pp), _pp), _pp);\n // qx\n uint256 qx = addmod(mulmod(m, m, _pp), _pp - addmod(s, s, _pp), _pp);\n // qy = -8*y1^4 + M(S-T)\n uint256 qy = addmod(mulmod(m, addmod(s, _pp - qx, _pp), _pp), _pp - mulmod(8, mulmod(square[1], square[1], _pp), _pp), _pp);\n // qz = 2*y1*z1\n uint256 qz = mulmod(2, mulmod(_y, _z, _pp), _pp);\n\n return (qx, qy, qz);\n }\n\n /// @dev Multiply point (x, y, z) times d.\n /// @param _d scalar to multiply\n /// @param _x coordinate x of P1\n /// @param _y coordinate y of P1\n /// @param _z coordinate z of P1\n /// @param _aa constant of curve\n /// @param _pp the modulus\n /// @return (qx, qy, qz) d*P1 in Jacobian\n function jacMul(\n uint256 _d,\n uint256 _x,\n uint256 _y,\n uint256 _z,\n uint256 _aa,\n uint256 _pp)\n internal pure returns (uint256, uint256, uint256)\n {\n uint256 remaining = _d;\n uint256[3] memory point;\n point[0] = _x;\n point[1] = _y;\n point[2] = _z;\n uint256 qx = 0;\n uint256 qy = 0;\n uint256 qz = 1;\n\n if (_d == 0) {\n return (qx, qy, qz);\n }\n // Double and add algorithm\n while (remaining != 0) {\n if ((remaining & 1) != 0) {\n (qx, qy, qz) = jacAdd(\n qx,\n qy,\n qz,\n point[0],\n point[1],\n point[2],\n _pp);\n }\n remaining = remaining / 2;\n (point[0], point[1], point[2]) = jacDouble(\n point[0],\n point[1],\n point[2],\n _aa,\n _pp);\n }\n return (qx, qy, qz);\n }\n}", + "sourcePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/EllipticCurve.sol", + "ast": { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/EllipticCurve.sol", + "exportedSymbols": { + "EllipticCurve": [ + 1420 + ] + }, + "id": 1421, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 249, + "literals": [ + "solidity", + ">=", + "0.4", + ".0", + "<", + "0.6", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:31:1" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": "@title Elliptic Curve Library\n@dev Library providing arithmetic operations over elliptic curves.\n@author Witnet Foundation", + "fullyImplemented": true, + "id": 1420, + "linearizedBaseContracts": [ + 1420 + ], + "name": "EllipticCurve", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 338, + "nodeType": "Block", + "src": "430:365:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 268, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 260, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 258, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 251, + "src": "440:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 259, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "446:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "440:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 263, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 261, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 251, + "src": "451:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 262, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "457:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "451:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "440:20:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 267, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 265, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "464:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 266, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "471:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "464:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "440:32:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 274, + "nodeType": "IfStatement", + "src": "436:77:1", + "trueBody": { + "id": 273, + "nodeType": "Block", + "src": "474:39:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "496e76616c6964206e756d626572", + "id": 270, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "489:16:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_f10345bf174b7296e0343b593f8b22d6d65d2b16a2522b6b74d9848a96db003a", + "typeString": "literal_string \"Invalid number\"" + }, + "value": "Invalid number" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_f10345bf174b7296e0343b593f8b22d6d65d2b16a2522b6b74d9848a96db003a", + "typeString": "literal_string \"Invalid number\"" + } + ], + "id": 269, + "name": "revert", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2494, + 2495 + ], + "referencedDeclaration": 2495, + "src": "482:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$", + "typeString": "function (string memory) pure" + } + }, + "id": 271, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "482:24:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 272, + "nodeType": "ExpressionStatement", + "src": "482:24:1" + } + ] + } + }, + { + "assignments": [ + 276 + ], + "declarations": [ + { + "constant": false, + "id": 276, + "name": "q", + "nodeType": "VariableDeclaration", + "scope": 338, + "src": "518:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 275, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "518:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 278, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 277, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "530:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "518:13:1" + }, + { + "assignments": [ + 280 + ], + "declarations": [ + { + "constant": false, + "id": 280, + "name": "newT", + "nodeType": "VariableDeclaration", + "scope": 338, + "src": "537:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 279, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "537:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 282, + "initialValue": { + "argumentTypes": null, + "hexValue": "31", + "id": 281, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "552:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "VariableDeclarationStatement", + "src": "537:16:1" + }, + { + "assignments": [ + 284 + ], + "declarations": [ + { + "constant": false, + "id": 284, + "name": "r", + "nodeType": "VariableDeclaration", + "scope": 338, + "src": "559:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 283, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "559:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 286, + "initialValue": { + "argumentTypes": null, + "id": 285, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "571:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "559:15:1" + }, + { + "assignments": [ + 288 + ], + "declarations": [ + { + "constant": false, + "id": 288, + "name": "newR", + "nodeType": "VariableDeclaration", + "scope": 338, + "src": "580:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 287, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "580:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 290, + "initialValue": { + "argumentTypes": null, + "id": 289, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 251, + "src": "595:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "580:17:1" + }, + { + "assignments": [ + 292 + ], + "declarations": [ + { + "constant": false, + "id": 292, + "name": "t", + "nodeType": "VariableDeclaration", + "scope": 338, + "src": "603:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 291, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "603:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 293, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "603:9:1" + }, + { + "body": { + "id": 334, + "nodeType": "Block", + "src": "636:140:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 297, + "name": "t", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 292, + "src": "644:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 298, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 284, + "src": "648:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "argumentTypes": null, + "id": 299, + "name": "newR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 288, + "src": "652:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "648:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "644:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 302, + "nodeType": "ExpressionStatement", + "src": "644:12:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 303, + "name": "q", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 276, + "src": "665:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 304, + "name": "newT", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 280, + "src": "668:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 305, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "664:9:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 306, + "name": "newT", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 280, + "src": "677:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 308, + "name": "q", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 276, + "src": "690:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 315, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 309, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "694:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 311, + "name": "t", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 292, + "src": "707:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 312, + "name": "newT", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 280, + "src": "710:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 313, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "716:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 310, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "700:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 314, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "700:20:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "694:26:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 316, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "693:28:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 317, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "723:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 307, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "683:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 318, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "683:44:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 319, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "676:52:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "664:64:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 321, + "nodeType": "ExpressionStatement", + "src": "664:64:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 332, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 322, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 284, + "src": "737:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 323, + "name": "newR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 288, + "src": "740:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 324, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "736:9:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 325, + "name": "newR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 288, + "src": "749:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 330, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 326, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 284, + "src": "755:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 327, + "name": "t", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 292, + "src": "759:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "id": 328, + "name": "newR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 288, + "src": "763:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "759:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "755:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 331, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "748:21:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "736:33:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 333, + "nodeType": "ExpressionStatement", + "src": "736:33:1" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 296, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 294, + "name": "newR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 288, + "src": "625:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 295, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "633:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "625:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 335, + "nodeType": "WhileStatement", + "src": "618:158:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 336, + "name": "q", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 276, + "src": "789:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 257, + "id": 337, + "nodeType": "Return", + "src": "782:8:1" + } + ] + }, + "documentation": "@dev Modular euclidean inverse of a number (mod p).\n @param _x The number\n @param _pp The modulus\n @return q such that x*q = 1 (mod _pp)", + "id": 339, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "invMod", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 254, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 251, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "375:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 250, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "375:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 253, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "387:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 252, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "387:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "374:25:1" + }, + "returnParameters": { + "id": 257, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 256, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "421:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 255, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "421:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "420:9:1" + }, + "scope": 1420, + "src": "359:436:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 383, + "nodeType": "Block", + "src": "1159:653:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 352, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 350, + "name": "_base", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 341, + "src": "1169:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 351, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1178:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1169:10:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 355, + "nodeType": "IfStatement", + "src": "1165:30:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "hexValue": "30", + "id": 353, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1194:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "functionReturnParameters": 349, + "id": 354, + "nodeType": "Return", + "src": "1187:8:1" + } + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 358, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 356, + "name": "_exp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 343, + "src": "1205:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 357, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1213:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1205:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 361, + "nodeType": "IfStatement", + "src": "1201:29:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "hexValue": "31", + "id": 359, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1229:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "functionReturnParameters": 349, + "id": 360, + "nodeType": "Return", + "src": "1222:8:1" + } + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 364, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 362, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 345, + "src": "1240:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 363, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1247:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1240:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 369, + "nodeType": "IfStatement", + "src": "1236:45:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "4d6f64756c7573206973207a65726f", + "id": 366, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1263:17:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_bc1233d995834f5f8e5d8ecb2ef23a237ca2f981f4f02c01953031da2abf3bcd", + "typeString": "literal_string \"Modulus is zero\"" + }, + "value": "Modulus is zero" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_bc1233d995834f5f8e5d8ecb2ef23a237ca2f981f4f02c01953031da2abf3bcd", + "typeString": "literal_string \"Modulus is zero\"" + } + ], + "id": 365, + "name": "revert", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2494, + 2495 + ], + "referencedDeclaration": 2495, + "src": "1256:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$", + "typeString": "function (string memory) pure" + } + }, + "id": 367, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1256:25:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 368, + "nodeType": "ExpressionStatement", + "src": "1256:25:1" + } + }, + { + "assignments": [ + 371 + ], + "declarations": [ + { + "constant": false, + "id": 371, + "name": "r", + "nodeType": "VariableDeclaration", + "scope": 383, + "src": "1287:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 370, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1287:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 373, + "initialValue": { + "argumentTypes": null, + "hexValue": "31", + "id": 372, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1299:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "VariableDeclarationStatement", + "src": "1287:13:1" + }, + { + "assignments": [ + 375 + ], + "declarations": [ + { + "constant": false, + "id": 375, + "name": "bit", + "nodeType": "VariableDeclaration", + "scope": 383, + "src": "1306:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 374, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1306:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 379, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819968_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9968" + }, + "id": 378, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 376, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1320:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "argumentTypes": null, + "hexValue": "323535", + "id": 377, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1325:3:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "1320:8:1", + "typeDescriptions": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819968_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9968" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1306:22:1" + }, + { + "externalReferences": [ + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1384:1:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1363:3:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1403:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1406:1:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1409:3:1", + "valueSize": 1 + } + }, + { + "_exp": { + "declaration": 343, + "isOffset": false, + "isSlot": false, + "src": "1532:4:1", + "valueSize": 1 + } + }, + { + "_exp": { + "declaration": 343, + "isOffset": false, + "isSlot": false, + "src": "1444:4:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1450:3:1", + "valueSize": 1 + } + }, + { + "_base": { + "declaration": 341, + "isOffset": false, + "isSlot": false, + "src": "1419:5:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1542:3:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1459:3:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1472:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1491:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1494:1:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1497:3:1", + "valueSize": 1 + } + }, + { + "_exp": { + "declaration": 343, + "isOffset": false, + "isSlot": false, + "src": "1628:4:1", + "valueSize": 1 + } + }, + { + "_base": { + "declaration": 341, + "isOffset": false, + "isSlot": false, + "src": "1507:5:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1638:3:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1555:3:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1568:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1587:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1590:1:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1593:3:1", + "valueSize": 1 + } + }, + { + "_exp": { + "declaration": 343, + "isOffset": false, + "isSlot": false, + "src": "1724:4:1", + "valueSize": 1 + } + }, + { + "_base": { + "declaration": 341, + "isOffset": false, + "isSlot": false, + "src": "1603:5:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1734:3:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1651:3:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1664:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1683:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1686:1:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1689:3:1", + "valueSize": 1 + } + }, + { + "_base": { + "declaration": 341, + "isOffset": false, + "isSlot": false, + "src": "1699:5:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1771:3:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1747:3:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1760:3:1", + "valueSize": 1 + } + } + ], + "id": 380, + "nodeType": "InlineAssembly", + "operations": "{\n for {\n }\n gt(bit, 0)\n {\n }\n {\n r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, bit)))), _pp)\n r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, div(bit, 2))))), _pp)\n r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, div(bit, 4))))), _pp)\n r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, div(bit, 8))))), _pp)\n bit := div(bit, 16)\n }\n}", + "src": "1335:458:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 381, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 371, + "src": "1806:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 349, + "id": 382, + "nodeType": "Return", + "src": "1799:8:1" + } + ] + }, + "documentation": "@dev Modular exponentiation, b^e % _pp.\n Source: https://github.com/androlo/standard-contracts/blob/master/contracts/src/crypto/ECCMath.sol\n @param _base base\n @param _exp exponent\n @param _pp modulus\n @return r such that r = b**e (mod _pp)", + "id": 384, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "expMod", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 346, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 341, + "name": "_base", + "nodeType": "VariableDeclaration", + "scope": 384, + "src": "1087:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 340, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1087:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 343, + "name": "_exp", + "nodeType": "VariableDeclaration", + "scope": 384, + "src": "1102:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 342, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1102:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 345, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 384, + "src": "1116:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 344, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1116:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1086:42:1" + }, + "returnParameters": { + "id": 349, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 348, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 384, + "src": "1150:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 347, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1150:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1149:9:1" + }, + "scope": 1420, + "src": "1071:741:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 438, + "nodeType": "Block", + "src": "2208:209:1", + "statements": [ + { + "assignments": [ + 400 + ], + "declarations": [ + { + "constant": false, + "id": 400, + "name": "zInv", + "nodeType": "VariableDeclaration", + "scope": 438, + "src": "2214:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 399, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2214:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 405, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 402, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 390, + "src": "2236:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 403, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 392, + "src": "2240:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 401, + "name": "invMod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 339, + "src": "2229:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 404, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2229:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2214:30:1" + }, + { + "assignments": [ + 407 + ], + "declarations": [ + { + "constant": false, + "id": 407, + "name": "zInv2", + "nodeType": "VariableDeclaration", + "scope": 438, + "src": "2250:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 406, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2250:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 413, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 409, + "name": "zInv", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 400, + "src": "2273:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 410, + "name": "zInv", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 400, + "src": "2279:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 411, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 392, + "src": "2285:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 408, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2266:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 412, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2266:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2250:39:1" + }, + { + "assignments": [ + 415 + ], + "declarations": [ + { + "constant": false, + "id": 415, + "name": "x2", + "nodeType": "VariableDeclaration", + "scope": 438, + "src": "2295:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 414, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2295:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 421, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 417, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 386, + "src": "2315:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 418, + "name": "zInv2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 407, + "src": "2319:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 419, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 392, + "src": "2326:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 416, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2308:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 420, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2308:22:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2295:35:1" + }, + { + "assignments": [ + 423 + ], + "declarations": [ + { + "constant": false, + "id": 423, + "name": "y2", + "nodeType": "VariableDeclaration", + "scope": 438, + "src": "2336:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 422, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2336:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 433, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 425, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "2356:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 427, + "name": "zInv", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 400, + "src": "2367:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 428, + "name": "zInv2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 407, + "src": "2373:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 429, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 392, + "src": "2380:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 426, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2360:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 430, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2360:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 431, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 392, + "src": "2386:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 424, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2349:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 432, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2349:41:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2336:54:1" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 434, + "name": "x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 415, + "src": "2405:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 435, + "name": "y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 423, + "src": "2409:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 436, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2404:8:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 398, + "id": 437, + "nodeType": "Return", + "src": "2397:15:1" + } + ] + }, + "documentation": "@dev Converts a point (x, y, z) expressed in Jacobian coordinates to affine coordinates (x', y', 1).\n @param _x coordinate x\n @param _y coordinate y\n @param _z coordinate z\n @param _pp the modulus\n @return (x', y') affine coordinates", + "id": 439, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toAffine", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 393, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 386, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 439, + "src": "2104:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 385, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2104:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 388, + "name": "_y", + "nodeType": "VariableDeclaration", + "scope": 439, + "src": "2120:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 387, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2120:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 390, + "name": "_z", + "nodeType": "VariableDeclaration", + "scope": 439, + "src": "2136:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 389, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2136:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 392, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 439, + "src": "2152:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 391, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2152:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2098:66:1" + }, + "returnParameters": { + "id": 398, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 395, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 439, + "src": "2188:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 394, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2188:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 397, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 439, + "src": "2197:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 396, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2197:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2187:18:1" + }, + "scope": 1420, + "src": "2081:336:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 509, + "nodeType": "Block", + "src": "2841:282:1", + "statements": [ + { + "assignments": [ + 455 + ], + "declarations": [ + { + "constant": false, + "id": 455, + "name": "y2", + "nodeType": "VariableDeclaration", + "scope": 509, + "src": "2867:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 454, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2867:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 477, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 458, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 443, + "src": "2894:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 460, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 443, + "src": "2905:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 461, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 443, + "src": "2909:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 462, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "2913:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 459, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2898:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 463, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2898:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 464, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "2919:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 457, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2887:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 465, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2887:36:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 468, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 443, + "src": "2939:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 469, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 445, + "src": "2943:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 470, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "2948:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 467, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2932:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 471, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2932:20:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 472, + "name": "_bb", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 447, + "src": "2954:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 473, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "2959:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 466, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "2925:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 474, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2925:38:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 475, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "2965:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 456, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "2880:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 476, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2880:89:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2867:102:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 489, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 478, + "name": "y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 455, + "src": "2975:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 480, + "name": "y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 455, + "src": "2987:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 486, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 483, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 481, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "2992:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 482, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2998:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2992:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 484, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2991:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "argumentTypes": null, + "hexValue": "34", + "id": 485, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3003:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "2991:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 487, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "3006:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 479, + "name": "expMod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 384, + "src": "2980:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 488, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2980:30:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2975:35:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 490, + "nodeType": "ExpressionStatement", + "src": "2975:35:1" + }, + { + "assignments": [ + 492 + ], + "declarations": [ + { + "constant": false, + "id": 492, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 509, + "src": "3052:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 491, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3052:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 506, + "initialValue": { + "argumentTypes": null, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 500, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 495, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 493, + "name": "y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 455, + "src": "3065:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 494, + "name": "_prefix", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 441, + "src": "3070:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "3065:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 496, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "3064:14:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 497, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3081:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "3064:18:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 499, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3086:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3064:23:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 504, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 502, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "3095:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 503, + "name": "y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 455, + "src": "3101:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3095:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "Conditional", + "src": "3064:39:1", + "trueExpression": { + "argumentTypes": null, + "id": 501, + "name": "y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 455, + "src": "3090:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3052:51:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 507, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 492, + "src": "3117:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 453, + "id": 508, + "nodeType": "Return", + "src": "3110:8:1" + } + ] + }, + "documentation": "@dev Derives the y coordinate from a compressed-format point x.\n @param _prefix parity byte (0x02 even, 0x03 odd)\n @param _x coordinate x\n @param _aa constant of curve\n @param _bb constant of curve\n @param _pp the modulus\n @return y coordinate y", + "id": 510, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "deriveY", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 450, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 441, + "name": "_prefix", + "nodeType": "VariableDeclaration", + "scope": 510, + "src": "2725:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 440, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "2725:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 443, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 510, + "src": "2744:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 442, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2744:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 445, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 510, + "src": "2760:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 444, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2760:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 447, + "name": "_bb", + "nodeType": "VariableDeclaration", + "scope": 510, + "src": "2777:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 446, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2777:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 449, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 510, + "src": "2794:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 448, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2794:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2719:87:1" + }, + "returnParameters": { + "id": 453, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 452, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 510, + "src": "2830:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 451, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2830:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2829:9:1" + }, + "scope": 1420, + "src": "2703:420:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 598, + "nodeType": "Block", + "src": "3541:403:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 539, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 535, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 531, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 527, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 525, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3551:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 526, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 512, + "src": "3556:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3551:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 530, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 528, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 512, + "src": "3562:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 529, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3568:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3562:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3551:20:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 534, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 532, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3575:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 533, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 514, + "src": "3580:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3575:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3551:31:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 538, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 536, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 514, + "src": "3586:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 537, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3592:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3586:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3551:44:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 543, + "nodeType": "IfStatement", + "src": "3547:77:1", + "trueBody": { + "id": 542, + "nodeType": "Block", + "src": "3597:27:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "hexValue": "66616c7365", + "id": 540, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3612:5:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + "functionReturnParameters": 524, + "id": 541, + "nodeType": "Return", + "src": "3605:12:1" + } + ] + } + }, + { + "assignments": [ + 545 + ], + "declarations": [ + { + "constant": false, + "id": 545, + "name": "lhs", + "nodeType": "VariableDeclaration", + "scope": 598, + "src": "3640:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 544, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3640:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 551, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 547, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 514, + "src": "3658:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 548, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 514, + "src": "3662:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 549, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3666:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 546, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "3651:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 550, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3651:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3640:30:1" + }, + { + "assignments": [ + 553 + ], + "declarations": [ + { + "constant": false, + "id": 553, + "name": "rhs", + "nodeType": "VariableDeclaration", + "scope": 598, + "src": "3687:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 552, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3687:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 563, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 556, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 512, + "src": "3712:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 557, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 512, + "src": "3716:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 558, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3720:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 555, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "3705:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 559, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3705:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 560, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 512, + "src": "3726:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 561, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3730:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 554, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "3698:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 562, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3698:36:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3687:47:1" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 566, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 564, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 516, + "src": "3744:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 565, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3751:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3744:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 580, + "nodeType": "IfStatement", + "src": "3740:92:1", + "trueBody": { + "id": 579, + "nodeType": "Block", + "src": "3754:78:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 577, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 567, + "name": "rhs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 553, + "src": "3781:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 569, + "name": "rhs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 553, + "src": "3794:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 571, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 512, + "src": "3806:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 572, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 516, + "src": "3810:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 573, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3815:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 570, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "3799:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 574, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3799:20:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 575, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3821:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 568, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "3787:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 576, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3787:38:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3781:44:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 578, + "nodeType": "ExpressionStatement", + "src": "3781:44:1" + } + ] + } + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 583, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 581, + "name": "_bb", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 518, + "src": "3841:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 582, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3848:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3841:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 593, + "nodeType": "IfStatement", + "src": "3837:79:1", + "trueBody": { + "id": 592, + "nodeType": "Block", + "src": "3851:65:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 590, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 584, + "name": "rhs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 553, + "src": "3882:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 586, + "name": "rhs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 553, + "src": "3895:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 587, + "name": "_bb", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 518, + "src": "3900:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 588, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3905:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 585, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "3888:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 589, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3888:21:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3882:27:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 591, + "nodeType": "ExpressionStatement", + "src": "3882:27:1" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 596, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 594, + "name": "lhs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 545, + "src": "3929:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 595, + "name": "rhs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 553, + "src": "3936:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3929:10:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 524, + "id": 597, + "nodeType": "Return", + "src": "3922:17:1" + } + ] + }, + "documentation": "@dev Check whether point (x,y) is on curve defined by a, b, and _pp.\n @param _x coordinate x of P1\n @param _y coordinate y of P1\n @param _aa constant of curve\n @param _bb constant of curve\n @param _pp the modulus\n @return true if x,y in the curve, false else", + "id": 599, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "isOnCurve", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 521, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 512, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 599, + "src": "3446:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 511, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3446:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 514, + "name": "_y", + "nodeType": "VariableDeclaration", + "scope": 599, + "src": "3459:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 513, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3459:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 516, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 599, + "src": "3472:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 515, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3472:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 518, + "name": "_bb", + "nodeType": "VariableDeclaration", + "scope": 599, + "src": "3486:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 517, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3486:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 520, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 599, + "src": "3500:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 519, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3500:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3440:69:1" + }, + "returnParameters": { + "id": 524, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 523, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 599, + "src": "3533:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 522, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3533:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3532:6:1" + }, + "scope": 1420, + "src": "3422:522:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 621, + "nodeType": "Block", + "src": "4231:40:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 612, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 601, + "src": "4245:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 618, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 615, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 613, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 605, + "src": "4250:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 614, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 603, + "src": "4256:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4250:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 616, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "4249:10:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "id": 617, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 605, + "src": "4262:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4249:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 619, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "4244:22:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 611, + "id": 620, + "nodeType": "Return", + "src": "4237:29:1" + } + ] + }, + "documentation": "@dev Calculate inverse (x, -y) of point (x, y).\n @param _x coordinate x of P1\n @param _y coordinate y of P1\n @param _pp the modulus\n @return (x, -y)", + "id": 622, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecInv", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 606, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 601, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 622, + "src": "4143:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 600, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4143:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 603, + "name": "_y", + "nodeType": "VariableDeclaration", + "scope": 622, + "src": "4159:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 602, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4159:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 605, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 622, + "src": "4175:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 604, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4175:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4137:50:1" + }, + "returnParameters": { + "id": 611, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 608, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 622, + "src": "4211:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 607, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4211:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 610, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 622, + "src": "4220:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 609, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4220:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4210:18:1" + }, + "scope": 1420, + "src": "4123:148:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 694, + "nodeType": "Block", + "src": "4773:418:1", + "statements": [ + { + "assignments": [ + 642 + ], + "declarations": [ + { + "constant": false, + "id": 642, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 694, + "src": "4779:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 641, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4779:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 644, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 643, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4788:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4779:10:1" + }, + { + "assignments": [ + 646 + ], + "declarations": [ + { + "constant": false, + "id": 646, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 694, + "src": "4795:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 645, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4795:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 648, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 647, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4804:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4795:10:1" + }, + { + "assignments": [ + 650 + ], + "declarations": [ + { + "constant": false, + "id": 650, + "name": "z", + "nodeType": "VariableDeclaration", + "scope": 694, + "src": "4811:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 649, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4811:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 652, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 651, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4820:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4811:10:1" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 655, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 653, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 624, + "src": "4864:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 654, + "name": "_x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 628, + "src": "4869:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4864:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 685, + "nodeType": "Block", + "src": "4980:121:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 683, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 670, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 642, + "src": "4989:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 671, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 646, + "src": "4992:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 672, + "name": "z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 650, + "src": "4995:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 673, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "4988:9:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 675, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 624, + "src": "5016:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 676, + "name": "_y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 626, + "src": "5029:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "31", + "id": 677, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5042:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + { + "argumentTypes": null, + "id": 678, + "name": "_x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 628, + "src": "5053:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 679, + "name": "_y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 630, + "src": "5066:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "31", + "id": 680, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5079:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + { + "argumentTypes": null, + "id": 681, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 634, + "src": "5090:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 674, + "name": "jacAdd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1105, + "src": "5000:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" + } + }, + "id": 682, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5000:94:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "src": "4988:106:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 684, + "nodeType": "ExpressionStatement", + "src": "4988:106:1" + } + ] + }, + "id": 686, + "nodeType": "IfStatement", + "src": "4860:241:1", + "trueBody": { + "id": 669, + "nodeType": "Block", + "src": "4874:100:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 667, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 656, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 642, + "src": "4883:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 657, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 646, + "src": "4886:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 658, + "name": "z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 650, + "src": "4889:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 659, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "4882:9:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 661, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 624, + "src": "4913:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 662, + "name": "_y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 626, + "src": "4926:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "31", + "id": 663, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4939:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + { + "argumentTypes": null, + "id": 664, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 632, + "src": "4950:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 665, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 634, + "src": "4963:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 660, + "name": "jacDouble", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1277, + "src": "4894:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" + } + }, + "id": 666, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4894:73:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "src": "4882:85:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 668, + "nodeType": "ExpressionStatement", + "src": "4882:85:1" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 688, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 642, + "src": "5155:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 689, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 646, + "src": "5164:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 690, + "name": "z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 650, + "src": "5173:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 691, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 634, + "src": "5182:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 687, + "name": "toAffine", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 439, + "src": "5139:8:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 692, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5139:47:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 640, + "id": 693, + "nodeType": "Return", + "src": "5132:54:1" + } + ] + }, + "documentation": "@dev Add two points (x1, y1) and (x2, y2) in affine coordinates.\n @param _x1 coordinate x of P1\n @param _y1 coordinate y of P1\n @param _x2 coordinate x of P2\n @param _y2 coordinate y of P2\n @param _aa constant of the curve\n @param _pp the modulus\n @return (qx, qy) = P1+P2 in affine coordinates", + "id": 695, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecAdd", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 635, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 624, + "name": "_x1", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4631:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 623, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4631:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 626, + "name": "_y1", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4648:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 625, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4648:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 628, + "name": "_x2", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4665:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 627, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4665:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 630, + "name": "_y2", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4682:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 629, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4682:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 632, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4699:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 631, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4699:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 634, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4716:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 633, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4716:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4625:103:1" + }, + "returnParameters": { + "id": 640, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 637, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4753:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 636, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4753:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 639, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4762:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 638, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4762:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4752:18:1" + }, + "scope": 1420, + "src": "4611:580:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 733, + "nodeType": "Block", + "src": "5697:175:1", + "statements": [ + { + "assignments": [ + 715, + 717 + ], + "declarations": [ + { + "constant": false, + "id": 715, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 733, + "src": "5725:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 714, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5725:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 717, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 733, + "src": "5736:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 716, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5736:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 723, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 719, + "name": "_x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 701, + "src": "5755:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 720, + "name": "_y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "5760:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 721, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 707, + "src": "5765:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 718, + "name": "ecInv", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 622, + "src": "5749:5:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 722, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5749:20:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5724:45:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 725, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 697, + "src": "5812:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 726, + "name": "_y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 699, + "src": "5823:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 727, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 715, + "src": "5834:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 728, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 717, + "src": "5843:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 729, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 705, + "src": "5852:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 730, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 707, + "src": "5863:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 724, + "name": "ecAdd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 695, + "src": "5799:5:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 731, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5799:68:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 713, + "id": 732, + "nodeType": "Return", + "src": "5792:75:1" + } + ] + }, + "documentation": "@dev Substract two points (x1, y1) and (x2, y2) in affine coordinates.\n @param _x1 coordinate x of P1\n @param _y1 coordinate y of P1\n @param _x2 coordinate x of P2\n @param _y2 coordinate y of P2\n @param _aa constant of the curve\n @param _pp the modulus\n @return (qx, qy) = P1-P2 in affine coordinates", + "id": 734, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecSub", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 708, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 697, + "name": "_x1", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5557:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 696, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5557:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 699, + "name": "_y1", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5574:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 698, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5574:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 701, + "name": "_x2", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5591:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 700, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5591:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 703, + "name": "_y2", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5608:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 702, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5608:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 705, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5625:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 704, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5625:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 707, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5642:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 706, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5642:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "5551:103:1" + }, + "returnParameters": { + "id": 713, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 710, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5677:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 709, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5677:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 712, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5686:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 711, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5686:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "5676:18:1" + }, + "scope": 1420, + "src": "5537:335:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 773, + "nodeType": "Block", + "src": "6310:238:1", + "statements": [ + { + "assignments": [ + 752, + 754, + 756 + ], + "declarations": [ + { + "constant": false, + "id": 752, + "name": "x1", + "nodeType": "VariableDeclaration", + "scope": 773, + "src": "6348:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 751, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6348:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 754, + "name": "y1", + "nodeType": "VariableDeclaration", + "scope": 773, + "src": "6360:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 753, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6360:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 756, + "name": "z1", + "nodeType": "VariableDeclaration", + "scope": 773, + "src": "6372:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 755, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6372:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 765, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 758, + "name": "_k", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 736, + "src": "6400:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 759, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 738, + "src": "6410:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 760, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 740, + "src": "6420:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "31", + "id": 761, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6430:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + { + "argumentTypes": null, + "id": 762, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 742, + "src": "6439:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 763, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 744, + "src": "6450:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 757, + "name": "jacMul", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1419, + "src": "6386:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" + } + }, + "id": 764, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6386:68:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6347:107:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 767, + "name": "x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 752, + "src": "6509:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 768, + "name": "y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 754, + "src": "6519:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 769, + "name": "z1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 756, + "src": "6529:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 770, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 744, + "src": "6539:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 766, + "name": "toAffine", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 439, + "src": "6493:8:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 771, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6493:50:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 750, + "id": 772, + "nodeType": "Return", + "src": "6486:57:1" + } + ] + }, + "documentation": "@dev Multiply point (x1, y1, z1) times d in affine coordinates.\n @param _k scalar to multiply\n @param _x coordinate x of P1\n @param _y coordinate y of P1\n @param _aa constant of the curve\n @param _pp the modulus\n @return (qx, qy) = d*P in affine coordinates", + "id": 774, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecMul", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 745, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 736, + "name": "_k", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6190:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 735, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6190:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 738, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6206:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 737, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6206:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 740, + "name": "_y", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6222:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 739, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6222:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 742, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6238:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 741, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6238:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 744, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6255:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 743, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6255:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "6184:83:1" + }, + "returnParameters": { + "id": 750, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 747, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6290:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 746, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6290:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 749, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6299:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 748, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6299:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "6289:18:1" + }, + "scope": 1420, + "src": "6170:378:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1104, + "nodeType": "Block", + "src": "7105:1450:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 805, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 799, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 797, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 776, + "src": "7116:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 798, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7121:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7116:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 800, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7115:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 803, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 801, + "name": "_y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 778, + "src": "7126:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 802, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7131:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7126:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 804, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7125:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "7115:18:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 811, + "nodeType": "IfStatement", + "src": "7111:52:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 806, + "name": "_x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 782, + "src": "7149:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 807, + "name": "_y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 784, + "src": "7154:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 808, + "name": "_z2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 786, + "src": "7159:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 809, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7148:15:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 796, + "id": 810, + "nodeType": "Return", + "src": "7141:22:1" + } + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 820, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 814, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 812, + "name": "_x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 782, + "src": "7174:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 813, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7179:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7174:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 815, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7173:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 818, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 816, + "name": "_y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 784, + "src": "7184:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 817, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7189:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7184:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 819, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7183:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "7173:18:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 826, + "nodeType": "IfStatement", + "src": "7169:52:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 821, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 776, + "src": "7207:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 822, + "name": "_y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 778, + "src": "7212:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 823, + "name": "_z1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 780, + "src": "7217:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 824, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7206:15:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 796, + "id": 825, + "nodeType": "Return", + "src": "7199:22:1" + } + }, + { + "assignments": [ + 831 + ], + "declarations": [ + { + "constant": false, + "id": 831, + "name": "zs", + "nodeType": "VariableDeclaration", + "scope": 1104, + "src": "7361:17:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4]" + }, + "typeName": { + "baseType": { + "id": 829, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "7361:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 830, + "length": { + "argumentTypes": null, + "hexValue": "34", + "id": 828, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7366:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "nodeType": "ArrayTypeName", + "src": "7361:7:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_storage_ptr", + "typeString": "uint256[4]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 832, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "7361:17:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 841, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 833, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7410:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 835, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 834, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7413:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "7410:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 837, + "name": "_z1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 780, + "src": "7425:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 838, + "name": "_z1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 780, + "src": "7430:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 839, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7435:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 836, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7418:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 840, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7418:21:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7410:29:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 842, + "nodeType": "ExpressionStatement", + "src": "7410:29:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 853, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 843, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7445:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 845, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 844, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7448:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "7445:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 847, + "name": "_z1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 780, + "src": "7460:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 848, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7465:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 850, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 849, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7468:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7465:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 851, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7472:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 846, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7453:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 852, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7453:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7445:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 854, + "nodeType": "ExpressionStatement", + "src": "7445:31:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 863, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 855, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7482:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 857, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 856, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7485:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "7482:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 859, + "name": "_z2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 786, + "src": "7497:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 860, + "name": "_z2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 786, + "src": "7502:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 861, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7507:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 858, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7490:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 862, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7490:21:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7482:29:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 864, + "nodeType": "ExpressionStatement", + "src": "7482:29:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 875, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 865, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7517:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 867, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 866, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7520:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "7517:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 869, + "name": "_z2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 786, + "src": "7532:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 870, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7537:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 872, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 871, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7540:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7537:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 873, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7544:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 868, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7525:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 874, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7525:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7517:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 876, + "nodeType": "ExpressionStatement", + "src": "7517:31:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 907, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 877, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7577:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 879, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 776, + "src": "7597:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 880, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7602:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 882, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 881, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7605:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7602:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 883, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7609:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 878, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7590:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 884, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7590:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 886, + "name": "_y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 778, + "src": "7628:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 887, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7633:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 889, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 888, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7636:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7633:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 890, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7640:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 885, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7621:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 891, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7621:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 893, + "name": "_x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 782, + "src": "7659:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 894, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7664:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 896, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 895, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7667:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7664:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 897, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7671:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 892, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7652:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 898, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7652:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 900, + "name": "_y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 784, + "src": "7690:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 901, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7695:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 903, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 902, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7698:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7695:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 904, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7702:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 899, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7683:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 905, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7683:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 906, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7582:130:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "src": "7577:135:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 908, + "nodeType": "ExpressionStatement", + "src": "7577:135:1" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 915, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 909, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7722:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 911, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 910, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7725:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7722:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 912, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7731:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 914, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 913, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7734:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7731:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7722:14:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 934, + "nodeType": "IfStatement", + "src": "7718:142:1", + "trueBody": { + "id": 933, + "nodeType": "Block", + "src": "7738:122:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 922, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 916, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7750:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 918, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 917, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7753:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7750:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 919, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7759:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 921, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 920, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7762:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7759:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7750:14:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 931, + "nodeType": "Block", + "src": "7807:47:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "55736520646f75626c6520696e7374656164", + "id": 928, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7824:20:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_e0a6c64d348a23aeba616ddff38efdbd5aec45b62c77a67c931b225a930b4902", + "typeString": "literal_string \"Use double instead\"" + }, + "value": "Use double instead" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_e0a6c64d348a23aeba616ddff38efdbd5aec45b62c77a67c931b225a930b4902", + "typeString": "literal_string \"Use double instead\"" + } + ], + "id": 927, + "name": "revert", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2494, + 2495 + ], + "referencedDeclaration": 2495, + "src": "7817:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$", + "typeString": "function (string memory) pure" + } + }, + "id": 929, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7817:28:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 930, + "nodeType": "ExpressionStatement", + "src": "7817:28:1" + } + ] + }, + "id": 932, + "nodeType": "IfStatement", + "src": "7746:108:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "57726f6e672064617461", + "id": 924, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7781:12:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_f5a600dd1007616677a3ee01eace6347fe379b820234173b19084f52d0cc85af", + "typeString": "literal_string \"Wrong data\"" + }, + "value": "Wrong data" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_f5a600dd1007616677a3ee01eace6347fe379b820234173b19084f52d0cc85af", + "typeString": "literal_string \"Wrong data\"" + } + ], + "id": 923, + "name": "revert", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2494, + 2495 + ], + "referencedDeclaration": 2495, + "src": "7774:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$", + "typeString": "function (string memory) pure" + } + }, + "id": 925, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7774:20:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 926, + "nodeType": "ExpressionStatement", + "src": "7774:20:1" + } + } + ] + } + }, + { + "assignments": [ + 939 + ], + "declarations": [ + { + "constant": false, + "id": 939, + "name": "hr", + "nodeType": "VariableDeclaration", + "scope": 1104, + "src": "7865:17:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4]" + }, + "typeName": { + "baseType": { + "id": 937, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "7865:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 938, + "length": { + "argumentTypes": null, + "hexValue": "34", + "id": 936, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7870:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "nodeType": "ArrayTypeName", + "src": "7865:7:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_storage_ptr", + "typeString": "uint256[4]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 940, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "7865:17:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 955, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 941, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "7896:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 943, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 942, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7899:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "7896:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 945, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7911:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 947, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 946, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7914:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7911:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 952, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 948, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7918:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 949, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7924:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 951, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 950, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7927:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7924:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7918:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 953, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7931:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 944, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "7904:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 954, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7904:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7896:39:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 956, + "nodeType": "ExpressionStatement", + "src": "7896:39:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 971, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 957, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "7949:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 959, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 958, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7952:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "7949:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 961, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7964:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 963, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 962, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7967:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7964:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 968, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 964, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7971:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 965, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7977:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 967, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 966, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7980:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7977:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7971:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 969, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7984:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 960, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "7957:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 970, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7957:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7949:39:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 972, + "nodeType": "ExpressionStatement", + "src": "7949:39:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 985, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 973, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8004:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 975, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 974, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8007:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "8004:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 977, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8019:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 979, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 978, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8022:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8019:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 980, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8026:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 982, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 981, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8029:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8026:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 983, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8033:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 976, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8012:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 984, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8012:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8004:33:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 986, + "nodeType": "ExpressionStatement", + "src": "8004:33:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 999, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 987, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8054:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 989, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 988, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8057:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "8054:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 991, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8069:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 993, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 992, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8072:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8069:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 994, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8076:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 996, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 995, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8079:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8076:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 997, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8083:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 990, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8062:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 998, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8062:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8054:33:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1000, + "nodeType": "ExpressionStatement", + "src": "8054:33:1" + }, + { + "assignments": [ + 1002 + ], + "declarations": [ + { + "constant": false, + "id": 1002, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 1104, + "src": "8123:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1001, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8123:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1020, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1005, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8150:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1007, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1006, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8153:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8150:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1008, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8157:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1010, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1009, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8160:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8157:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1011, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8164:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1004, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8143:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1012, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8143:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1017, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1013, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8170:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1014, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8176:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1016, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 1015, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8179:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8176:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8170:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1018, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8183:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1003, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "8136:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1019, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8136:51:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8123:64:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1041, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1021, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1002, + "src": "8193:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1023, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1002, + "src": "8205:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1024, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8209:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "32", + "id": 1026, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8222:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1028, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "8232:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1030, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1029, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8235:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8232:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1031, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8239:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1033, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1032, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8242:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8239:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1034, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8246:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1027, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8225:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1035, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8225:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1036, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8252:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1025, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8215:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1037, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8215:41:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8209:47:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1039, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8258:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1022, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "8198:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1040, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8198:64:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8193:69:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1042, + "nodeType": "ExpressionStatement", + "src": "8193:69:1" + }, + { + "assignments": [ + 1044 + ], + "declarations": [ + { + "constant": false, + "id": 1044, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 1104, + "src": "8306:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1043, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8306:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1066, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1046, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8326:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1048, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1047, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8329:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8326:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1051, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "8347:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1053, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1052, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8350:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8347:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1054, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8354:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1056, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1055, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8357:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8354:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1057, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8361:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1050, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8340:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1058, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8340:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1061, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1059, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8367:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 1060, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1002, + "src": "8373:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8367:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1062, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8377:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1049, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "8333:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1063, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8333:48:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1064, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8383:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1045, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8319:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1065, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8319:68:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8306:81:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1083, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1067, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1044, + "src": "8393:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1069, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1044, + "src": "8405:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1080, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1070, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8409:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1072, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "8422:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1074, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1073, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8425:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8422:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1075, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8429:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1077, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 1076, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8432:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8429:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1078, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8436:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1071, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8415:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1079, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8415:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8409:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1081, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8442:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1068, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "8398:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1082, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8398:48:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8393:53:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1084, + "nodeType": "ExpressionStatement", + "src": "8393:53:1" + }, + { + "assignments": [ + 1086 + ], + "declarations": [ + { + "constant": false, + "id": 1086, + "name": "qz", + "nodeType": "VariableDeclaration", + "scope": 1104, + "src": "8472:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1085, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8472:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1098, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1088, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8492:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1090, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1089, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8495:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8492:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1092, + "name": "_z1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 780, + "src": "8506:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1093, + "name": "_z2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 786, + "src": "8511:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1094, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8516:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1091, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8499:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1095, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8499:21:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1096, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8522:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1087, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8485:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1097, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8485:41:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8472:54:1" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1099, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1002, + "src": "8539:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1100, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1044, + "src": "8543:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1101, + "name": "qz", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1086, + "src": "8547:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1102, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8538:12:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 796, + "id": 1103, + "nodeType": "Return", + "src": "8532:18:1" + } + ] + }, + "documentation": "@dev Adds two points (x1, y1, z1) and (x2 y2, z2).\n @param _x1 coordinate x of P1\n @param _y1 coordinate y of P1\n @param _z1 coordinate z of P1\n @param _x2 coordinate x of square\n @param _y2 coordinate y of square\n @param _z2 coordinate z of square\n @param _pp the modulus\n @return (qx, qy, qz) P1+square in Jacobian", + "id": 1105, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "jacAdd", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 789, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 776, + "name": "_x1", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "6936:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 775, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6936:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 778, + "name": "_y1", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "6953:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 777, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6953:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 780, + "name": "_z1", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "6970:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 779, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6970:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 782, + "name": "_x2", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "6987:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 781, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6987:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 784, + "name": "_y2", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "7004:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 783, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7004:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 786, + "name": "_z2", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "7021:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 785, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7021:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 788, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "7038:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 787, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7038:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "6930:120:1" + }, + "returnParameters": { + "id": 796, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 791, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "7076:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 790, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7076:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 793, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "7085:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 792, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7085:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 795, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "7094:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 794, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7094:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "7075:27:1" + }, + "scope": 1420, + "src": "6915:1640:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 1276, + "nodeType": "Block", + "src": "8982:956:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1126, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1124, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1111, + "src": "8992:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1125, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8998:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "8992:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 1132, + "nodeType": "IfStatement", + "src": "8988:38:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1127, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1107, + "src": "9015:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1128, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1109, + "src": "9019:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1129, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1111, + "src": "9023:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1130, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "9014:12:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 1123, + "id": 1131, + "nodeType": "Return", + "src": "9007:19:1" + } + }, + { + "assignments": [ + 1137 + ], + "declarations": [ + { + "constant": false, + "id": 1137, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 1276, + "src": "9032:24:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3]" + }, + "typeName": { + "baseType": { + "id": 1135, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9032:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1136, + "length": { + "argumentTypes": null, + "hexValue": "33", + "id": 1134, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9040:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "nodeType": "ArrayTypeName", + "src": "9032:10:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_storage_ptr", + "typeString": "uint256[3]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1138, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "9032:24:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1147, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1139, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9283:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1141, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1140, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9290:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "9283:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1143, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1107, + "src": "9302:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1144, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1107, + "src": "9306:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1145, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9310:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1142, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9295:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1146, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9295:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9283:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1148, + "nodeType": "ExpressionStatement", + "src": "9283:31:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1157, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1149, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9327:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1151, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1150, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9334:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "9327:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1153, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1109, + "src": "9346:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1154, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1109, + "src": "9350:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1155, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9354:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1152, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9339:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1156, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9339:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9327:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1158, + "nodeType": "ExpressionStatement", + "src": "9327:31:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1167, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1159, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9371:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1161, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1160, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9378:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "9371:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1163, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1111, + "src": "9390:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1164, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1111, + "src": "9394:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1165, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9398:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1162, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9383:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1166, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9383:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9371:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1168, + "nodeType": "ExpressionStatement", + "src": "9371:31:1" + }, + { + "assignments": [ + 1170 + ], + "declarations": [ + { + "constant": false, + "id": 1170, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 1276, + "src": "9425:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1169, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "9425:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1182, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "34", + "id": 1172, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9441:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1174, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1107, + "src": "9451:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1175, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9455:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1177, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1176, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9462:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "9455:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1178, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9466:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1173, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9444:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1179, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9444:26:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1180, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9472:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1171, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9434:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1181, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9434:42:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9425:51:1" + }, + { + "assignments": [ + 1184 + ], + "declarations": [ + { + "constant": false, + "id": 1184, + "name": "m", + "nodeType": "VariableDeclaration", + "scope": 1276, + "src": "9491:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1183, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "9491:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1208, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "33", + "id": 1187, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9514:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1188, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9517:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1190, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1189, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9524:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "9517:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1191, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9528:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1186, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9507:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1192, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9507:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1194, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1113, + "src": "9541:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1196, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9553:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1198, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1197, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9560:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "9553:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1199, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9564:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1201, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1200, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9571:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "9564:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1202, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9575:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1195, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9546:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1203, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9546:33:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1204, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9581:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1193, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9534:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1205, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9534:51:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1206, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9587:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1185, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "9500:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1207, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9500:91:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9491:100:1" + }, + { + "assignments": [ + 1210 + ], + "declarations": [ + { + "constant": false, + "id": 1210, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 1276, + "src": "9607:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1209, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9607:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1226, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1213, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1184, + "src": "9634:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1214, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1184, + "src": "9637:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1215, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9640:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1212, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9627:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1216, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9627:17:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1223, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1217, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9646:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1219, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1170, + "src": "9659:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1220, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1170, + "src": "9662:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1221, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9665:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1218, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "9652:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1222, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9652:17:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9646:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1224, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9671:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1211, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "9620:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9620:55:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9607:68:1" + }, + { + "assignments": [ + 1228 + ], + "declarations": [ + { + "constant": false, + "id": 1228, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 1276, + "src": "9710:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1227, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9710:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1258, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1231, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1184, + "src": "9737:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1233, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1170, + "src": "9747:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1236, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1234, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9750:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 1235, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1210, + "src": "9756:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9750:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1237, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9760:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1232, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "9740:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1238, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9740:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1239, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9766:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1230, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9730:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1240, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9730:40:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1255, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1241, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9772:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "38", + "id": 1243, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9785:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1245, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9795:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1247, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1246, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9802:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "9795:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1248, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9806:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1250, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1249, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9813:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "9806:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1251, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9817:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1244, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9788:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9788:33:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1253, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9823:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1242, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9778:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1254, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9778:49:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9772:55:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1256, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9829:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1229, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "9723:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1257, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9723:110:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9710:123:1" + }, + { + "assignments": [ + 1260 + ], + "declarations": [ + { + "constant": false, + "id": 1260, + "name": "qz", + "nodeType": "VariableDeclaration", + "scope": 1276, + "src": "9859:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1259, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9859:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1270, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "32", + "id": 1262, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9879:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1264, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1109, + "src": "9889:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1265, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1111, + "src": "9893:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1266, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9897:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1263, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9882:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1267, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9882:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1268, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9903:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1261, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9872:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9872:35:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9859:48:1" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1271, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1210, + "src": "9922:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1272, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1228, + "src": "9926:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1273, + "name": "qz", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1260, + "src": "9930:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1274, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "9921:12:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 1123, + "id": 1275, + "nodeType": "Return", + "src": "9914:19:1" + } + ] + }, + "documentation": "@dev Doubles a points (x, y, z).\n @param _x coordinate x of P1\n @param _y coordinate y of P1\n @param _z coordinate z of P1\n @param _pp the modulus\n @param _aa the a scalar in the curve equation\n @return (qx, qy, qz) 2P in Jacobian", + "id": 1277, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "jacDouble", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1116, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1107, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8850:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1106, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8850:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1109, + "name": "_y", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8866:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1108, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8866:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1111, + "name": "_z", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8882:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1110, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8882:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1113, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8898:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1112, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8898:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1115, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8915:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1114, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8915:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "8844:83:1" + }, + "returnParameters": { + "id": 1123, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1118, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8953:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1117, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8953:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1120, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8962:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1119, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8962:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1122, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8971:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1121, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8971:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "8952:27:1" + }, + "scope": 1420, + "src": "8826:1112:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 1418, + "nodeType": "Block", + "src": "10404:679:1", + "statements": [ + { + "assignments": [ + 1299 + ], + "declarations": [ + { + "constant": false, + "id": 1299, + "name": "remaining", + "nodeType": "VariableDeclaration", + "scope": 1418, + "src": "10410:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1298, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10410:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1301, + "initialValue": { + "argumentTypes": null, + "id": 1300, + "name": "_d", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1279, + "src": "10430:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10410:22:1" + }, + { + "assignments": [ + 1306 + ], + "declarations": [ + { + "constant": false, + "id": 1306, + "name": "point", + "nodeType": "VariableDeclaration", + "scope": 1418, + "src": "10438:23:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3]" + }, + "typeName": { + "baseType": { + "id": 1304, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10438:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1305, + "length": { + "argumentTypes": null, + "hexValue": "33", + "id": 1303, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10446:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "nodeType": "ArrayTypeName", + "src": "10438:10:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_storage_ptr", + "typeString": "uint256[3]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1307, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "10438:23:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1312, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1308, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10467:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1310, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1309, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10473:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "10467:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1311, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1281, + "src": "10478:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10467:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1313, + "nodeType": "ExpressionStatement", + "src": "10467:13:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1318, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1314, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10486:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1316, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1315, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10492:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "10486:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1317, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1283, + "src": "10497:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10486:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1319, + "nodeType": "ExpressionStatement", + "src": "10486:13:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1324, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1320, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10505:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1322, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1321, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10511:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "10505:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1323, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "10516:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10505:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1325, + "nodeType": "ExpressionStatement", + "src": "10505:13:1" + }, + { + "assignments": [ + 1327 + ], + "declarations": [ + { + "constant": false, + "id": 1327, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 1418, + "src": "10524:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1326, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10524:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1329, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 1328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10537:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "10524:14:1" + }, + { + "assignments": [ + 1331 + ], + "declarations": [ + { + "constant": false, + "id": 1331, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 1418, + "src": "10544:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1330, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10544:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1333, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 1332, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10557:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "10544:14:1" + }, + { + "assignments": [ + 1335 + ], + "declarations": [ + { + "constant": false, + "id": 1335, + "name": "qz", + "nodeType": "VariableDeclaration", + "scope": 1418, + "src": "10564:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1334, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10564:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1337, + "initialValue": { + "argumentTypes": null, + "hexValue": "31", + "id": 1336, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10577:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "VariableDeclarationStatement", + "src": "10564:14:1" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1340, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1338, + "name": "_d", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1279, + "src": "10589:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1339, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10595:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "10589:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 1347, + "nodeType": "IfStatement", + "src": "10585:47:1", + "trueBody": { + "id": 1346, + "nodeType": "Block", + "src": "10598:34:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1341, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1327, + "src": "10614:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1342, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1331, + "src": "10618:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1343, + "name": "qz", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1335, + "src": "10622:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1344, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10613:12:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 1297, + "id": 1345, + "nodeType": "Return", + "src": "10606:19:1" + } + ] + } + }, + { + "body": { + "id": 1411, + "nodeType": "Block", + "src": "10692:362:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1356, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1353, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1351, + "name": "remaining", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1299, + "src": "10705:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1352, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10717:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "10705:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1354, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10704:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1355, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10723:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "10704:20:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 1379, + "nodeType": "IfStatement", + "src": "10700:184:1", + "trueBody": { + "id": 1378, + "nodeType": "Block", + "src": "10726:158:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1376, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1357, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1327, + "src": "10737:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1358, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1331, + "src": "10741:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1359, + "name": "qz", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1335, + "src": "10745:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1360, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "10736:12:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1362, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1327, + "src": "10769:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1363, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1331, + "src": "10783:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1364, + "name": "qz", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1335, + "src": "10797:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1365, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10811:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1367, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1366, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10817:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "10811:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1368, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10831:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1370, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1369, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10837:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "10831:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1371, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10851:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1373, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1372, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10857:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "10851:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1374, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1289, + "src": "10871:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1361, + "name": "jacAdd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1105, + "src": "10751:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" + } + }, + "id": 1375, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "10751:124:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "src": "10736:139:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1377, + "nodeType": "ExpressionStatement", + "src": "10736:139:1" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "id": 1384, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1380, + "name": "remaining", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1299, + "src": "10891:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1383, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1381, + "name": "remaining", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1299, + "src": "10903:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1382, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10915:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "10903:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10891:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1385, + "nodeType": "ExpressionStatement", + "src": "10891:25:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1409, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1386, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10925:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1388, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1387, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10931:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "10925:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1389, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10935:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1391, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1390, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10941:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "10935:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1392, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10945:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1394, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1393, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10951:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "10945:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1395, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "10924:30:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1397, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10976:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1399, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1398, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10982:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "10976:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1400, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10994:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1402, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1401, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11000:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "10994:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1403, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "11012:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1405, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1404, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11018:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "11012:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1406, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1287, + "src": "11030:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1407, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1289, + "src": "11043:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1396, + "name": "jacDouble", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1277, + "src": "10957:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" + } + }, + "id": 1408, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "10957:90:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "src": "10924:123:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1410, + "nodeType": "ExpressionStatement", + "src": "10924:123:1" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1350, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1348, + "name": "remaining", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1299, + "src": "10676:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1349, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10689:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "10676:14:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1412, + "nodeType": "WhileStatement", + "src": "10669:385:1" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1413, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1327, + "src": "11067:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1414, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1331, + "src": "11071:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1415, + "name": "qz", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1335, + "src": "11075:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1416, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11066:12:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 1297, + "id": 1417, + "nodeType": "Return", + "src": "11059:19:1" + } + ] + }, + "documentation": "@dev Multiply point (x, y, z) times d.\n @param _d scalar to multiply\n @param _x coordinate x of P1\n @param _y coordinate y of P1\n @param _z coordinate z of P1\n @param _aa constant of curve\n @param _pp the modulus\n @return (qx, qy, qz) d*P1 in Jacobian", + "id": 1419, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "jacMul", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1290, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1279, + "name": "_d", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10256:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1278, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10256:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1281, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10272:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1280, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10272:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1283, + "name": "_y", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10288:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1282, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10288:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1285, + "name": "_z", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10304:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1284, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10304:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1287, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10320:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1286, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10320:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1289, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10337:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1288, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10337:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "10250:99:1" + }, + "returnParameters": { + "id": 1297, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1292, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10375:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1291, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10375:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1294, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10384:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1293, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10384:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1296, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10393:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1295, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10393:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "10374:27:1" + }, + "scope": 1420, + "src": "10235:848:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + } + ], + "scope": 1421, + "src": "174:10911:1" + } + ], + "src": "0:11085:1" + }, + "legacyAST": { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/EllipticCurve.sol", + "exportedSymbols": { + "EllipticCurve": [ + 1420 + ] + }, + "id": 1421, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 249, + "literals": [ + "solidity", + ">=", + "0.4", + ".0", + "<", + "0.6", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:31:1" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": "@title Elliptic Curve Library\n@dev Library providing arithmetic operations over elliptic curves.\n@author Witnet Foundation", + "fullyImplemented": true, + "id": 1420, + "linearizedBaseContracts": [ + 1420 + ], + "name": "EllipticCurve", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 338, + "nodeType": "Block", + "src": "430:365:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 268, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 260, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 258, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 251, + "src": "440:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 259, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "446:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "440:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 263, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 261, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 251, + "src": "451:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 262, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "457:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "451:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "440:20:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 267, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 265, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "464:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 266, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "471:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "464:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "440:32:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 274, + "nodeType": "IfStatement", + "src": "436:77:1", + "trueBody": { + "id": 273, + "nodeType": "Block", + "src": "474:39:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "496e76616c6964206e756d626572", + "id": 270, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "489:16:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_f10345bf174b7296e0343b593f8b22d6d65d2b16a2522b6b74d9848a96db003a", + "typeString": "literal_string \"Invalid number\"" + }, + "value": "Invalid number" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_f10345bf174b7296e0343b593f8b22d6d65d2b16a2522b6b74d9848a96db003a", + "typeString": "literal_string \"Invalid number\"" + } + ], + "id": 269, + "name": "revert", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2494, + 2495 + ], + "referencedDeclaration": 2495, + "src": "482:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$", + "typeString": "function (string memory) pure" + } + }, + "id": 271, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "482:24:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 272, + "nodeType": "ExpressionStatement", + "src": "482:24:1" + } + ] + } + }, + { + "assignments": [ + 276 + ], + "declarations": [ + { + "constant": false, + "id": 276, + "name": "q", + "nodeType": "VariableDeclaration", + "scope": 338, + "src": "518:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 275, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "518:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 278, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 277, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "530:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "518:13:1" + }, + { + "assignments": [ + 280 + ], + "declarations": [ + { + "constant": false, + "id": 280, + "name": "newT", + "nodeType": "VariableDeclaration", + "scope": 338, + "src": "537:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 279, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "537:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 282, + "initialValue": { + "argumentTypes": null, + "hexValue": "31", + "id": 281, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "552:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "VariableDeclarationStatement", + "src": "537:16:1" + }, + { + "assignments": [ + 284 + ], + "declarations": [ + { + "constant": false, + "id": 284, + "name": "r", + "nodeType": "VariableDeclaration", + "scope": 338, + "src": "559:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 283, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "559:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 286, + "initialValue": { + "argumentTypes": null, + "id": 285, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "571:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "559:15:1" + }, + { + "assignments": [ + 288 + ], + "declarations": [ + { + "constant": false, + "id": 288, + "name": "newR", + "nodeType": "VariableDeclaration", + "scope": 338, + "src": "580:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 287, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "580:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 290, + "initialValue": { + "argumentTypes": null, + "id": 289, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 251, + "src": "595:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "580:17:1" + }, + { + "assignments": [ + 292 + ], + "declarations": [ + { + "constant": false, + "id": 292, + "name": "t", + "nodeType": "VariableDeclaration", + "scope": 338, + "src": "603:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 291, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "603:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 293, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "603:9:1" + }, + { + "body": { + "id": 334, + "nodeType": "Block", + "src": "636:140:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 297, + "name": "t", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 292, + "src": "644:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 298, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 284, + "src": "648:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "argumentTypes": null, + "id": 299, + "name": "newR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 288, + "src": "652:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "648:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "644:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 302, + "nodeType": "ExpressionStatement", + "src": "644:12:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 320, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 303, + "name": "q", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 276, + "src": "665:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 304, + "name": "newT", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 280, + "src": "668:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 305, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "664:9:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 306, + "name": "newT", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 280, + "src": "677:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 308, + "name": "q", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 276, + "src": "690:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 315, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 309, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "694:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 311, + "name": "t", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 292, + "src": "707:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 312, + "name": "newT", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 280, + "src": "710:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 313, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "716:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 310, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "700:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 314, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "700:20:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "694:26:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 316, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "693:28:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 317, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "723:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 307, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "683:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 318, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "683:44:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 319, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "676:52:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "664:64:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 321, + "nodeType": "ExpressionStatement", + "src": "664:64:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 332, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 322, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 284, + "src": "737:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 323, + "name": "newR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 288, + "src": "740:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 324, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "736:9:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 325, + "name": "newR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 288, + "src": "749:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 330, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 326, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 284, + "src": "755:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 329, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 327, + "name": "t", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 292, + "src": "759:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "id": 328, + "name": "newR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 288, + "src": "763:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "759:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "755:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 331, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "748:21:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "736:33:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 333, + "nodeType": "ExpressionStatement", + "src": "736:33:1" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 296, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 294, + "name": "newR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 288, + "src": "625:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 295, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "633:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "625:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 335, + "nodeType": "WhileStatement", + "src": "618:158:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 336, + "name": "q", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 276, + "src": "789:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 257, + "id": 337, + "nodeType": "Return", + "src": "782:8:1" + } + ] + }, + "documentation": "@dev Modular euclidean inverse of a number (mod p).\n @param _x The number\n @param _pp The modulus\n @return q such that x*q = 1 (mod _pp)", + "id": 339, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "invMod", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 254, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 251, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "375:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 250, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "375:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 253, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "387:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 252, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "387:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "374:25:1" + }, + "returnParameters": { + "id": 257, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 256, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 339, + "src": "421:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 255, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "421:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "420:9:1" + }, + "scope": 1420, + "src": "359:436:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 383, + "nodeType": "Block", + "src": "1159:653:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 352, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 350, + "name": "_base", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 341, + "src": "1169:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 351, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1178:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1169:10:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 355, + "nodeType": "IfStatement", + "src": "1165:30:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "hexValue": "30", + "id": 353, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1194:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "functionReturnParameters": 349, + "id": 354, + "nodeType": "Return", + "src": "1187:8:1" + } + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 358, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 356, + "name": "_exp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 343, + "src": "1205:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 357, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1213:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1205:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 361, + "nodeType": "IfStatement", + "src": "1201:29:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "hexValue": "31", + "id": 359, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1229:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "functionReturnParameters": 349, + "id": 360, + "nodeType": "Return", + "src": "1222:8:1" + } + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 364, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 362, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 345, + "src": "1240:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 363, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1247:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1240:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 369, + "nodeType": "IfStatement", + "src": "1236:45:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "4d6f64756c7573206973207a65726f", + "id": 366, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1263:17:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_bc1233d995834f5f8e5d8ecb2ef23a237ca2f981f4f02c01953031da2abf3bcd", + "typeString": "literal_string \"Modulus is zero\"" + }, + "value": "Modulus is zero" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_bc1233d995834f5f8e5d8ecb2ef23a237ca2f981f4f02c01953031da2abf3bcd", + "typeString": "literal_string \"Modulus is zero\"" + } + ], + "id": 365, + "name": "revert", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2494, + 2495 + ], + "referencedDeclaration": 2495, + "src": "1256:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$", + "typeString": "function (string memory) pure" + } + }, + "id": 367, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1256:25:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 368, + "nodeType": "ExpressionStatement", + "src": "1256:25:1" + } + }, + { + "assignments": [ + 371 + ], + "declarations": [ + { + "constant": false, + "id": 371, + "name": "r", + "nodeType": "VariableDeclaration", + "scope": 383, + "src": "1287:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 370, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1287:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 373, + "initialValue": { + "argumentTypes": null, + "hexValue": "31", + "id": 372, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1299:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "VariableDeclarationStatement", + "src": "1287:13:1" + }, + { + "assignments": [ + 375 + ], + "declarations": [ + { + "constant": false, + "id": 375, + "name": "bit", + "nodeType": "VariableDeclaration", + "scope": 383, + "src": "1306:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 374, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1306:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 379, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819968_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9968" + }, + "id": 378, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 376, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1320:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "BinaryOperation", + "operator": "**", + "rightExpression": { + "argumentTypes": null, + "hexValue": "323535", + "id": 377, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1325:3:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_255_by_1", + "typeString": "int_const 255" + }, + "value": "255" + }, + "src": "1320:8:1", + "typeDescriptions": { + "typeIdentifier": "t_rational_57896044618658097711785492504343953926634992332820282019728792003956564819968_by_1", + "typeString": "int_const 5789...(69 digits omitted)...9968" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1306:22:1" + }, + { + "externalReferences": [ + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1384:1:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1363:3:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1403:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1406:1:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1409:3:1", + "valueSize": 1 + } + }, + { + "_exp": { + "declaration": 343, + "isOffset": false, + "isSlot": false, + "src": "1532:4:1", + "valueSize": 1 + } + }, + { + "_exp": { + "declaration": 343, + "isOffset": false, + "isSlot": false, + "src": "1444:4:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1450:3:1", + "valueSize": 1 + } + }, + { + "_base": { + "declaration": 341, + "isOffset": false, + "isSlot": false, + "src": "1419:5:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1542:3:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1459:3:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1472:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1491:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1494:1:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1497:3:1", + "valueSize": 1 + } + }, + { + "_exp": { + "declaration": 343, + "isOffset": false, + "isSlot": false, + "src": "1628:4:1", + "valueSize": 1 + } + }, + { + "_base": { + "declaration": 341, + "isOffset": false, + "isSlot": false, + "src": "1507:5:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1638:3:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1555:3:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1568:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1587:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1590:1:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1593:3:1", + "valueSize": 1 + } + }, + { + "_exp": { + "declaration": 343, + "isOffset": false, + "isSlot": false, + "src": "1724:4:1", + "valueSize": 1 + } + }, + { + "_base": { + "declaration": 341, + "isOffset": false, + "isSlot": false, + "src": "1603:5:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1734:3:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1651:3:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1664:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1683:1:1", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 371, + "isOffset": false, + "isSlot": false, + "src": "1686:1:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1689:3:1", + "valueSize": 1 + } + }, + { + "_base": { + "declaration": 341, + "isOffset": false, + "isSlot": false, + "src": "1699:5:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1771:3:1", + "valueSize": 1 + } + }, + { + "_pp": { + "declaration": 345, + "isOffset": false, + "isSlot": false, + "src": "1747:3:1", + "valueSize": 1 + } + }, + { + "bit": { + "declaration": 375, + "isOffset": false, + "isSlot": false, + "src": "1760:3:1", + "valueSize": 1 + } + } + ], + "id": 380, + "nodeType": "InlineAssembly", + "operations": "{\n for {\n }\n gt(bit, 0)\n {\n }\n {\n r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, bit)))), _pp)\n r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, div(bit, 2))))), _pp)\n r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, div(bit, 4))))), _pp)\n r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, div(bit, 8))))), _pp)\n bit := div(bit, 16)\n }\n}", + "src": "1335:458:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 381, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 371, + "src": "1806:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 349, + "id": 382, + "nodeType": "Return", + "src": "1799:8:1" + } + ] + }, + "documentation": "@dev Modular exponentiation, b^e % _pp.\n Source: https://github.com/androlo/standard-contracts/blob/master/contracts/src/crypto/ECCMath.sol\n @param _base base\n @param _exp exponent\n @param _pp modulus\n @return r such that r = b**e (mod _pp)", + "id": 384, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "expMod", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 346, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 341, + "name": "_base", + "nodeType": "VariableDeclaration", + "scope": 384, + "src": "1087:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 340, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1087:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 343, + "name": "_exp", + "nodeType": "VariableDeclaration", + "scope": 384, + "src": "1102:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 342, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1102:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 345, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 384, + "src": "1116:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 344, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1116:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1086:42:1" + }, + "returnParameters": { + "id": 349, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 348, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 384, + "src": "1150:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 347, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1150:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1149:9:1" + }, + "scope": 1420, + "src": "1071:741:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 438, + "nodeType": "Block", + "src": "2208:209:1", + "statements": [ + { + "assignments": [ + 400 + ], + "declarations": [ + { + "constant": false, + "id": 400, + "name": "zInv", + "nodeType": "VariableDeclaration", + "scope": 438, + "src": "2214:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 399, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2214:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 405, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 402, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 390, + "src": "2236:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 403, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 392, + "src": "2240:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 401, + "name": "invMod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 339, + "src": "2229:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 404, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2229:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2214:30:1" + }, + { + "assignments": [ + 407 + ], + "declarations": [ + { + "constant": false, + "id": 407, + "name": "zInv2", + "nodeType": "VariableDeclaration", + "scope": 438, + "src": "2250:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 406, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2250:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 413, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 409, + "name": "zInv", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 400, + "src": "2273:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 410, + "name": "zInv", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 400, + "src": "2279:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 411, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 392, + "src": "2285:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 408, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2266:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 412, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2266:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2250:39:1" + }, + { + "assignments": [ + 415 + ], + "declarations": [ + { + "constant": false, + "id": 415, + "name": "x2", + "nodeType": "VariableDeclaration", + "scope": 438, + "src": "2295:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 414, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2295:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 421, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 417, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 386, + "src": "2315:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 418, + "name": "zInv2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 407, + "src": "2319:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 419, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 392, + "src": "2326:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 416, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2308:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 420, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2308:22:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2295:35:1" + }, + { + "assignments": [ + 423 + ], + "declarations": [ + { + "constant": false, + "id": 423, + "name": "y2", + "nodeType": "VariableDeclaration", + "scope": 438, + "src": "2336:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 422, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2336:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 433, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 425, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 388, + "src": "2356:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 427, + "name": "zInv", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 400, + "src": "2367:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 428, + "name": "zInv2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 407, + "src": "2373:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 429, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 392, + "src": "2380:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 426, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2360:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 430, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2360:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 431, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 392, + "src": "2386:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 424, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2349:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 432, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2349:41:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2336:54:1" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 434, + "name": "x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 415, + "src": "2405:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 435, + "name": "y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 423, + "src": "2409:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 436, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2404:8:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 398, + "id": 437, + "nodeType": "Return", + "src": "2397:15:1" + } + ] + }, + "documentation": "@dev Converts a point (x, y, z) expressed in Jacobian coordinates to affine coordinates (x', y', 1).\n @param _x coordinate x\n @param _y coordinate y\n @param _z coordinate z\n @param _pp the modulus\n @return (x', y') affine coordinates", + "id": 439, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "toAffine", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 393, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 386, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 439, + "src": "2104:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 385, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2104:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 388, + "name": "_y", + "nodeType": "VariableDeclaration", + "scope": 439, + "src": "2120:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 387, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2120:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 390, + "name": "_z", + "nodeType": "VariableDeclaration", + "scope": 439, + "src": "2136:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 389, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2136:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 392, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 439, + "src": "2152:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 391, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2152:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2098:66:1" + }, + "returnParameters": { + "id": 398, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 395, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 439, + "src": "2188:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 394, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2188:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 397, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 439, + "src": "2197:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 396, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2197:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2187:18:1" + }, + "scope": 1420, + "src": "2081:336:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 509, + "nodeType": "Block", + "src": "2841:282:1", + "statements": [ + { + "assignments": [ + 455 + ], + "declarations": [ + { + "constant": false, + "id": 455, + "name": "y2", + "nodeType": "VariableDeclaration", + "scope": 509, + "src": "2867:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 454, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2867:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 477, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 458, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 443, + "src": "2894:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 460, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 443, + "src": "2905:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 461, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 443, + "src": "2909:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 462, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "2913:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 459, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2898:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 463, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2898:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 464, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "2919:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 457, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2887:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 465, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2887:36:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 468, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 443, + "src": "2939:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 469, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 445, + "src": "2943:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 470, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "2948:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 467, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "2932:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 471, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2932:20:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 472, + "name": "_bb", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 447, + "src": "2954:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 473, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "2959:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 466, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "2925:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 474, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2925:38:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 475, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "2965:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 456, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "2880:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 476, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2880:89:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2867:102:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 489, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 478, + "name": "y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 455, + "src": "2975:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 480, + "name": "y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 455, + "src": "2987:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 486, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 483, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 481, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "2992:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 482, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2998:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "2992:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 484, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2991:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "argumentTypes": null, + "hexValue": "34", + "id": 485, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3003:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "src": "2991:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 487, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "3006:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 479, + "name": "expMod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 384, + "src": "2980:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 488, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2980:30:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2975:35:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 490, + "nodeType": "ExpressionStatement", + "src": "2975:35:1" + }, + { + "assignments": [ + 492 + ], + "declarations": [ + { + "constant": false, + "id": 492, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 509, + "src": "3052:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 491, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3052:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 506, + "initialValue": { + "argumentTypes": null, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 500, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 498, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 495, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 493, + "name": "y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 455, + "src": "3065:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 494, + "name": "_prefix", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 441, + "src": "3070:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "src": "3065:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 496, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "3064:14:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 497, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3081:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "3064:18:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 499, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3086:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3064:23:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 504, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 502, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 449, + "src": "3095:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 503, + "name": "y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 455, + "src": "3101:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3095:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "Conditional", + "src": "3064:39:1", + "trueExpression": { + "argumentTypes": null, + "id": 501, + "name": "y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 455, + "src": "3090:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3052:51:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 507, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 492, + "src": "3117:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 453, + "id": 508, + "nodeType": "Return", + "src": "3110:8:1" + } + ] + }, + "documentation": "@dev Derives the y coordinate from a compressed-format point x.\n @param _prefix parity byte (0x02 even, 0x03 odd)\n @param _x coordinate x\n @param _aa constant of curve\n @param _bb constant of curve\n @param _pp the modulus\n @return y coordinate y", + "id": 510, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "deriveY", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 450, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 441, + "name": "_prefix", + "nodeType": "VariableDeclaration", + "scope": 510, + "src": "2725:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 440, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "2725:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 443, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 510, + "src": "2744:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 442, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2744:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 445, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 510, + "src": "2760:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 444, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2760:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 447, + "name": "_bb", + "nodeType": "VariableDeclaration", + "scope": 510, + "src": "2777:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 446, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2777:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 449, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 510, + "src": "2794:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 448, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2794:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2719:87:1" + }, + "returnParameters": { + "id": 453, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 452, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 510, + "src": "2830:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 451, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2830:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2829:9:1" + }, + "scope": 1420, + "src": "2703:420:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 598, + "nodeType": "Block", + "src": "3541:403:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 539, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 535, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 531, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 527, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 525, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3551:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 526, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 512, + "src": "3556:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3551:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 530, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 528, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 512, + "src": "3562:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 529, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3568:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3562:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3551:20:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 534, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 532, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3575:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 533, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 514, + "src": "3580:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3575:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3551:31:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 538, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 536, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 514, + "src": "3586:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 537, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3592:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3586:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3551:44:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 543, + "nodeType": "IfStatement", + "src": "3547:77:1", + "trueBody": { + "id": 542, + "nodeType": "Block", + "src": "3597:27:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "hexValue": "66616c7365", + "id": 540, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3612:5:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + "functionReturnParameters": 524, + "id": 541, + "nodeType": "Return", + "src": "3605:12:1" + } + ] + } + }, + { + "assignments": [ + 545 + ], + "declarations": [ + { + "constant": false, + "id": 545, + "name": "lhs", + "nodeType": "VariableDeclaration", + "scope": 598, + "src": "3640:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 544, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3640:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 551, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 547, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 514, + "src": "3658:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 548, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 514, + "src": "3662:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 549, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3666:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 546, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "3651:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 550, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3651:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3640:30:1" + }, + { + "assignments": [ + 553 + ], + "declarations": [ + { + "constant": false, + "id": 553, + "name": "rhs", + "nodeType": "VariableDeclaration", + "scope": 598, + "src": "3687:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 552, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3687:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 563, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 556, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 512, + "src": "3712:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 557, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 512, + "src": "3716:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 558, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3720:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 555, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "3705:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 559, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3705:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 560, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 512, + "src": "3726:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 561, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3730:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 554, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "3698:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 562, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3698:36:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3687:47:1" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 566, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 564, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 516, + "src": "3744:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 565, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3751:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3744:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 580, + "nodeType": "IfStatement", + "src": "3740:92:1", + "trueBody": { + "id": 579, + "nodeType": "Block", + "src": "3754:78:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 577, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 567, + "name": "rhs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 553, + "src": "3781:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 569, + "name": "rhs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 553, + "src": "3794:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 571, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 512, + "src": "3806:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 572, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 516, + "src": "3810:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 573, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3815:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 570, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "3799:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 574, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3799:20:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 575, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3821:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 568, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "3787:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 576, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3787:38:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3781:44:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 578, + "nodeType": "ExpressionStatement", + "src": "3781:44:1" + } + ] + } + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 583, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 581, + "name": "_bb", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 518, + "src": "3841:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 582, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3848:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3841:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 593, + "nodeType": "IfStatement", + "src": "3837:79:1", + "trueBody": { + "id": 592, + "nodeType": "Block", + "src": "3851:65:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 590, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 584, + "name": "rhs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 553, + "src": "3882:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 586, + "name": "rhs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 553, + "src": "3895:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 587, + "name": "_bb", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 518, + "src": "3900:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 588, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 520, + "src": "3905:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 585, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "3888:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 589, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3888:21:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3882:27:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 591, + "nodeType": "ExpressionStatement", + "src": "3882:27:1" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 596, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 594, + "name": "lhs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 545, + "src": "3929:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 595, + "name": "rhs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 553, + "src": "3936:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3929:10:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 524, + "id": 597, + "nodeType": "Return", + "src": "3922:17:1" + } + ] + }, + "documentation": "@dev Check whether point (x,y) is on curve defined by a, b, and _pp.\n @param _x coordinate x of P1\n @param _y coordinate y of P1\n @param _aa constant of curve\n @param _bb constant of curve\n @param _pp the modulus\n @return true if x,y in the curve, false else", + "id": 599, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "isOnCurve", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 521, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 512, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 599, + "src": "3446:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 511, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3446:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 514, + "name": "_y", + "nodeType": "VariableDeclaration", + "scope": 599, + "src": "3459:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 513, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3459:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 516, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 599, + "src": "3472:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 515, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3472:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 518, + "name": "_bb", + "nodeType": "VariableDeclaration", + "scope": 599, + "src": "3486:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 517, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3486:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 520, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 599, + "src": "3500:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 519, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3500:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3440:69:1" + }, + "returnParameters": { + "id": 524, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 523, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 599, + "src": "3533:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 522, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3533:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3532:6:1" + }, + "scope": 1420, + "src": "3422:522:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 621, + "nodeType": "Block", + "src": "4231:40:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 612, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 601, + "src": "4245:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 618, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 615, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 613, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 605, + "src": "4250:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 614, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 603, + "src": "4256:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4250:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 616, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "4249:10:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "%", + "rightExpression": { + "argumentTypes": null, + "id": 617, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 605, + "src": "4262:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4249:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 619, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "4244:22:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 611, + "id": 620, + "nodeType": "Return", + "src": "4237:29:1" + } + ] + }, + "documentation": "@dev Calculate inverse (x, -y) of point (x, y).\n @param _x coordinate x of P1\n @param _y coordinate y of P1\n @param _pp the modulus\n @return (x, -y)", + "id": 622, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecInv", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 606, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 601, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 622, + "src": "4143:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 600, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4143:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 603, + "name": "_y", + "nodeType": "VariableDeclaration", + "scope": 622, + "src": "4159:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 602, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4159:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 605, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 622, + "src": "4175:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 604, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4175:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4137:50:1" + }, + "returnParameters": { + "id": 611, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 608, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 622, + "src": "4211:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 607, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4211:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 610, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 622, + "src": "4220:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 609, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4220:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4210:18:1" + }, + "scope": 1420, + "src": "4123:148:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 694, + "nodeType": "Block", + "src": "4773:418:1", + "statements": [ + { + "assignments": [ + 642 + ], + "declarations": [ + { + "constant": false, + "id": 642, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 694, + "src": "4779:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 641, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4779:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 644, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 643, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4788:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4779:10:1" + }, + { + "assignments": [ + 646 + ], + "declarations": [ + { + "constant": false, + "id": 646, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 694, + "src": "4795:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 645, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4795:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 648, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 647, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4804:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4795:10:1" + }, + { + "assignments": [ + 650 + ], + "declarations": [ + { + "constant": false, + "id": 650, + "name": "z", + "nodeType": "VariableDeclaration", + "scope": 694, + "src": "4811:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 649, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "4811:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 652, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 651, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4820:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4811:10:1" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 655, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 653, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 624, + "src": "4864:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 654, + "name": "_x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 628, + "src": "4869:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4864:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 685, + "nodeType": "Block", + "src": "4980:121:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 683, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 670, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 642, + "src": "4989:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 671, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 646, + "src": "4992:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 672, + "name": "z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 650, + "src": "4995:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 673, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "4988:9:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 675, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 624, + "src": "5016:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 676, + "name": "_y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 626, + "src": "5029:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "31", + "id": 677, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5042:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + { + "argumentTypes": null, + "id": 678, + "name": "_x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 628, + "src": "5053:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 679, + "name": "_y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 630, + "src": "5066:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "31", + "id": 680, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5079:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + { + "argumentTypes": null, + "id": 681, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 634, + "src": "5090:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 674, + "name": "jacAdd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1105, + "src": "5000:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" + } + }, + "id": 682, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5000:94:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "src": "4988:106:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 684, + "nodeType": "ExpressionStatement", + "src": "4988:106:1" + } + ] + }, + "id": 686, + "nodeType": "IfStatement", + "src": "4860:241:1", + "trueBody": { + "id": 669, + "nodeType": "Block", + "src": "4874:100:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 667, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 656, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 642, + "src": "4883:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 657, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 646, + "src": "4886:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 658, + "name": "z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 650, + "src": "4889:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 659, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "4882:9:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 661, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 624, + "src": "4913:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 662, + "name": "_y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 626, + "src": "4926:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "31", + "id": 663, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4939:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + { + "argumentTypes": null, + "id": 664, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 632, + "src": "4950:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 665, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 634, + "src": "4963:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 660, + "name": "jacDouble", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1277, + "src": "4894:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" + } + }, + "id": 666, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4894:73:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "src": "4882:85:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 668, + "nodeType": "ExpressionStatement", + "src": "4882:85:1" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 688, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 642, + "src": "5155:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 689, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 646, + "src": "5164:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 690, + "name": "z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 650, + "src": "5173:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 691, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 634, + "src": "5182:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 687, + "name": "toAffine", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 439, + "src": "5139:8:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 692, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5139:47:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 640, + "id": 693, + "nodeType": "Return", + "src": "5132:54:1" + } + ] + }, + "documentation": "@dev Add two points (x1, y1) and (x2, y2) in affine coordinates.\n @param _x1 coordinate x of P1\n @param _y1 coordinate y of P1\n @param _x2 coordinate x of P2\n @param _y2 coordinate y of P2\n @param _aa constant of the curve\n @param _pp the modulus\n @return (qx, qy) = P1+P2 in affine coordinates", + "id": 695, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecAdd", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 635, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 624, + "name": "_x1", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4631:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 623, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4631:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 626, + "name": "_y1", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4648:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 625, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4648:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 628, + "name": "_x2", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4665:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 627, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4665:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 630, + "name": "_y2", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4682:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 629, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4682:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 632, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4699:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 631, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4699:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 634, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4716:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 633, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4716:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4625:103:1" + }, + "returnParameters": { + "id": 640, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 637, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4753:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 636, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4753:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 639, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 695, + "src": "4762:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 638, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4762:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "4752:18:1" + }, + "scope": 1420, + "src": "4611:580:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 733, + "nodeType": "Block", + "src": "5697:175:1", + "statements": [ + { + "assignments": [ + 715, + 717 + ], + "declarations": [ + { + "constant": false, + "id": 715, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 733, + "src": "5725:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 714, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5725:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 717, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 733, + "src": "5736:9:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 716, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5736:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 723, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 719, + "name": "_x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 701, + "src": "5755:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 720, + "name": "_y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 703, + "src": "5760:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 721, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 707, + "src": "5765:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 718, + "name": "ecInv", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 622, + "src": "5749:5:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 722, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5749:20:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5724:45:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 725, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 697, + "src": "5812:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 726, + "name": "_y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 699, + "src": "5823:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 727, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 715, + "src": "5834:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 728, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 717, + "src": "5843:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 729, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 705, + "src": "5852:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 730, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 707, + "src": "5863:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 724, + "name": "ecAdd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 695, + "src": "5799:5:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 731, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5799:68:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 713, + "id": 732, + "nodeType": "Return", + "src": "5792:75:1" + } + ] + }, + "documentation": "@dev Substract two points (x1, y1) and (x2, y2) in affine coordinates.\n @param _x1 coordinate x of P1\n @param _y1 coordinate y of P1\n @param _x2 coordinate x of P2\n @param _y2 coordinate y of P2\n @param _aa constant of the curve\n @param _pp the modulus\n @return (qx, qy) = P1-P2 in affine coordinates", + "id": 734, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecSub", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 708, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 697, + "name": "_x1", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5557:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 696, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5557:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 699, + "name": "_y1", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5574:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 698, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5574:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 701, + "name": "_x2", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5591:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 700, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5591:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 703, + "name": "_y2", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5608:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 702, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5608:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 705, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5625:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 704, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5625:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 707, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5642:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 706, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5642:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "5551:103:1" + }, + "returnParameters": { + "id": 713, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 710, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5677:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 709, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5677:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 712, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 734, + "src": "5686:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 711, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5686:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "5676:18:1" + }, + "scope": 1420, + "src": "5537:335:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 773, + "nodeType": "Block", + "src": "6310:238:1", + "statements": [ + { + "assignments": [ + 752, + 754, + 756 + ], + "declarations": [ + { + "constant": false, + "id": 752, + "name": "x1", + "nodeType": "VariableDeclaration", + "scope": 773, + "src": "6348:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 751, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6348:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 754, + "name": "y1", + "nodeType": "VariableDeclaration", + "scope": 773, + "src": "6360:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 753, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6360:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 756, + "name": "z1", + "nodeType": "VariableDeclaration", + "scope": 773, + "src": "6372:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 755, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6372:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 765, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 758, + "name": "_k", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 736, + "src": "6400:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 759, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 738, + "src": "6410:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 760, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 740, + "src": "6420:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "31", + "id": 761, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6430:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + { + "argumentTypes": null, + "id": 762, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 742, + "src": "6439:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 763, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 744, + "src": "6450:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 757, + "name": "jacMul", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1419, + "src": "6386:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" + } + }, + "id": 764, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6386:68:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6347:107:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 767, + "name": "x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 752, + "src": "6509:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 768, + "name": "y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 754, + "src": "6519:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 769, + "name": "z1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 756, + "src": "6529:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 770, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 744, + "src": "6539:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 766, + "name": "toAffine", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 439, + "src": "6493:8:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 771, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6493:50:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 750, + "id": 772, + "nodeType": "Return", + "src": "6486:57:1" + } + ] + }, + "documentation": "@dev Multiply point (x1, y1, z1) times d in affine coordinates.\n @param _k scalar to multiply\n @param _x coordinate x of P1\n @param _y coordinate y of P1\n @param _aa constant of the curve\n @param _pp the modulus\n @return (qx, qy) = d*P in affine coordinates", + "id": 774, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecMul", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 745, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 736, + "name": "_k", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6190:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 735, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6190:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 738, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6206:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 737, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6206:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 740, + "name": "_y", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6222:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 739, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6222:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 742, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6238:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 741, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6238:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 744, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6255:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 743, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6255:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "6184:83:1" + }, + "returnParameters": { + "id": 750, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 747, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6290:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 746, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6290:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 749, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 774, + "src": "6299:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 748, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6299:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "6289:18:1" + }, + "scope": 1420, + "src": "6170:378:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1104, + "nodeType": "Block", + "src": "7105:1450:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 805, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 799, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 797, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 776, + "src": "7116:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 798, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7121:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7116:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 800, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7115:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 803, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 801, + "name": "_y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 778, + "src": "7126:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 802, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7131:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7126:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 804, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7125:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "7115:18:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 811, + "nodeType": "IfStatement", + "src": "7111:52:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 806, + "name": "_x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 782, + "src": "7149:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 807, + "name": "_y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 784, + "src": "7154:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 808, + "name": "_z2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 786, + "src": "7159:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 809, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7148:15:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 796, + "id": 810, + "nodeType": "Return", + "src": "7141:22:1" + } + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 820, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 814, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 812, + "name": "_x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 782, + "src": "7174:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 813, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7179:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7174:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 815, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7173:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "&&", + "rightExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 818, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 816, + "name": "_y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 784, + "src": "7184:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 817, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7189:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7184:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "id": 819, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7183:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "7173:18:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 826, + "nodeType": "IfStatement", + "src": "7169:52:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 821, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 776, + "src": "7207:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 822, + "name": "_y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 778, + "src": "7212:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 823, + "name": "_z1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 780, + "src": "7217:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 824, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7206:15:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 796, + "id": 825, + "nodeType": "Return", + "src": "7199:22:1" + } + }, + { + "assignments": [ + 831 + ], + "declarations": [ + { + "constant": false, + "id": 831, + "name": "zs", + "nodeType": "VariableDeclaration", + "scope": 1104, + "src": "7361:17:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4]" + }, + "typeName": { + "baseType": { + "id": 829, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "7361:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 830, + "length": { + "argumentTypes": null, + "hexValue": "34", + "id": 828, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7366:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "nodeType": "ArrayTypeName", + "src": "7361:7:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_storage_ptr", + "typeString": "uint256[4]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 832, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "7361:17:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 841, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 833, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7410:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 835, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 834, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7413:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "7410:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 837, + "name": "_z1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 780, + "src": "7425:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 838, + "name": "_z1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 780, + "src": "7430:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 839, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7435:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 836, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7418:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 840, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7418:21:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7410:29:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 842, + "nodeType": "ExpressionStatement", + "src": "7410:29:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 853, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 843, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7445:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 845, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 844, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7448:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "7445:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 847, + "name": "_z1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 780, + "src": "7460:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 848, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7465:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 850, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 849, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7468:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7465:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 851, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7472:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 846, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7453:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 852, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7453:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7445:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 854, + "nodeType": "ExpressionStatement", + "src": "7445:31:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 863, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 855, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7482:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 857, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 856, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7485:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "7482:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 859, + "name": "_z2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 786, + "src": "7497:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 860, + "name": "_z2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 786, + "src": "7502:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 861, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7507:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 858, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7490:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 862, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7490:21:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7482:29:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 864, + "nodeType": "ExpressionStatement", + "src": "7482:29:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 875, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 865, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7517:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 867, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 866, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7520:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "7517:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 869, + "name": "_z2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 786, + "src": "7532:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 870, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7537:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 872, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 871, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7540:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7537:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 873, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7544:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 868, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7525:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 874, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7525:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7517:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 876, + "nodeType": "ExpressionStatement", + "src": "7517:31:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 907, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 877, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7577:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 879, + "name": "_x1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 776, + "src": "7597:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 880, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7602:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 882, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 881, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7605:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7602:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 883, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7609:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 878, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7590:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 884, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7590:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 886, + "name": "_y1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 778, + "src": "7628:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 887, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7633:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 889, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 888, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7636:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7633:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 890, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7640:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 885, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7621:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 891, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7621:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 893, + "name": "_x2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 782, + "src": "7659:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 894, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7664:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 896, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 895, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7667:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7664:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 897, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7671:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 892, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7652:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 898, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7652:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 900, + "name": "_y2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 784, + "src": "7690:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 901, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7695:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 903, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 902, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7698:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7695:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 904, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7702:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 899, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "7683:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 905, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7683:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 906, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "7582:130:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "src": "7577:135:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 908, + "nodeType": "ExpressionStatement", + "src": "7577:135:1" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 915, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 909, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7722:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 911, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 910, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7725:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7722:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 912, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7731:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 914, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 913, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7734:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7731:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7722:14:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 934, + "nodeType": "IfStatement", + "src": "7718:142:1", + "trueBody": { + "id": 933, + "nodeType": "Block", + "src": "7738:122:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 922, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 916, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7750:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 918, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 917, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7753:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7750:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 919, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7759:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 921, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 920, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7762:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7759:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7750:14:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 931, + "nodeType": "Block", + "src": "7807:47:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "55736520646f75626c6520696e7374656164", + "id": 928, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7824:20:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_e0a6c64d348a23aeba616ddff38efdbd5aec45b62c77a67c931b225a930b4902", + "typeString": "literal_string \"Use double instead\"" + }, + "value": "Use double instead" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_e0a6c64d348a23aeba616ddff38efdbd5aec45b62c77a67c931b225a930b4902", + "typeString": "literal_string \"Use double instead\"" + } + ], + "id": 927, + "name": "revert", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2494, + 2495 + ], + "referencedDeclaration": 2495, + "src": "7817:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$", + "typeString": "function (string memory) pure" + } + }, + "id": 929, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7817:28:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 930, + "nodeType": "ExpressionStatement", + "src": "7817:28:1" + } + ] + }, + "id": 932, + "nodeType": "IfStatement", + "src": "7746:108:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "57726f6e672064617461", + "id": 924, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7781:12:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_f5a600dd1007616677a3ee01eace6347fe379b820234173b19084f52d0cc85af", + "typeString": "literal_string \"Wrong data\"" + }, + "value": "Wrong data" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_f5a600dd1007616677a3ee01eace6347fe379b820234173b19084f52d0cc85af", + "typeString": "literal_string \"Wrong data\"" + } + ], + "id": 923, + "name": "revert", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2494, + 2495 + ], + "referencedDeclaration": 2495, + "src": "7774:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_revert_pure$_t_string_memory_ptr_$returns$__$", + "typeString": "function (string memory) pure" + } + }, + "id": 925, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7774:20:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 926, + "nodeType": "ExpressionStatement", + "src": "7774:20:1" + } + } + ] + } + }, + { + "assignments": [ + 939 + ], + "declarations": [ + { + "constant": false, + "id": 939, + "name": "hr", + "nodeType": "VariableDeclaration", + "scope": 1104, + "src": "7865:17:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4]" + }, + "typeName": { + "baseType": { + "id": 937, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "7865:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 938, + "length": { + "argumentTypes": null, + "hexValue": "34", + "id": 936, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7870:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + "nodeType": "ArrayTypeName", + "src": "7865:7:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_storage_ptr", + "typeString": "uint256[4]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 940, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "7865:17:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 955, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 941, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "7896:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 943, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 942, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7899:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "7896:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 945, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7911:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 947, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 946, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7914:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7911:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 952, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 948, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7918:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 949, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7924:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 951, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 950, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7927:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7924:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7918:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 953, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7931:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 944, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "7904:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 954, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7904:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7896:39:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 956, + "nodeType": "ExpressionStatement", + "src": "7896:39:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 971, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 957, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "7949:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 959, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 958, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7952:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "7949:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 961, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7964:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 963, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 962, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7967:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7964:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 968, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 964, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7971:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 965, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "7977:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 967, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 966, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7980:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "7977:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7971:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 969, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "7984:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 960, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "7957:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 970, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7957:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "7949:39:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 972, + "nodeType": "ExpressionStatement", + "src": "7949:39:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 985, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 973, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8004:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 975, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 974, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8007:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "8004:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 977, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8019:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 979, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 978, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8022:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8019:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 980, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8026:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 982, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 981, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8029:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8026:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 983, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8033:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 976, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8012:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 984, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8012:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8004:33:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 986, + "nodeType": "ExpressionStatement", + "src": "8004:33:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 999, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 987, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8054:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 989, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 988, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8057:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "8054:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 991, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8069:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 993, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 992, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8072:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8069:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 994, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8076:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 996, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 995, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8079:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8076:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 997, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8083:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 990, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8062:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 998, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8062:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8054:33:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1000, + "nodeType": "ExpressionStatement", + "src": "8054:33:1" + }, + { + "assignments": [ + 1002 + ], + "declarations": [ + { + "constant": false, + "id": 1002, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 1104, + "src": "8123:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1001, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8123:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1020, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1005, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8150:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1007, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1006, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8153:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8150:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1008, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8157:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1010, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1009, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8160:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8157:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1011, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8164:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1004, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8143:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1012, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8143:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1017, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1013, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8170:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1014, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8176:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1016, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 1015, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8179:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8176:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8170:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1018, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8183:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1003, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "8136:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1019, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8136:51:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8123:64:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1041, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1021, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1002, + "src": "8193:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1023, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1002, + "src": "8205:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1024, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8209:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "32", + "id": 1026, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8222:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1028, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "8232:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1030, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1029, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8235:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8232:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1031, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8239:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1033, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1032, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8242:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8239:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1034, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8246:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1027, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8225:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1035, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8225:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1036, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8252:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1025, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8215:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1037, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8215:41:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8209:47:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1039, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8258:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1022, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "8198:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1040, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8198:64:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8193:69:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1042, + "nodeType": "ExpressionStatement", + "src": "8193:69:1" + }, + { + "assignments": [ + 1044 + ], + "declarations": [ + { + "constant": false, + "id": 1044, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 1104, + "src": "8306:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1043, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8306:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1066, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1046, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8326:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1048, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1047, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8329:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8326:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1051, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "8347:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1053, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1052, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8350:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8347:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1054, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8354:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1056, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1055, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8357:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8354:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1057, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8361:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1050, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8340:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1058, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8340:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1061, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1059, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8367:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 1060, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1002, + "src": "8373:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8367:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1062, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8377:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1049, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "8333:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1063, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8333:48:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1064, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8383:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1045, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8319:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1065, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8319:68:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8306:81:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1083, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1067, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1044, + "src": "8393:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1069, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1044, + "src": "8405:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1080, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1070, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8409:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1072, + "name": "zs", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 831, + "src": "8422:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1074, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1073, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8425:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8422:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1075, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8429:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1077, + "indexExpression": { + "argumentTypes": null, + "hexValue": "33", + "id": 1076, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8432:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8429:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1078, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8436:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1071, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8415:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1079, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8415:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8409:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1081, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8442:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1068, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "8398:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1082, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8398:48:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8393:53:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1084, + "nodeType": "ExpressionStatement", + "src": "8393:53:1" + }, + { + "assignments": [ + 1086 + ], + "declarations": [ + { + "constant": false, + "id": 1086, + "name": "qz", + "nodeType": "VariableDeclaration", + "scope": 1104, + "src": "8472:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1085, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8472:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1098, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1088, + "name": "hr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 939, + "src": "8492:2:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$4_memory_ptr", + "typeString": "uint256[4] memory" + } + }, + "id": 1090, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1089, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8495:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "8492:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1092, + "name": "_z1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 780, + "src": "8506:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1093, + "name": "_z2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 786, + "src": "8511:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1094, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8516:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1091, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8499:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1095, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8499:21:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1096, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 788, + "src": "8522:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1087, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "8485:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1097, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8485:41:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8472:54:1" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1099, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1002, + "src": "8539:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1100, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1044, + "src": "8543:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1101, + "name": "qz", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1086, + "src": "8547:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1102, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "8538:12:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 796, + "id": 1103, + "nodeType": "Return", + "src": "8532:18:1" + } + ] + }, + "documentation": "@dev Adds two points (x1, y1, z1) and (x2 y2, z2).\n @param _x1 coordinate x of P1\n @param _y1 coordinate y of P1\n @param _z1 coordinate z of P1\n @param _x2 coordinate x of square\n @param _y2 coordinate y of square\n @param _z2 coordinate z of square\n @param _pp the modulus\n @return (qx, qy, qz) P1+square in Jacobian", + "id": 1105, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "jacAdd", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 789, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 776, + "name": "_x1", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "6936:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 775, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6936:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 778, + "name": "_y1", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "6953:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 777, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6953:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 780, + "name": "_z1", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "6970:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 779, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6970:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 782, + "name": "_x2", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "6987:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 781, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6987:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 784, + "name": "_y2", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "7004:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 783, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7004:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 786, + "name": "_z2", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "7021:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 785, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7021:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 788, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "7038:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 787, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7038:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "6930:120:1" + }, + "returnParameters": { + "id": 796, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 791, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "7076:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 790, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7076:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 793, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "7085:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 792, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7085:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 795, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1105, + "src": "7094:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 794, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7094:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "7075:27:1" + }, + "scope": 1420, + "src": "6915:1640:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 1276, + "nodeType": "Block", + "src": "8982:956:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1126, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1124, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1111, + "src": "8992:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1125, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8998:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "8992:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 1132, + "nodeType": "IfStatement", + "src": "8988:38:1", + "trueBody": { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1127, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1107, + "src": "9015:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1128, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1109, + "src": "9019:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1129, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1111, + "src": "9023:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1130, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "9014:12:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 1123, + "id": 1131, + "nodeType": "Return", + "src": "9007:19:1" + } + }, + { + "assignments": [ + 1137 + ], + "declarations": [ + { + "constant": false, + "id": 1137, + "name": "square", + "nodeType": "VariableDeclaration", + "scope": 1276, + "src": "9032:24:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3]" + }, + "typeName": { + "baseType": { + "id": 1135, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9032:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1136, + "length": { + "argumentTypes": null, + "hexValue": "33", + "id": 1134, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9040:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "nodeType": "ArrayTypeName", + "src": "9032:10:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_storage_ptr", + "typeString": "uint256[3]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1138, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "9032:24:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1147, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1139, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9283:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1141, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1140, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9290:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "9283:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1143, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1107, + "src": "9302:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1144, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1107, + "src": "9306:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1145, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9310:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1142, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9295:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1146, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9295:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9283:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1148, + "nodeType": "ExpressionStatement", + "src": "9283:31:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1157, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1149, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9327:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1151, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1150, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9334:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "9327:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1153, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1109, + "src": "9346:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1154, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1109, + "src": "9350:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1155, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9354:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1152, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9339:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1156, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9339:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9327:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1158, + "nodeType": "ExpressionStatement", + "src": "9327:31:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1167, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1159, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9371:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1161, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1160, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9378:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "9371:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1163, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1111, + "src": "9390:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1164, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1111, + "src": "9394:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1165, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9398:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1162, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9383:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1166, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9383:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9371:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1168, + "nodeType": "ExpressionStatement", + "src": "9371:31:1" + }, + { + "assignments": [ + 1170 + ], + "declarations": [ + { + "constant": false, + "id": 1170, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 1276, + "src": "9425:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1169, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "9425:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1182, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "34", + "id": 1172, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9441:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + "value": "4" + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1174, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1107, + "src": "9451:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1175, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9455:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1177, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1176, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9462:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "9455:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1178, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9466:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1173, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9444:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1179, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9444:26:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1180, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9472:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_4_by_1", + "typeString": "int_const 4" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1171, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9434:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1181, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9434:42:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9425:51:1" + }, + { + "assignments": [ + 1184 + ], + "declarations": [ + { + "constant": false, + "id": 1184, + "name": "m", + "nodeType": "VariableDeclaration", + "scope": 1276, + "src": "9491:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1183, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "9491:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1208, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "33", + "id": 1187, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9514:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1188, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9517:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1190, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1189, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9524:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "9517:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1191, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9528:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1186, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9507:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1192, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9507:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1194, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1113, + "src": "9541:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1196, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9553:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1198, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1197, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9560:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "9553:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1199, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9564:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1201, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1200, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9571:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "9564:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1202, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9575:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1195, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9546:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1203, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9546:33:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1204, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9581:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1193, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9534:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1205, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9534:51:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1206, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9587:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1185, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "9500:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1207, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9500:91:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9491:100:1" + }, + { + "assignments": [ + 1210 + ], + "declarations": [ + { + "constant": false, + "id": 1210, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 1276, + "src": "9607:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1209, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9607:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1226, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1213, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1184, + "src": "9634:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1214, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1184, + "src": "9637:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1215, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9640:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1212, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9627:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1216, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9627:17:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1223, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1217, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9646:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1219, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1170, + "src": "9659:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1220, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1170, + "src": "9662:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1221, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9665:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1218, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "9652:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1222, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9652:17:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9646:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1224, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9671:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1211, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "9620:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1225, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9620:55:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9607:68:1" + }, + { + "assignments": [ + 1228 + ], + "declarations": [ + { + "constant": false, + "id": 1228, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 1276, + "src": "9710:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1227, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9710:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1258, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1231, + "name": "m", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1184, + "src": "9737:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1233, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1170, + "src": "9747:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1236, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1234, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9750:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 1235, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1210, + "src": "9756:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9750:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1237, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9760:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1232, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "9740:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1238, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9740:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1239, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9766:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1230, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9730:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1240, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9730:40:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1255, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1241, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9772:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "38", + "id": 1243, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9785:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + "value": "8" + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1245, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9795:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1247, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1246, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9802:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "9795:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1248, + "name": "square", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1137, + "src": "9806:6:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1250, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1249, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9813:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "9806:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1251, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9817:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1244, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9788:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9788:33:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1253, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9823:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_8_by_1", + "typeString": "int_const 8" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1242, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9778:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1254, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9778:49:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "9772:55:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1256, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9829:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1229, + "name": "addmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2477, + "src": "9723:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_addmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1257, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9723:110:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9710:123:1" + }, + { + "assignments": [ + 1260 + ], + "declarations": [ + { + "constant": false, + "id": 1260, + "name": "qz", + "nodeType": "VariableDeclaration", + "scope": 1276, + "src": "9859:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1259, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "9859:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1270, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "32", + "id": 1262, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9879:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1264, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1109, + "src": "9889:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1265, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1111, + "src": "9893:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1266, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9897:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1263, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9882:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1267, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9882:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1268, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1115, + "src": "9903:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1261, + "name": "mulmod", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "9872:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_mulmod_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 1269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9872:35:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9859:48:1" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1271, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1210, + "src": "9922:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1272, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1228, + "src": "9926:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1273, + "name": "qz", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1260, + "src": "9930:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1274, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "9921:12:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 1123, + "id": 1275, + "nodeType": "Return", + "src": "9914:19:1" + } + ] + }, + "documentation": "@dev Doubles a points (x, y, z).\n @param _x coordinate x of P1\n @param _y coordinate y of P1\n @param _z coordinate z of P1\n @param _pp the modulus\n @param _aa the a scalar in the curve equation\n @return (qx, qy, qz) 2P in Jacobian", + "id": 1277, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "jacDouble", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1116, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1107, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8850:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1106, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8850:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1109, + "name": "_y", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8866:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1108, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8866:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1111, + "name": "_z", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8882:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1110, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8882:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1113, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8898:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1112, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8898:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1115, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8915:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1114, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8915:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "8844:83:1" + }, + "returnParameters": { + "id": 1123, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1118, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8953:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1117, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8953:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1120, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8962:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1119, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8962:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1122, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1277, + "src": "8971:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1121, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8971:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "8952:27:1" + }, + "scope": 1420, + "src": "8826:1112:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 1418, + "nodeType": "Block", + "src": "10404:679:1", + "statements": [ + { + "assignments": [ + 1299 + ], + "declarations": [ + { + "constant": false, + "id": 1299, + "name": "remaining", + "nodeType": "VariableDeclaration", + "scope": 1418, + "src": "10410:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1298, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10410:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1301, + "initialValue": { + "argumentTypes": null, + "id": 1300, + "name": "_d", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1279, + "src": "10430:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "10410:22:1" + }, + { + "assignments": [ + 1306 + ], + "declarations": [ + { + "constant": false, + "id": 1306, + "name": "point", + "nodeType": "VariableDeclaration", + "scope": 1418, + "src": "10438:23:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3]" + }, + "typeName": { + "baseType": { + "id": 1304, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10438:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1305, + "length": { + "argumentTypes": null, + "hexValue": "33", + "id": 1303, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10446:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_3_by_1", + "typeString": "int_const 3" + }, + "value": "3" + }, + "nodeType": "ArrayTypeName", + "src": "10438:10:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_storage_ptr", + "typeString": "uint256[3]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1307, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "10438:23:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1312, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1308, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10467:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1310, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1309, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10473:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "10467:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1311, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1281, + "src": "10478:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10467:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1313, + "nodeType": "ExpressionStatement", + "src": "10467:13:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1318, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1314, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10486:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1316, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1315, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10492:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "10486:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1317, + "name": "_y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1283, + "src": "10497:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10486:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1319, + "nodeType": "ExpressionStatement", + "src": "10486:13:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1324, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1320, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10505:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1322, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1321, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10511:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "10505:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1323, + "name": "_z", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1285, + "src": "10516:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10505:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1325, + "nodeType": "ExpressionStatement", + "src": "10505:13:1" + }, + { + "assignments": [ + 1327 + ], + "declarations": [ + { + "constant": false, + "id": 1327, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 1418, + "src": "10524:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1326, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10524:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1329, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 1328, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10537:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "10524:14:1" + }, + { + "assignments": [ + 1331 + ], + "declarations": [ + { + "constant": false, + "id": 1331, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 1418, + "src": "10544:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1330, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10544:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1333, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 1332, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10557:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "10544:14:1" + }, + { + "assignments": [ + 1335 + ], + "declarations": [ + { + "constant": false, + "id": 1335, + "name": "qz", + "nodeType": "VariableDeclaration", + "scope": 1418, + "src": "10564:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1334, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10564:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1337, + "initialValue": { + "argumentTypes": null, + "hexValue": "31", + "id": 1336, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10577:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "nodeType": "VariableDeclarationStatement", + "src": "10564:14:1" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1340, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1338, + "name": "_d", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1279, + "src": "10589:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1339, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10595:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "10589:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 1347, + "nodeType": "IfStatement", + "src": "10585:47:1", + "trueBody": { + "id": 1346, + "nodeType": "Block", + "src": "10598:34:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1341, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1327, + "src": "10614:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1342, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1331, + "src": "10618:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1343, + "name": "qz", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1335, + "src": "10622:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1344, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10613:12:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 1297, + "id": 1345, + "nodeType": "Return", + "src": "10606:19:1" + } + ] + } + }, + { + "body": { + "id": 1411, + "nodeType": "Block", + "src": "10692:362:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1356, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1353, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1351, + "name": "remaining", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1299, + "src": "10705:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "&", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1352, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10717:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "10705:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1354, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "10704:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1355, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10723:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "10704:20:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 1379, + "nodeType": "IfStatement", + "src": "10700:184:1", + "trueBody": { + "id": 1378, + "nodeType": "Block", + "src": "10726:158:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1376, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1357, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1327, + "src": "10737:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1358, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1331, + "src": "10741:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1359, + "name": "qz", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1335, + "src": "10745:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1360, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "10736:12:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1362, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1327, + "src": "10769:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1363, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1331, + "src": "10783:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1364, + "name": "qz", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1335, + "src": "10797:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1365, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10811:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1367, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1366, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10817:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "10811:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1368, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10831:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1370, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1369, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10837:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "10831:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1371, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10851:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1373, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1372, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10857:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "10851:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1374, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1289, + "src": "10871:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1361, + "name": "jacAdd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1105, + "src": "10751:6:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" + } + }, + "id": 1375, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "10751:124:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "src": "10736:139:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1377, + "nodeType": "ExpressionStatement", + "src": "10736:139:1" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "id": 1384, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1380, + "name": "remaining", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1299, + "src": "10891:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1383, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1381, + "name": "remaining", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1299, + "src": "10903:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1382, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10915:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "10903:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "10891:25:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1385, + "nodeType": "ExpressionStatement", + "src": "10891:25:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 1409, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1386, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10925:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1388, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1387, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10931:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "10925:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1389, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10935:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1391, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1390, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10941:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "10935:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1392, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10945:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1394, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1393, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10951:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "10945:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1395, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "10924:30:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1397, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10976:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1399, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1398, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10982:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "10976:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1400, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "10994:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1402, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1401, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11000:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "10994:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1403, + "name": "point", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1306, + "src": "11012:5:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$3_memory_ptr", + "typeString": "uint256[3] memory" + } + }, + "id": 1405, + "indexExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1404, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "11018:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "11012:8:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1406, + "name": "_aa", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1287, + "src": "11030:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1407, + "name": "_pp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1289, + "src": "11043:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1396, + "name": "jacDouble", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1277, + "src": "10957:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256,uint256)" + } + }, + "id": 1408, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "10957:90:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "src": "10924:123:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1410, + "nodeType": "ExpressionStatement", + "src": "10924:123:1" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1350, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1348, + "name": "remaining", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1299, + "src": "10676:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1349, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "10689:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "10676:14:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1412, + "nodeType": "WhileStatement", + "src": "10669:385:1" + }, + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1413, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1327, + "src": "11067:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1414, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1331, + "src": "11071:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1415, + "name": "qz", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1335, + "src": "11075:2:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1416, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "11066:12:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "functionReturnParameters": 1297, + "id": 1417, + "nodeType": "Return", + "src": "11059:19:1" + } + ] + }, + "documentation": "@dev Multiply point (x, y, z) times d.\n @param _d scalar to multiply\n @param _x coordinate x of P1\n @param _y coordinate y of P1\n @param _z coordinate z of P1\n @param _aa constant of curve\n @param _pp the modulus\n @return (qx, qy, qz) d*P1 in Jacobian", + "id": 1419, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "jacMul", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1290, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1279, + "name": "_d", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10256:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1278, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10256:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1281, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10272:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1280, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10272:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1283, + "name": "_y", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10288:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1282, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10288:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1285, + "name": "_z", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10304:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1284, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10304:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1287, + "name": "_aa", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10320:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1286, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10320:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1289, + "name": "_pp", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10337:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1288, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10337:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "10250:99:1" + }, + "returnParameters": { + "id": 1297, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1292, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10375:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1291, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10375:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1294, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10384:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1293, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10384:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1296, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1419, + "src": "10393:7:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1295, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "10393:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "10374:27:1" + }, + "scope": 1420, + "src": "10235:848:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + } + ], + "scope": 1421, + "src": "174:10911:1" + } + ], + "src": "0:11085:1" + }, + "compiler": { + "name": "solc", + "version": "0.5.8+commit.23d335f2.Emscripten.clang" + }, + "networks": { + "1570892867630": { + "events": {}, + "links": {}, + "address": "0xD01a908CDE0705c9179d7ac082bAa3586b89fd49", + "transactionHash": "0xfa6c5a30f21fe5ec17234c27be3249e7cb0c68e6ac0bda078ca66bb3c0796052" + }, + "1570921815108": { + "events": {}, + "links": {}, + "address": "0xCcdfF65247C25d0A4bf66997C35D152d9AE3D627", + "transactionHash": "0xff00560ca55de04ee001013509330517b4688c3085f63dc914038bd25c12dd1a" + }, + "1570922470877": { + "events": {}, + "links": {}, + "address": "0x35D64225aA2F133334c9333767D97559191eeE88", + "transactionHash": "0x7ad1034af0b8febdce55f4c46b97b560d5db46c68dedef7289c67eceb47f4cf8" + }, + "1570923244533": { + "events": {}, + "links": {}, + "address": "0xBea5FbacCA1b17a966616eA3696e8E005aDB319A", + "transactionHash": "0x93094efc50102b995aaf4c47d748faf842e2d5a78040d30ebe79b931fcded026" + } + }, + "schemaVersion": "3.0.16", + "updatedAt": "2019-10-12T23:34:13.076Z", + "devdoc": { + "author": "Witnet Foundation", + "details": "Library providing arithmetic operations over elliptic curves.", + "methods": { + "deriveY(uint8,uint256,uint256,uint256,uint256)": { + "details": "Derives the y coordinate from a compressed-format point x.", + "params": { + "_aa": "constant of curve", + "_bb": "constant of curve", + "_pp": "the modulus", + "_prefix": "parity byte (0x02 even, 0x03 odd)", + "_x": "coordinate x" + }, + "return": "y coordinate y" + }, + "ecAdd(uint256,uint256,uint256,uint256,uint256,uint256)": { + "details": "Add two points (x1, y1) and (x2, y2) in affine coordinates.", + "params": { + "_aa": "constant of the curve", + "_pp": "the modulus", + "_x1": "coordinate x of P1", + "_x2": "coordinate x of P2", + "_y1": "coordinate y of P1", + "_y2": "coordinate y of P2" + }, + "return": "(qx, qy) = P1+P2 in affine coordinates" + }, + "ecInv(uint256,uint256,uint256)": { + "details": "Calculate inverse (x, -y) of point (x, y).", + "params": { + "_pp": "the modulus", + "_x": "coordinate x of P1", + "_y": "coordinate y of P1" + }, + "return": "(x, -y)" + }, + "ecMul(uint256,uint256,uint256,uint256,uint256)": { + "details": "Multiply point (x1, y1, z1) times d in affine coordinates.", + "params": { + "_aa": "constant of the curve", + "_k": "scalar to multiply", + "_pp": "the modulus", + "_x": "coordinate x of P1", + "_y": "coordinate y of P1" + }, + "return": "(qx, qy) = d*P in affine coordinates" + }, + "ecSub(uint256,uint256,uint256,uint256,uint256,uint256)": { + "details": "Substract two points (x1, y1) and (x2, y2) in affine coordinates.", + "params": { + "_aa": "constant of the curve", + "_pp": "the modulus", + "_x1": "coordinate x of P1", + "_x2": "coordinate x of P2", + "_y1": "coordinate y of P1", + "_y2": "coordinate y of P2" + }, + "return": "(qx, qy) = P1-P2 in affine coordinates" + }, + "expMod(uint256,uint256,uint256)": { + "details": "Modular exponentiation, b^e % _pp. Source: https://github.com/androlo/standard-contracts/blob/master/contracts/src/crypto/ECCMath.sol", + "params": { + "_base": "base", + "_exp": "exponent", + "_pp": "modulus" + }, + "return": "r such that r = b**e (mod _pp)" + }, + "invMod(uint256,uint256)": { + "details": "Modular euclidean inverse of a number (mod p).", + "params": { + "_pp": "The modulus", + "_x": "The number" + }, + "return": "q such that x*q = 1 (mod _pp)" + }, + "isOnCurve(uint256,uint256,uint256,uint256,uint256)": { + "details": "Check whether point (x,y) is on curve defined by a, b, and _pp.", + "params": { + "_aa": "constant of curve", + "_bb": "constant of curve", + "_pp": "the modulus", + "_x": "coordinate x of P1", + "_y": "coordinate y of P1" + }, + "return": "true if x,y in the curve, false else" + }, + "toAffine(uint256,uint256,uint256,uint256)": { + "details": "Converts a point (x, y, z) expressed in Jacobian coordinates to affine coordinates (x', y', 1).", + "params": { + "_pp": "the modulus", + "_x": "coordinate x", + "_y": "coordinate y", + "_z": "coordinate z" + }, + "return": "(x', y') affine coordinates" + } + }, + "title": "Elliptic Curve Library" + }, + "userdoc": { + "methods": {} + } +} \ No newline at end of file diff --git a/build/contracts/LSAG.json b/build/contracts/LSAG.json new file mode 100644 index 0000000..c12210c --- /dev/null +++ b/build/contracts/LSAG.json @@ -0,0 +1,12641 @@ +{ + "contractName": "LSAG", + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "_x", + "type": "uint256" + } + ], + "name": "intToPoint", + "outputs": [ + { + "name": "", + "type": "uint256[2]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "b", + "type": "bytes" + } + ], + "name": "H1", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "b", + "type": "bytes" + } + ], + "name": "H2", + "outputs": [ + { + "name": "", + "type": "uint256[2]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "pubKey", + "type": "uint256[2]" + }, + { + "name": "c", + "type": "uint256" + }, + { + "name": "s", + "type": "uint256" + } + ], + "name": "ringCalcZ1", + "outputs": [ + { + "name": "", + "type": "uint256[2]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "keyImage", + "type": "uint256[2]" + }, + { + "name": "h", + "type": "uint256[2]" + }, + { + "name": "s", + "type": "uint256" + }, + { + "name": "c", + "type": "uint256" + } + ], + "name": "ringCalcZ2", + "outputs": [ + { + "name": "", + "type": "uint256[2]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "message", + "type": "bytes" + }, + { + "name": "c0", + "type": "uint256" + }, + { + "name": "keyImage", + "type": "uint256[2]" + }, + { + "name": "s", + "type": "uint256[]" + }, + { + "name": "publicKeys", + "type": "uint256[2][]" + } + ], + "name": "verify", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"name\":\"pubKey\",\"type\":\"uint256[2]\"},{\"name\":\"c\",\"type\":\"uint256\"},{\"name\":\"s\",\"type\":\"uint256\"}],\"name\":\"ringCalcZ1\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256[2]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"keyImage\",\"type\":\"uint256[2]\"},{\"name\":\"h\",\"type\":\"uint256[2]\"},{\"name\":\"s\",\"type\":\"uint256\"},{\"name\":\"c\",\"type\":\"uint256\"}],\"name\":\"ringCalcZ2\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256[2]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"b\",\"type\":\"bytes\"}],\"name\":\"H2\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256[2]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"b\",\"type\":\"bytes\"}],\"name\":\"H1\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_x\",\"type\":\"uint256\"}],\"name\":\"intToPoint\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256[2]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"message\",\"type\":\"bytes\"},{\"name\":\"c0\",\"type\":\"uint256\"},{\"name\":\"keyImage\",\"type\":\"uint256[2]\"},{\"name\":\"s\",\"type\":\"uint256[]\"},{\"name\":\"publicKeys\",\"type\":\"uint256[2][]\"}],\"name\":\"verify\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{\"H1(bytes)\":{\"notice\":\"Returns an integer representation of the hash of the input\"},\"H2(bytes)\":{\"notice\":\"Returns elliptic curve point of the integer representation of the hash of the input\"},\"intToPoint(uint256)\":{\"notice\":\"Converts an integer to an elliptic curve point\"},\"ringCalcZ1(uint256[2],uint256,uint256)\":{\"notice\":\"Helper function to calculate Z1 Avoids stack too deep problem\"},\"ringCalcZ2(uint256[2],uint256[2],uint256,uint256)\":{\"notice\":\"Helper function to calculate Z2 Avoids stack too deep problem\"},\"verify(bytes,uint256,uint256[2],uint256[],uint256[2][])\":{\"notice\":\"Verifies the ring signature Section 4.2 of the paper https://eprint.iacr.org/2004/027.pdf\"}}}},\"settings\":{\"compilationTarget\":{\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/LSAG.sol\":\"LSAG\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/AltBn128.sol\":{\"keccak256\":\"0x7f2a04ce897b704ff86ef183077997a99149a7dc00d5c83270b651e2297169ea\",\"urls\":[\"bzzr://df6a6c3aff1ad2854afb736b3e24af3e7d74084afd72d3241e8add0760c69dce\"]},\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/EllipticCurve.sol\":{\"keccak256\":\"0x266a80e64a3a30ac323911cfe04db54b397ba50301bf889172dbe2363c9c6ac6\",\"urls\":[\"bzzr://430d8d98304bb333e393bbc864df528b56a26375b138711049a30d33d5cc2925\"]},\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/LSAG.sol\":{\"keccak256\":\"0x767bcf9fea22f21fb5d0e067df5a562dc5d28ab7ea2c4c59ac33503f964268e8\",\"urls\":[\"bzzr://29da86072cb9a283677acb46960934e343b919abfc3c38f1fa5a0b25d188af16\"]},\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/secp256k1.sol\":{\"keccak256\":\"0x22177ffc23e5a8bf0ca84b50e07cdae72102fe969f6eb287f6dd6e093a20dd9b\",\"urls\":[\"bzzr://78243287b410cfac54b97316d074571fe70916e9090e3e85d271d25c8bb66cff\"]}},\"version\":1}", + "bytecode": "0x611579610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361061006c5760003560e01c80632872d29a1461007157806336c91c051461012657806385d88a431461021c5780639728de9814610313578063d6edde19146103e2578063fe46a2b21461044c575b600080fd5b6100e86004803603608081101561008757600080fd5b8101908080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f820116905080830192505050505050919291929080359060200190929190803590602001909291905050506106ce565b6040518082600260200280838360005b838110156101135780820151818401526020810190506100f8565b5050505090500191505060405180910390f35b6101de600480360360c081101561013c57600080fd5b8101908080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f820116905080830192505050505050919291929080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f820116905080830192505050505050919291929080359060200190929190803590602001909291905050506109e3565b6040518082600260200280838360005b838110156102095780820151818401526020810190506101ee565b5050505090500191505060405180910390f35b6102d56004803603602081101561023257600080fd5b810190808035906020019064010000000081111561024f57600080fd5b82018360208201111561026157600080fd5b8035906020019184600183028401116401000000008311171561028357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610d29565b6040518082600260200280838360005b838110156103005780820151818401526020810190506102e5565b5050505090500191505060405180910390f35b6103cc6004803603602081101561032957600080fd5b810190808035906020019064010000000081111561034657600080fd5b82018360208201111561035857600080fd5b8035906020019184600183028401116401000000008311171561037a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610d49565b6040518082815260200191505060405180910390f35b61040e600480360360208110156103f857600080fd5b8101908080359060200190929190505050610de6565b6040518082600260200280838360005b8381101561043957808201518184015260208101905061041e565b5050505090500191505060405180910390f35b6106b4600480360360c081101561046257600080fd5b810190808035906020019064010000000081111561047f57600080fd5b82018360208201111561049157600080fd5b803590602001918460018302840111640100000000831117156104b357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f82011690508083019250505050505091929192908035906020019064010000000081111561056157600080fd5b82018360208201111561057357600080fd5b8035906020019184602083028401116401000000008311171561059557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105f557600080fd5b82018360208201111561060757600080fd5b8035906020019184604083028401116401000000008311171561062957600080fd5b9190808060200260200160405190810160405280939291908181526020016000905b828210156106a2578484839050604002016002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050508152602001906001019061064b565b50505050509192919290505050610ff2565b604051808215151515815260200191505060405180910390f35b6106d661152b565b6106de61152b565b6106e661152b565b6106ee61152b565b60008073__secp256k1_____________________________63c0181914886040518263ffffffff1660e01b815260040180828152602001915050604080518083038186803b15801561073f57600080fd5b505af4158015610753573d6000803e3d6000fd5b505050506040513d604081101561076957600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050818460006002811061079a57fe5b60200201818152505080846001600281106107b157fe5b60200201818152505073__secp256k1_____________________________63f75f20608a8a6040518363ffffffff1660e01b81526004018083600260200280838360005b838110156108105780820151818401526020810190506107f5565b5050505090500182815260200192505050604080518083038186803b15801561083857600080fd5b505af415801561084c573d6000803e3d6000fd5b505050506040513d604081101561086257600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050818360006002811061089357fe5b60200201818152505080836001600281106108aa57fe5b60200201818152505073__secp256k1_____________________________63cf86462085856040518363ffffffff1660e01b81526004018083600260200280838360005b838110156109095780820151818401526020810190506108ee565b5050505090500182600260200280838360005b8381101561093757808201518184015260208101905061091c565b5050505090500192505050604080518083038186803b15801561095957600080fd5b505af415801561096d573d6000803e3d6000fd5b505050506040513d604081101561098357600080fd5b810190808051906020019092919080519060200190929190505050809250819350505081856000600281106109b457fe5b60200201818152505080856001600281106109cb57fe5b60200201818152505084955050505050509392505050565b6109eb61152b565b6109f361152b565b6109fb61152b565b610a0361152b565b60008073__secp256k1_____________________________63f75f20608a8a6040518363ffffffff1660e01b81526004018083600260200280838360005b83811015610a5c578082015181840152602081019050610a41565b5050505090500182815260200192505050604080518083038186803b158015610a8457600080fd5b505af4158015610a98573d6000803e3d6000fd5b505050506040513d6040811015610aae57600080fd5b81019080805190602001909291908051906020019092919050505080925081935050508184600060028110610adf57fe5b6020020181815250508084600160028110610af657fe5b60200201818152505073__secp256k1_____________________________63f75f20608b896040518363ffffffff1660e01b81526004018083600260200280838360005b83811015610b55578082015181840152602081019050610b3a565b5050505090500182815260200192505050604080518083038186803b158015610b7d57600080fd5b505af4158015610b91573d6000803e3d6000fd5b505050506040513d6040811015610ba757600080fd5b81019080805190602001909291908051906020019092919050505080925081935050508183600060028110610bd857fe5b6020020181815250508083600160028110610bef57fe5b60200201818152505073__secp256k1_____________________________63cf86462085856040518363ffffffff1660e01b81526004018083600260200280838360005b83811015610c4e578082015181840152602081019050610c33565b5050505090500182600260200280838360005b83811015610c7c578082015181840152602081019050610c61565b5050505090500192505050604080518083038186803b158015610c9e57600080fd5b505af4158015610cb2573d6000803e3d6000fd5b505050506040513d6040811015610cc857600080fd5b81019080805190602001909291908051906020019092919050505080925081935050508185600060028110610cf957fe5b6020020181815250508085600160028110610d1057fe5b6020020181815250508495505050505050949350505050565b610d3161152b565b610d42610d3d83610d49565b610de6565b9050919050565b600073__AltBn128______________________________634f06f279838051906020012060001c6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610da457600080fd5b505af4158015610db8573d6000803e3d6000fd5b505050506040513d6020811015610dce57600080fd5b81019080805190602001909291905050509050919050565b610dee61152b565b60008290506000805b600115610fe95773__AltBn128______________________________63c690219b846040518263ffffffff1660e01b815260040180828152602001915050604080518083038186803b158015610e4c57600080fd5b505af4158015610e60573d6000803e3d6000fd5b505050506040513d6040811015610e7657600080fd5b810190808051906020019092919080519060200190929190505050809350819250505073__AltBn128______________________________6381dd69fe82846040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610ef057600080fd5b505af4158015610f04573d6000803e3d6000fd5b505050506040513d6020811015610f1a57600080fd5b810190808051906020019092919050505015610f4f576040518060400160405280848152602001838152509350505050610fed565b73__AltBn128______________________________63e76ee2428460016040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610fa757600080fd5b505af4158015610fbb573d6000803e3d6000fd5b505050506040513d6020811015610fd157600080fd5b81019080805190602001909291905050509250610df7565b5050505b919050565b600060028251101561106c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f5369676e61747572652073697a6520746f6f20736d616c6c000000000000000081525060200191505060405180910390fd5b82518251146110e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f5369676e61747572652073697a657320646f206e6f74206d617463682100000081525060200191505060405180910390fd5b600085905060008090506060604051806020016040528060008152509050600091505b84518210156111cc578085838151811061111c57fe5b60200260200101516040516020018083805190602001908083835b6020831061115a5780518252602082019150602081019050602083039250611137565b6001836020036101000a03801982511681845116808217855250505050505090500182600260200280838360005b838110156111a3578082015181840152602081019050611188565b505050509050019250505060405160208183030381529060405290508180600101925050611106565b6111d461152b565b6111dd82610d29565b90506111e761152b565b6111ef61152b565b600094505b87518510156113c25761122e88868151811061120c57fe5b6020026020010151878b888151811061122157fe5b60200260200101516106ce565b915061124f8a848b888151811061124157fe5b6020026020010151896109e3565b9050600188510385146113b5576113b2848b8e85856040516020018086805190602001908083835b6020831061129a5780518252602082019150602081019050602083039250611277565b6001836020036101000a03801982511681845116808217855250505050505090500185600260200280838360005b838110156112e35780820151818401526020810190506112c8565b5050505090500184805190602001908083835b6020831061131957805182526020820191506020810190506020830392506112f6565b6001836020036101000a03801982511681845116808217855250505050505090500183600260200280838360005b83811015611362578082015181840152602081019050611347565b5050505090500182600260200280838360005b83811015611390578082015181840152602081019050611375565b5050505090500195505050505050604051602081830303815290604052610d49565b95505b84806001019550506111f4565b611518848b8e85856040516020018086805190602001908083835b6020831061140057805182526020820191506020810190506020830392506113dd565b6001836020036101000a03801982511681845116808217855250505050505090500185600260200280838360005b8381101561144957808201518184015260208101905061142e565b5050505090500184805190602001908083835b6020831061147f578051825260208201915060208101905060208303925061145c565b6001836020036101000a03801982511681845116808217855250505050505090500183600260200280838360005b838110156114c85780820151818401526020810190506114ad565b5050505090500182600260200280838360005b838110156114f65780820151818401526020810190506114db565b5050505090500195505050505050604051602081830303815290604052610d49565b8b14965050505050505095945050505050565b604051806040016040528060029060208202803883398082019150509050509056fea165627a7a72305820ad2b79d7335ed7920b2e6731bf4c30aedd74dc2017bd4c495326d7442207a8bb0029", + "deployedBytecode": "0x730000000000000000000000000000000000000000301460806040526004361061006c5760003560e01c80632872d29a1461007157806336c91c051461012657806385d88a431461021c5780639728de9814610313578063d6edde19146103e2578063fe46a2b21461044c575b600080fd5b6100e86004803603608081101561008757600080fd5b8101908080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f820116905080830192505050505050919291929080359060200190929190803590602001909291905050506106ce565b6040518082600260200280838360005b838110156101135780820151818401526020810190506100f8565b5050505090500191505060405180910390f35b6101de600480360360c081101561013c57600080fd5b8101908080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f820116905080830192505050505050919291929080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f820116905080830192505050505050919291929080359060200190929190803590602001909291905050506109e3565b6040518082600260200280838360005b838110156102095780820151818401526020810190506101ee565b5050505090500191505060405180910390f35b6102d56004803603602081101561023257600080fd5b810190808035906020019064010000000081111561024f57600080fd5b82018360208201111561026157600080fd5b8035906020019184600183028401116401000000008311171561028357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610d29565b6040518082600260200280838360005b838110156103005780820151818401526020810190506102e5565b5050505090500191505060405180910390f35b6103cc6004803603602081101561032957600080fd5b810190808035906020019064010000000081111561034657600080fd5b82018360208201111561035857600080fd5b8035906020019184600183028401116401000000008311171561037a57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610d49565b6040518082815260200191505060405180910390f35b61040e600480360360208110156103f857600080fd5b8101908080359060200190929190505050610de6565b6040518082600260200280838360005b8381101561043957808201518184015260208101905061041e565b5050505090500191505060405180910390f35b6106b4600480360360c081101561046257600080fd5b810190808035906020019064010000000081111561047f57600080fd5b82018360208201111561049157600080fd5b803590602001918460018302840111640100000000831117156104b357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f82011690508083019250505050505091929192908035906020019064010000000081111561056157600080fd5b82018360208201111561057357600080fd5b8035906020019184602083028401116401000000008311171561059557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105f557600080fd5b82018360208201111561060757600080fd5b8035906020019184604083028401116401000000008311171561062957600080fd5b9190808060200260200160405190810160405280939291908181526020016000905b828210156106a2578484839050604002016002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050508152602001906001019061064b565b50505050509192919290505050610ff2565b604051808215151515815260200191505060405180910390f35b6106d661152b565b6106de61152b565b6106e661152b565b6106ee61152b565b60008073__secp256k1_____________________________63c0181914886040518263ffffffff1660e01b815260040180828152602001915050604080518083038186803b15801561073f57600080fd5b505af4158015610753573d6000803e3d6000fd5b505050506040513d604081101561076957600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050818460006002811061079a57fe5b60200201818152505080846001600281106107b157fe5b60200201818152505073__secp256k1_____________________________63f75f20608a8a6040518363ffffffff1660e01b81526004018083600260200280838360005b838110156108105780820151818401526020810190506107f5565b5050505090500182815260200192505050604080518083038186803b15801561083857600080fd5b505af415801561084c573d6000803e3d6000fd5b505050506040513d604081101561086257600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050818360006002811061089357fe5b60200201818152505080836001600281106108aa57fe5b60200201818152505073__secp256k1_____________________________63cf86462085856040518363ffffffff1660e01b81526004018083600260200280838360005b838110156109095780820151818401526020810190506108ee565b5050505090500182600260200280838360005b8381101561093757808201518184015260208101905061091c565b5050505090500192505050604080518083038186803b15801561095957600080fd5b505af415801561096d573d6000803e3d6000fd5b505050506040513d604081101561098357600080fd5b810190808051906020019092919080519060200190929190505050809250819350505081856000600281106109b457fe5b60200201818152505080856001600281106109cb57fe5b60200201818152505084955050505050509392505050565b6109eb61152b565b6109f361152b565b6109fb61152b565b610a0361152b565b60008073__secp256k1_____________________________63f75f20608a8a6040518363ffffffff1660e01b81526004018083600260200280838360005b83811015610a5c578082015181840152602081019050610a41565b5050505090500182815260200192505050604080518083038186803b158015610a8457600080fd5b505af4158015610a98573d6000803e3d6000fd5b505050506040513d6040811015610aae57600080fd5b81019080805190602001909291908051906020019092919050505080925081935050508184600060028110610adf57fe5b6020020181815250508084600160028110610af657fe5b60200201818152505073__secp256k1_____________________________63f75f20608b896040518363ffffffff1660e01b81526004018083600260200280838360005b83811015610b55578082015181840152602081019050610b3a565b5050505090500182815260200192505050604080518083038186803b158015610b7d57600080fd5b505af4158015610b91573d6000803e3d6000fd5b505050506040513d6040811015610ba757600080fd5b81019080805190602001909291908051906020019092919050505080925081935050508183600060028110610bd857fe5b6020020181815250508083600160028110610bef57fe5b60200201818152505073__secp256k1_____________________________63cf86462085856040518363ffffffff1660e01b81526004018083600260200280838360005b83811015610c4e578082015181840152602081019050610c33565b5050505090500182600260200280838360005b83811015610c7c578082015181840152602081019050610c61565b5050505090500192505050604080518083038186803b158015610c9e57600080fd5b505af4158015610cb2573d6000803e3d6000fd5b505050506040513d6040811015610cc857600080fd5b81019080805190602001909291908051906020019092919050505080925081935050508185600060028110610cf957fe5b6020020181815250508085600160028110610d1057fe5b6020020181815250508495505050505050949350505050565b610d3161152b565b610d42610d3d83610d49565b610de6565b9050919050565b600073__AltBn128______________________________634f06f279838051906020012060001c6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610da457600080fd5b505af4158015610db8573d6000803e3d6000fd5b505050506040513d6020811015610dce57600080fd5b81019080805190602001909291905050509050919050565b610dee61152b565b60008290506000805b600115610fe95773__AltBn128______________________________63c690219b846040518263ffffffff1660e01b815260040180828152602001915050604080518083038186803b158015610e4c57600080fd5b505af4158015610e60573d6000803e3d6000fd5b505050506040513d6040811015610e7657600080fd5b810190808051906020019092919080519060200190929190505050809350819250505073__AltBn128______________________________6381dd69fe82846040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610ef057600080fd5b505af4158015610f04573d6000803e3d6000fd5b505050506040513d6020811015610f1a57600080fd5b810190808051906020019092919050505015610f4f576040518060400160405280848152602001838152509350505050610fed565b73__AltBn128______________________________63e76ee2428460016040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610fa757600080fd5b505af4158015610fbb573d6000803e3d6000fd5b505050506040513d6020811015610fd157600080fd5b81019080805190602001909291905050509250610df7565b5050505b919050565b600060028251101561106c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f5369676e61747572652073697a6520746f6f20736d616c6c000000000000000081525060200191505060405180910390fd5b82518251146110e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f5369676e61747572652073697a657320646f206e6f74206d617463682100000081525060200191505060405180910390fd5b600085905060008090506060604051806020016040528060008152509050600091505b84518210156111cc578085838151811061111c57fe5b60200260200101516040516020018083805190602001908083835b6020831061115a5780518252602082019150602081019050602083039250611137565b6001836020036101000a03801982511681845116808217855250505050505090500182600260200280838360005b838110156111a3578082015181840152602081019050611188565b505050509050019250505060405160208183030381529060405290508180600101925050611106565b6111d461152b565b6111dd82610d29565b90506111e761152b565b6111ef61152b565b600094505b87518510156113c25761122e88868151811061120c57fe5b6020026020010151878b888151811061122157fe5b60200260200101516106ce565b915061124f8a848b888151811061124157fe5b6020026020010151896109e3565b9050600188510385146113b5576113b2848b8e85856040516020018086805190602001908083835b6020831061129a5780518252602082019150602081019050602083039250611277565b6001836020036101000a03801982511681845116808217855250505050505090500185600260200280838360005b838110156112e35780820151818401526020810190506112c8565b5050505090500184805190602001908083835b6020831061131957805182526020820191506020810190506020830392506112f6565b6001836020036101000a03801982511681845116808217855250505050505090500183600260200280838360005b83811015611362578082015181840152602081019050611347565b5050505090500182600260200280838360005b83811015611390578082015181840152602081019050611375565b5050505090500195505050505050604051602081830303815290604052610d49565b95505b84806001019550506111f4565b611518848b8e85856040516020018086805190602001908083835b6020831061140057805182526020820191506020810190506020830392506113dd565b6001836020036101000a03801982511681845116808217855250505050505090500185600260200280838360005b8381101561144957808201518184015260208101905061142e565b5050505090500184805190602001908083835b6020831061147f578051825260208201915060208101905060208303925061145c565b6001836020036101000a03801982511681845116808217855250505050505090500183600260200280838360005b838110156114c85780820151818401526020810190506114ad565b5050505090500182600260200280838360005b838110156114f65780820151818401526020810190506114db565b5050505090500195505050505050604051602081830303815290604052610d49565b8b14965050505050505095945050505050565b604051806040016040528060029060208202803883398082019150509050509056fea165627a7a72305820ad2b79d7335ed7920b2e6731bf4c30aedd74dc2017bd4c495326d7442207a8bb0029", + "sourceMap": "168:4412:2:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24", + "deployedSourceMap": "168:4412:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1350:729;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;1350:729:2;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;1350:729:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1350:729:2;;;;;;;;;;;;;;;;2174:767;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;2174:767:2;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;2174:767:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;2174:767:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;2174:767:2;;;;;;;;;;;;;;;;1134:121;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1134:121:2;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;1134:121:2;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;1134:121:2;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;1134:121:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;1134:121:2;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1134:121:2;;;;;;;;;;;;;;;;884:133;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;884:133:2;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;884:133:2;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;884:133:2;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;884:133:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;884:133:2;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;419:373;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;419:373:2;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;419:373:2;;;;;;;;;;;;;;;;3065:1513;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;3065:1513:2;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;3065:1513:2;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;3065:1513:2;;;;;;100:9:-1;95:1;81:12;77:20;67:8;63:35;60:50;39:11;25:12;22:29;11:107;8:2;;;131:1;128;121:12;8:2;3065:1513:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;3065:1513:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;3065:1513:2;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;3065:1513:2;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;3065:1513:2;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;39:11;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;3065:1513:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;3065:1513:2;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;3065:1513:2;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;3065:1513:2;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;39:11;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;3065:1513:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;3065:1513:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1350:729;1477:17;;:::i;:::-;1636:24;;:::i;:::-;1670:20;;:::i;:::-;1700;;:::i;:::-;1730:9;1749;1779;:17;1797:1;1779:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1779:20:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1779:20:2;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1779:20:2;;;;;;;;;;;;;;;;;;;;;;;;;1770:29;;;;;;;;1818:1;1810:2;1813:1;1810:5;;;;;;;;;;:9;;;;;1837:1;1829:2;1832:1;1829:5;;;;;;;;;;:9;;;;;1858;:16;1875:6;1883:1;1858:27;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1858:27:2;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1858:27:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1858:27:2;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1858:27:2;;;;;;;;;;;;;;;;;;;;;;;;;1849:36;;;;;;;;1904:1;1896:2;1899:1;1896:5;;;;;;;;;;:9;;;;;1923:1;1915:2;1918:1;1915:5;;;;;;;;;;:9;;;;;1944;:16;1974:2;1990;1944:58;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1944:58:2;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;1944:58:2;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1944:58:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1944:58:2;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1944:58:2;;;;;;;;;;;;;;;;;;;;;;;;;1935:67;;;;;;;;2025:1;2013:6;2020:1;2013:9;;;;;;;;;;:13;;;;;2048:1;2036:6;2043:1;2036:9;;;;;;;;;;:13;;;;;2066:6;2059:13;;;;;;;1350:729;;;;;:::o;2174:767::-;2332:17;;:::i;:::-;2494:24;;:::i;:::-;2528:20;;:::i;:::-;2558;;:::i;:::-;2588:9;2607;2637;:16;2654:1;2657;2637:22;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;2637:22:2;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2637:22:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2637:22:2;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2637:22:2;;;;;;;;;;;;;;;;;;;;;;;;;2628:31;;;;;;;;2678:1;2670:2;2673:1;2670:5;;;;;;;;;;:9;;;;;2697:1;2689:2;2692:1;2689:5;;;;;;;;;;:9;;;;;2718;:16;2735:8;2745:1;2718:29;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;2718:29:2;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2718:29:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2718:29:2;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2718:29:2;;;;;;;;;;;;;;;;;;;;;;;;;2709:38;;;;;;;;2766:1;2758:2;2761:1;2758:5;;;;;;;;;;:9;;;;;2785:1;2777:2;2780:1;2777:5;;;;;;;;;;:9;;;;;2806;:16;2836:2;2852;2806:58;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;2806:58:2;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;2806:58:2;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2806:58:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2806:58:2;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2806:58:2;;;;;;;;;;;;;;;;;;;;;;;;;2797:67;;;;;;;;2887:1;2875:6;2882:1;2875:9;;;;;;;;;;:13;;;;;2910:1;2898:6;2905:1;2898:9;;;;;;;;;;:13;;;;;2928:6;2921:13;;;;;;;2174:767;;;;;;:::o;1134:121::-;1191:17;;:::i;:::-;1231;1242:5;1245:1;1242:2;:5::i;:::-;1231:10;:17::i;:::-;1224:24;;1134:121;;;:::o;884:133::-;941:7;974:8;:13;1006:1;996:12;;;;;;988:21;;974:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;974:36:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;974:36:2;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;974:36:2;;;;;;;;;;;;;;;;967:43;;884:133;;;:::o;419:373::-;480:17;;:::i;:::-;513:9;525:2;513:14;;537:9;556:12;579:207;586:4;579:207;;;618:8;:18;637:1;618:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;618:21:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;618:21:2;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;618:21:2;;;;;;;;;;;;;;;;;;;;;;;;;606:33;;;;;;;;658:8;:20;679:4;685:1;658:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;658:29:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;658:29:2;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;658:29:2;;;;;;;;;;;;;;;;654:81;;;707:13;;;;;;;;715:1;707:13;;;;718:1;707:13;;;;;;;;;;654:81;753:8;:16;770:1;773;753:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;753:22:2;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;753:22:2;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;753:22:2;;;;;;;;;;;;;;;;749:26;;579:207;;;419:373;;;;;;;:::o;3065:1513::-;3270:4;3337:1;3316:10;:17;:22;;3308:59;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3406:1;:8;3385:10;:17;:29;3377:71;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3460:9;3472:2;3460:14;;3484:9;3496:1;3484:13;;3566:19;:24;;;;;;;;;;;;;;3610:1;3606:5;;3601:159;3617:10;:17;3613:1;:21;3601:159;;;3698:6;3722:10;3733:1;3722:13;;;;;;;;;;;;;;3664:85;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;3664:85:2;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;3664:85:2;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;3664:85:2;;;3655:94;;3636:3;;;;;;;3601:159;;;3771:19;;:::i;:::-;3793:10;3796:6;3793:2;:10::i;:::-;3771:32;;3832:21;;:::i;:::-;3863;;:::i;:::-;3905:1;3901:5;;3896:479;3912:10;:17;3908:1;:21;3896:479;;;3957:34;3968:10;3979:1;3968:13;;;;;;;;;;;;;;3983:1;3986;3988;3986:4;;;;;;;;;;;;;;3957:10;:34::i;:::-;3951:40;;4011:32;4022:8;4032:1;4035;4037;4035:4;;;;;;;;;;;;;;4041:1;4011:10;:32::i;:::-;4005:38;;4087:1;4067:10;:17;:21;4062:1;:26;4058:307;;4112:237;4178:6;4210:8;4244:7;4277:3;4306;4136:195;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;4136:195:2;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;4136:195:2;;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;4136:195:2;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;4136:195:2;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;4136:195:2;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;4136:195:2;;;4112:2;:237::i;:::-;4108:241;;4058:307;3931:3;;;;;;;3896:479;;;4398:173;4448:6;4472:8;4498:7;4523:3;4544;4414:147;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;4414:147:2;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;4414:147:2;;;;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;4414:147:2;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;4414:147:2;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;4414:147:2;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;4414:147:2;;;4398:2;:173::i;:::-;4392:2;:179;4385:186;;;;;;;;3065:1513;;;;;;;:::o;168:4412::-;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;168:4412:2;;;;:::o", + "source": "pragma solidity >=0.4.0 <0.6.0;\n\nimport \"./AltBn128.sol\";\nimport \"./secp256k1.sol\";\n\n/*\nLinkable Spontaneous Anonymous Groups\n\nhttps://eprint.iacr.org/2004/027.pdf\n*/\n\nlibrary LSAG {\n // abi.encodePacked is the \"concat\" or \"serialization\"\n // of all supplied arguments into one long bytes value\n // i.e. abi.encodePacked :: [a] -> bytes\n\n /**\n * Converts an integer to an elliptic curve point\n */\n function intToPoint(uint256 _x) public view\n returns (uint256[2] memory)\n {\n uint256 x = _x;\n uint256 y;\n uint256 beta;\n\n while (true) {\n (beta, y) = AltBn128.evalCurve(x);\n\n if (AltBn128.onCurveBeta(beta, y)) {\n return [x, y];\n }\n\n x = AltBn128.addmodn(x, 1);\n }\n }\n\n /**\n * Returns an integer representation of the hash\n * of the input\n */\n function H1(bytes memory b) public pure\n returns (uint256)\n { \n return AltBn128.modn(uint256(keccak256(b)));\n }\n\n /**\n * Returns elliptic curve point of the integer representation\n * of the hash of the input\n */\n function H2(bytes memory b) public view\n returns (uint256[2] memory)\n {\n return intToPoint(H1(b));\n }\n\n /**\n * Helper function to calculate Z1\n * Avoids stack too deep problem\n */\n function ringCalcZ1(\n uint256[2] memory pubKey,\n uint256 c,\n uint256 s\n ) public view\n returns (uint256[2] memory)\n {\n\n // return AltBn128.ecAdd(\n // AltBn128.ecMulG(s),\n // AltBn128.ecMul(pubKey, c)\n // );\n\n uint256[2] memory output;\n uint256[2] memory p1;\n uint256[2] memory p2;\n uint256 x;\n uint256 y; \n\n (x, y) = secp256k1.ecMultG(s);\n\n p1[0] = x;\n p1[1] = y;\n\n (x, y) = secp256k1.ecMult(pubKey, c);\n\n p2[0] = x;\n p2[1] = y;\n\n (x, y) = secp256k1.ecAddd(\n p1,\n p2\n );\n\n output[0] = x;\n output[1] = y;\n return output;\n }\n\n /**\n * Helper function to calculate Z2\n * Avoids stack too deep problem\n */\n function ringCalcZ2(\n uint256[2] memory keyImage,\n uint256[2] memory h,\n uint256 s,\n uint256 c\n ) public view\n returns (uint256[2] memory)\n {\n // return AltBn128.ecAdd(\n // AltBn128.ecMul(h, s),\n // AltBn128.ecMul(keyImage, c)\n // );\n\n uint256[2] memory output;\n uint256[2] memory p1;\n uint256[2] memory p2;\n uint256 x;\n uint256 y; \n\n (x, y) = secp256k1.ecMult(h, s);\n\n p1[0] = x;\n p1[1] = y;\n\n (x, y) = secp256k1.ecMult(keyImage, c);\n\n p2[0] = x;\n p2[1] = y;\n\n (x, y) = secp256k1.ecAddd(\n p1,\n p2\n );\n\n output[0] = x;\n output[1] = y;\n return output;\n }\n\n\n /**\n * Verifies the ring signature\n * Section 4.2 of the paper https://eprint.iacr.org/2004/027.pdf\n */\n function verify(\n bytes memory message,\n uint256 c0,\n uint256[2] memory keyImage,\n uint256[] memory s,\n uint256[2][] memory publicKeys\n ) public view\n returns (bool)\n {\n \n \n require(publicKeys.length >= 2, \"Signature size too small\");\n require(publicKeys.length == s.length, \"Signature sizes do not match!\");\n\n\n uint256 c = c0;\n uint256 i = 0;\n\n // Step 1\n // Extract out public key bytes\n bytes memory hBytes = \"\";\n\n for (i = 0; i < publicKeys.length; i++) {\n hBytes = abi.encodePacked(\n hBytes,\n publicKeys[i]\n );\n }\n\n\n uint256[2] memory h = H2(hBytes);\n\n // Step 2\n uint256[2] memory z_1;\n uint256[2] memory z_2;\n\n\n for (i = 0; i < publicKeys.length; i++) {\n\n z_1 = ringCalcZ1(publicKeys[i], c, s[i]);\n z_2 = ringCalcZ2(keyImage, h, s[i], c);\n\n if (i != publicKeys.length - 1) {\n c = H1(\n abi.encodePacked(\n hBytes,\n keyImage,\n message,\n z_1,\n z_2\n )\n );\n\n }\n }\n\n return c0 == H1(\n abi.encodePacked(\n hBytes,\n keyImage,\n message,\n z_1,\n z_2\n )\n );\n }\n}", + "sourcePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/LSAG.sol", + "ast": { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/LSAG.sol", + "exportedSymbols": { + "LSAG": [ + 1893 + ] + }, + "id": 1894, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1422, + "literals": [ + "solidity", + ">=", + "0.4", + ".0", + "<", + "0.6", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:31:2" + }, + { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/AltBn128.sol", + "file": "./AltBn128.sol", + "id": 1423, + "nodeType": "ImportDirective", + "scope": 1894, + "sourceUnit": 248, + "src": "33:24:2", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/secp256k1.sol", + "file": "./secp256k1.sol", + "id": 1424, + "nodeType": "ImportDirective", + "scope": 1894, + "sourceUnit": 2482, + "src": "58:25:2", + "symbolAliases": [], + "unitAlias": "" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": null, + "fullyImplemented": true, + "id": 1893, + "linearizedBaseContracts": [ + 1893 + ], + "name": "LSAG", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 1474, + "nodeType": "Block", + "src": "503:289:2", + "statements": [ + { + "assignments": [ + 1434 + ], + "declarations": [ + { + "constant": false, + "id": 1434, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 1474, + "src": "513:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1433, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "513:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1436, + "initialValue": { + "argumentTypes": null, + "id": 1435, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1426, + "src": "525:2:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "513:14:2" + }, + { + "assignments": [ + 1438 + ], + "declarations": [ + { + "constant": false, + "id": 1438, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 1474, + "src": "537:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1437, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "537:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1439, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "537:9:2" + }, + { + "assignments": [ + 1441 + ], + "declarations": [ + { + "constant": false, + "id": 1441, + "name": "beta", + "nodeType": "VariableDeclaration", + "scope": 1474, + "src": "556:12:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1440, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "556:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1442, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "556:12:2" + }, + { + "body": { + "id": 1472, + "nodeType": "Block", + "src": "592:194:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1444, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1441, + "src": "607:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1445, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1438, + "src": "613:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1446, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "606:9:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1449, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1434, + "src": "637:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1447, + "name": "AltBn128", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "618:8:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_AltBn128_$247_$", + "typeString": "type(library AltBn128)" + } + }, + "id": 1448, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "evalCurve", + "nodeType": "MemberAccess", + "referencedDeclaration": 246, + "src": "618:18:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_view$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256) view returns (uint256,uint256)" + } + }, + "id": 1450, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "618:21:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "606:33:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1452, + "nodeType": "ExpressionStatement", + "src": "606:33:2" + }, + { + "condition": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1455, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1441, + "src": "679:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1456, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1438, + "src": "685:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1453, + "name": "AltBn128", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "658:8:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_AltBn128_$247_$", + "typeString": "type(library AltBn128)" + } + }, + "id": 1454, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "onCurveBeta", + "nodeType": "MemberAccess", + "referencedDeclaration": 200, + "src": "658:20:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$returns$_t_bool_$", + "typeString": "function (uint256,uint256) pure returns (bool)" + } + }, + "id": 1457, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "658:29:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 1463, + "nodeType": "IfStatement", + "src": "654:81:2", + "trueBody": { + "id": 1462, + "nodeType": "Block", + "src": "689:46:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1458, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1434, + "src": "715:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1459, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1438, + "src": "718:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1460, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "714:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "functionReturnParameters": 1432, + "id": 1461, + "nodeType": "Return", + "src": "707:13:2" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "id": 1470, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1464, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1434, + "src": "749:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1467, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1434, + "src": "770:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "31", + "id": 1468, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "773:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + } + ], + "expression": { + "argumentTypes": null, + "id": 1465, + "name": "AltBn128", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "753:8:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_AltBn128_$247_$", + "typeString": "type(library AltBn128)" + } + }, + "id": 1466, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "addmodn", + "nodeType": "MemberAccess", + "referencedDeclaration": 131, + "src": "753:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1469, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "753:22:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "749:26:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1471, + "nodeType": "ExpressionStatement", + "src": "749:26:2" + } + ] + }, + "condition": { + "argumentTypes": null, + "hexValue": "74727565", + "id": 1443, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "586:4:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "id": 1473, + "nodeType": "WhileStatement", + "src": "579:207:2" + } + ] + }, + "documentation": "Converts an integer to an elliptic curve point", + "id": 1475, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "intToPoint", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1427, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1426, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 1475, + "src": "439:10:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1425, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "439:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "438:12:2" + }, + "returnParameters": { + "id": 1432, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1431, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1475, + "src": "480:17:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1428, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "480:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1430, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1429, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "488:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "480:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "479:19:2" + }, + "scope": 1893, + "src": "419:373:2", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1491, + "nodeType": "Block", + "src": "954:63:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1486, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1477, + "src": "1006:1:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1485, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "996:9:2", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 1487, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "996:12:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 1484, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "988:7:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": "uint256" + }, + "id": 1488, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "988:21:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1482, + "name": "AltBn128", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "974:8:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_AltBn128_$247_$", + "typeString": "type(library AltBn128)" + } + }, + "id": 1483, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "modn", + "nodeType": "MemberAccess", + "referencedDeclaration": 143, + "src": "974:13:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 1489, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "974:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 1481, + "id": 1490, + "nodeType": "Return", + "src": "967:43:2" + } + ] + }, + "documentation": "Returns an integer representation of the hash\nof the input", + "id": 1492, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "H1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1478, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1477, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 1492, + "src": "896:14:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1476, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "896:5:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "895:16:2" + }, + "returnParameters": { + "id": 1481, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1480, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1492, + "src": "941:7:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1479, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "941:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "940:9:2" + }, + "scope": 1893, + "src": "884:133:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1507, + "nodeType": "Block", + "src": "1214:41:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1503, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1494, + "src": "1245:1:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1502, + "name": "H1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1492, + "src": "1242:2:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$returns$_t_uint256_$", + "typeString": "function (bytes memory) pure returns (uint256)" + } + }, + "id": 1504, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1242:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1501, + "name": "intToPoint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1475, + "src": "1231:10:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_array$_t_uint256_$2_memory_ptr_$", + "typeString": "function (uint256) view returns (uint256[2] memory)" + } + }, + "id": 1505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1231:17:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "functionReturnParameters": 1500, + "id": 1506, + "nodeType": "Return", + "src": "1224:24:2" + } + ] + }, + "documentation": "Returns elliptic curve point of the integer representation\nof the hash of the input", + "id": 1508, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "H2", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1495, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1494, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 1508, + "src": "1146:14:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1493, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1146:5:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1145:16:2" + }, + "returnParameters": { + "id": 1500, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1499, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1508, + "src": "1191:17:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1496, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1191:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1498, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1497, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1199:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1191:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1190:19:2" + }, + "scope": 1893, + "src": "1134:121:2", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1614, + "nodeType": "Block", + "src": "1500:579:2", + "statements": [ + { + "assignments": [ + 1527 + ], + "declarations": [ + { + "constant": false, + "id": 1527, + "name": "output", + "nodeType": "VariableDeclaration", + "scope": 1614, + "src": "1636:24:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1525, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1636:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1526, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1524, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1644:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1636:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1528, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1636:24:2" + }, + { + "assignments": [ + 1533 + ], + "declarations": [ + { + "constant": false, + "id": 1533, + "name": "p1", + "nodeType": "VariableDeclaration", + "scope": 1614, + "src": "1670:20:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1531, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1670:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1532, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1530, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1678:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1670:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1534, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1670:20:2" + }, + { + "assignments": [ + 1539 + ], + "declarations": [ + { + "constant": false, + "id": 1539, + "name": "p2", + "nodeType": "VariableDeclaration", + "scope": 1614, + "src": "1700:20:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1537, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1700:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1538, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1536, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1708:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1700:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1540, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1700:20:2" + }, + { + "assignments": [ + 1542 + ], + "declarations": [ + { + "constant": false, + "id": 1542, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 1614, + "src": "1730:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1541, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1730:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1543, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1730:9:2" + }, + { + "assignments": [ + 1545 + ], + "declarations": [ + { + "constant": false, + "id": 1545, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 1614, + "src": "1749:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1544, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1749:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1546, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1749:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1554, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1547, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1542, + "src": "1771:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1548, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1545, + "src": "1774:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1549, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1770:6:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1552, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1516, + "src": "1797:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1550, + "name": "secp256k1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2481, + "src": "1779:9:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_secp256k1_$2481_$", + "typeString": "type(library secp256k1)" + } + }, + "id": 1551, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMultG", + "nodeType": "MemberAccess", + "referencedDeclaration": 2411, + "src": "1779:17:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256,uint256)" + } + }, + "id": 1553, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1779:20:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "1770:29:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1555, + "nodeType": "ExpressionStatement", + "src": "1770:29:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1560, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1556, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1533, + "src": "1810:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1558, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1557, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1813:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1810:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1559, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1542, + "src": "1818:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1810:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1561, + "nodeType": "ExpressionStatement", + "src": "1810:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1566, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1562, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1533, + "src": "1829:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1564, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1563, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1832:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1829:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1565, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1545, + "src": "1837:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1829:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1567, + "nodeType": "ExpressionStatement", + "src": "1829:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1576, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1568, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1542, + "src": "1850:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1569, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1545, + "src": "1853:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1570, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1849:6:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1573, + "name": "pubKey", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1512, + "src": "1875:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1574, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1514, + "src": "1883:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1571, + "name": "secp256k1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2481, + "src": "1858:9:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_secp256k1_$2481_$", + "typeString": "type(library secp256k1)" + } + }, + "id": 1572, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMult", + "nodeType": "MemberAccess", + "referencedDeclaration": 2442, + "src": "1858:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_array$_t_uint256_$2_memory_ptr_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256[2] memory,uint256) pure returns (uint256,uint256)" + } + }, + "id": 1575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1858:27:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "1849:36:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1577, + "nodeType": "ExpressionStatement", + "src": "1849:36:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1582, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1578, + "name": "p2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1539, + "src": "1896:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1580, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1579, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1899:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1896:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1581, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1542, + "src": "1904:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1896:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1583, + "nodeType": "ExpressionStatement", + "src": "1896:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1588, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1584, + "name": "p2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1539, + "src": "1915:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1586, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1585, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1918:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1915:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1587, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1545, + "src": "1923:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1915:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1589, + "nodeType": "ExpressionStatement", + "src": "1915:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1598, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1590, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1542, + "src": "1936:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1591, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1545, + "src": "1939:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1592, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1935:6:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1595, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1533, + "src": "1974:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1596, + "name": "p2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1539, + "src": "1990:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 1593, + "name": "secp256k1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2481, + "src": "1944:9:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_secp256k1_$2481_$", + "typeString": "type(library secp256k1)" + } + }, + "id": 1594, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecAddd", + "nodeType": "MemberAccess", + "referencedDeclaration": 2480, + "src": "1944:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_array$_t_uint256_$2_memory_ptr_$_t_array$_t_uint256_$2_memory_ptr_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256[2] memory,uint256[2] memory) pure returns (uint256,uint256)" + } + }, + "id": 1597, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1944:58:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "1935:67:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1599, + "nodeType": "ExpressionStatement", + "src": "1935:67:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1604, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1600, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1527, + "src": "2013:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1602, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1601, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2020:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2013:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1603, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1542, + "src": "2025:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2013:13:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1605, + "nodeType": "ExpressionStatement", + "src": "2013:13:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1610, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1606, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1527, + "src": "2036:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1608, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1607, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2043:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2036:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1609, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1545, + "src": "2048:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2036:13:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1611, + "nodeType": "ExpressionStatement", + "src": "2036:13:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1612, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1527, + "src": "2066:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "functionReturnParameters": 1522, + "id": 1613, + "nodeType": "Return", + "src": "2059:13:2" + } + ] + }, + "documentation": "Helper function to calculate Z1\nAvoids stack too deep problem", + "id": 1615, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ringCalcZ1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1517, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1512, + "name": "pubKey", + "nodeType": "VariableDeclaration", + "scope": 1615, + "src": "1379:24:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1509, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1379:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1511, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1510, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1387:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1379:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1514, + "name": "c", + "nodeType": "VariableDeclaration", + "scope": 1615, + "src": "1413:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1513, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1413:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1516, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 1615, + "src": "1432:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1515, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1432:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1369:78:2" + }, + "returnParameters": { + "id": 1522, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1521, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1615, + "src": "1477:17:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1518, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1477:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1520, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1519, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1485:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1477:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1476:19:2" + }, + "scope": 1893, + "src": "1350:729:2", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1726, + "nodeType": "Block", + "src": "2355:586:2", + "statements": [ + { + "assignments": [ + 1638 + ], + "declarations": [ + { + "constant": false, + "id": 1638, + "name": "output", + "nodeType": "VariableDeclaration", + "scope": 1726, + "src": "2494:24:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1636, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2494:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1637, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1635, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2502:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2494:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1639, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2494:24:2" + }, + { + "assignments": [ + 1644 + ], + "declarations": [ + { + "constant": false, + "id": 1644, + "name": "p1", + "nodeType": "VariableDeclaration", + "scope": 1726, + "src": "2528:20:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1642, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2528:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1643, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1641, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2536:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2528:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1645, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2528:20:2" + }, + { + "assignments": [ + 1650 + ], + "declarations": [ + { + "constant": false, + "id": 1650, + "name": "p2", + "nodeType": "VariableDeclaration", + "scope": 1726, + "src": "2558:20:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1648, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2558:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1649, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1647, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2566:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2558:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1651, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2558:20:2" + }, + { + "assignments": [ + 1653 + ], + "declarations": [ + { + "constant": false, + "id": 1653, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 1726, + "src": "2588:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1652, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2588:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1654, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2588:9:2" + }, + { + "assignments": [ + 1656 + ], + "declarations": [ + { + "constant": false, + "id": 1656, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 1726, + "src": "2607:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1655, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2607:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1657, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2607:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1666, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1658, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1653, + "src": "2629:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1659, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1656, + "src": "2632:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1660, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "2628:6:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1663, + "name": "h", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1623, + "src": "2654:1:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1664, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1625, + "src": "2657:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1661, + "name": "secp256k1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2481, + "src": "2637:9:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_secp256k1_$2481_$", + "typeString": "type(library secp256k1)" + } + }, + "id": 1662, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMult", + "nodeType": "MemberAccess", + "referencedDeclaration": 2442, + "src": "2637:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_array$_t_uint256_$2_memory_ptr_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256[2] memory,uint256) pure returns (uint256,uint256)" + } + }, + "id": 1665, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2637:22:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "2628:31:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1667, + "nodeType": "ExpressionStatement", + "src": "2628:31:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1672, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1668, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1644, + "src": "2670:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1670, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1669, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2673:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2670:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1671, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1653, + "src": "2678:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2670:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1673, + "nodeType": "ExpressionStatement", + "src": "2670:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1678, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1674, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1644, + "src": "2689:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1676, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1675, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2692:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2689:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1677, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1656, + "src": "2697:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2689:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1679, + "nodeType": "ExpressionStatement", + "src": "2689:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1688, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1680, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1653, + "src": "2710:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1681, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1656, + "src": "2713:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1682, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "2709:6:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1685, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1619, + "src": "2735:8:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1686, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1627, + "src": "2745:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1683, + "name": "secp256k1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2481, + "src": "2718:9:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_secp256k1_$2481_$", + "typeString": "type(library secp256k1)" + } + }, + "id": 1684, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMult", + "nodeType": "MemberAccess", + "referencedDeclaration": 2442, + "src": "2718:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_array$_t_uint256_$2_memory_ptr_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256[2] memory,uint256) pure returns (uint256,uint256)" + } + }, + "id": 1687, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2718:29:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "2709:38:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1689, + "nodeType": "ExpressionStatement", + "src": "2709:38:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1694, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1690, + "name": "p2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1650, + "src": "2758:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1692, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1691, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2761:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2758:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1693, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1653, + "src": "2766:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2758:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1695, + "nodeType": "ExpressionStatement", + "src": "2758:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1700, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1696, + "name": "p2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1650, + "src": "2777:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1698, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1697, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2780:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2777:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1699, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1656, + "src": "2785:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2777:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1701, + "nodeType": "ExpressionStatement", + "src": "2777:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1710, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1702, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1653, + "src": "2798:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1703, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1656, + "src": "2801:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1704, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "2797:6:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1707, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1644, + "src": "2836:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1708, + "name": "p2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1650, + "src": "2852:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 1705, + "name": "secp256k1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2481, + "src": "2806:9:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_secp256k1_$2481_$", + "typeString": "type(library secp256k1)" + } + }, + "id": 1706, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecAddd", + "nodeType": "MemberAccess", + "referencedDeclaration": 2480, + "src": "2806:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_array$_t_uint256_$2_memory_ptr_$_t_array$_t_uint256_$2_memory_ptr_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256[2] memory,uint256[2] memory) pure returns (uint256,uint256)" + } + }, + "id": 1709, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2806:58:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "2797:67:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1711, + "nodeType": "ExpressionStatement", + "src": "2797:67:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1716, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1712, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1638, + "src": "2875:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1714, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1713, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2882:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2875:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1715, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1653, + "src": "2887:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2875:13:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1717, + "nodeType": "ExpressionStatement", + "src": "2875:13:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1722, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1718, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1638, + "src": "2898:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1720, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1719, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2905:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2898:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1721, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1656, + "src": "2910:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2898:13:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1723, + "nodeType": "ExpressionStatement", + "src": "2898:13:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1724, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1638, + "src": "2928:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "functionReturnParameters": 1633, + "id": 1725, + "nodeType": "Return", + "src": "2921:13:2" + } + ] + }, + "documentation": "Helper function to calculate Z2\nAvoids stack too deep problem", + "id": 1727, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ringCalcZ2", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1628, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1619, + "name": "keyImage", + "nodeType": "VariableDeclaration", + "scope": 1727, + "src": "2203:26:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1616, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2203:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1618, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1617, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2211:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2203:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1623, + "name": "h", + "nodeType": "VariableDeclaration", + "scope": 1727, + "src": "2239:19:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1620, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2239:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1622, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1621, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2247:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2239:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1625, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 1727, + "src": "2268:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1624, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2268:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1627, + "name": "c", + "nodeType": "VariableDeclaration", + "scope": 1727, + "src": "2287:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1626, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2287:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2193:109:2" + }, + "returnParameters": { + "id": 1633, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1632, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1727, + "src": "2332:17:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1629, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2332:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1631, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1630, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2340:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2332:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2331:19:2" + }, + "scope": 1893, + "src": "2174:767:2", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1891, + "nodeType": "Block", + "src": "3280:1298:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1752, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1749, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "3316:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1750, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3316:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1751, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3337:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "3316:22:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "5369676e61747572652073697a6520746f6f20736d616c6c", + "id": 1753, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3340:26:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_b1cd0afb440e018b7a67fba9742102c05aa6bca79e337afd988daba03fb571c1", + "typeString": "literal_string \"Signature size too small\"" + }, + "value": "Signature size too small" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_b1cd0afb440e018b7a67fba9742102c05aa6bca79e337afd988daba03fb571c1", + "typeString": "literal_string \"Signature size too small\"" + } + ], + "id": 1748, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2499, + 2500 + ], + "referencedDeclaration": 2500, + "src": "3308:7:2", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 1754, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3308:59:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1755, + "nodeType": "ExpressionStatement", + "src": "3308:59:2" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1761, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1757, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "3385:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1758, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3385:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1759, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1738, + "src": "3406:1:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 1760, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3406:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3385:29:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "5369676e61747572652073697a657320646f206e6f74206d6174636821", + "id": 1762, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3416:31:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_f501dc3294ed158f434bc066f53f10e3fea6c537e2a23b8555646ee77de5b80a", + "typeString": "literal_string \"Signature sizes do not match!\"" + }, + "value": "Signature sizes do not match!" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_f501dc3294ed158f434bc066f53f10e3fea6c537e2a23b8555646ee77de5b80a", + "typeString": "literal_string \"Signature sizes do not match!\"" + } + ], + "id": 1756, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2499, + 2500 + ], + "referencedDeclaration": 2500, + "src": "3377:7:2", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 1763, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3377:71:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1764, + "nodeType": "ExpressionStatement", + "src": "3377:71:2" + }, + { + "assignments": [ + 1766 + ], + "declarations": [ + { + "constant": false, + "id": 1766, + "name": "c", + "nodeType": "VariableDeclaration", + "scope": 1891, + "src": "3460:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1765, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3460:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1768, + "initialValue": { + "argumentTypes": null, + "id": 1767, + "name": "c0", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1731, + "src": "3472:2:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3460:14:2" + }, + { + "assignments": [ + 1770 + ], + "declarations": [ + { + "constant": false, + "id": 1770, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 1891, + "src": "3484:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1769, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3484:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1772, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 1771, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3496:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "3484:13:2" + }, + { + "assignments": [ + 1774 + ], + "declarations": [ + { + "constant": false, + "id": 1774, + "name": "hBytes", + "nodeType": "VariableDeclaration", + "scope": 1891, + "src": "3566:19:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1773, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3566:5:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1776, + "initialValue": { + "argumentTypes": null, + "hexValue": "", + "id": 1775, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3588:2:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + }, + "value": "" + }, + "nodeType": "VariableDeclarationStatement", + "src": "3566:24:2" + }, + { + "body": { + "id": 1798, + "nodeType": "Block", + "src": "3641:119:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1796, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1788, + "name": "hBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1774, + "src": "3655:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1791, + "name": "hBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1774, + "src": "3698:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1792, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "3722:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1794, + "indexExpression": { + "argumentTypes": null, + "id": 1793, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3733:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3722:13:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory", + "typeString": "uint256[2] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory", + "typeString": "uint256[2] memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 1789, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2483, + "src": "3664:3:2", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 1790, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3664:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 1795, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3664:85:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "src": "3655:94:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1797, + "nodeType": "ExpressionStatement", + "src": "3655:94:2" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1784, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1781, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3613:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1782, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "3617:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1783, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3617:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3613:21:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1799, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 1779, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1777, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3606:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 1778, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3610:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3606:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1780, + "nodeType": "ExpressionStatement", + "src": "3606:5:2" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 1786, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "3636:3:2", + "subExpression": { + "argumentTypes": null, + "id": 1785, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3636:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1787, + "nodeType": "ExpressionStatement", + "src": "3636:3:2" + }, + "nodeType": "ForStatement", + "src": "3601:159:2" + }, + { + "assignments": [ + 1804 + ], + "declarations": [ + { + "constant": false, + "id": 1804, + "name": "h", + "nodeType": "VariableDeclaration", + "scope": 1891, + "src": "3771:19:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1802, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3771:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1803, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1801, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3779:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "3771:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1808, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1806, + "name": "hBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1774, + "src": "3796:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1805, + "name": "H2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1508, + "src": "3793:2:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes_memory_ptr_$returns$_t_array$_t_uint256_$2_memory_ptr_$", + "typeString": "function (bytes memory) view returns (uint256[2] memory)" + } + }, + "id": 1807, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3793:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3771:32:2" + }, + { + "assignments": [ + 1813 + ], + "declarations": [ + { + "constant": false, + "id": 1813, + "name": "z_1", + "nodeType": "VariableDeclaration", + "scope": 1891, + "src": "3832:21:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1811, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3832:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1812, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1810, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3840:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "3832:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1814, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "3832:21:2" + }, + { + "assignments": [ + 1819 + ], + "declarations": [ + { + "constant": false, + "id": 1819, + "name": "z_2", + "nodeType": "VariableDeclaration", + "scope": 1891, + "src": "3863:21:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1817, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3863:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1818, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1816, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3871:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "3863:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1820, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "3863:21:2" + }, + { + "body": { + "id": 1876, + "nodeType": "Block", + "src": "3936:439:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1842, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1832, + "name": "z_1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1813, + "src": "3951:3:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1834, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "3968:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1836, + "indexExpression": { + "argumentTypes": null, + "id": 1835, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3979:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3968:13:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1837, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1766, + "src": "3983:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1838, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1738, + "src": "3986:1:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 1840, + "indexExpression": { + "argumentTypes": null, + "id": 1839, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3988:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3986:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1833, + "name": "ringCalcZ1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1615, + "src": "3957:10:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_array$_t_uint256_$2_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_array$_t_uint256_$2_memory_ptr_$", + "typeString": "function (uint256[2] memory,uint256,uint256) view returns (uint256[2] memory)" + } + }, + "id": 1841, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3957:34:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "src": "3951:40:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1843, + "nodeType": "ExpressionStatement", + "src": "3951:40:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1853, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1844, + "name": "z_2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1819, + "src": "4005:3:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1846, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1735, + "src": "4022:8:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1847, + "name": "h", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1804, + "src": "4032:1:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1848, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1738, + "src": "4035:1:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 1850, + "indexExpression": { + "argumentTypes": null, + "id": 1849, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "4037:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4035:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1851, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1766, + "src": "4041:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1845, + "name": "ringCalcZ2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1727, + "src": "4011:10:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_array$_t_uint256_$2_memory_ptr_$_t_array$_t_uint256_$2_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_array$_t_uint256_$2_memory_ptr_$", + "typeString": "function (uint256[2] memory,uint256[2] memory,uint256,uint256) view returns (uint256[2] memory)" + } + }, + "id": 1852, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4011:32:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "src": "4005:38:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1854, + "nodeType": "ExpressionStatement", + "src": "4005:38:2" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1860, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1855, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "4062:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1859, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1856, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "4067:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1857, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4067:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1858, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4087:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "4067:21:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4062:26:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 1875, + "nodeType": "IfStatement", + "src": "4058:307:2", + "trueBody": { + "id": 1874, + "nodeType": "Block", + "src": "4090:275:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1872, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1861, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1766, + "src": "4108:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1865, + "name": "hBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1774, + "src": "4178:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 1866, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1735, + "src": "4210:8:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1867, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1729, + "src": "4244:7:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 1868, + "name": "z_1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1813, + "src": "4277:3:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1869, + "name": "z_2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1819, + "src": "4306:3:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 1863, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2483, + "src": "4136:3:2", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 1864, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4136:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 1870, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4136:195:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1862, + "name": "H1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1492, + "src": "4112:2:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$returns$_t_uint256_$", + "typeString": "function (bytes memory) pure returns (uint256)" + } + }, + "id": 1871, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4112:237:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4108:241:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1873, + "nodeType": "ExpressionStatement", + "src": "4108:241:2" + } + ] + } + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1828, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1825, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3908:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1826, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "3912:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1827, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3912:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3908:21:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1877, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 1823, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1821, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3901:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 1822, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3905:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3901:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1824, + "nodeType": "ExpressionStatement", + "src": "3901:5:2" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 1830, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "3931:3:2", + "subExpression": { + "argumentTypes": null, + "id": 1829, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3931:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1831, + "nodeType": "ExpressionStatement", + "src": "3931:3:2" + }, + "nodeType": "ForStatement", + "src": "3896:479:2" + }, + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1889, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1878, + "name": "c0", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1731, + "src": "4392:2:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1882, + "name": "hBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1774, + "src": "4448:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 1883, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1735, + "src": "4472:8:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1884, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1729, + "src": "4498:7:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 1885, + "name": "z_1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1813, + "src": "4523:3:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1886, + "name": "z_2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1819, + "src": "4544:3:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 1880, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2483, + "src": "4414:3:2", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 1881, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4414:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 1887, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4414:147:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1879, + "name": "H1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1492, + "src": "4398:2:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$returns$_t_uint256_$", + "typeString": "function (bytes memory) pure returns (uint256)" + } + }, + "id": 1888, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4398:173:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4392:179:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 1747, + "id": 1890, + "nodeType": "Return", + "src": "4385:186:2" + } + ] + }, + "documentation": "Verifies the ring signature\nSection 4.2 of the paper https://eprint.iacr.org/2004/027.pdf", + "id": 1892, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "verify", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1744, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1729, + "name": "message", + "nodeType": "VariableDeclaration", + "scope": 1892, + "src": "3090:20:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1728, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3090:5:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1731, + "name": "c0", + "nodeType": "VariableDeclaration", + "scope": 1892, + "src": "3120:10:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1730, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3120:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1735, + "name": "keyImage", + "nodeType": "VariableDeclaration", + "scope": 1892, + "src": "3140:26:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1732, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3140:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1734, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1733, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3148:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "3140:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1738, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 1892, + "src": "3176:18:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 1736, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3176:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1737, + "length": null, + "nodeType": "ArrayTypeName", + "src": "3176:9:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1743, + "name": "publicKeys", + "nodeType": "VariableDeclaration", + "scope": 1892, + "src": "3204:30:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2][]" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 1739, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3204:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1741, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1740, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3212:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "3204:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "id": 1742, + "length": null, + "nodeType": "ArrayTypeName", + "src": "3204:12:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage_ptr", + "typeString": "uint256[2][]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3080:160:2" + }, + "returnParameters": { + "id": 1747, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1746, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1892, + "src": "3270:4:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 1745, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3270:4:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3269:6:2" + }, + "scope": 1893, + "src": "3065:1513:2", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 1894, + "src": "168:4412:2" + } + ], + "src": "0:4580:2" + }, + "legacyAST": { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/LSAG.sol", + "exportedSymbols": { + "LSAG": [ + 1893 + ] + }, + "id": 1894, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1422, + "literals": [ + "solidity", + ">=", + "0.4", + ".0", + "<", + "0.6", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:31:2" + }, + { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/AltBn128.sol", + "file": "./AltBn128.sol", + "id": 1423, + "nodeType": "ImportDirective", + "scope": 1894, + "sourceUnit": 248, + "src": "33:24:2", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/secp256k1.sol", + "file": "./secp256k1.sol", + "id": 1424, + "nodeType": "ImportDirective", + "scope": 1894, + "sourceUnit": 2482, + "src": "58:25:2", + "symbolAliases": [], + "unitAlias": "" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": null, + "fullyImplemented": true, + "id": 1893, + "linearizedBaseContracts": [ + 1893 + ], + "name": "LSAG", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 1474, + "nodeType": "Block", + "src": "503:289:2", + "statements": [ + { + "assignments": [ + 1434 + ], + "declarations": [ + { + "constant": false, + "id": 1434, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 1474, + "src": "513:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1433, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "513:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1436, + "initialValue": { + "argumentTypes": null, + "id": 1435, + "name": "_x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1426, + "src": "525:2:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "513:14:2" + }, + { + "assignments": [ + 1438 + ], + "declarations": [ + { + "constant": false, + "id": 1438, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 1474, + "src": "537:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1437, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "537:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1439, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "537:9:2" + }, + { + "assignments": [ + 1441 + ], + "declarations": [ + { + "constant": false, + "id": 1441, + "name": "beta", + "nodeType": "VariableDeclaration", + "scope": 1474, + "src": "556:12:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1440, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "556:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1442, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "556:12:2" + }, + { + "body": { + "id": 1472, + "nodeType": "Block", + "src": "592:194:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1444, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1441, + "src": "607:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1445, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1438, + "src": "613:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1446, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "606:9:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1449, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1434, + "src": "637:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1447, + "name": "AltBn128", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "618:8:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_AltBn128_$247_$", + "typeString": "type(library AltBn128)" + } + }, + "id": 1448, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "evalCurve", + "nodeType": "MemberAccess", + "referencedDeclaration": 246, + "src": "618:18:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_view$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256) view returns (uint256,uint256)" + } + }, + "id": 1450, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "618:21:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "606:33:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1452, + "nodeType": "ExpressionStatement", + "src": "606:33:2" + }, + { + "condition": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1455, + "name": "beta", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1441, + "src": "679:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1456, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1438, + "src": "685:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1453, + "name": "AltBn128", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "658:8:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_AltBn128_$247_$", + "typeString": "type(library AltBn128)" + } + }, + "id": 1454, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "onCurveBeta", + "nodeType": "MemberAccess", + "referencedDeclaration": 200, + "src": "658:20:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$returns$_t_bool_$", + "typeString": "function (uint256,uint256) pure returns (bool)" + } + }, + "id": 1457, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "658:29:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 1463, + "nodeType": "IfStatement", + "src": "654:81:2", + "trueBody": { + "id": 1462, + "nodeType": "Block", + "src": "689:46:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1458, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1434, + "src": "715:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1459, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1438, + "src": "718:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1460, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "714:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "functionReturnParameters": 1432, + "id": 1461, + "nodeType": "Return", + "src": "707:13:2" + } + ] + } + }, + { + "expression": { + "argumentTypes": null, + "id": 1470, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1464, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1434, + "src": "749:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1467, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1434, + "src": "770:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "hexValue": "31", + "id": 1468, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "773:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + } + ], + "expression": { + "argumentTypes": null, + "id": 1465, + "name": "AltBn128", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "753:8:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_AltBn128_$247_$", + "typeString": "type(library AltBn128)" + } + }, + "id": 1466, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "addmodn", + "nodeType": "MemberAccess", + "referencedDeclaration": 131, + "src": "753:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 1469, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "753:22:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "749:26:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1471, + "nodeType": "ExpressionStatement", + "src": "749:26:2" + } + ] + }, + "condition": { + "argumentTypes": null, + "hexValue": "74727565", + "id": 1443, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "586:4:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "id": 1473, + "nodeType": "WhileStatement", + "src": "579:207:2" + } + ] + }, + "documentation": "Converts an integer to an elliptic curve point", + "id": 1475, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "intToPoint", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1427, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1426, + "name": "_x", + "nodeType": "VariableDeclaration", + "scope": 1475, + "src": "439:10:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1425, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "439:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "438:12:2" + }, + "returnParameters": { + "id": 1432, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1431, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1475, + "src": "480:17:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1428, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "480:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1430, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1429, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "488:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "480:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "479:19:2" + }, + "scope": 1893, + "src": "419:373:2", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1491, + "nodeType": "Block", + "src": "954:63:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1486, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1477, + "src": "1006:1:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1485, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2490, + "src": "996:9:2", + "typeDescriptions": { + "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", + "typeString": "function (bytes memory) pure returns (bytes32)" + } + }, + "id": 1487, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "996:12:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 1484, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "988:7:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_uint256_$", + "typeString": "type(uint256)" + }, + "typeName": "uint256" + }, + "id": 1488, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "988:21:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1482, + "name": "AltBn128", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 247, + "src": "974:8:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_AltBn128_$247_$", + "typeString": "type(library AltBn128)" + } + }, + "id": 1483, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "modn", + "nodeType": "MemberAccess", + "referencedDeclaration": 143, + "src": "974:13:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256)" + } + }, + "id": 1489, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "974:36:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 1481, + "id": 1490, + "nodeType": "Return", + "src": "967:43:2" + } + ] + }, + "documentation": "Returns an integer representation of the hash\nof the input", + "id": 1492, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "H1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1478, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1477, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 1492, + "src": "896:14:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1476, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "896:5:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "895:16:2" + }, + "returnParameters": { + "id": 1481, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1480, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1492, + "src": "941:7:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1479, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "941:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "940:9:2" + }, + "scope": 1893, + "src": "884:133:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1507, + "nodeType": "Block", + "src": "1214:41:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1503, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1494, + "src": "1245:1:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1502, + "name": "H1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1492, + "src": "1242:2:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$returns$_t_uint256_$", + "typeString": "function (bytes memory) pure returns (uint256)" + } + }, + "id": 1504, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1242:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1501, + "name": "intToPoint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1475, + "src": "1231:10:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_uint256_$returns$_t_array$_t_uint256_$2_memory_ptr_$", + "typeString": "function (uint256) view returns (uint256[2] memory)" + } + }, + "id": 1505, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1231:17:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "functionReturnParameters": 1500, + "id": 1506, + "nodeType": "Return", + "src": "1224:24:2" + } + ] + }, + "documentation": "Returns elliptic curve point of the integer representation\nof the hash of the input", + "id": 1508, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "H2", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1495, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1494, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 1508, + "src": "1146:14:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1493, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1146:5:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1145:16:2" + }, + "returnParameters": { + "id": 1500, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1499, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1508, + "src": "1191:17:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1496, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1191:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1498, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1497, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1199:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1191:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1190:19:2" + }, + "scope": 1893, + "src": "1134:121:2", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1614, + "nodeType": "Block", + "src": "1500:579:2", + "statements": [ + { + "assignments": [ + 1527 + ], + "declarations": [ + { + "constant": false, + "id": 1527, + "name": "output", + "nodeType": "VariableDeclaration", + "scope": 1614, + "src": "1636:24:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1525, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1636:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1526, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1524, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1644:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1636:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1528, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1636:24:2" + }, + { + "assignments": [ + 1533 + ], + "declarations": [ + { + "constant": false, + "id": 1533, + "name": "p1", + "nodeType": "VariableDeclaration", + "scope": 1614, + "src": "1670:20:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1531, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1670:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1532, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1530, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1678:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1670:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1534, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1670:20:2" + }, + { + "assignments": [ + 1539 + ], + "declarations": [ + { + "constant": false, + "id": 1539, + "name": "p2", + "nodeType": "VariableDeclaration", + "scope": 1614, + "src": "1700:20:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1537, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1700:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1538, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1536, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1708:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1700:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1540, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1700:20:2" + }, + { + "assignments": [ + 1542 + ], + "declarations": [ + { + "constant": false, + "id": 1542, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 1614, + "src": "1730:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1541, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1730:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1543, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1730:9:2" + }, + { + "assignments": [ + 1545 + ], + "declarations": [ + { + "constant": false, + "id": 1545, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 1614, + "src": "1749:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1544, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1749:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1546, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1749:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1554, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1547, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1542, + "src": "1771:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1548, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1545, + "src": "1774:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1549, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1770:6:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1552, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1516, + "src": "1797:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1550, + "name": "secp256k1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2481, + "src": "1779:9:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_secp256k1_$2481_$", + "typeString": "type(library secp256k1)" + } + }, + "id": 1551, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMultG", + "nodeType": "MemberAccess", + "referencedDeclaration": 2411, + "src": "1779:17:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256) pure returns (uint256,uint256)" + } + }, + "id": 1553, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1779:20:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "1770:29:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1555, + "nodeType": "ExpressionStatement", + "src": "1770:29:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1560, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1556, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1533, + "src": "1810:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1558, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1557, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1813:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1810:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1559, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1542, + "src": "1818:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1810:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1561, + "nodeType": "ExpressionStatement", + "src": "1810:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1566, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1562, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1533, + "src": "1829:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1564, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1563, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1832:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1829:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1565, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1545, + "src": "1837:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1829:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1567, + "nodeType": "ExpressionStatement", + "src": "1829:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1576, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1568, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1542, + "src": "1850:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1569, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1545, + "src": "1853:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1570, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1849:6:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1573, + "name": "pubKey", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1512, + "src": "1875:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1574, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1514, + "src": "1883:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1571, + "name": "secp256k1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2481, + "src": "1858:9:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_secp256k1_$2481_$", + "typeString": "type(library secp256k1)" + } + }, + "id": 1572, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMult", + "nodeType": "MemberAccess", + "referencedDeclaration": 2442, + "src": "1858:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_array$_t_uint256_$2_memory_ptr_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256[2] memory,uint256) pure returns (uint256,uint256)" + } + }, + "id": 1575, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1858:27:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "1849:36:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1577, + "nodeType": "ExpressionStatement", + "src": "1849:36:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1582, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1578, + "name": "p2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1539, + "src": "1896:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1580, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1579, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1899:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1896:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1581, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1542, + "src": "1904:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1896:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1583, + "nodeType": "ExpressionStatement", + "src": "1896:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1588, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1584, + "name": "p2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1539, + "src": "1915:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1586, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1585, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1918:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1915:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1587, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1545, + "src": "1923:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1915:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1589, + "nodeType": "ExpressionStatement", + "src": "1915:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1598, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1590, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1542, + "src": "1936:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1591, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1545, + "src": "1939:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1592, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1935:6:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1595, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1533, + "src": "1974:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1596, + "name": "p2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1539, + "src": "1990:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 1593, + "name": "secp256k1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2481, + "src": "1944:9:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_secp256k1_$2481_$", + "typeString": "type(library secp256k1)" + } + }, + "id": 1594, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecAddd", + "nodeType": "MemberAccess", + "referencedDeclaration": 2480, + "src": "1944:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_array$_t_uint256_$2_memory_ptr_$_t_array$_t_uint256_$2_memory_ptr_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256[2] memory,uint256[2] memory) pure returns (uint256,uint256)" + } + }, + "id": 1597, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1944:58:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "1935:67:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1599, + "nodeType": "ExpressionStatement", + "src": "1935:67:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1604, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1600, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1527, + "src": "2013:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1602, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1601, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2020:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2013:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1603, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1542, + "src": "2025:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2013:13:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1605, + "nodeType": "ExpressionStatement", + "src": "2013:13:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1610, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1606, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1527, + "src": "2036:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1608, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1607, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2043:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2036:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1609, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1545, + "src": "2048:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2036:13:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1611, + "nodeType": "ExpressionStatement", + "src": "2036:13:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1612, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1527, + "src": "2066:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "functionReturnParameters": 1522, + "id": 1613, + "nodeType": "Return", + "src": "2059:13:2" + } + ] + }, + "documentation": "Helper function to calculate Z1\nAvoids stack too deep problem", + "id": 1615, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ringCalcZ1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1517, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1512, + "name": "pubKey", + "nodeType": "VariableDeclaration", + "scope": 1615, + "src": "1379:24:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1509, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1379:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1511, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1510, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1387:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1379:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1514, + "name": "c", + "nodeType": "VariableDeclaration", + "scope": 1615, + "src": "1413:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1513, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1413:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1516, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 1615, + "src": "1432:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1515, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1432:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1369:78:2" + }, + "returnParameters": { + "id": 1522, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1521, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1615, + "src": "1477:17:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1518, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1477:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1520, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1519, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1485:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1477:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1476:19:2" + }, + "scope": 1893, + "src": "1350:729:2", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1726, + "nodeType": "Block", + "src": "2355:586:2", + "statements": [ + { + "assignments": [ + 1638 + ], + "declarations": [ + { + "constant": false, + "id": 1638, + "name": "output", + "nodeType": "VariableDeclaration", + "scope": 1726, + "src": "2494:24:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1636, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2494:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1637, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1635, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2502:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2494:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1639, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2494:24:2" + }, + { + "assignments": [ + 1644 + ], + "declarations": [ + { + "constant": false, + "id": 1644, + "name": "p1", + "nodeType": "VariableDeclaration", + "scope": 1726, + "src": "2528:20:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1642, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2528:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1643, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1641, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2536:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2528:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1645, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2528:20:2" + }, + { + "assignments": [ + 1650 + ], + "declarations": [ + { + "constant": false, + "id": 1650, + "name": "p2", + "nodeType": "VariableDeclaration", + "scope": 1726, + "src": "2558:20:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1648, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2558:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1649, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1647, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2566:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2558:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1651, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2558:20:2" + }, + { + "assignments": [ + 1653 + ], + "declarations": [ + { + "constant": false, + "id": 1653, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 1726, + "src": "2588:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1652, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2588:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1654, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2588:9:2" + }, + { + "assignments": [ + 1656 + ], + "declarations": [ + { + "constant": false, + "id": 1656, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 1726, + "src": "2607:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1655, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2607:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1657, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2607:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1666, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1658, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1653, + "src": "2629:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1659, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1656, + "src": "2632:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1660, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "2628:6:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1663, + "name": "h", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1623, + "src": "2654:1:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1664, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1625, + "src": "2657:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1661, + "name": "secp256k1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2481, + "src": "2637:9:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_secp256k1_$2481_$", + "typeString": "type(library secp256k1)" + } + }, + "id": 1662, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMult", + "nodeType": "MemberAccess", + "referencedDeclaration": 2442, + "src": "2637:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_array$_t_uint256_$2_memory_ptr_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256[2] memory,uint256) pure returns (uint256,uint256)" + } + }, + "id": 1665, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2637:22:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "2628:31:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1667, + "nodeType": "ExpressionStatement", + "src": "2628:31:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1672, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1668, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1644, + "src": "2670:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1670, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1669, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2673:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2670:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1671, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1653, + "src": "2678:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2670:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1673, + "nodeType": "ExpressionStatement", + "src": "2670:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1678, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1674, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1644, + "src": "2689:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1676, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1675, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2692:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2689:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1677, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1656, + "src": "2697:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2689:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1679, + "nodeType": "ExpressionStatement", + "src": "2689:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1688, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1680, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1653, + "src": "2710:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1681, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1656, + "src": "2713:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1682, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "2709:6:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1685, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1619, + "src": "2735:8:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1686, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1627, + "src": "2745:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1683, + "name": "secp256k1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2481, + "src": "2718:9:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_secp256k1_$2481_$", + "typeString": "type(library secp256k1)" + } + }, + "id": 1684, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMult", + "nodeType": "MemberAccess", + "referencedDeclaration": 2442, + "src": "2718:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_array$_t_uint256_$2_memory_ptr_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256[2] memory,uint256) pure returns (uint256,uint256)" + } + }, + "id": 1687, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2718:29:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "2709:38:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1689, + "nodeType": "ExpressionStatement", + "src": "2709:38:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1694, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1690, + "name": "p2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1650, + "src": "2758:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1692, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1691, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2761:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2758:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1693, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1653, + "src": "2766:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2758:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1695, + "nodeType": "ExpressionStatement", + "src": "2758:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1700, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1696, + "name": "p2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1650, + "src": "2777:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1698, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1697, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2780:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2777:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1699, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1656, + "src": "2785:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2777:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1701, + "nodeType": "ExpressionStatement", + "src": "2777:9:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1710, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 1702, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1653, + "src": "2798:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1703, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1656, + "src": "2801:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 1704, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "2797:6:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1707, + "name": "p1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1644, + "src": "2836:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1708, + "name": "p2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1650, + "src": "2852:2:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 1705, + "name": "secp256k1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2481, + "src": "2806:9:2", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_secp256k1_$2481_$", + "typeString": "type(library secp256k1)" + } + }, + "id": 1706, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecAddd", + "nodeType": "MemberAccess", + "referencedDeclaration": 2480, + "src": "2806:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_array$_t_uint256_$2_memory_ptr_$_t_array$_t_uint256_$2_memory_ptr_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256[2] memory,uint256[2] memory) pure returns (uint256,uint256)" + } + }, + "id": 1709, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2806:58:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "2797:67:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1711, + "nodeType": "ExpressionStatement", + "src": "2797:67:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1716, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1712, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1638, + "src": "2875:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1714, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 1713, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2882:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2875:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1715, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1653, + "src": "2887:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2875:13:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1717, + "nodeType": "ExpressionStatement", + "src": "2875:13:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1722, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1718, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1638, + "src": "2898:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1720, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1719, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2905:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2898:9:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1721, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1656, + "src": "2910:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2898:13:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1723, + "nodeType": "ExpressionStatement", + "src": "2898:13:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1724, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1638, + "src": "2928:6:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "functionReturnParameters": 1633, + "id": 1725, + "nodeType": "Return", + "src": "2921:13:2" + } + ] + }, + "documentation": "Helper function to calculate Z2\nAvoids stack too deep problem", + "id": 1727, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ringCalcZ2", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1628, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1619, + "name": "keyImage", + "nodeType": "VariableDeclaration", + "scope": 1727, + "src": "2203:26:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1616, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2203:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1618, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1617, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2211:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2203:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1623, + "name": "h", + "nodeType": "VariableDeclaration", + "scope": 1727, + "src": "2239:19:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1620, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2239:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1622, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1621, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2247:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2239:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1625, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 1727, + "src": "2268:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1624, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2268:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1627, + "name": "c", + "nodeType": "VariableDeclaration", + "scope": 1727, + "src": "2287:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1626, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2287:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2193:109:2" + }, + "returnParameters": { + "id": 1633, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1632, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1727, + "src": "2332:17:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1629, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2332:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1631, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1630, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2340:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2332:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2331:19:2" + }, + "scope": 1893, + "src": "2174:767:2", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1891, + "nodeType": "Block", + "src": "3280:1298:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1752, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1749, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "3316:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1750, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3316:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 1751, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3337:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "3316:22:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "5369676e61747572652073697a6520746f6f20736d616c6c", + "id": 1753, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3340:26:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_b1cd0afb440e018b7a67fba9742102c05aa6bca79e337afd988daba03fb571c1", + "typeString": "literal_string \"Signature size too small\"" + }, + "value": "Signature size too small" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_b1cd0afb440e018b7a67fba9742102c05aa6bca79e337afd988daba03fb571c1", + "typeString": "literal_string \"Signature size too small\"" + } + ], + "id": 1748, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2499, + 2500 + ], + "referencedDeclaration": 2500, + "src": "3308:7:2", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 1754, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3308:59:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1755, + "nodeType": "ExpressionStatement", + "src": "3308:59:2" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1761, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1757, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "3385:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1758, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3385:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1759, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1738, + "src": "3406:1:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 1760, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3406:8:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3385:29:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "5369676e61747572652073697a657320646f206e6f74206d6174636821", + "id": 1762, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3416:31:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_f501dc3294ed158f434bc066f53f10e3fea6c537e2a23b8555646ee77de5b80a", + "typeString": "literal_string \"Signature sizes do not match!\"" + }, + "value": "Signature sizes do not match!" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_f501dc3294ed158f434bc066f53f10e3fea6c537e2a23b8555646ee77de5b80a", + "typeString": "literal_string \"Signature sizes do not match!\"" + } + ], + "id": 1756, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 2499, + 2500 + ], + "referencedDeclaration": 2500, + "src": "3377:7:2", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 1763, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3377:71:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1764, + "nodeType": "ExpressionStatement", + "src": "3377:71:2" + }, + { + "assignments": [ + 1766 + ], + "declarations": [ + { + "constant": false, + "id": 1766, + "name": "c", + "nodeType": "VariableDeclaration", + "scope": 1891, + "src": "3460:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1765, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3460:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1768, + "initialValue": { + "argumentTypes": null, + "id": 1767, + "name": "c0", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1731, + "src": "3472:2:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3460:14:2" + }, + { + "assignments": [ + 1770 + ], + "declarations": [ + { + "constant": false, + "id": 1770, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 1891, + "src": "3484:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1769, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3484:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1772, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 1771, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3496:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "3484:13:2" + }, + { + "assignments": [ + 1774 + ], + "declarations": [ + { + "constant": false, + "id": 1774, + "name": "hBytes", + "nodeType": "VariableDeclaration", + "scope": 1891, + "src": "3566:19:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1773, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3566:5:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1776, + "initialValue": { + "argumentTypes": null, + "hexValue": "", + "id": 1775, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3588:2:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "typeString": "literal_string \"\"" + }, + "value": "" + }, + "nodeType": "VariableDeclarationStatement", + "src": "3566:24:2" + }, + { + "body": { + "id": 1798, + "nodeType": "Block", + "src": "3641:119:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1796, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1788, + "name": "hBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1774, + "src": "3655:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1791, + "name": "hBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1774, + "src": "3698:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1792, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "3722:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1794, + "indexExpression": { + "argumentTypes": null, + "id": 1793, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3733:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3722:13:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory", + "typeString": "uint256[2] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory", + "typeString": "uint256[2] memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 1789, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2483, + "src": "3664:3:2", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 1790, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3664:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 1795, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3664:85:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "src": "3655:94:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 1797, + "nodeType": "ExpressionStatement", + "src": "3655:94:2" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1784, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1781, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3613:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1782, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "3617:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1783, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3617:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3613:21:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1799, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 1779, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1777, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3606:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 1778, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3610:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3606:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1780, + "nodeType": "ExpressionStatement", + "src": "3606:5:2" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 1786, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "3636:3:2", + "subExpression": { + "argumentTypes": null, + "id": 1785, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3636:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1787, + "nodeType": "ExpressionStatement", + "src": "3636:3:2" + }, + "nodeType": "ForStatement", + "src": "3601:159:2" + }, + { + "assignments": [ + 1804 + ], + "declarations": [ + { + "constant": false, + "id": 1804, + "name": "h", + "nodeType": "VariableDeclaration", + "scope": 1891, + "src": "3771:19:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1802, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3771:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1803, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1801, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3779:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "3771:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1808, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1806, + "name": "hBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1774, + "src": "3796:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1805, + "name": "H2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1508, + "src": "3793:2:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes_memory_ptr_$returns$_t_array$_t_uint256_$2_memory_ptr_$", + "typeString": "function (bytes memory) view returns (uint256[2] memory)" + } + }, + "id": 1807, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3793:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3771:32:2" + }, + { + "assignments": [ + 1813 + ], + "declarations": [ + { + "constant": false, + "id": 1813, + "name": "z_1", + "nodeType": "VariableDeclaration", + "scope": 1891, + "src": "3832:21:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1811, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3832:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1812, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1810, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3840:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "3832:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1814, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "3832:21:2" + }, + { + "assignments": [ + 1819 + ], + "declarations": [ + { + "constant": false, + "id": 1819, + "name": "z_2", + "nodeType": "VariableDeclaration", + "scope": 1891, + "src": "3863:21:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1817, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3863:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1818, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1816, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3871:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "3863:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1820, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "3863:21:2" + }, + { + "body": { + "id": 1876, + "nodeType": "Block", + "src": "3936:439:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1842, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1832, + "name": "z_1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1813, + "src": "3951:3:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1834, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "3968:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1836, + "indexExpression": { + "argumentTypes": null, + "id": 1835, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3979:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3968:13:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1837, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1766, + "src": "3983:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1838, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1738, + "src": "3986:1:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 1840, + "indexExpression": { + "argumentTypes": null, + "id": 1839, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3988:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3986:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1833, + "name": "ringCalcZ1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1615, + "src": "3957:10:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_array$_t_uint256_$2_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_array$_t_uint256_$2_memory_ptr_$", + "typeString": "function (uint256[2] memory,uint256,uint256) view returns (uint256[2] memory)" + } + }, + "id": 1841, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3957:34:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "src": "3951:40:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1843, + "nodeType": "ExpressionStatement", + "src": "3951:40:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 1853, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1844, + "name": "z_2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1819, + "src": "4005:3:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1846, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1735, + "src": "4022:8:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1847, + "name": "h", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1804, + "src": "4032:1:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 1848, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1738, + "src": "4035:1:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 1850, + "indexExpression": { + "argumentTypes": null, + "id": 1849, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "4037:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "4035:4:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 1851, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1766, + "src": "4041:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 1845, + "name": "ringCalcZ2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1727, + "src": "4011:10:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_array$_t_uint256_$2_memory_ptr_$_t_array$_t_uint256_$2_memory_ptr_$_t_uint256_$_t_uint256_$returns$_t_array$_t_uint256_$2_memory_ptr_$", + "typeString": "function (uint256[2] memory,uint256[2] memory,uint256,uint256) view returns (uint256[2] memory)" + } + }, + "id": 1852, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4011:32:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "src": "4005:38:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 1854, + "nodeType": "ExpressionStatement", + "src": "4005:38:2" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1860, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1855, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "4062:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1859, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1856, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "4067:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1857, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4067:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 1858, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4087:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "src": "4067:21:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4062:26:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 1875, + "nodeType": "IfStatement", + "src": "4058:307:2", + "trueBody": { + "id": 1874, + "nodeType": "Block", + "src": "4090:275:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1872, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1861, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1766, + "src": "4108:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1865, + "name": "hBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1774, + "src": "4178:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 1866, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1735, + "src": "4210:8:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1867, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1729, + "src": "4244:7:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 1868, + "name": "z_1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1813, + "src": "4277:3:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1869, + "name": "z_2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1819, + "src": "4306:3:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 1863, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2483, + "src": "4136:3:2", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 1864, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4136:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 1870, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4136:195:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1862, + "name": "H1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1492, + "src": "4112:2:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$returns$_t_uint256_$", + "typeString": "function (bytes memory) pure returns (uint256)" + } + }, + "id": 1871, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4112:237:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4108:241:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1873, + "nodeType": "ExpressionStatement", + "src": "4108:241:2" + } + ] + } + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1828, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1825, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3908:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1826, + "name": "publicKeys", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1743, + "src": "3912:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2] memory[] memory" + } + }, + "id": 1827, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "3912:17:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3908:21:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 1877, + "initializationExpression": { + "expression": { + "argumentTypes": null, + "id": 1823, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1821, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3901:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "30", + "id": 1822, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3905:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "3901:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1824, + "nodeType": "ExpressionStatement", + "src": "3901:5:2" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 1830, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "3931:3:2", + "subExpression": { + "argumentTypes": null, + "id": 1829, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1770, + "src": "3931:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1831, + "nodeType": "ExpressionStatement", + "src": "3931:3:2" + }, + "nodeType": "ForStatement", + "src": "3896:479:2" + }, + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 1889, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 1878, + "name": "c0", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1731, + "src": "4392:2:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1882, + "name": "hBytes", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1774, + "src": "4448:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 1883, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1735, + "src": "4472:8:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1884, + "name": "message", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1729, + "src": "4498:7:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 1885, + "name": "z_1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1813, + "src": "4523:3:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + { + "argumentTypes": null, + "id": 1886, + "name": "z_2", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1819, + "src": "4544:3:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + }, + { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 1880, + "name": "abi", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2483, + "src": "4414:3:2", + "typeDescriptions": { + "typeIdentifier": "t_magic_abi", + "typeString": "abi" + } + }, + "id": 1881, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "memberName": "encodePacked", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "4414:16:2", + "typeDescriptions": { + "typeIdentifier": "t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$", + "typeString": "function () pure returns (bytes memory)" + } + }, + "id": 1887, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4414:147:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 1879, + "name": "H1", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1492, + "src": "4398:2:2", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$returns$_t_uint256_$", + "typeString": "function (bytes memory) pure returns (uint256)" + } + }, + "id": 1888, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4398:173:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4392:179:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 1747, + "id": 1890, + "nodeType": "Return", + "src": "4385:186:2" + } + ] + }, + "documentation": "Verifies the ring signature\nSection 4.2 of the paper https://eprint.iacr.org/2004/027.pdf", + "id": 1892, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "verify", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1744, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1729, + "name": "message", + "nodeType": "VariableDeclaration", + "scope": 1892, + "src": "3090:20:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 1728, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3090:5:2", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1731, + "name": "c0", + "nodeType": "VariableDeclaration", + "scope": 1892, + "src": "3120:10:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1730, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3120:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1735, + "name": "keyImage", + "nodeType": "VariableDeclaration", + "scope": 1892, + "src": "3140:26:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 1732, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3140:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1734, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1733, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3148:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "3140:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1738, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 1892, + "src": "3176:18:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 1736, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3176:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1737, + "length": null, + "nodeType": "ArrayTypeName", + "src": "3176:9:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 1743, + "name": "publicKeys", + "nodeType": "VariableDeclaration", + "scope": 1892, + "src": "3204:30:2", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_memory_$dyn_memory_ptr", + "typeString": "uint256[2][]" + }, + "typeName": { + "baseType": { + "baseType": { + "id": 1739, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3204:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1741, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 1740, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3212:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "3204:10:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "id": 1742, + "length": null, + "nodeType": "ArrayTypeName", + "src": "3204:12:2", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_array$_t_uint256_$2_storage_$dyn_storage_ptr", + "typeString": "uint256[2][]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3080:160:2" + }, + "returnParameters": { + "id": 1747, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1746, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 1892, + "src": "3270:4:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 1745, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3270:4:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3269:6:2" + }, + "scope": 1893, + "src": "3065:1513:2", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 1894, + "src": "168:4412:2" + } + ], + "src": "0:4580:2" + }, + "compiler": { + "name": "solc", + "version": "0.5.8+commit.23d335f2.Emscripten.clang" + }, + "networks": { + "1570892867630": { + "events": {}, + "links": { + "AltBn128": "0xB3D8962B6e2EE1Ea92e915437B05904c4BFb405a", + "secp256k1": "0x0f25859348F1b6C66b5F8Eb0cc2dDfdda1944875" + }, + "address": "0xE17E5581e0cbf613d63b9Cc5Ae56A4011eE63b85", + "transactionHash": "0xbfab139502a92dd61160e717575c4afc06227b80ac4e6f5afb4f6c0da14a6f9c" + }, + "1570921815108": { + "events": {}, + "links": { + "AltBn128": "0x4E85ebd453c75dd7ED5C47D35c6511fE9BfD6527", + "secp256k1": "0xCAE17a18265fA4115185F4E8e788815896be2098" + }, + "address": "0x7A4f782e8D568EB7ADcA2cE77D1078eD9379f61f", + "transactionHash": "0x172bd4404f3d522a117d104553c27546942d9b8d695dd4c9fd76f7166e2d550a" + }, + "1570922470877": { + "events": {}, + "links": { + "AltBn128": "0x3a2E75212344761155848563a43c7f1fb2C32ceD", + "secp256k1": "0x86EBb7bCb731CEc36681E98e349b719D5EfCd3B9" + }, + "address": "0xC2AD255B0BAfe57C867271b0D6ccCE6694030EB8", + "transactionHash": "0x61cfe115781694e2e5ef337857de377eee1c94a003bc808e384ded5ecfdcb93b" + }, + "1570923244533": { + "events": {}, + "links": { + "AltBn128": "0x952C306A57457C5Ab7d5b5fB7130c149deC76f66", + "secp256k1": "0xdf59BC02817eCbC4b263dCb6576Becf19BD5f15d" + }, + "address": "0xEA7be366e4733E1c7d9183788a19613DbA79FF3d", + "transactionHash": "0xa1fc17a29f84c2539bfa8cff087f6b19c85d5e46d507cfdf0d28443f2b851969" + } + }, + "schemaVersion": "3.0.16", + "updatedAt": "2019-10-12T23:34:13.061Z", + "devdoc": { + "methods": {} + }, + "userdoc": { + "methods": { + "H1(bytes)": { + "notice": "Returns an integer representation of the hash of the input" + }, + "H2(bytes)": { + "notice": "Returns elliptic curve point of the integer representation of the hash of the input" + }, + "intToPoint(uint256)": { + "notice": "Converts an integer to an elliptic curve point" + }, + "ringCalcZ1(uint256[2],uint256,uint256)": { + "notice": "Helper function to calculate Z1 Avoids stack too deep problem" + }, + "ringCalcZ2(uint256[2],uint256[2],uint256,uint256)": { + "notice": "Helper function to calculate Z2 Avoids stack too deep problem" + }, + "verify(bytes,uint256,uint256[2],uint256[],uint256[2][])": { + "notice": "Verifies the ring signature Section 4.2 of the paper https://eprint.iacr.org/2004/027.pdf" + } + } + } +} \ No newline at end of file diff --git a/build/contracts/Migrations.json b/build/contracts/Migrations.json new file mode 100644 index 0000000..80cddee --- /dev/null +++ b/build/contracts/Migrations.json @@ -0,0 +1,1410 @@ +{ + "contractName": "Migrations", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "last_completed_migration", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "constant": false, + "inputs": [ + { + "name": "completed", + "type": "uint256" + } + ], + "name": "setCompleted", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "new_address", + "type": "address" + } + ], + "name": "upgrade", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[{\"name\":\"new_address\",\"type\":\"address\"}],\"name\":\"upgrade\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"last_completed_migration\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"completed\",\"type\":\"uint256\"}],\"name\":\"setCompleted\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/Migrations.sol\":\"Migrations\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/Migrations.sol\":{\"keccak256\":\"0xfdb731592344e2a2890faf03baec7b4bee7057ffba18ba6dbb6eec8db85f8f4c\",\"urls\":[\"bzzr://ddc8801d0a2a7220c2c9bf3881b4921817e72fdd96827ec8be4428fa009ace07\"]}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102ae806100606000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a72305820160861a6644090a2a2f8b206640716ff5c56fbe1ddf465176cdf3e76fd3d36f30029", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80630900f01014610051578063445df0ac146100955780638da5cb5b146100b3578063fdacd576146100fd575b600080fd5b6100936004803603602081101561006757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061012b565b005b61009d6101f7565b6040518082815260200191505060405180910390f35b6100bb6101fd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101296004803603602081101561011357600080fd5b8101908080359060200190929190505050610222565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101f45760008190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156101da57600080fd5b505af11580156101ee573d6000803e3d6000fd5b50505050505b50565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561027f57806001819055505b5056fea165627a7a72305820160861a6644090a2a2f8b206640716ff5c56fbe1ddf465176cdf3e76fd3d36f30029", + "sourceMap": "34:480:3:-;;;123:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;123:50:3;158:10;150:5;;:18;;;;;;;;;;;;;;;;;;34:480;;;;;;", + "deployedSourceMap": "34:480:3:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;34:480:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;347:165:3;;;;;;;;;;;;;;;;;;;:::i;:::-;;82:36;;;:::i;:::-;;;;;;;;;;;;;;;;;;;58:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;240:103;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;240:103:3;;;;;;;;;;;;;;;;;:::i;:::-;;347:165;223:5;;;;;;;;;;;209:19;;:10;:19;;;205:26;;;409:19;442:11;409:45;;460:8;:21;;;482:24;;460:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;460:47:3;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;460:47:3;;;;230:1;205:26;347:165;:::o;82:36::-;;;;:::o;58:20::-;;;;;;;;;;;;;:::o;240:103::-;223:5;;;;;;;;;;;209:19;;:10;:19;;;205:26;;;329:9;302:24;:36;;;;205:26;240:103;:::o", + "source": "pragma solidity >=0.4.21 <0.6.0;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n constructor() public {\n owner = msg.sender;\n }\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n", + "sourcePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/Migrations.sol", + "ast": { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/Migrations.sol", + "exportedSymbols": { + "Migrations": [ + 1950 + ] + }, + "id": 1951, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1895, + "literals": [ + "solidity", + ">=", + "0.4", + ".21", + "<", + "0.6", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:32:3" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 1950, + "linearizedBaseContracts": [ + 1950 + ], + "name": "Migrations", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 1897, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 1950, + "src": "58:20:3", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 1896, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "58:7:3", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 1899, + "name": "last_completed_migration", + "nodeType": "VariableDeclaration", + "scope": 1950, + "src": "82:36:3", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1898, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "82:4:3", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "body": { + "id": 1907, + "nodeType": "Block", + "src": "144:29:3", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1905, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1902, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1897, + "src": "150:5:3", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1903, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2489, + "src": "158:3:3", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 1904, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "158:10:3", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "src": "150:18:3", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 1906, + "nodeType": "ExpressionStatement", + "src": "150:18:3" + } + ] + }, + "documentation": null, + "id": 1908, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1900, + "nodeType": "ParameterList", + "parameters": [], + "src": "134:2:3" + }, + "returnParameters": { + "id": 1901, + "nodeType": "ParameterList", + "parameters": [], + "src": "144:0:3" + }, + "scope": 1950, + "src": "123:50:3", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1916, + "nodeType": "Block", + "src": "199:37:3", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 1913, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1910, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2489, + "src": "209:3:3", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 1911, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "209:10:3", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 1912, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1897, + "src": "223:5:3", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "209:19:3", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 1915, + "nodeType": "IfStatement", + "src": "205:26:3", + "trueBody": { + "id": 1914, + "nodeType": "PlaceholderStatement", + "src": "230:1:3" + } + } + ] + }, + "documentation": null, + "id": 1917, + "name": "restricted", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 1909, + "nodeType": "ParameterList", + "parameters": [], + "src": "196:2:3" + }, + "src": "177:59:3", + "visibility": "internal" + }, + { + "body": { + "id": 1928, + "nodeType": "Block", + "src": "296:47:3", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1926, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1924, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1899, + "src": "302:24:3", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1925, + "name": "completed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1919, + "src": "329:9:3", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "302:36:3", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1927, + "nodeType": "ExpressionStatement", + "src": "302:36:3" + } + ] + }, + "documentation": null, + "id": 1929, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "arguments": null, + "id": 1922, + "modifierName": { + "argumentTypes": null, + "id": 1921, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1917, + "src": "285:10:3", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "285:10:3" + } + ], + "name": "setCompleted", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1920, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1919, + "name": "completed", + "nodeType": "VariableDeclaration", + "scope": 1929, + "src": "262:14:3", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1918, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "262:4:3", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "261:16:3" + }, + "returnParameters": { + "id": 1923, + "nodeType": "ParameterList", + "parameters": [], + "src": "296:0:3" + }, + "scope": 1950, + "src": "240:103:3", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1948, + "nodeType": "Block", + "src": "403:109:3", + "statements": [ + { + "assignments": [ + 1937 + ], + "declarations": [ + { + "constant": false, + "id": 1937, + "name": "upgraded", + "nodeType": "VariableDeclaration", + "scope": 1948, + "src": "409:19:3", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$1950", + "typeString": "contract Migrations" + }, + "typeName": { + "contractScope": null, + "id": 1936, + "name": "Migrations", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 1950, + "src": "409:10:3", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$1950", + "typeString": "contract Migrations" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1941, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1939, + "name": "new_address", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1931, + "src": "442:11:3", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 1938, + "name": "Migrations", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1950, + "src": "431:10:3", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Migrations_$1950_$", + "typeString": "type(contract Migrations)" + } + }, + "id": 1940, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "431:23:3", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$1950", + "typeString": "contract Migrations" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "409:45:3" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1945, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1899, + "src": "482:24:3", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1942, + "name": "upgraded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1937, + "src": "460:8:3", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$1950", + "typeString": "contract Migrations" + } + }, + "id": 1944, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "setCompleted", + "nodeType": "MemberAccess", + "referencedDeclaration": 1929, + "src": "460:21:3", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256) external" + } + }, + "id": 1946, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "460:47:3", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1947, + "nodeType": "ExpressionStatement", + "src": "460:47:3" + } + ] + }, + "documentation": null, + "id": 1949, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "arguments": null, + "id": 1934, + "modifierName": { + "argumentTypes": null, + "id": 1933, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1917, + "src": "392:10:3", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "392:10:3" + } + ], + "name": "upgrade", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1932, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1931, + "name": "new_address", + "nodeType": "VariableDeclaration", + "scope": 1949, + "src": "364:19:3", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 1930, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "364:7:3", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "363:21:3" + }, + "returnParameters": { + "id": 1935, + "nodeType": "ParameterList", + "parameters": [], + "src": "403:0:3" + }, + "scope": 1950, + "src": "347:165:3", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 1951, + "src": "34:480:3" + } + ], + "src": "0:515:3" + }, + "legacyAST": { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/Migrations.sol", + "exportedSymbols": { + "Migrations": [ + 1950 + ] + }, + "id": 1951, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1895, + "literals": [ + "solidity", + ">=", + "0.4", + ".21", + "<", + "0.6", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:32:3" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 1950, + "linearizedBaseContracts": [ + 1950 + ], + "name": "Migrations", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 1897, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 1950, + "src": "58:20:3", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 1896, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "58:7:3", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 1899, + "name": "last_completed_migration", + "nodeType": "VariableDeclaration", + "scope": 1950, + "src": "82:36:3", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1898, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "82:4:3", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "body": { + "id": 1907, + "nodeType": "Block", + "src": "144:29:3", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1905, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1902, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1897, + "src": "150:5:3", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1903, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2489, + "src": "158:3:3", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 1904, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "158:10:3", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "src": "150:18:3", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 1906, + "nodeType": "ExpressionStatement", + "src": "150:18:3" + } + ] + }, + "documentation": null, + "id": 1908, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1900, + "nodeType": "ParameterList", + "parameters": [], + "src": "134:2:3" + }, + "returnParameters": { + "id": 1901, + "nodeType": "ParameterList", + "parameters": [], + "src": "144:0:3" + }, + "scope": 1950, + "src": "123:50:3", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1916, + "nodeType": "Block", + "src": "199:37:3", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 1913, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 1910, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2489, + "src": "209:3:3", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 1911, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "209:10:3", + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 1912, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1897, + "src": "223:5:3", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "209:19:3", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 1915, + "nodeType": "IfStatement", + "src": "205:26:3", + "trueBody": { + "id": 1914, + "nodeType": "PlaceholderStatement", + "src": "230:1:3" + } + } + ] + }, + "documentation": null, + "id": 1917, + "name": "restricted", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 1909, + "nodeType": "ParameterList", + "parameters": [], + "src": "196:2:3" + }, + "src": "177:59:3", + "visibility": "internal" + }, + { + "body": { + "id": 1928, + "nodeType": "Block", + "src": "296:47:3", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 1926, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 1924, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1899, + "src": "302:24:3", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 1925, + "name": "completed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1919, + "src": "329:9:3", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "302:36:3", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 1927, + "nodeType": "ExpressionStatement", + "src": "302:36:3" + } + ] + }, + "documentation": null, + "id": 1929, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "arguments": null, + "id": 1922, + "modifierName": { + "argumentTypes": null, + "id": 1921, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1917, + "src": "285:10:3", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "285:10:3" + } + ], + "name": "setCompleted", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1920, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1919, + "name": "completed", + "nodeType": "VariableDeclaration", + "scope": 1929, + "src": "262:14:3", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 1918, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "262:4:3", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "261:16:3" + }, + "returnParameters": { + "id": 1923, + "nodeType": "ParameterList", + "parameters": [], + "src": "296:0:3" + }, + "scope": 1950, + "src": "240:103:3", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 1948, + "nodeType": "Block", + "src": "403:109:3", + "statements": [ + { + "assignments": [ + 1937 + ], + "declarations": [ + { + "constant": false, + "id": 1937, + "name": "upgraded", + "nodeType": "VariableDeclaration", + "scope": 1948, + "src": "409:19:3", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$1950", + "typeString": "contract Migrations" + }, + "typeName": { + "contractScope": null, + "id": 1936, + "name": "Migrations", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 1950, + "src": "409:10:3", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$1950", + "typeString": "contract Migrations" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 1941, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1939, + "name": "new_address", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1931, + "src": "442:11:3", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 1938, + "name": "Migrations", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1950, + "src": "431:10:3", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Migrations_$1950_$", + "typeString": "type(contract Migrations)" + } + }, + "id": 1940, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "431:23:3", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$1950", + "typeString": "contract Migrations" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "409:45:3" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 1945, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1899, + "src": "482:24:3", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 1942, + "name": "upgraded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1937, + "src": "460:8:3", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$1950", + "typeString": "contract Migrations" + } + }, + "id": 1944, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "setCompleted", + "nodeType": "MemberAccess", + "referencedDeclaration": 1929, + "src": "460:21:3", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256) external" + } + }, + "id": 1946, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "460:47:3", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 1947, + "nodeType": "ExpressionStatement", + "src": "460:47:3" + } + ] + }, + "documentation": null, + "id": 1949, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "arguments": null, + "id": 1934, + "modifierName": { + "argumentTypes": null, + "id": 1933, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1917, + "src": "392:10:3", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "392:10:3" + } + ], + "name": "upgrade", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 1932, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 1931, + "name": "new_address", + "nodeType": "VariableDeclaration", + "scope": 1949, + "src": "364:19:3", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 1930, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "364:7:3", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "363:21:3" + }, + "returnParameters": { + "id": 1935, + "nodeType": "ParameterList", + "parameters": [], + "src": "403:0:3" + }, + "scope": 1950, + "src": "347:165:3", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 1951, + "src": "34:480:3" + } + ], + "src": "0:515:3" + }, + "compiler": { + "name": "solc", + "version": "0.5.8+commit.23d335f2.Emscripten.clang" + }, + "networks": { + "1570892867630": { + "events": {}, + "links": {}, + "address": "0x1dddFdcd11dBd16FF1B66Bb3764173f48aFd196C", + "transactionHash": "0xa17559b73607c5bcc6fc2bafed2e4fc03d8309bc3a1883216b3f7570f493a01a" + }, + "1570921815108": { + "events": {}, + "links": {}, + "address": "0xe073EFd3CEC19E8fA30BF8eBC3e19CFa5A62c7B6", + "transactionHash": "0x24f531ef19729d3863a3235192df3172723768a97b0c3e4b9fbf0b99d14b9fdd" + }, + "1570922470877": { + "events": {}, + "links": {}, + "address": "0x4f151E7Faa001cFf78994F087C4414C1e7083314", + "transactionHash": "0xd0cdc540ce3d0cd7827d243fe47b79e5ba52699354fe636c6a00787c8cadcfce" + }, + "1570923244533": { + "events": {}, + "links": {}, + "address": "0x918A1ad90d75337f7Fa37df8A74AAD6d921F8557", + "transactionHash": "0x4c0c4d8eccd6e18b660a49351dc0bfa942462ba48e2011f5fa62327ffa555273" + } + }, + "schemaVersion": "3.0.16", + "updatedAt": "2019-10-12T23:34:13.095Z", + "devdoc": { + "methods": {} + }, + "userdoc": { + "methods": {} + } +} \ No newline at end of file diff --git a/build/contracts/secp256k1.json b/build/contracts/secp256k1.json new file mode 100644 index 0000000..a5ed73b --- /dev/null +++ b/build/contracts/secp256k1.json @@ -0,0 +1,3865 @@ +{ + "contractName": "secp256k1", + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "privKey", + "type": "uint256" + } + ], + "name": "derivePubKey", + "outputs": [ + { + "name": "qx", + "type": "uint256" + }, + { + "name": "qy", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "s", + "type": "uint256" + } + ], + "name": "ecMultG", + "outputs": [ + { + "name": "qx", + "type": "uint256" + }, + { + "name": "qy", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "keyImage", + "type": "uint256[2]" + }, + { + "name": "s", + "type": "uint256" + } + ], + "name": "ecMult", + "outputs": [ + { + "name": "qx", + "type": "uint256" + }, + { + "name": "qy", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "x", + "type": "uint256[2]" + }, + { + "name": "y", + "type": "uint256[2]" + } + ], + "name": "ecAddd", + "outputs": [ + { + "name": "qx", + "type": "uint256" + }, + { + "name": "qy", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "pure", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.5.8+commit.23d335f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"name\":\"privKey\",\"type\":\"uint256\"}],\"name\":\"derivePubKey\",\"outputs\":[{\"name\":\"qx\",\"type\":\"uint256\"},{\"name\":\"qy\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"s\",\"type\":\"uint256\"}],\"name\":\"ecMultG\",\"outputs\":[{\"name\":\"qx\",\"type\":\"uint256\"},{\"name\":\"qy\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"x\",\"type\":\"uint256[2]\"},{\"name\":\"y\",\"type\":\"uint256[2]\"}],\"name\":\"ecAddd\",\"outputs\":[{\"name\":\"qx\",\"type\":\"uint256\"},{\"name\":\"qy\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"keyImage\",\"type\":\"uint256[2]\"},{\"name\":\"s\",\"type\":\"uint256\"}],\"name\":\"ecMult\",\"outputs\":[{\"name\":\"qx\",\"type\":\"uint256\"},{\"name\":\"qy\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Witnet Foundation\",\"methods\":{\"derivePubKey(uint256)\":{\"details\":\"Public Key derivation from private key\",\"params\":{\"privKey\":\"The private key\"},\"return\":\"(qx, qy) The Public Key\"}},\"title\":\"Secp256k1 Elliptic Curve\"},\"userdoc\":{\"methods\":{},\"notice\":\"Example of particularization of Elliptic Curve for secp256k1 curve\"}},\"settings\":{\"compilationTarget\":{\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/secp256k1.sol\":\"secp256k1\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/EllipticCurve.sol\":{\"keccak256\":\"0x266a80e64a3a30ac323911cfe04db54b397ba50301bf889172dbe2363c9c6ac6\",\"urls\":[\"bzzr://430d8d98304bb333e393bbc864df528b56a26375b138711049a30d33d5cc2925\"]},\"/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/secp256k1.sol\":{\"keccak256\":\"0x22177ffc23e5a8bf0ca84b50e07cdae72102fe969f6eb287f6dd6e093a20dd9b\",\"urls\":[\"bzzr://78243287b410cfac54b97316d074571fe70916e9090e3e85d271d25c8bb66cff\"]}},\"version\":1}", + "bytecode": "0x6106e6610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c8063bc9e2bcf1461005b578063c0181914146100a4578063cf864620146100ed578063f75f2060146101ae575b600080fd5b6100876004803603602081101561007157600080fd5b8101908080359060200190929190505050610238565b604051808381526020018281526020019250505060405180910390f35b6100d0600480360360208110156100ba57600080fd5b810190808035906020019092919050505061035c565b604051808381526020018281526020019250505060405180910390f35b6101916004803603608081101561010357600080fd5b8101908080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f820116905080830192505050505050919291929080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050509192919290505050610480565b604051808381526020018281526020019250505060405180910390f35b61021b600480360360608110156101c457600080fd5b8101908080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050509192919290803590602001909291905050506105b2565b604051808381526020018281526020019250505060405180910390f35b60008073__EllipticCurve_________________________63364b62d5847f79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817987f483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b860007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f6040518663ffffffff1660e01b81526004018086815260200185815260200184815260200183815260200182815260200195505050505050604080518083038186803b15801561030a57600080fd5b505af415801561031e573d6000803e3d6000fd5b505050506040513d604081101561033457600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050915091565b60008073__EllipticCurve_________________________63364b62d5847f79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817987f483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b860007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f6040518663ffffffff1660e01b81526004018086815260200185815260200184815260200183815260200182815260200195505050505050604080518083038186803b15801561042e57600080fd5b505af4158015610442573d6000803e3d6000fd5b505050506040513d604081101561045857600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050915091565b60008073__EllipticCurve_________________________63c5e45aa4856000600281106104aa57fe5b6020020151866001600281106104bc57fe5b6020020151866000600281106104ce57fe5b6020020151876001600281106104e057fe5b602002015160007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f6040518763ffffffff1660e01b8152600401808781526020018681526020018581526020018481526020018381526020018281526020019650505050505050604080518083038186803b15801561055e57600080fd5b505af4158015610572573d6000803e3d6000fd5b505050506040513d604081101561058857600080fd5b81019080805190602001909291908051906020019092919050505080925081935050509250929050565b60008073__EllipticCurve_________________________63364b62d584866000600281106105dd57fe5b6020020151876001600281106105ef57fe5b602002015160007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f6040518663ffffffff1660e01b81526004018086815260200185815260200184815260200183815260200182815260200195505050505050604080518083038186803b15801561066657600080fd5b505af415801561067a573d6000803e3d6000fd5b505050506040513d604081101561069057600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050925092905056fea165627a7a72305820576c0c75f4e6d0deb87b18e13397449ddb5e4e654320158642475bb73239551a0029", + "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c8063bc9e2bcf1461005b578063c0181914146100a4578063cf864620146100ed578063f75f2060146101ae575b600080fd5b6100876004803603602081101561007157600080fd5b8101908080359060200190929190505050610238565b604051808381526020018281526020019250505060405180910390f35b6100d0600480360360208110156100ba57600080fd5b810190808035906020019092919050505061035c565b604051808381526020018281526020019250505060405180910390f35b6101916004803603608081101561010357600080fd5b8101908080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f820116905080830192505050505050919291929080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050509192919290505050610480565b604051808381526020018281526020019250505060405180910390f35b61021b600480360360608110156101c457600080fd5b8101908080604001906002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050509192919290803590602001909291905050506105b2565b604051808381526020018281526020019250505060405180910390f35b60008073__EllipticCurve_________________________63364b62d5847f79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817987f483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b860007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f6040518663ffffffff1660e01b81526004018086815260200185815260200184815260200183815260200182815260200195505050505050604080518083038186803b15801561030a57600080fd5b505af415801561031e573d6000803e3d6000fd5b505050506040513d604081101561033457600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050915091565b60008073__EllipticCurve_________________________63364b62d5847f79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817987f483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b860007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f6040518663ffffffff1660e01b81526004018086815260200185815260200184815260200183815260200182815260200195505050505050604080518083038186803b15801561042e57600080fd5b505af4158015610442573d6000803e3d6000fd5b505050506040513d604081101561045857600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050915091565b60008073__EllipticCurve_________________________63c5e45aa4856000600281106104aa57fe5b6020020151866001600281106104bc57fe5b6020020151866000600281106104ce57fe5b6020020151876001600281106104e057fe5b602002015160007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f6040518763ffffffff1660e01b8152600401808781526020018681526020018581526020018481526020018381526020018281526020019650505050505050604080518083038186803b15801561055e57600080fd5b505af4158015610572573d6000803e3d6000fd5b505050506040513d604081101561058857600080fd5b81019080805190602001909291908051906020019092919050505080925081935050509250929050565b60008073__EllipticCurve_________________________63364b62d584866000600281106105dd57fe5b6020020151876001600281106105ef57fe5b602002015160007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f6040518663ffffffff1660e01b81526004018086815260200185815260200184815260200183815260200182815260200195505050505050604080518083038186803b15801561066657600080fd5b505af415801561067a573d6000803e3d6000fd5b505050506040513d604081101561069057600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050925092905056fea165627a7a72305820576c0c75f4e6d0deb87b18e13397449ddb5e4e654320158642475bb73239551a0029", + "sourceMap": "215:1278:5:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24", + "deployedSourceMap": "215:1278:5:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;694:185;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;694:185:5;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;883:168;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;883:168:5;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;1272:217;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;1272:217:5;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;1272:217:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;1272:217:5;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;1055:213;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1055:213:5;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;1055:213:5;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;694:185;753:10;765;794:13;:19;821:7;260:66;352;444:1;498:66;794:80;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;794:80:5;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;794:80:5;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;794:80:5;;;;;;;;;;;;;;;;;;;;;;;;;783:91;;;;;;;;694:185;;;:::o;883:168::-;931:10;943;972:13;:19;999:1;260:66;352;444:1;498:66;972:74;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;972:74:5;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;972:74:5;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;972:74:5;;;;;;;;;;;;;;;;;;;;;;;;;961:85;;;;;;;;883:168;;;:::o;1272:217::-;1350:10;1362;1391:13;:19;1418:1;1420;1418:4;;;;;;;;;;;1430:1;1432;1430:4;;;;;;;;;;;1442:1;1444;1442:4;;;;;;;;;;;1454:1;1456;1454:4;;;;;;;;;;;444:1;498:66;1391:93;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1391:93:5;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1391:93:5;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1391:93:5;;;;;;;;;;;;;;;;;;;;;;;;;1380:104;;;;;;;;1272:217;;;;;:::o;1055:213::-;1130:10;1142;1171:13;:19;1198:1;1207:8;1216:1;1207:11;;;;;;;;;;;1226:8;1235:1;1226:11;;;;;;;;;;;444:1;498:66;1171:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1171:92:5;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1171:92:5;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1171:92:5;;;;;;;;;;;;;;;;;;;;;;;;;1160:103;;;;;;;;1055:213;;;;;:::o", + "source": "pragma solidity >=0.4.0 <0.6.0;\n\nimport \"./EllipticCurve.sol\";\n\n\n/**\n * @title Secp256k1 Elliptic Curve\n * @notice Example of particularization of Elliptic Curve for secp256k1 curve\n * @author Witnet Foundation\n */\nlibrary secp256k1 {\n\n uint256 constant GX = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798;\n uint256 constant GY = 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8;\n uint256 constant AA = 0;\n uint256 constant BB = 7;\n uint256 constant PP = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F;\n\n /// @dev Public Key derivation from private key\n /// @param privKey The private key\n /// @return (qx, qy) The Public Key\n function derivePubKey(uint256 privKey) public pure returns(uint256 qx, uint256 qy) {\n (qx, qy) = EllipticCurve.ecMul(\n privKey,\n GX,\n GY,\n AA,\n PP\n );\n }\n\n function ecMultG(uint256 s) public pure returns(uint256 qx, uint256 qy) {\n (qx, qy) = EllipticCurve.ecMul(\n s,\n GX,\n GY,\n AA,\n PP\n );\n }\n\n function ecMult(uint256[2] memory keyImage, uint256 s) public pure returns(uint256 qx, uint256 qy) {\n (qx, qy) = EllipticCurve.ecMul(\n s,\n keyImage[0],\n keyImage[1],\n AA,\n PP\n );\n }\n\n function ecAddd(uint256[2] memory x, uint256[2] memory y) public pure returns(uint256 qx, uint256 qy) {\n (qx, qy) = EllipticCurve.ecAdd(\n x[0],\n x[1],\n y[0],\n y[1],\n AA,\n PP\n );\n }\n\n\n}", + "sourcePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/secp256k1.sol", + "ast": { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/secp256k1.sol", + "exportedSymbols": { + "secp256k1": [ + 2474 + ] + }, + "id": 2475, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 2342, + "literals": [ + "solidity", + ">=", + "0.4", + ".0", + "<", + "0.6", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:31:5" + }, + { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/EllipticCurve.sol", + "file": "./EllipticCurve.sol", + "id": 2343, + "nodeType": "ImportDirective", + "scope": 2475, + "sourceUnit": 1421, + "src": "33:29:5", + "symbolAliases": [], + "unitAlias": "" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": "@title Secp256k1 Elliptic Curve\n@notice Example of particularization of Elliptic Curve for secp256k1 curve\n@author Witnet Foundation", + "fullyImplemented": true, + "id": 2474, + "linearizedBaseContracts": [ + 2474 + ], + "name": "secp256k1", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": true, + "id": 2346, + "name": "GX", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "238:88:5", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2344, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "238:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "307837394245363637454639444342424143353541303632393543453837304230373032394246434442324443453238443935394632383135423136463831373938", + "id": 2345, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "260:66:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_55066263022277343669578718895168534326250603453777594175500187360389116729240_by_1", + "typeString": "int_const 5506...(69 digits omitted)...9240" + }, + "value": "0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798" + }, + "visibility": "internal" + }, + { + "constant": true, + "id": 2349, + "name": "GY", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "330:88:5", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2347, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "330:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "307834383341444137373236413343343635354441344642464330453131303841384644313742343438413638353534313939433437443038464642313044344238", + "id": 2348, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "352:66:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_32670510020758816978083085130507043184471273380659243275938904335757337482424_by_1", + "typeString": "int_const 3267...(69 digits omitted)...2424" + }, + "value": "0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8" + }, + "visibility": "internal" + }, + { + "constant": true, + "id": 2352, + "name": "AA", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "422:23:5", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2350, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "422:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "30", + "id": 2351, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "444:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "visibility": "internal" + }, + { + "constant": true, + "id": 2355, + "name": "BB", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "449:23:5", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2353, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "449:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "37", + "id": 2354, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "471:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_7_by_1", + "typeString": "int_const 7" + }, + "value": "7" + }, + "visibility": "internal" + }, + { + "constant": true, + "id": 2358, + "name": "PP", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "476:88:5", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2356, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "476:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "307846464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646454646464646433246", + "id": 2357, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "498:66:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_115792089237316195423570985008687907853269984665640564039457584007908834671663_by_1", + "typeString": "int_const 1157...(70 digits omitted)...1663" + }, + "value": "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F" + }, + "visibility": "internal" + }, + { + "body": { + "id": 2380, + "nodeType": "Block", + "src": "777:102:5", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2378, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 2367, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2363, + "src": "784:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2368, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2365, + "src": "788:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2369, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "783:8:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2372, + "name": "privKey", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2360, + "src": "821:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2373, + "name": "GX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2346, + "src": "836:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2374, + "name": "GY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2349, + "src": "846:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2375, + "name": "AA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2352, + "src": "856:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2376, + "name": "PP", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2358, + "src": "866:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 2370, + "name": "EllipticCurve", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1420, + "src": "794:13:5", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_EllipticCurve_$1420_$", + "typeString": "type(library EllipticCurve)" + } + }, + "id": 2371, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMul", + "nodeType": "MemberAccess", + "referencedDeclaration": 774, + "src": "794:19:5", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 2377, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "794:80:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "783:91:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2379, + "nodeType": "ExpressionStatement", + "src": "783:91:5" + } + ] + }, + "documentation": "@dev Public Key derivation from private key\n @param privKey The private key\n @return (qx, qy) The Public Key", + "id": 2381, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "derivePubKey", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2361, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2360, + "name": "privKey", + "nodeType": "VariableDeclaration", + "scope": 2381, + "src": "716:15:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2359, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "716:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "715:17:5" + }, + "returnParameters": { + "id": 2366, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2363, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 2381, + "src": "753:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2362, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "753:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2365, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 2381, + "src": "765:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2364, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "765:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "752:24:5" + }, + "scope": 2474, + "src": "694:185:5", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2403, + "nodeType": "Block", + "src": "955:96:5", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2401, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 2390, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2386, + "src": "962:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2391, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2388, + "src": "966:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2392, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "961:8:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2395, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2383, + "src": "999:1:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2396, + "name": "GX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2346, + "src": "1008:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2397, + "name": "GY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2349, + "src": "1018:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2398, + "name": "AA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2352, + "src": "1028:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2399, + "name": "PP", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2358, + "src": "1038:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 2393, + "name": "EllipticCurve", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1420, + "src": "972:13:5", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_EllipticCurve_$1420_$", + "typeString": "type(library EllipticCurve)" + } + }, + "id": 2394, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMul", + "nodeType": "MemberAccess", + "referencedDeclaration": 774, + "src": "972:19:5", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 2400, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "972:74:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "961:85:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2402, + "nodeType": "ExpressionStatement", + "src": "961:85:5" + } + ] + }, + "documentation": null, + "id": 2404, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecMultG", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2384, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2383, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 2404, + "src": "900:9:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2382, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "900:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "899:11:5" + }, + "returnParameters": { + "id": 2389, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2386, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 2404, + "src": "931:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2385, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "931:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2388, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 2404, + "src": "943:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2387, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "943:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "930:24:5" + }, + "scope": 2474, + "src": "883:168:5", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2434, + "nodeType": "Block", + "src": "1154:114:5", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2432, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 2417, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2413, + "src": "1161:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2418, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2415, + "src": "1165:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2419, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1160:8:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2422, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2410, + "src": "1198:1:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2423, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2408, + "src": "1207:8:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2425, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 2424, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1216:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1207:11:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2426, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2408, + "src": "1226:8:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2428, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2427, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1235:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1226:11:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2429, + "name": "AA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2352, + "src": "1245:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2430, + "name": "PP", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2358, + "src": "1255:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 2420, + "name": "EllipticCurve", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1420, + "src": "1171:13:5", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_EllipticCurve_$1420_$", + "typeString": "type(library EllipticCurve)" + } + }, + "id": 2421, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMul", + "nodeType": "MemberAccess", + "referencedDeclaration": 774, + "src": "1171:19:5", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 2431, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1171:92:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "1160:103:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2433, + "nodeType": "ExpressionStatement", + "src": "1160:103:5" + } + ] + }, + "documentation": null, + "id": 2435, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecMult", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2411, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2408, + "name": "keyImage", + "nodeType": "VariableDeclaration", + "scope": 2435, + "src": "1071:26:5", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 2405, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1071:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2407, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2406, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1079:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1071:10:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2410, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 2435, + "src": "1099:9:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2409, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1099:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1070:39:5" + }, + "returnParameters": { + "id": 2416, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2413, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 2435, + "src": "1130:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2412, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1130:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2415, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 2435, + "src": "1142:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2414, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1142:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1129:24:5" + }, + "scope": 2474, + "src": "1055:213:5", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2472, + "nodeType": "Block", + "src": "1374:115:5", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2470, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 2450, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2446, + "src": "1381:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2451, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2448, + "src": "1385:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2452, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1380:8:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2455, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2439, + "src": "1418:1:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2457, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 2456, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1420:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1418:4:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2458, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2439, + "src": "1430:1:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2460, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2459, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1432:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1430:4:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2461, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2443, + "src": "1442:1:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2463, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 2462, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1444:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1442:4:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2464, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2443, + "src": "1454:1:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2466, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2465, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1456:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1454:4:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2467, + "name": "AA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2352, + "src": "1466:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2468, + "name": "PP", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2358, + "src": "1476:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 2453, + "name": "EllipticCurve", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1420, + "src": "1391:13:5", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_EllipticCurve_$1420_$", + "typeString": "type(library EllipticCurve)" + } + }, + "id": 2454, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecAdd", + "nodeType": "MemberAccess", + "referencedDeclaration": 695, + "src": "1391:19:5", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 2469, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1391:93:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "1380:104:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2471, + "nodeType": "ExpressionStatement", + "src": "1380:104:5" + } + ] + }, + "documentation": null, + "id": 2473, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecAddd", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2444, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2439, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 2473, + "src": "1288:19:5", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 2436, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1288:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2438, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2437, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1296:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1288:10:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2443, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 2473, + "src": "1309:19:5", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 2440, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1309:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2442, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2441, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1317:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1309:10:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1287:42:5" + }, + "returnParameters": { + "id": 2449, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2446, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 2473, + "src": "1350:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2445, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1350:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2448, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 2473, + "src": "1362:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2447, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1362:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1349:24:5" + }, + "scope": 2474, + "src": "1272:217:5", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 2475, + "src": "215:1278:5" + } + ], + "src": "0:1493:5" + }, + "legacyAST": { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/secp256k1.sol", + "exportedSymbols": { + "secp256k1": [ + 2474 + ] + }, + "id": 2475, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 2342, + "literals": [ + "solidity", + ">=", + "0.4", + ".0", + "<", + "0.6", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "0:31:5" + }, + { + "absolutePath": "/Users/suchetaaa/Desktop/Anonymous-e-voting/contracts/EllipticCurve.sol", + "file": "./EllipticCurve.sol", + "id": 2343, + "nodeType": "ImportDirective", + "scope": 2475, + "sourceUnit": 1421, + "src": "33:29:5", + "symbolAliases": [], + "unitAlias": "" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": "@title Secp256k1 Elliptic Curve\n@notice Example of particularization of Elliptic Curve for secp256k1 curve\n@author Witnet Foundation", + "fullyImplemented": true, + "id": 2474, + "linearizedBaseContracts": [ + 2474 + ], + "name": "secp256k1", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": true, + "id": 2346, + "name": "GX", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "238:88:5", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2344, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "238:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "307837394245363637454639444342424143353541303632393543453837304230373032394246434442324443453238443935394632383135423136463831373938", + "id": 2345, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "260:66:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_55066263022277343669578718895168534326250603453777594175500187360389116729240_by_1", + "typeString": "int_const 5506...(69 digits omitted)...9240" + }, + "value": "0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798" + }, + "visibility": "internal" + }, + { + "constant": true, + "id": 2349, + "name": "GY", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "330:88:5", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2347, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "330:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "307834383341444137373236413343343635354441344642464330453131303841384644313742343438413638353534313939433437443038464642313044344238", + "id": 2348, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "352:66:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_32670510020758816978083085130507043184471273380659243275938904335757337482424_by_1", + "typeString": "int_const 3267...(69 digits omitted)...2424" + }, + "value": "0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8" + }, + "visibility": "internal" + }, + { + "constant": true, + "id": 2352, + "name": "AA", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "422:23:5", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2350, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "422:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "30", + "id": 2351, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "444:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "visibility": "internal" + }, + { + "constant": true, + "id": 2355, + "name": "BB", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "449:23:5", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2353, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "449:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "37", + "id": 2354, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "471:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_7_by_1", + "typeString": "int_const 7" + }, + "value": "7" + }, + "visibility": "internal" + }, + { + "constant": true, + "id": 2358, + "name": "PP", + "nodeType": "VariableDeclaration", + "scope": 2474, + "src": "476:88:5", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2356, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "476:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "307846464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646464646454646464646433246", + "id": 2357, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "498:66:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_115792089237316195423570985008687907853269984665640564039457584007908834671663_by_1", + "typeString": "int_const 1157...(70 digits omitted)...1663" + }, + "value": "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F" + }, + "visibility": "internal" + }, + { + "body": { + "id": 2380, + "nodeType": "Block", + "src": "777:102:5", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2378, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 2367, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2363, + "src": "784:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2368, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2365, + "src": "788:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2369, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "783:8:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2372, + "name": "privKey", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2360, + "src": "821:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2373, + "name": "GX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2346, + "src": "836:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2374, + "name": "GY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2349, + "src": "846:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2375, + "name": "AA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2352, + "src": "856:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2376, + "name": "PP", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2358, + "src": "866:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 2370, + "name": "EllipticCurve", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1420, + "src": "794:13:5", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_EllipticCurve_$1420_$", + "typeString": "type(library EllipticCurve)" + } + }, + "id": 2371, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMul", + "nodeType": "MemberAccess", + "referencedDeclaration": 774, + "src": "794:19:5", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 2377, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "794:80:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "783:91:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2379, + "nodeType": "ExpressionStatement", + "src": "783:91:5" + } + ] + }, + "documentation": "@dev Public Key derivation from private key\n @param privKey The private key\n @return (qx, qy) The Public Key", + "id": 2381, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "derivePubKey", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2361, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2360, + "name": "privKey", + "nodeType": "VariableDeclaration", + "scope": 2381, + "src": "716:15:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2359, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "716:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "715:17:5" + }, + "returnParameters": { + "id": 2366, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2363, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 2381, + "src": "753:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2362, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "753:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2365, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 2381, + "src": "765:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2364, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "765:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "752:24:5" + }, + "scope": 2474, + "src": "694:185:5", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2403, + "nodeType": "Block", + "src": "955:96:5", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2401, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 2390, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2386, + "src": "962:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2391, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2388, + "src": "966:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2392, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "961:8:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2395, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2383, + "src": "999:1:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2396, + "name": "GX", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2346, + "src": "1008:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2397, + "name": "GY", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2349, + "src": "1018:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2398, + "name": "AA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2352, + "src": "1028:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2399, + "name": "PP", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2358, + "src": "1038:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 2393, + "name": "EllipticCurve", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1420, + "src": "972:13:5", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_EllipticCurve_$1420_$", + "typeString": "type(library EllipticCurve)" + } + }, + "id": 2394, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMul", + "nodeType": "MemberAccess", + "referencedDeclaration": 774, + "src": "972:19:5", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 2400, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "972:74:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "961:85:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2402, + "nodeType": "ExpressionStatement", + "src": "961:85:5" + } + ] + }, + "documentation": null, + "id": 2404, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecMultG", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2384, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2383, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 2404, + "src": "900:9:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2382, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "900:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "899:11:5" + }, + "returnParameters": { + "id": 2389, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2386, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 2404, + "src": "931:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2385, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "931:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2388, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 2404, + "src": "943:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2387, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "943:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "930:24:5" + }, + "scope": 2474, + "src": "883:168:5", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2434, + "nodeType": "Block", + "src": "1154:114:5", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2432, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 2417, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2413, + "src": "1161:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2418, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2415, + "src": "1165:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2419, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1160:8:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 2422, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2410, + "src": "1198:1:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2423, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2408, + "src": "1207:8:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2425, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 2424, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1216:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1207:11:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2426, + "name": "keyImage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2408, + "src": "1226:8:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2428, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2427, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1235:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1226:11:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2429, + "name": "AA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2352, + "src": "1245:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2430, + "name": "PP", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2358, + "src": "1255:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 2420, + "name": "EllipticCurve", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1420, + "src": "1171:13:5", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_EllipticCurve_$1420_$", + "typeString": "type(library EllipticCurve)" + } + }, + "id": 2421, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecMul", + "nodeType": "MemberAccess", + "referencedDeclaration": 774, + "src": "1171:19:5", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 2431, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1171:92:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "1160:103:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2433, + "nodeType": "ExpressionStatement", + "src": "1160:103:5" + } + ] + }, + "documentation": null, + "id": 2435, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecMult", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2411, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2408, + "name": "keyImage", + "nodeType": "VariableDeclaration", + "scope": 2435, + "src": "1071:26:5", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 2405, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1071:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2407, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2406, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1079:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1071:10:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2410, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 2435, + "src": "1099:9:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2409, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1099:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1070:39:5" + }, + "returnParameters": { + "id": 2416, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2413, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 2435, + "src": "1130:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2412, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1130:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2415, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 2435, + "src": "1142:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2414, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1142:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1129:24:5" + }, + "scope": 2474, + "src": "1055:213:5", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 2472, + "nodeType": "Block", + "src": "1374:115:5", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 2470, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "id": 2450, + "name": "qx", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2446, + "src": "1381:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2451, + "name": "qy", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2448, + "src": "1385:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2452, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1380:8:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2455, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2439, + "src": "1418:1:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2457, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 2456, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1420:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1418:4:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2458, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2439, + "src": "1430:1:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2460, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2459, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1432:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1430:4:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2461, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2443, + "src": "1442:1:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2463, + "indexExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 2462, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1444:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1442:4:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 2464, + "name": "y", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2443, + "src": "1454:1:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2] memory" + } + }, + "id": 2466, + "indexExpression": { + "argumentTypes": null, + "hexValue": "31", + "id": 2465, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1456:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1454:4:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2467, + "name": "AA", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2352, + "src": "1466:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 2468, + "name": "PP", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2358, + "src": "1476:2:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 2453, + "name": "EllipticCurve", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 1420, + "src": "1391:13:5", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_EllipticCurve_$1420_$", + "typeString": "type(library EllipticCurve)" + } + }, + "id": 2454, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecAdd", + "nodeType": "MemberAccess", + "referencedDeclaration": 695, + "src": "1391:19:5", + "typeDescriptions": { + "typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256,uint256,uint256,uint256) pure returns (uint256,uint256)" + } + }, + "id": 2469, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1391:93:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "1380:104:5", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2471, + "nodeType": "ExpressionStatement", + "src": "1380:104:5" + } + ] + }, + "documentation": null, + "id": 2473, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "ecAddd", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2444, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2439, + "name": "x", + "nodeType": "VariableDeclaration", + "scope": 2473, + "src": "1288:19:5", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 2436, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1288:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2438, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2437, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1296:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1288:10:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2443, + "name": "y", + "nodeType": "VariableDeclaration", + "scope": 2473, + "src": "1309:19:5", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_memory_ptr", + "typeString": "uint256[2]" + }, + "typeName": { + "baseType": { + "id": 2440, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1309:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2442, + "length": { + "argumentTypes": null, + "hexValue": "32", + "id": 2441, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1317:1:5", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "1309:10:5", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$2_storage_ptr", + "typeString": "uint256[2]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1287:42:5" + }, + "returnParameters": { + "id": 2449, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2446, + "name": "qx", + "nodeType": "VariableDeclaration", + "scope": 2473, + "src": "1350:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2445, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1350:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 2448, + "name": "qy", + "nodeType": "VariableDeclaration", + "scope": 2473, + "src": "1362:10:5", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2447, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1362:7:5", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1349:24:5" + }, + "scope": 2474, + "src": "1272:217:5", + "stateMutability": "pure", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 2475, + "src": "215:1278:5" + } + ], + "src": "0:1493:5" + }, + "compiler": { + "name": "solc", + "version": "0.5.8+commit.23d335f2.Emscripten.clang" + }, + "networks": { + "1570892867630": { + "events": {}, + "links": { + "EllipticCurve": "0xD01a908CDE0705c9179d7ac082bAa3586b89fd49" + }, + "address": "0x0f25859348F1b6C66b5F8Eb0cc2dDfdda1944875", + "transactionHash": "0xd472232cc76af7fba1cf3b8cb83a31ac3b0af60f4214e367eae6b99b834ddbe9" + }, + "1570921815108": { + "events": {}, + "links": { + "EllipticCurve": "0xCcdfF65247C25d0A4bf66997C35D152d9AE3D627" + }, + "address": "0xCAE17a18265fA4115185F4E8e788815896be2098", + "transactionHash": "0xeb35efe615f711bf6f013ecd3062c693bc60a32e908f85715fbee848afa575ce" + }, + "1570922470877": { + "events": {}, + "links": { + "EllipticCurve": "0x35D64225aA2F133334c9333767D97559191eeE88" + }, + "address": "0x86EBb7bCb731CEc36681E98e349b719D5EfCd3B9", + "transactionHash": "0x591db60ce804f109d18170bc556351208290671c756df044bb587eecb15ab22e" + }, + "1570923244533": { + "events": {}, + "links": { + "EllipticCurve": "0xBea5FbacCA1b17a966616eA3696e8E005aDB319A" + }, + "address": "0xdf59BC02817eCbC4b263dCb6576Becf19BD5f15d", + "transactionHash": "0x1ab304ed0bc5e8bdb9d26fb9c1a8909755289c220c2daa4c2b7eafede4537242" + } + }, + "schemaVersion": "3.0.16", + "updatedAt": "2019-10-12T23:34:13.093Z", + "devdoc": { + "author": "Witnet Foundation", + "methods": { + "derivePubKey(uint256)": { + "details": "Public Key derivation from private key", + "params": { + "privKey": "The private key" + }, + "return": "(qx, qy) The Public Key" + } + }, + "title": "Secp256k1 Elliptic Curve" + }, + "userdoc": { + "methods": {}, + "notice": "Example of particularization of Elliptic Curve for secp256k1 curve" + } +} \ No newline at end of file diff --git a/contracts/AltBn128.sol b/contracts/AltBn128.sol new file mode 100644 index 0000000..3c67366 --- /dev/null +++ b/contracts/AltBn128.sol @@ -0,0 +1,148 @@ +pragma solidity >=0.4.0 <0.6.0; + +/** + * Heavily referenced from https://github.com/ethereum/py_ecc/blob/master/py_ecc/bn128/bn128_curve.py +*/ + +library AltBn128 { + // uint256 constant public G1x = uint256(0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798); + // uint256 constant public G1y = uint256(0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8); + + // // Number of elements in the field (often called `q`) + // // n = n(u) = 36u^4 + 36u^3 + 18u^2 + 6u + 1 + // uint256 constant public N = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141; + + // // p = p(u) = 36u^4 + 36u^3 + 24u^2 + 6u + 1 + // // Field Order + // uint256 constant public P = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F; + + // // (p+1) / 4 + // uint256 constant public A = 0x0; + + uint256 constant public G1x = uint256(0x01); + uint256 constant public G1y = uint256(0x02); + + // Number of elements in the field (often called `q`) + // n = n(u) = 36u^4 + 36u^3 + 18u^2 + 6u + 1 + uint256 constant public N = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001; + + // p = p(u) = 36u^4 + 36u^3 + 24u^2 + 6u + 1 + // Field Order + uint256 constant public P = 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47; + + // (p+1) / 4 + uint256 constant public A = 0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52; + + /* ECC Functions */ + function ecAdd(uint256[2] memory p0, uint256[2] memory p1) public view + returns (uint256[2] memory retP) + { + uint256[4] memory i = [p0[0], p0[1], p1[0], p1[1]]; + + assembly { + // call ecadd precompile + // inputs are: x1, y1, x2, y2 + if iszero(staticcall(not(0), 0x06, i, 0x80, retP, 0x40)) { + revert(0, 0) + } + } + } + + function ecMul(uint256[2] memory p, uint256 s) public view + returns (uint256[2] memory retP) + { + // With a public key (x, y), this computes p = scalar * (x, y). + uint256[3] memory i = [p[0], p[1], s]; + + assembly { + // call ecmul precompile + // inputs are: x, y, scalar + if iszero(staticcall(not(0), 0x07, i, 0x60, retP, 0x40)) { + revert(0, 0) + } + } + } + + function ecMulG(uint256 s) public view + returns (uint256[2] memory retP) + { + return ecMul([G1x, G1y], s); + } + + function powmod(uint256 base, uint256 e, uint256 m) public view + returns (uint256 o) + { + // returns pow(base, e) % m + assembly { + // define pointer + let p := mload(0x40) + + // Store data assembly-favouring ways + mstore(p, 0x20) // Length of Base + mstore(add(p, 0x20), 0x20) // Length of Exponent + mstore(add(p, 0x40), 0x20) // Length of Modulus + mstore(add(p, 0x60), base) // Base + mstore(add(p, 0x80), e) // Exponent + mstore(add(p, 0xa0), m) // Modulus + + // call modexp precompile! -- old school gas handling + let success := staticcall(sub(gas, 2000), 0x05, p, 0xc0, p, 0x20) + + // gas fiddling + switch success case 0 { + revert(0, 0) + } + + // data + o := mload(p) + } + } + + // Keep everything contained within this lib + function addmodn(uint256 x, uint256 n) public pure + returns (uint256) + { + return addmod(x, n, N); + } + + function modn(uint256 x) public pure + returns (uint256) + { + return x % N; + } + + /* + Checks if the points x, y exists on alt_bn_128 curve + */ + function onCurve(uint256 x, uint256 y) public pure + returns(bool) + { + uint256 beta = mulmod(x, x, P); + beta = mulmod(beta, x, P); + beta = addmod(beta, 3, P); + + return onCurveBeta(beta, y); + } + + function onCurveBeta(uint256 beta, uint256 y) public pure + returns(bool) + { + return beta == mulmod(y, y, P); + } + + /* + * Calculates point y value given x + */ + function evalCurve(uint256 x) public view + returns (uint256, uint256) + { + uint256 beta = mulmod(x, x, P); + beta = mulmod(beta, x, P); + beta = addmod(beta, 3, P); + + uint256 y = powmod(beta, A, P); + + // require(beta == mulmod(y, y, P), "Invalid x for evalCurve"); + return (beta, y); + } +} \ No newline at end of file diff --git a/contracts/EllipticCurve.sol b/contracts/EllipticCurve.sol new file mode 100644 index 0000000..9ebd90d --- /dev/null +++ b/contracts/EllipticCurve.sol @@ -0,0 +1,415 @@ +pragma solidity >=0.4.0 <0.6.0; + + +/** + * @title Elliptic Curve Library + * @dev Library providing arithmetic operations over elliptic curves. + * @author Witnet Foundation + */ +library EllipticCurve { + + /// @dev Modular euclidean inverse of a number (mod p). + /// @param _x The number + /// @param _pp The modulus + /// @return q such that x*q = 1 (mod _pp) + function invMod(uint256 _x, uint256 _pp) public pure returns (uint256) { + if (_x == 0 || _x == _pp || _pp == 0) { + revert("Invalid number"); + } + uint256 q = 0; + uint256 newT = 1; + uint256 r = _pp; + uint256 newR = _x; + uint256 t; + while (newR != 0) { + t = r / newR; + (q, newT) = (newT, addmod(q, (_pp - mulmod(t, newT, _pp)), _pp)); + (r, newR) = (newR, r - t * newR ); + } + + return q; + } + + /// @dev Modular exponentiation, b^e % _pp. + /// Source: https://github.com/androlo/standard-contracts/blob/master/contracts/src/crypto/ECCMath.sol + /// @param _base base + /// @param _exp exponent + /// @param _pp modulus + /// @return r such that r = b**e (mod _pp) + function expMod(uint256 _base, uint256 _exp, uint256 _pp) public pure returns (uint256) { + if (_base == 0) + return 0; + if (_exp == 0) + return 1; + if (_pp == 0) + revert("Modulus is zero"); + uint256 r = 1; + uint256 bit = 2 ** 255; + + assembly { + for { } gt(bit, 0) { }{ + r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, bit)))), _pp) + r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, div(bit, 2))))), _pp) + r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, div(bit, 4))))), _pp) + r := mulmod(mulmod(r, r, _pp), exp(_base, iszero(iszero(and(_exp, div(bit, 8))))), _pp) + bit := div(bit, 16) + } + } + + return r; + } + + /// @dev Converts a point (x, y, z) expressed in Jacobian coordinates to affine coordinates (x', y', 1). + /// @param _x coordinate x + /// @param _y coordinate y + /// @param _z coordinate z + /// @param _pp the modulus + /// @return (x', y') affine coordinates + function toAffine( + uint256 _x, + uint256 _y, + uint256 _z, + uint256 _pp) + public pure returns (uint256, uint256) + { + uint256 zInv = invMod(_z, _pp); + uint256 zInv2 = mulmod(zInv, zInv, _pp); + uint256 x2 = mulmod(_x, zInv2, _pp); + uint256 y2 = mulmod(_y, mulmod(zInv, zInv2, _pp), _pp); + + return (x2, y2); + } + + /// @dev Derives the y coordinate from a compressed-format point x. + /// @param _prefix parity byte (0x02 even, 0x03 odd) + /// @param _x coordinate x + /// @param _aa constant of curve + /// @param _bb constant of curve + /// @param _pp the modulus + /// @return y coordinate y + function deriveY( + uint8 _prefix, + uint256 _x, + uint256 _aa, + uint256 _bb, + uint256 _pp) + public pure returns (uint256) + { + // x^3 + ax + b + uint256 y2 = addmod(mulmod(_x, mulmod(_x, _x, _pp), _pp), addmod(mulmod(_x, _aa, _pp), _bb, _pp), _pp); + y2 = expMod(y2, (_pp + 1) / 4, _pp); + // uint256 cmp = yBit ^ y_ & 1; + uint256 y = (y2 + _prefix) % 2 == 0 ? y2 : _pp - y2; + + return y; + } + + /// @dev Check whether point (x,y) is on curve defined by a, b, and _pp. + /// @param _x coordinate x of P1 + /// @param _y coordinate y of P1 + /// @param _aa constant of curve + /// @param _bb constant of curve + /// @param _pp the modulus + /// @return true if x,y in the curve, false else + function isOnCurve( + uint _x, + uint _y, + uint _aa, + uint _bb, + uint _pp) + public pure returns (bool) + { + if (0 == _x || _x == _pp || 0 == _y || _y == _pp) { + return false; + } + // y^2 + uint lhs = mulmod(_y, _y, _pp); + // x^3 + uint rhs = mulmod(mulmod(_x, _x, _pp), _x, _pp); + if (_aa != 0) { + // x^3 + a*x + rhs = addmod(rhs, mulmod(_x, _aa, _pp), _pp); + } + if (_bb != 0) { + // x^3 + a*x + b + rhs = addmod(rhs, _bb, _pp); + } + + return lhs == rhs; + } + + /// @dev Calculate inverse (x, -y) of point (x, y). + /// @param _x coordinate x of P1 + /// @param _y coordinate y of P1 + /// @param _pp the modulus + /// @return (x, -y) + function ecInv( + uint256 _x, + uint256 _y, + uint256 _pp) + public pure returns (uint256, uint256) + { + return (_x, (_pp - _y) % _pp); + } + + /// @dev Add two points (x1, y1) and (x2, y2) in affine coordinates. + /// @param _x1 coordinate x of P1 + /// @param _y1 coordinate y of P1 + /// @param _x2 coordinate x of P2 + /// @param _y2 coordinate y of P2 + /// @param _aa constant of the curve + /// @param _pp the modulus + /// @return (qx, qy) = P1+P2 in affine coordinates + function ecAdd( + uint256 _x1, + uint256 _y1, + uint256 _x2, + uint256 _y2, + uint256 _aa, + uint256 _pp) + public pure returns(uint256, uint256) + { + uint x = 0; + uint y = 0; + uint z = 0; + // Double if x1==x2 else add + if (_x1==_x2) { + (x, y, z) = jacDouble( + _x1, + _y1, + 1, + _aa, + _pp); + } else { + (x, y, z) = jacAdd( + _x1, + _y1, + 1, + _x2, + _y2, + 1, + _pp); + } + // Get back to affine + return toAffine( + x, + y, + z, + _pp); + } + + /// @dev Substract two points (x1, y1) and (x2, y2) in affine coordinates. + /// @param _x1 coordinate x of P1 + /// @param _y1 coordinate y of P1 + /// @param _x2 coordinate x of P2 + /// @param _y2 coordinate y of P2 + /// @param _aa constant of the curve + /// @param _pp the modulus + /// @return (qx, qy) = P1-P2 in affine coordinates + function ecSub( + uint256 _x1, + uint256 _y1, + uint256 _x2, + uint256 _y2, + uint256 _aa, + uint256 _pp) + public pure returns(uint256, uint256) + { + // invert square + (uint256 x, uint256 y) = ecInv(_x2, _y2, _pp); + // P1-square + return ecAdd( + _x1, + _y1, + x, + y, + _aa, + _pp); + } + + /// @dev Multiply point (x1, y1, z1) times d in affine coordinates. + /// @param _k scalar to multiply + /// @param _x coordinate x of P1 + /// @param _y coordinate y of P1 + /// @param _aa constant of the curve + /// @param _pp the modulus + /// @return (qx, qy) = d*P in affine coordinates + function ecMul( + uint256 _k, + uint256 _x, + uint256 _y, + uint256 _aa, + uint256 _pp) + public pure returns(uint256, uint256) + { + // Jacobian multiplication + (uint256 x1, uint256 y1, uint256 z1) = jacMul( + _k, + _x, + _y, + 1, + _aa, + _pp); + // Get back to affine + return toAffine( + x1, + y1, + z1, + _pp); + } + + /// @dev Adds two points (x1, y1, z1) and (x2 y2, z2). + /// @param _x1 coordinate x of P1 + /// @param _y1 coordinate y of P1 + /// @param _z1 coordinate z of P1 + /// @param _x2 coordinate x of square + /// @param _y2 coordinate y of square + /// @param _z2 coordinate z of square + /// @param _pp the modulus + /// @return (qx, qy, qz) P1+square in Jacobian + function jacAdd( + uint256 _x1, + uint256 _y1, + uint256 _z1, + uint256 _x2, + uint256 _y2, + uint256 _z2, + uint256 _pp) + internal pure returns (uint256, uint256, uint256) + { + if ((_x1==0)&&(_y1==0)) + return (_x2, _y2, _z2); + if ((_x2==0)&&(_y2==0)) + return (_x1, _y1, _z1); + // We follow the equations described in https://pdfs.semanticscholar.org/5c64/29952e08025a9649c2b0ba32518e9a7fb5c2.pdf Section 5 + + uint[4] memory zs; // z1^2, z1^3, z2^2, z2^3 + zs[0] = mulmod(_z1, _z1, _pp); + zs[1] = mulmod(_z1, zs[0], _pp); + zs[2] = mulmod(_z2, _z2, _pp); + zs[3] = mulmod(_z2, zs[2], _pp); + + // u1, s1, u2, s2 + zs = [ + mulmod(_x1, zs[2], _pp), + mulmod(_y1, zs[3], _pp), + mulmod(_x2, zs[0], _pp), + mulmod(_y2, zs[1], _pp) + ]; + if (zs[0] == zs[2]) { + if (zs[1] != zs[3]) + revert("Wrong data"); + else { + revert("Use double instead"); + } + } + uint[4] memory hr; + //h + hr[0] = addmod(zs[2], _pp - zs[0], _pp); + //r + hr[1] = addmod(zs[3], _pp - zs[1], _pp); + //h^2 + hr[2] = mulmod(hr[0], hr[0], _pp); + // h^3 + hr[3] = mulmod(hr[2], hr[0], _pp); + // qx = -h^3 -2u1h^2+r^2 + uint256 qx = addmod(mulmod(hr[1], hr[1], _pp), _pp - hr[3], _pp); + qx = addmod(qx, _pp - mulmod(2, mulmod(zs[0], hr[2], _pp), _pp), _pp); + // qy = -s1*z1*h^3+r(u1*h^2 -x^3) + uint256 qy = mulmod(hr[1], addmod(mulmod(zs[0], hr[2], _pp), _pp - qx, _pp), _pp); + qy = addmod(qy, _pp - mulmod(zs[1], hr[3], _pp), _pp); + // qz = h*z1*z2 + uint256 qz = mulmod(hr[0], mulmod(_z1, _z2, _pp), _pp); + return(qx, qy, qz); + } + + /// @dev Doubles a points (x, y, z). + /// @param _x coordinate x of P1 + /// @param _y coordinate y of P1 + /// @param _z coordinate z of P1 + /// @param _pp the modulus + /// @param _aa the a scalar in the curve equation + /// @return (qx, qy, qz) 2P in Jacobian + function jacDouble( + uint256 _x, + uint256 _y, + uint256 _z, + uint256 _aa, + uint256 _pp) + internal pure returns (uint256, uint256, uint256) + { + if (_z == 0) + return (_x, _y, _z); + uint256[3] memory square; + // We follow the equations described in https://pdfs.semanticscholar.org/5c64/29952e08025a9649c2b0ba32518e9a7fb5c2.pdf Section 5 + // Note: there is a bug in the paper regarding the m parameter, M=3*(x1^2)+a*(z1^4) + square[0] = mulmod(_x, _x, _pp); //x1^2 + square[1] = mulmod(_y, _y, _pp); //y1^2 + square[2] = mulmod(_z, _z, _pp); //z1^2 + + // s + uint s = mulmod(4, mulmod(_x, square[1], _pp), _pp); + // m + uint m = addmod(mulmod(3, square[0], _pp), mulmod(_aa, mulmod(square[2], square[2], _pp), _pp), _pp); + // qx + uint256 qx = addmod(mulmod(m, m, _pp), _pp - addmod(s, s, _pp), _pp); + // qy = -8*y1^4 + M(S-T) + uint256 qy = addmod(mulmod(m, addmod(s, _pp - qx, _pp), _pp), _pp - mulmod(8, mulmod(square[1], square[1], _pp), _pp), _pp); + // qz = 2*y1*z1 + uint256 qz = mulmod(2, mulmod(_y, _z, _pp), _pp); + + return (qx, qy, qz); + } + + /// @dev Multiply point (x, y, z) times d. + /// @param _d scalar to multiply + /// @param _x coordinate x of P1 + /// @param _y coordinate y of P1 + /// @param _z coordinate z of P1 + /// @param _aa constant of curve + /// @param _pp the modulus + /// @return (qx, qy, qz) d*P1 in Jacobian + function jacMul( + uint256 _d, + uint256 _x, + uint256 _y, + uint256 _z, + uint256 _aa, + uint256 _pp) + internal pure returns (uint256, uint256, uint256) + { + uint256 remaining = _d; + uint256[3] memory point; + point[0] = _x; + point[1] = _y; + point[2] = _z; + uint256 qx = 0; + uint256 qy = 0; + uint256 qz = 1; + + if (_d == 0) { + return (qx, qy, qz); + } + // Double and add algorithm + while (remaining != 0) { + if ((remaining & 1) != 0) { + (qx, qy, qz) = jacAdd( + qx, + qy, + qz, + point[0], + point[1], + point[2], + _pp); + } + remaining = remaining / 2; + (point[0], point[1], point[2]) = jacDouble( + point[0], + point[1], + point[2], + _aa, + _pp); + } + return (qx, qy, qz); + } +} \ No newline at end of file diff --git a/contracts/LSAG.sol b/contracts/LSAG.sol new file mode 100644 index 0000000..d6a1200 --- /dev/null +++ b/contracts/LSAG.sol @@ -0,0 +1,215 @@ +pragma solidity >=0.4.0 <0.6.0; + +import "./AltBn128.sol"; +import "./secp256k1.sol"; + +/* +Linkable Spontaneous Anonymous Groups + +https://eprint.iacr.org/2004/027.pdf +*/ + +library LSAG { + // abi.encodePacked is the "concat" or "serialization" + // of all supplied arguments into one long bytes value + // i.e. abi.encodePacked :: [a] -> bytes + + /** + * Converts an integer to an elliptic curve point + */ + function intToPoint(uint256 _x) public view + returns (uint256[2] memory) + { + uint256 x = _x; + uint256 y; + uint256 beta; + + while (true) { + (beta, y) = AltBn128.evalCurve(x); + + if (AltBn128.onCurveBeta(beta, y)) { + return [x, y]; + } + + x = AltBn128.addmodn(x, 1); + } + } + + /** + * Returns an integer representation of the hash + * of the input + */ + function H1(bytes memory b) public pure + returns (uint256) + { + return AltBn128.modn(uint256(keccak256(b))); + } + + /** + * Returns elliptic curve point of the integer representation + * of the hash of the input + */ + function H2(bytes memory b) public view + returns (uint256[2] memory) + { + return intToPoint(H1(b)); + } + + /** + * Helper function to calculate Z1 + * Avoids stack too deep problem + */ + function ringCalcZ1( + uint256[2] memory pubKey, + uint256 c, + uint256 s + ) public view + returns (uint256[2] memory) + { + + // return AltBn128.ecAdd( + // AltBn128.ecMulG(s), + // AltBn128.ecMul(pubKey, c) + // ); + + uint256[2] memory output; + uint256[2] memory p1; + uint256[2] memory p2; + uint256 x; + uint256 y; + + (x, y) = secp256k1.ecMultG(s); + + p1[0] = x; + p1[1] = y; + + (x, y) = secp256k1.ecMult(pubKey, c); + + p2[0] = x; + p2[1] = y; + + (x, y) = secp256k1.ecAddd( + p1, + p2 + ); + + output[0] = x; + output[1] = y; + return output; + } + + /** + * Helper function to calculate Z2 + * Avoids stack too deep problem + */ + function ringCalcZ2( + uint256[2] memory keyImage, + uint256[2] memory h, + uint256 s, + uint256 c + ) public view + returns (uint256[2] memory) + { + // return AltBn128.ecAdd( + // AltBn128.ecMul(h, s), + // AltBn128.ecMul(keyImage, c) + // ); + + uint256[2] memory output; + uint256[2] memory p1; + uint256[2] memory p2; + uint256 x; + uint256 y; + + (x, y) = secp256k1.ecMult(h, s); + + p1[0] = x; + p1[1] = y; + + (x, y) = secp256k1.ecMult(keyImage, c); + + p2[0] = x; + p2[1] = y; + + (x, y) = secp256k1.ecAddd( + p1, + p2 + ); + + output[0] = x; + output[1] = y; + return output; + } + + + /** + * Verifies the ring signature + * Section 4.2 of the paper https://eprint.iacr.org/2004/027.pdf + */ + function verify( + bytes memory message, + uint256 c0, + uint256[2] memory keyImage, + uint256[] memory s, + uint256[2][] memory publicKeys + ) public view + returns (bool) + { + + + require(publicKeys.length >= 2, "Signature size too small"); + require(publicKeys.length == s.length, "Signature sizes do not match!"); + + + uint256 c = c0; + uint256 i = 0; + + // Step 1 + // Extract out public key bytes + bytes memory hBytes = ""; + + for (i = 0; i < publicKeys.length; i++) { + hBytes = abi.encodePacked( + hBytes, + publicKeys[i] + ); + } + + + uint256[2] memory h = H2(hBytes); + + // Step 2 + uint256[2] memory z_1; + uint256[2] memory z_2; + + + for (i = 0; i < publicKeys.length; i++) { + + z_1 = ringCalcZ1(publicKeys[i], c, s[i]); + z_2 = ringCalcZ2(keyImage, h, s[i], c); + + if (i != publicKeys.length - 1) { + c = H1( + abi.encodePacked( + hBytes, + keyImage, + message, + z_1, + z_2 + ) + ); + + } + } + + return c0 == H1( + abi.encodePacked( + hBytes, + keyImage, + message, + z_1, + z_2 + ) + ); + } +} \ No newline at end of file diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol new file mode 100644 index 0000000..c378ffb --- /dev/null +++ b/contracts/Migrations.sol @@ -0,0 +1,23 @@ +pragma solidity >=0.4.21 <0.6.0; + +contract Migrations { + address public owner; + uint public last_completed_migration; + + constructor() public { + owner = msg.sender; + } + + modifier restricted() { + if (msg.sender == owner) _; + } + + function setCompleted(uint completed) public restricted { + last_completed_migration = completed; + } + + function upgrade(address new_address) public restricted { + Migrations upgraded = Migrations(new_address); + upgraded.setCompleted(last_completed_migration); + } +} diff --git a/contracts/e_voting.sol b/contracts/e_voting.sol new file mode 100644 index 0000000..a6c8de1 --- /dev/null +++ b/contracts/e_voting.sol @@ -0,0 +1,131 @@ +pragma solidity >=0.4.0 <0.6.0; +// pragma experimental ABIEncoderV2; +import "./LSAG.sol"; + +contract EVoting { + + struct Voter { + uint weight; + bool voted; + uint8 vote; + address delegate; + } + + struct Proposal { + uint voteCount; + } + + struct keyImages { + uint256 x; + uint256 y; + } + + address chairperson; + mapping(address => Voter) voters; + Proposal[] proposals; + uint256[2][] _pub_keys; + keyImages[] I_array; + address common; + + /// Create a new ballot with $(_numProposals, Proposals[] prop, uint256[2][] pubkeys) different proposals. + /// Initializing Public Keys, Proposal length + constructor(/*uint8 _proposals, address common_address, uint256[2][] memory _pubkeys, uint256 num_members*/) public { + chairperson = msg.sender; + voters[chairperson].weight = 1; + proposals.length = 10; + // for (uint i = 0; i < num_members; i++) { + // pub_keys.push(_pubkeys[i]); + // } + _pub_keys = [[76860218087793983084535703376981386467447611172084071853258931251531655143810,31412445800597707204000296306981535369487689728022294203473644188534598278433],[38383509265263568403091993992632738089196255623116815243548433385026133154873,6177458042690818063654998812321100640246417077410401798821997202074455067658],[109494974759407544115980221650269989415835863198723097195991870480545591748694,88373887815570028484318636992066972615473624433958557212898599653752288516553],[62024398634874066443962845630678733310841268459352721513836874076957014825693,17523914466505763903401497950553046259382636897003925910700830930167415374845],[63717588402740889593319833542751400718873158538928593038126726953424863531161,81834072601552631999151743416373775064561835219024365947336813467257575949287],[94488627319558170444192963521553866738182271320922938361822272954834163056706,75117489132020203438334222530089728350198927250708518444467009567047301998524],[72073121700845816532409909568957092975560328036852544806670390063697244167579,88008882899030566411419232439265353825316367124231879120604152247564011428118],[69302663261811420267463647311565591458354544084275858903094017435028909835870,76244600855121168108544883604098564729610790293645164381848998871531984754082],[21062411477782016300649284598637628528529199124745416083435916321565775381913,89400255616484687868490880757687246913068397762041460105517838105693640679676],[11324961394441086302516068549805884234494603864143349084821232258857030082588,47850239753691939370379379177679604685639311272023121432695464273305267682132]]; + + // pub_keys = [[57821270388025671679082986323759317106236019579646704630239591681422142402873, 81852641370837570497548634207073850211297355610253263906104967633874362469602], [25712850812449497645081724081388342780477851750572903542985504942115721367043, 7928418776134213981488203910441805777302498711166840436627074750328926186440]]; + + common = 0x17458104Da8654E7C067e3410a65080D9dDB14F3; + + } + + function setCommon(address _common) public { + require(msg.sender == chairperson, "sender is not the chairperson. cant set the common address"); + common = _common; + } + + function bytesToUint(bytes memory b) internal returns (uint256){ + uint256 number; + for(uint i=0;i= proposals.length) return; + // sender.voted = true; + // sender.vote = toProposal; + // proposals[toProposal].voteCount += sender.weight; + } + + function winningProposal() public view returns (uint8 _winningProposal) { + uint256 winningVoteCount = 0; + for (uint8 prop = 0; prop < proposals.length; prop++) + if (proposals[prop].voteCount > winningVoteCount) { + winningVoteCount = proposals[prop].voteCount; + _winningProposal = prop; + } + } + + + // function to convert uint to bytes + function toBytes(uint256 x) public returns (bytes memory b) { + b = new bytes(32); + assembly { mstore(add(b, 32), x) } +} + +} diff --git a/contracts/secp256k1.sol b/contracts/secp256k1.sol new file mode 100644 index 0000000..46ebdc0 --- /dev/null +++ b/contracts/secp256k1.sol @@ -0,0 +1,64 @@ +pragma solidity >=0.4.0 <0.6.0; + +import "./EllipticCurve.sol"; + + +/** + * @title Secp256k1 Elliptic Curve + * @notice Example of particularization of Elliptic Curve for secp256k1 curve + * @author Witnet Foundation + */ +library secp256k1 { + + uint256 constant GX = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798; + uint256 constant GY = 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8; + uint256 constant AA = 0; + uint256 constant BB = 7; + uint256 constant PP = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F; + + /// @dev Public Key derivation from private key + /// @param privKey The private key + /// @return (qx, qy) The Public Key + function derivePubKey(uint256 privKey) public pure returns(uint256 qx, uint256 qy) { + (qx, qy) = EllipticCurve.ecMul( + privKey, + GX, + GY, + AA, + PP + ); + } + + function ecMultG(uint256 s) public pure returns(uint256 qx, uint256 qy) { + (qx, qy) = EllipticCurve.ecMul( + s, + GX, + GY, + AA, + PP + ); + } + + function ecMult(uint256[2] memory keyImage, uint256 s) public pure returns(uint256 qx, uint256 qy) { + (qx, qy) = EllipticCurve.ecMul( + s, + keyImage[0], + keyImage[1], + AA, + PP + ); + } + + function ecAddd(uint256[2] memory x, uint256[2] memory y) public pure returns(uint256 qx, uint256 qy) { + (qx, qy) = EllipticCurve.ecAdd( + x[0], + x[1], + y[0], + y[1], + AA, + PP + ); + } + + +} \ No newline at end of file diff --git a/e_voting.sol b/e_voting.sol new file mode 100644 index 0000000..da45394 --- /dev/null +++ b/e_voting.sol @@ -0,0 +1,114 @@ +pragma solidity >=0.4.0 <0.6.0; +pragma experimental ABIEncoderV2; +import "./LSAG.sol"; + +contract EVoting { + + struct Voter { + uint weight; + bool voted; + uint8 vote; + address delegate; + } + + struct Proposal { + uint voteCount; + } + + struct keyImages { + uint256 x; + uint256 y; + } + + address chairperson; + mapping(address => Voter) voters; + Proposal[] proposals; + uint256[2][] pub_keys; + keyImages[] I_array; + address common; + + /// Create a new ballot with $(_numProposals, Proposals[] prop, uint256[] pubkeys) different proposals. + /// Initializing Public Keys, Proposal length + constructor() public { + chairperson = msg.sender; + voters[chairperson].weight = 1; + proposals.length = 10; + // for (uint i = 0; i < num_members; i++) { + // pub_keys.push(_pubkeys[i]); + // } + // pub_keys = _pubkeys; + pub_keys = [[57821270388025671679082986323759317106236019579646704630239591681422142402873, 81852641370837570497548634207073850211297355610253263906104967633874362469602], [25712850812449497645081724081388342780477851750572903542985504942115721367043, 7928418776134213981488203910441805777302498711166840436627074750328926186440]]; + + common = 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c; + + } + + function bytesToUint(bytes memory b) internal returns (uint256){ + uint256 number; + for(uint i=0;i= proposals.length) return; + // sender.voted = true; + // sender.vote = toProposal; + // proposals[toProposal].voteCount += sender.weight; + } + + function winningProposal() public view returns (uint8 _winningProposal) { + uint256 winningVoteCount = 0; + for (uint8 prop = 0; prop < proposals.length; prop++) + if (proposals[prop].voteCount > winningVoteCount) { + winningVoteCount = proposals[prop].voteCount; + _winningProposal = prop; + } + } +} diff --git a/ecdsa/LICENSE b/ecdsa/LICENSE new file mode 100755 index 0000000..474479a --- /dev/null +++ b/ecdsa/LICENSE @@ -0,0 +1,24 @@ +"python-ecdsa" Copyright (c) 2010 Brian Warner + +Portions written in 2005 by Peter Pearson and placed in the public domain. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/ecdsa/MANIFEST.in b/ecdsa/MANIFEST.in new file mode 100755 index 0000000..6a80c88 --- /dev/null +++ b/ecdsa/MANIFEST.in @@ -0,0 +1,3 @@ +# basic metadata +include MANIFEST.in LICENSE NEWS README.md versioneer.py +include ecdsa/_version.py diff --git a/ecdsa/NEWS b/ecdsa/NEWS new file mode 100755 index 0000000..4c8954a --- /dev/null +++ b/ecdsa/NEWS @@ -0,0 +1,57 @@ +* Release 0.13 (07 Feb 2015) + +Fix the argument order for Curve constructor (put openssl_name= at the end, +with a default value) to unbreak compatibility with external callers who used +the 0.11 convention. + +* Release 0.12 (06 Feb 2015) + +Switch to Versioneer for version-string management (fixing the broken +`ecdsa.__version__` attribute). Add Curve.openssl_name property. Mention +secp256k1 in README, test against OpenSSL. Produce "wheel" distributions. Add +py3.4 and pypy3 compatibility testing. Other minor fixes. + +* Release 0.11 (10 Mar 2014) + +Add signature-encoding functions "sigencode_{strings,string,der}_canonize" +which canonicalize the S value (using the smaller of the two possible +values). Add "validate_point=" argument to VerifyingKey.from_string() +constructor (defaults to True) which can be used to disable time-consuming +point validation when importing a pre-validated verifying key. Drop python2.5 +support (untested but not explicitly broken yet), update trove classifiers. + +* Release 0.10 (23 Oct 2013) + +Make the secp256k1 available in __init__.py too (thanks to Scott Bannert). + +* Release 0.9 (01 Oct 2013) + +Add secp256k1 curve (thanks to Benjamin Dauvergne). Add deterministic (no +entropy needed) signatures (thanks to slush). Added py3.2/py3.3 compatibility +(thanks to Elizabeth Myers). + +* Release 0.8 (04 Oct 2011) + +Small API addition: accept a hashfunc= argument in the constructors for +SigningKey and VerifyingKey. This makes it easier to write wrappers that e.g. +use NIST256p and SHA256 without their obligating callers to pass +hashfunc=sha256 in each time they call sign() or verify(). + +* Release 0.7 (28 Nov 2010) + +Fix test failure against OpenSSL-1.0.0 (previous versions only worked against +openssl-0.9.8 or earlier). Increase python requirement to py2.5 or later +(still no py3 compatibility, but work is underway). Replace use of obsolete +'sha' library with modern 'hashlib'. Clean up unit test runner (stop using +subprocesses). + +* Release 0.6 (15 Oct 2010) + +Small packaging changes: extract version number from git, add 'setup.py test' +command, set exit code correctly on test failure. Fix pyflakes warnings. + +* Release 0.5 (27 Apr 2010) + +Initial release. EC-DSA signature for five NIST "Suite B" GF(p) curves: +prime192v1, secp224r1, prime256v1, secp384r1, and secp521r1. DER/PEM +input/output functions, seed-to-randrange helper functions. diff --git a/ecdsa/README.md b/ecdsa/README.md new file mode 100755 index 0000000..9c7d1f4 --- /dev/null +++ b/ecdsa/README.md @@ -0,0 +1,336 @@ +# Pure-Python ECDSA + +[![build status](https://travis-ci.org/warner/python-ecdsa.png)](http://travis-ci.org/warner/python-ecdsa) +[![Coverage Status](https://coveralls.io/repos/warner/python-ecdsa/badge.svg)](https://coveralls.io/r/warner/python-ecdsa) +[![Latest Version](https://pypip.in/version/ecdsa/badge.svg?style=flat)](https://pypi.python.org/pypi/ecdsa/) + + +This is an easy-to-use implementation of ECDSA cryptography (Elliptic Curve +Digital Signature Algorithm), implemented purely in Python, released under +the MIT license. With this library, you can quickly create keypairs (signing +key and verifying key), sign messages, and verify the signatures. The keys +and signatures are very short, making them easy to handle and incorporate +into other protocols. + +## Features + +This library provides key generation, signing, and verifying, for five +popular NIST "Suite B" GF(p) curves, with key lengths of 192, 224, 256, 384, +and 521 bits. The "short names" for these curves, as known by the OpenSSL +tool (`openssl ecparam -list_curves`), are: prime192v1, secp224r1, +prime256v1, secp384r1, and secp521r1. It also includes the 256-bit curve used +by Bitcoin, whose short name is secp256k1. No other curves are included, but +it would not be too hard to add more. + +## Dependencies + +This library uses only Python and the 'six' package. It requires python2.6 or +later versions of the python2.x series. It is also compatible with python3.2 +and 3.3. + +To run the OpenSSL compatibility tests, the 'openssl' tool must be on your +$PATH. This release has been tested successfully against both OpenSSL 0.9.8o +and 1.0.0a . + +## Speed + +The following table shows how long this library takes to generate keypairs +(keygen=), to sign data (sign=), and to verify those signatures (verify=), on +my 2008 Mac laptop. All times are in seconds. It also shows the length of a +signature (in bytes): the verifying ("public") key is typically the same +length as the signature, and the signing ("private") key is half that length. +Use "python setup.py speed" to generate this table on your own computer. + +* NIST192p: siglen= 48, keygen=0.160s, sign=0.058s, verify=0.116s +* NIST224p: siglen= 56, keygen=0.230s, sign=0.086s, verify=0.165s +* NIST256p: siglen= 64, keygen=0.305s, sign=0.112s, verify=0.220s +* NIST384p: siglen= 96, keygen=0.801s, sign=0.289s, verify=0.558s +* NIST521p: siglen=132, keygen=1.582s, sign=0.584s, verify=1.152s + +For comparison, a quality C++ implementation of ECDSA (Crypto++) typically +computes a NIST256p signature in 2.88ms and a verification in 8.53ms, about +30-40x faster. + +Keys and signature can be serialized in different ways (see Usage, below). +For a NIST192p key, the three basic representations require strings of the +following lengths (in bytes): + + to_string: signkey= 24, verifykey= 48, signature=48 + DER: signkey=106, verifykey= 80, signature=55 + PEM: signkey=278, verifykey=162, (no support for PEM signatures) + +## History + +In 2006, Peter Pearson announced his pure-python implementation of ECDSA in a +[message to sci.crypt][1], available from his [download site][2]. In 2010, +Brian Warner wrote a wrapper around this code, to make it a bit easier and +safer to use. You are looking at the README for this wrapper. + +[1]: http://www.derkeiler.com/Newsgroups/sci.crypt/2006-01/msg00651.html +[2]: http://webpages.charter.net/curryfans/peter/downloads.html + +## Testing + +There are four test suites, three for the original Pearson module, and one +more for the wrapper. To run them all, do this: + + python setup.py test + +On my 2014 Mac Mini, the combined tests take about 20 seconds to run. On a +2.4GHz P4 Linux box, they take 81 seconds. + +One component of `test_pyecdsa.py` checks compatibility with OpenSSL, by +running the "openssl" CLI tool. If this tool is not on your $PATH, you may +want to comment out this test (the easiest way is to add a line that says +"del OpenSSL" to the end of test_pyecdsa.py). + +## Security + +This library does not protect against timing attacks. Do not allow attackers +to measure how long it takes you to generate a keypair or sign a message. +This library depends upon a strong source of random numbers. Do not use it on +a system where os.urandom() is weak. + +## Usage + +You start by creating a SigningKey. You can use this to sign data, by passing +in a data string and getting back the signature (also a string). You can also +ask a SigningKey to give you the corresponding VerifyingKey. The VerifyingKey +can be used to verify a signature, by passing it both the data string and the +signature string: it either returns True or raises BadSignatureError. + +```python +from ecdsa import SigningKey +sk = SigningKey.generate() # uses NIST192p +vk = sk.get_verifying_key() +signature = sk.sign("message") +assert vk.verify(signature, "message") +``` + +Each SigningKey/VerifyingKey is associated with a specific curve, like +NIST192p (the default one). Longer curves are more secure, but take longer to +use, and result in longer keys and signatures. + +```python +from ecdsa import SigningKey, NIST384p +sk = SigningKey.generate(curve=NIST384p) +vk = sk.get_verifying_key() +signature = sk.sign("message") +assert vk.verify(signature, "message") +``` + +The SigningKey can be serialized into several different formats: the shortest +is to call `s=sk.to_string()`, and then re-create it with +`SigningKey.from_string(s, curve)` . This short form does not record the +curve, so you must be sure to tell from_string() the same curve you used for +the original key. The short form of a NIST192p-based signing key is just 24 +bytes long. + +```python +from ecdsa import SigningKey, NIST384p +sk = SigningKey.generate(curve=NIST384p) +sk_string = sk.to_string() +sk2 = SigningKey.from_string(sk_string, curve=NIST384p) +# sk and sk2 are the same key +``` + +`sk.to_pem()` and `sk.to_der()` will serialize the signing key into the same +formats that OpenSSL uses. The PEM file looks like the familiar ASCII-armored +`"-----BEGIN EC PRIVATE KEY-----"` base64-encoded format, and the DER format +is a shorter binary form of the same data. +`SigningKey.from_pem()/.from_der()` will undo this serialization. These +formats include the curve name, so you do not need to pass in a curve +identifier to the deserializer. + +```python +from ecdsa import SigningKey, NIST384p +sk = SigningKey.generate(curve=NIST384p) +sk_pem = sk.to_pem() +sk2 = SigningKey.from_pem(sk_pem) +# sk and sk2 are the same key +``` + +Likewise, the VerifyingKey can be serialized in the same way: +`vk.to_string()/VerifyingKey.from_string()`, `to_pem()/from_pem()`, and +`to_der()/from_der()`. The same curve= argument is needed for +`VerifyingKey.from_string()`. + +```python +from ecdsa import SigningKey, VerifyingKey, NIST384p +sk = SigningKey.generate(curve=NIST384p) +vk = sk.get_verifying_key() +vk_string = vk.to_string() +vk2 = VerifyingKey.from_string(vk_string, curve=NIST384p) +# vk and vk2 are the same key + +from ecdsa import SigningKey, VerifyingKey, NIST384p +sk = SigningKey.generate(curve=NIST384p) +vk = sk.get_verifying_key() +vk_pem = vk.to_pem() +vk2 = VerifyingKey.from_pem(vk_pem) +# vk and vk2 are the same key +``` + +There are a couple of different ways to compute a signature. Fundamentally, +ECDSA takes a number that represents the data being signed, and returns a +pair of numbers that represent the signature. The hashfunc= argument to +`sk.sign()` and `vk.verify()` is used to turn an arbitrary string into +fixed-length digest, which is then turned into a number that ECDSA can sign, +and both sign and verify must use the same approach. The default value is +hashlib.sha1, but if you use NIST256p or a longer curve, you can use +hashlib.sha256 instead. + +There are also multiple ways to represent a signature. The default +`sk.sign()` and `vk.verify()` methods present it as a short string, for +simplicity and minimal overhead. To use a different scheme, use the +`sk.sign(sigencode=)` and `vk.verify(sigdecode=)` arguments. There are helper +funcions in the "ecdsa.util" module that can be useful here. + +It is also possible to create a SigningKey from a "seed", which is +deterministic. This can be used in protocols where you want to derive +consistent signing keys from some other secret, for example when you want +three separate keys and only want to store a single master secret. You should +start with a uniformly-distributed unguessable seed with about curve.baselen +bytes of entropy, and then use one of the helper functions in ecdsa.util to +convert it into an integer in the correct range, and then finally pass it +into `SigningKey.from_secret_exponent()`, like this: + +```python +from ecdsa import NIST384p, SigningKey +from ecdsa.util import randrange_from_seed__trytryagain + +def make_key(seed): + secexp = randrange_from_seed__trytryagain(seed, NIST384p.order) + return SigningKey.from_secret_exponent(secexp, curve=NIST384p) + +seed = os.urandom(NIST384p.baselen) # or other starting point +sk1a = make_key(seed) +sk1b = make_key(seed) +# note: sk1a and sk1b are the same key +sk2 = make_key("2-"+seed) # different key +``` + +## OpenSSL Compatibility + +To produce signatures that can be verified by OpenSSL tools, or to verify +signatures that were produced by those tools, use: + +```python +# openssl ecparam -name secp224r1 -genkey -out sk.pem +# openssl ec -in sk.pem -pubout -out vk.pem +# openssl dgst -ecdsa-with-SHA1 -sign sk.pem -out data.sig data +# openssl dgst -ecdsa-with-SHA1 -verify vk.pem -signature data.sig data +# openssl dgst -ecdsa-with-SHA1 -prverify sk.pem -signature data.sig data + +sk.sign(msg, hashfunc=hashlib.sha1, sigencode=ecdsa.util.sigencode_der) +vk.verify(sig, msg, hashfunc=hashlib.sha1, sigdecode=ecdsa.util.sigdecode_der) +``` + +The keys that openssl handles can be read and written as follows: + +```python +sk = SigningKey.from_pem(open("sk.pem").read()) +open("sk.pem","w").write(sk.to_pem()) + +vk = VerifyingKey.from_pem(open("vk.pem").read()) +open("vk.pem","w").write(vk.to_pem()) +``` + +## Entropy + +Creating a signing key with `SigningKey.generate()` requires some form of +entropy (as opposed to `from_secret_exponent/from_string/from_der/from_pem`, +which are deterministic and do not require an entropy source). The default +source is `os.urandom()`, but you can pass any other function that behaves +like os.urandom as the entropy= argument to do something different. This may +be useful in unit tests, where you want to achieve repeatable results. The +ecdsa.util.PRNG utility is handy here: it takes a seed and produces a strong +pseudo-random stream from it: + +```python +from ecdsa.util import PRNG +from ecdsa import SigningKey +rng1 = PRNG("seed") +sk1 = SigningKey.generate(entropy=rng1) +rng2 = PRNG("seed") +sk2 = SigningKey.generate(entropy=rng2) +# sk1 and sk2 are the same key +``` + +Likewise, ECDSA signature generation requires a random number, and each +signature must use a different one (using the same number twice will +immediately reveal the private signing key). The `sk.sign()` method takes an +entropy= argument which behaves the same as `SigningKey.generate(entropy=)`. + +## Deterministic Signatures + +If you call `SigningKey.sign_deterministic(data)` instead of `.sign(data)`, +the code will generate a deterministic signature instead of a random one. +This uses the algorithm from RFC6979 to safely generate a unique `k` value, +derived from the private key and the message being signed. Each time you sign +the same message with the same key, you will get the same signature (using +the same `k`). + +This may become the default in a future version, as it is not vulnerable to +failures of the entropy source. + +## Examples + +Create a NIST192p keypair and immediately save both to disk: + +```python +from ecdsa import SigningKey +sk = SigningKey.generate() +vk = sk.get_verifying_key() +open("private.pem","w").write(sk.to_pem()) +open("public.pem","w").write(vk.to_pem()) +``` + +Load a signing key from disk, use it to sign a message, and write the +signature to disk: + +```python +from ecdsa import SigningKey +sk = SigningKey.from_pem(open("private.pem").read()) +message = open("message","rb").read() +sig = sk.sign(message) +open("signature","wb").write(sig) +``` + +Load the verifying key, message, and signature from disk, and verify the +signature: + +```python +from ecdsa import VerifyingKey, BadSignatureError +vk = VerifyingKey.from_pem(open("public.pem").read()) +message = open("message","rb").read() +sig = open("signature","rb").read() +try: + vk.verify(sig, message) + print "good signature" +except BadSignatureError: + print "BAD SIGNATURE" +``` + +Create a NIST521p keypair + +```python +from ecdsa import SigningKey, NIST521p +sk = SigningKey.generate(curve=NIST521p) +vk = sk.get_verifying_key() +``` + +Create three independent signing keys from a master seed: + +```python +from ecdsa import NIST192p, SigningKey +from ecdsa.util import randrange_from_seed__trytryagain + +def make_key_from_seed(seed, curve=NIST192p): + secexp = randrange_from_seed__trytryagain(seed, curve.order) + return SigningKey.from_secret_exponent(secexp, curve) + +sk1 = make_key_from_seed("1:%s" % seed) +sk2 = make_key_from_seed("2:%s" % seed) +sk3 = make_key_from_seed("3:%s" % seed) +``` diff --git a/ecdsa/__init__.py b/ecdsa/__init__.py new file mode 100755 index 0000000..d896bbc --- /dev/null +++ b/ecdsa/__init__.py @@ -0,0 +1,14 @@ +from .keys import SigningKey, VerifyingKey, BadSignatureError, BadDigestError +from .curves import NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1 + +# This code comes from http://github.com/warner/python-ecdsa +from ._version import get_versions +__version__ = get_versions()['version'] +del get_versions + +__all__ = ["curves", "der", "ecdsa", "ellipticcurve", "keys", "numbertheory", + "test_pyecdsa", "util", "six"] + +_hush_pyflakes = [SigningKey, VerifyingKey, BadSignatureError, BadDigestError, + NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1] +del _hush_pyflakes diff --git a/ecdsa/_version.py b/ecdsa/_version.py new file mode 100755 index 0000000..70a9130 --- /dev/null +++ b/ecdsa/_version.py @@ -0,0 +1,520 @@ + +# This file helps to compute a version number in source trees obtained from +# git-archive tarball (such as those provided by githubs download-from-tag +# feature). Distribution tarballs (built by setup.py sdist) and build +# directories (produced by setup.py build) will contain a much shorter file +# that just contains the computed version number. + +# This file is released into the public domain. Generated by +# versioneer-0.17 (https://github.com/warner/python-versioneer) + +"""Git implementation of _version.py.""" + +import errno +import os +import re +import subprocess +import sys + + +def get_keywords(): + """Get the keywords needed to look up the version information.""" + # these strings will be replaced by git during git-archive. + # setup.py/versioneer.py will grep for the variable names, so they must + # each be defined on a line of their own. _version.py will just call + # get_keywords(). + git_refnames = "$Format:%d$" + git_full = "$Format:%H$" + git_date = "$Format:%ci$" + keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} + return keywords + + +class VersioneerConfig: + """Container for Versioneer configuration parameters.""" + + +def get_config(): + """Create, populate and return the VersioneerConfig() object.""" + # these strings are filled in when 'setup.py versioneer' creates + # _version.py + cfg = VersioneerConfig() + cfg.VCS = "git" + cfg.style = "pep440" + cfg.tag_prefix = "python-ecdsa-" + cfg.parentdir_prefix = "ecdsa-" + cfg.versionfile_source = "ecdsa/_version.py" + cfg.verbose = False + return cfg + + +class NotThisMethod(Exception): + """Exception raised if a method is not valid for the current scenario.""" + + +LONG_VERSION_PY = {} +HANDLERS = {} + + +def register_vcs_handler(vcs, method): # decorator + """Decorator to mark a method as the handler for a particular VCS.""" + def decorate(f): + """Store f in HANDLERS[vcs][method].""" + if vcs not in HANDLERS: + HANDLERS[vcs] = {} + HANDLERS[vcs][method] = f + return f + return decorate + + +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, + env=None): + """Call the given command(s).""" + assert isinstance(commands, list) + p = None + for c in commands: + try: + dispcmd = str([c] + args) + # remember shell=False, so use git.cmd on windows, not just git + p = subprocess.Popen([c] + args, cwd=cwd, env=env, + stdout=subprocess.PIPE, + stderr=(subprocess.PIPE if hide_stderr + else None)) + break + except EnvironmentError: + e = sys.exc_info()[1] + if e.errno == errno.ENOENT: + continue + if verbose: + print("unable to run %s" % dispcmd) + print(e) + return None, None + else: + if verbose: + print("unable to find command, tried %s" % (commands,)) + return None, None + stdout = p.communicate()[0].strip() + if sys.version_info[0] >= 3: + stdout = stdout.decode() + if p.returncode != 0: + if verbose: + print("unable to run %s (error)" % dispcmd) + print("stdout was %s" % stdout) + return None, p.returncode + return stdout, p.returncode + + +def versions_from_parentdir(parentdir_prefix, root, verbose): + """Try to determine the version from the parent directory name. + + Source tarballs conventionally unpack into a directory that includes both + the project name and a version string. We will also support searching up + two directory levels for an appropriately named parent directory + """ + rootdirs = [] + + for i in range(3): + dirname = os.path.basename(root) + if dirname.startswith(parentdir_prefix): + return {"version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, "error": None, "date": None} + else: + rootdirs.append(root) + root = os.path.dirname(root) # up a level + + if verbose: + print("Tried directories %s but none started with prefix %s" % + (str(rootdirs), parentdir_prefix)) + raise NotThisMethod("rootdir doesn't start with parentdir_prefix") + + +@register_vcs_handler("git", "get_keywords") +def git_get_keywords(versionfile_abs): + """Extract version information from the given file.""" + # the code embedded in _version.py can just fetch the value of these + # keywords. When used from setup.py, we don't want to import _version.py, + # so we do it with a regexp instead. This function is not used from + # _version.py. + keywords = {} + try: + f = open(versionfile_abs, "r") + for line in f.readlines(): + if line.strip().startswith("git_refnames ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["refnames"] = mo.group(1) + if line.strip().startswith("git_full ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["full"] = mo.group(1) + if line.strip().startswith("git_date ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["date"] = mo.group(1) + f.close() + except EnvironmentError: + pass + return keywords + + +@register_vcs_handler("git", "keywords") +def git_versions_from_keywords(keywords, tag_prefix, verbose): + """Get version information from git keywords.""" + if not keywords: + raise NotThisMethod("no keywords at all, weird") + date = keywords.get("date") + if date is not None: + # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant + # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 + # -like" string, which we must then edit to make compliant), because + # it's been around since git-1.5.3, and it's too difficult to + # discover which version we're using, or to work around using an + # older one. + date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + refnames = keywords["refnames"].strip() + if refnames.startswith("$Format"): + if verbose: + print("keywords are unexpanded, not using") + raise NotThisMethod("unexpanded keywords, not a git-archive tarball") + refs = set([r.strip() for r in refnames.strip("()").split(",")]) + # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of + # just "foo-1.0". If we see a "tag: " prefix, prefer those. + TAG = "tag: " + tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) + if not tags: + # Either we're using git < 1.8.3, or there really are no tags. We use + # a heuristic: assume all version tags have a digit. The old git %d + # expansion behaves like git log --decorate=short and strips out the + # refs/heads/ and refs/tags/ prefixes that would let us distinguish + # between branches and tags. By ignoring refnames without digits, we + # filter out many common branch names like "release" and + # "stabilization", as well as "HEAD" and "master". + tags = set([r for r in refs if re.search(r'\d', r)]) + if verbose: + print("discarding '%s', no digits" % ",".join(refs - tags)) + if verbose: + print("likely tags: %s" % ",".join(sorted(tags))) + for ref in sorted(tags): + # sorting will prefer e.g. "2.0" over "2.0rc1" + if ref.startswith(tag_prefix): + r = ref[len(tag_prefix):] + if verbose: + print("picking %s" % r) + return {"version": r, + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": None, + "date": date} + # no suitable tags, so version is "0+unknown", but full hex is still there + if verbose: + print("no suitable tags, using unknown + full revision id") + return {"version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": "no suitable tags", "date": None} + + +@register_vcs_handler("git", "pieces_from_vcs") +def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): + """Get version from 'git describe' in the root of the source tree. + + This only gets called if the git-archive 'subst' keywords were *not* + expanded, and _version.py hasn't already been rewritten with a short + version string, meaning we're inside a checked out source tree. + """ + GITS = ["git"] + if sys.platform == "win32": + GITS = ["git.cmd", "git.exe"] + + out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, + hide_stderr=True) + if rc != 0: + if verbose: + print("Directory %s not under git control" % root) + raise NotThisMethod("'git rev-parse --git-dir' returned error") + + # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] + # if there isn't one, this yields HEX[-dirty] (no NUM) + describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", + "--always", "--long", + "--match", "%s*" % tag_prefix], + cwd=root) + # --long was added in git-1.5.5 + if describe_out is None: + raise NotThisMethod("'git describe' failed") + describe_out = describe_out.strip() + full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) + if full_out is None: + raise NotThisMethod("'git rev-parse' failed") + full_out = full_out.strip() + + pieces = {} + pieces["long"] = full_out + pieces["short"] = full_out[:7] # maybe improved later + pieces["error"] = None + + # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] + # TAG might have hyphens. + git_describe = describe_out + + # look for -dirty suffix + dirty = git_describe.endswith("-dirty") + pieces["dirty"] = dirty + if dirty: + git_describe = git_describe[:git_describe.rindex("-dirty")] + + # now we have TAG-NUM-gHEX or HEX + + if "-" in git_describe: + # TAG-NUM-gHEX + mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) + if not mo: + # unparseable. Maybe git-describe is misbehaving? + pieces["error"] = ("unable to parse git-describe output: '%s'" + % describe_out) + return pieces + + # tag + full_tag = mo.group(1) + if not full_tag.startswith(tag_prefix): + if verbose: + fmt = "tag '%s' doesn't start with prefix '%s'" + print(fmt % (full_tag, tag_prefix)) + pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" + % (full_tag, tag_prefix)) + return pieces + pieces["closest-tag"] = full_tag[len(tag_prefix):] + + # distance: number of commits since tag + pieces["distance"] = int(mo.group(2)) + + # commit: short hex revision ID + pieces["short"] = mo.group(3) + + else: + # HEX: no tags + pieces["closest-tag"] = None + count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], + cwd=root) + pieces["distance"] = int(count_out) # total number of commits + + # commit date: see ISO-8601 comment in git_versions_from_keywords() + date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], + cwd=root)[0].strip() + pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + + return pieces + + +def plus_or_dot(pieces): + """Return a + if we don't already have one, else return a .""" + if "+" in pieces.get("closest-tag", ""): + return "." + return "+" + + +def render_pep440(pieces): + """Build up version string, with post-release "local version identifier". + + Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you + get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty + + Exceptions: + 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += plus_or_dot(pieces) + rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0+untagged.%d.g%s" % (pieces["distance"], + pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def render_pep440_pre(pieces): + """TAG[.post.devDISTANCE] -- No -dirty. + + Exceptions: + 1: no tags. 0.post.devDISTANCE + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += ".post.dev%d" % pieces["distance"] + else: + # exception #1 + rendered = "0.post.dev%d" % pieces["distance"] + return rendered + + +def render_pep440_post(pieces): + """TAG[.postDISTANCE[.dev0]+gHEX] . + + The ".dev0" means dirty. Note that .dev0 sorts backwards + (a dirty tree will appear "older" than the corresponding clean one), + but you shouldn't be releasing software with -dirty anyways. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "g%s" % pieces["short"] + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += "+g%s" % pieces["short"] + return rendered + + +def render_pep440_old(pieces): + """TAG[.postDISTANCE[.dev0]] . + + The ".dev0" means dirty. + + Eexceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + return rendered + + +def render_git_describe(pieces): + """TAG[-DISTANCE-gHEX][-dirty]. + + Like 'git describe --tags --dirty --always'. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render_git_describe_long(pieces): + """TAG-DISTANCE-gHEX[-dirty]. + + Like 'git describe --tags --dirty --always -long'. + The distance/hash is unconditional. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render(pieces, style): + """Render the given version pieces into the requested style.""" + if pieces["error"]: + return {"version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None} + + if not style or style == "default": + style = "pep440" # the default + + if style == "pep440": + rendered = render_pep440(pieces) + elif style == "pep440-pre": + rendered = render_pep440_pre(pieces) + elif style == "pep440-post": + rendered = render_pep440_post(pieces) + elif style == "pep440-old": + rendered = render_pep440_old(pieces) + elif style == "git-describe": + rendered = render_git_describe(pieces) + elif style == "git-describe-long": + rendered = render_git_describe_long(pieces) + else: + raise ValueError("unknown style '%s'" % style) + + return {"version": rendered, "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], "error": None, + "date": pieces.get("date")} + + +def get_versions(): + """Get version information or return default if unable to do so.""" + # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have + # __file__, we can work backwards from there to the root. Some + # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which + # case we can only use expanded keywords. + + cfg = get_config() + verbose = cfg.verbose + + try: + return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, + verbose) + except NotThisMethod: + pass + + try: + root = os.path.realpath(__file__) + # versionfile_source is the relative path from the top of the source + # tree (where the .git directory might live) to this file. Invert + # this to find the root from __file__. + for i in cfg.versionfile_source.split('/'): + root = os.path.dirname(root) + except NameError: + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to find root of source tree", + "date": None} + + try: + pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) + return render(pieces, cfg.style) + except NotThisMethod: + pass + + try: + if cfg.parentdir_prefix: + return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) + except NotThisMethod: + pass + + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to compute version", "date": None} diff --git a/ecdsa/curves.py b/ecdsa/curves.py new file mode 100755 index 0000000..5ff53ad --- /dev/null +++ b/ecdsa/curves.py @@ -0,0 +1,56 @@ +from __future__ import division + +from . import der, ecdsa + + +class UnknownCurveError(Exception): + pass + + +def orderlen(order): + return (1+len("%x" % order))//2 # bytes + + +# the NIST curves +class Curve: + def __init__(self, name, curve, generator, oid, openssl_name=None): + self.name = name + self.openssl_name = openssl_name # maybe None + self.curve = curve + self.generator = generator + self.order = generator.order() + self.baselen = orderlen(self.order) + self.verifying_key_length = 2*self.baselen + self.signature_length = 2*self.baselen + self.oid = oid + self.encoded_oid = der.encode_oid(*oid) + +NIST192p = Curve("NIST192p", ecdsa.curve_192, + ecdsa.generator_192, + (1, 2, 840, 10045, 3, 1, 1), "prime192v1") +NIST224p = Curve("NIST224p", ecdsa.curve_224, + ecdsa.generator_224, + (1, 3, 132, 0, 33), "secp224r1") +NIST256p = Curve("NIST256p", ecdsa.curve_256, + ecdsa.generator_256, + (1, 2, 840, 10045, 3, 1, 7), "prime256v1") +NIST384p = Curve("NIST384p", ecdsa.curve_384, + ecdsa.generator_384, + (1, 3, 132, 0, 34), "secp384r1") +NIST521p = Curve("NIST521p", ecdsa.curve_521, + ecdsa.generator_521, + (1, 3, 132, 0, 35), "secp521r1") +SECP256k1 = Curve("SECP256k1", ecdsa.curve_secp256k1, + ecdsa.generator_secp256k1, + (1, 3, 132, 0, 10), "secp256k1") + +curves = [NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1] + + +def find_curve(oid_curve): + for c in curves: + if c.oid == oid_curve: + return c + raise UnknownCurveError("I don't know about the curve with oid %s." + "I only know about these: %s" % + (oid_curve, [c.name for c in curves])) diff --git a/ecdsa/der.py b/ecdsa/der.py new file mode 100755 index 0000000..f7a587a --- /dev/null +++ b/ecdsa/der.py @@ -0,0 +1,222 @@ +from __future__ import division + +import binascii +import base64 +from six import int2byte, b, integer_types, text_type + + +class UnexpectedDER(Exception): + pass + + +def encode_constructed(tag, value): + return int2byte(0xa0+tag) + encode_length(len(value)) + value + + +def encode_integer(r): + assert r >= 0 # can't support negative numbers yet + h = ("%x" % r).encode() + if len(h) % 2: + h = b("0") + h + s = binascii.unhexlify(h) + num = s[0] if isinstance(s[0], integer_types) else ord(s[0]) + if num <= 0x7f: + return b("\x02") + int2byte(len(s)) + s + else: + # DER integers are two's complement, so if the first byte is + # 0x80-0xff then we need an extra 0x00 byte to prevent it from + # looking negative. + return b("\x02") + int2byte(len(s)+1) + b("\x00") + s + + +def encode_bitstring(s): + return b("\x03") + encode_length(len(s)) + s + + +def encode_octet_string(s): + return b("\x04") + encode_length(len(s)) + s + + +def encode_oid(first, second, *pieces): + assert first <= 2 + assert second <= 39 + encoded_pieces = [int2byte(40*first+second)] + [encode_number(p) + for p in pieces] + body = b('').join(encoded_pieces) + return b('\x06') + encode_length(len(body)) + body + + +def encode_sequence(*encoded_pieces): + total_len = sum([len(p) for p in encoded_pieces]) + return b('\x30') + encode_length(total_len) + b('').join(encoded_pieces) + + +def encode_number(n): + b128_digits = [] + while n: + b128_digits.insert(0, (n & 0x7f) | 0x80) + n = n >> 7 + if not b128_digits: + b128_digits.append(0) + b128_digits[-1] &= 0x7f + return b('').join([int2byte(d) for d in b128_digits]) + + +def remove_constructed(string): + s0 = string[0] if isinstance(string[0], integer_types) else ord(string[0]) + if (s0 & 0xe0) != 0xa0: + raise UnexpectedDER("wanted constructed tag (0xa0-0xbf), got 0x%02x" + % s0) + tag = s0 & 0x1f + length, llen = read_length(string[1:]) + body = string[1+llen:1+llen+length] + rest = string[1+llen+length:] + return tag, body, rest + + +def remove_sequence(string): + if not string.startswith(b("\x30")): + n = string[0] if isinstance(string[0], integer_types) else ord(string[0]) + raise UnexpectedDER("wanted sequence (0x30), got 0x%02x" % n) + length, lengthlength = read_length(string[1:]) + endseq = 1+lengthlength+length + return string[1+lengthlength:endseq], string[endseq:] + + +def remove_octet_string(string): + if not string.startswith(b("\x04")): + n = string[0] if isinstance(string[0], integer_types) else ord(string[0]) + raise UnexpectedDER("wanted octetstring (0x04), got 0x%02x" % n) + length, llen = read_length(string[1:]) + body = string[1+llen:1+llen+length] + rest = string[1+llen+length:] + return body, rest + + +def remove_object(string): + if not string.startswith(b("\x06")): + n = string[0] if isinstance(string[0], integer_types) else ord(string[0]) + raise UnexpectedDER("wanted object (0x06), got 0x%02x" % n) + length, lengthlength = read_length(string[1:]) + body = string[1+lengthlength:1+lengthlength+length] + rest = string[1+lengthlength+length:] + numbers = [] + while body: + n, ll = read_number(body) + numbers.append(n) + body = body[ll:] + n0 = numbers.pop(0) + first = n0//40 + second = n0-(40*first) + numbers.insert(0, first) + numbers.insert(1, second) + return tuple(numbers), rest + + +def remove_integer(string): + if not string.startswith(b("\x02")): + n = string[0] if isinstance(string[0], integer_types) else ord(string[0]) + raise UnexpectedDER("wanted integer (0x02), got 0x%02x" % n) + length, llen = read_length(string[1:]) + numberbytes = string[1+llen:1+llen+length] + rest = string[1+llen+length:] + nbytes = numberbytes[0] if isinstance(numberbytes[0], integer_types) else ord(numberbytes[0]) + assert nbytes < 0x80 # can't support negative numbers yet + return int(binascii.hexlify(numberbytes), 16), rest + + +def read_number(string): + number = 0 + llen = 0 + # base-128 big endian, with b7 set in all but the last byte + while True: + if llen > len(string): + raise UnexpectedDER("ran out of length bytes") + number = number << 7 + d = string[llen] if isinstance(string[llen], integer_types) else ord(string[llen]) + number += (d & 0x7f) + llen += 1 + if not d & 0x80: + break + return number, llen + + +def encode_length(l): + assert l >= 0 + if l < 0x80: + return int2byte(l) + s = ("%x" % l).encode() + if len(s) % 2: + s = b("0") + s + s = binascii.unhexlify(s) + llen = len(s) + return int2byte(0x80 | llen) + s + + +def read_length(string): + num = string[0] if isinstance(string[0], integer_types) else ord(string[0]) + if not (num & 0x80): + # short form + return (num & 0x7f), 1 + # else long-form: b0&0x7f is number of additional base256 length bytes, + # big-endian + llen = num & 0x7f + if llen > len(string)-1: + raise UnexpectedDER("ran out of length bytes") + return int(binascii.hexlify(string[1:1+llen]), 16), 1+llen + + +def remove_bitstring(string): + num = string[0] if isinstance(string[0], integer_types) else ord(string[0]) + if not string.startswith(b("\x03")): + raise UnexpectedDER("wanted bitstring (0x03), got 0x%02x" % num) + length, llen = read_length(string[1:]) + body = string[1+llen:1+llen+length] + rest = string[1+llen+length:] + return body, rest + +# SEQUENCE([1, STRING(secexp), cont[0], OBJECT(curvename), cont[1], BINTSTRING) + + +# signatures: (from RFC3279) +# ansi-X9-62 OBJECT IDENTIFIER ::= { +# iso(1) member-body(2) us(840) 10045 } +# +# id-ecSigType OBJECT IDENTIFIER ::= { +# ansi-X9-62 signatures(4) } +# ecdsa-with-SHA1 OBJECT IDENTIFIER ::= { +# id-ecSigType 1 } +## so 1,2,840,10045,4,1 +## so 0x42, .. .. + +# Ecdsa-Sig-Value ::= SEQUENCE { +# r INTEGER, +# s INTEGER } + +# id-public-key-type OBJECT IDENTIFIER ::= { ansi-X9.62 2 } +# +# id-ecPublicKey OBJECT IDENTIFIER ::= { id-publicKeyType 1 } + +# I think the secp224r1 identifier is (t=06,l=05,v=2b81040021) +# secp224r1 OBJECT IDENTIFIER ::= { +# iso(1) identified-organization(3) certicom(132) curve(0) 33 } +# and the secp384r1 is (t=06,l=05,v=2b81040022) +# secp384r1 OBJECT IDENTIFIER ::= { +# iso(1) identified-organization(3) certicom(132) curve(0) 34 } + +def unpem(pem): + if isinstance(pem, text_type): + pem = pem.encode() + + d = b("").join([l.strip() for l in pem.split(b("\n")) + if l and not l.startswith(b("-----"))]) + return base64.b64decode(d) + + +def topem(der, name): + b64 = base64.b64encode(der) + lines = [("-----BEGIN %s-----\n" % name).encode()] + lines.extend([b64[start:start+64]+b("\n") + for start in range(0, len(b64), 64)]) + lines.append(("-----END %s-----\n" % name).encode()) + return b("").join(lines) diff --git a/ecdsa/ecdsa.py b/ecdsa/ecdsa.py new file mode 100755 index 0000000..4f387b7 --- /dev/null +++ b/ecdsa/ecdsa.py @@ -0,0 +1,277 @@ +#! /usr/bin/env python + +""" +Implementation of Elliptic-Curve Digital Signatures. + +Classes and methods for elliptic-curve signatures: +private keys, public keys, signatures, +NIST prime-modulus curves with modulus lengths of +192, 224, 256, 384, and 521 bits. + +Example: + + # (In real-life applications, you would probably want to + # protect against defects in SystemRandom.) + from random import SystemRandom + randrange = SystemRandom().randrange + + # Generate a public/private key pair using the NIST Curve P-192: + + g = generator_192 + n = g.order() + secret = randrange( 1, n ) + pubkey = Public_key( g, g * secret ) + privkey = Private_key( pubkey, secret ) + + # Signing a hash value: + + hash = randrange( 1, n ) + signature = privkey.sign( hash, randrange( 1, n ) ) + + # Verifying a signature for a hash value: + + if pubkey.verifies( hash, signature ): + print_("Demo verification succeeded.") + else: + print_("*** Demo verification failed.") + + # Verification fails if the hash value is modified: + + if pubkey.verifies( hash-1, signature ): + print_("**** Demo verification failed to reject tampered hash.") + else: + print_("Demo verification correctly rejected tampered hash.") + +Version of 2009.05.16. + +Revision history: + 2005.12.31 - Initial version. + 2008.11.25 - Substantial revisions introducing new classes. + 2009.05.16 - Warn against using random.randrange in real applications. + 2009.05.17 - Use random.SystemRandom by default. + +Written in 2005 by Peter Pearson and placed in the public domain. +""" + +from six import int2byte, b +from . import ellipticcurve +from . import numbertheory + + +class Signature(object): + """ECDSA signature. + """ + def __init__(self, r, s): + self.r = r + self.s = s + + +class Public_key(object): + """Public key for ECDSA. + """ + + def __init__(self, generator, point): + """generator is the Point that generates the group, + point is the Point that defines the public key. + """ + + self.curve = generator.curve() + self.generator = generator + self.point = point + n = generator.order() + if not n: + raise RuntimeError("Generator point must have order.") + if not n * point == ellipticcurve.INFINITY: + raise RuntimeError("Generator point order is bad.") + if point.x() < 0 or n <= point.x() or point.y() < 0 or n <= point.y(): + raise RuntimeError("Generator point has x or y out of range.") + + def verifies(self, hash, signature): + """Verify that signature is a valid signature of hash. + Return True if the signature is valid. + """ + + # From X9.62 J.3.1. + + G = self.generator + n = G.order() + r = signature.r + s = signature.s + if r < 1 or r > n - 1: + return False + if s < 1 or s > n - 1: + return False + c = numbertheory.inverse_mod(s, n) + u1 = (hash * c) % n + u2 = (r * c) % n + xy = u1 * G + u2 * self.point + v = xy.x() % n + return v == r + + +class Private_key(object): + """Private key for ECDSA. + """ + + def __init__(self, public_key, secret_multiplier): + """public_key is of class Public_key; + secret_multiplier is a large integer. + """ + + self.public_key = public_key + self.secret_multiplier = secret_multiplier + + def sign(self, hash, random_k): + """Return a signature for the provided hash, using the provided + random nonce. It is absolutely vital that random_k be an unpredictable + number in the range [1, self.public_key.point.order()-1]. If + an attacker can guess random_k, he can compute our private key from a + single signature. Also, if an attacker knows a few high-order + bits (or a few low-order bits) of random_k, he can compute our private + key from many signatures. The generation of nonces with adequate + cryptographic strength is very difficult and far beyond the scope + of this comment. + + May raise RuntimeError, in which case retrying with a new + random value k is in order. + """ + + G = self.public_key.generator + n = G.order() + k = random_k % n + p1 = k * G + r = p1.x() + if r == 0: + raise RuntimeError("amazingly unlucky random number r") + s = (numbertheory.inverse_mod(k, n) * + (hash + (self.secret_multiplier * r) % n)) % n + if s == 0: + raise RuntimeError("amazingly unlucky random number s") + return Signature(r, s) + + +def int_to_string(x): + """Convert integer x into a string of bytes, as per X9.62.""" + assert x >= 0 + if x == 0: + return b('\0') + result = [] + while x: + ordinal = x & 0xFF + result.append(int2byte(ordinal)) + x >>= 8 + + result.reverse() + return b('').join(result) + + +def string_to_int(s): + """Convert a string of bytes into an integer, as per X9.62.""" + result = 0 + for c in s: + if not isinstance(c, int): + c = ord(c) + result = 256 * result + c + return result + + +def digest_integer(m): + """Convert an integer into a string of bytes, compute + its SHA-1 hash, and convert the result to an integer.""" + # + # I don't expect this function to be used much. I wrote + # it in order to be able to duplicate the examples + # in ECDSAVS. + # + from hashlib import sha1 + return string_to_int(sha1(int_to_string(m)).digest()) + + +def point_is_valid(generator, x, y): + """Is (x,y) a valid public key based on the specified generator?""" + + # These are the tests specified in X9.62. + + n = generator.order() + curve = generator.curve() + if x < 0 or n <= x or y < 0 or n <= y: + return False + if not curve.contains_point(x, y): + return False + if not n * ellipticcurve.Point(curve, x, y) == ellipticcurve.INFINITY: + return False + return True + + +# NIST Curve P-192: +_p = 6277101735386680763835789423207666416083908700390324961279 +_r = 6277101735386680763835789423176059013767194773182842284081 +# s = 0x3045ae6fc8422f64ed579528d38120eae12196d5L +# c = 0x3099d2bbbfcb2538542dcd5fb078b6ef5f3d6fe2c745de65L +_b = 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1 +_Gx = 0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012 +_Gy = 0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811 + +curve_192 = ellipticcurve.CurveFp(_p, -3, _b) +generator_192 = ellipticcurve.Point(curve_192, _Gx, _Gy, _r) + + +# NIST Curve P-224: +_p = 26959946667150639794667015087019630673557916260026308143510066298881 +_r = 26959946667150639794667015087019625940457807714424391721682722368061 +# s = 0xbd71344799d5c7fcdc45b59fa3b9ab8f6a948bc5L +# c = 0x5b056c7e11dd68f40469ee7f3c7a7d74f7d121116506d031218291fbL +_b = 0xb4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4 +_Gx = 0xb70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21 +_Gy = 0xbd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34 + +curve_224 = ellipticcurve.CurveFp(_p, -3, _b) +generator_224 = ellipticcurve.Point(curve_224, _Gx, _Gy, _r) + +# NIST Curve P-256: +_p = 115792089210356248762697446949407573530086143415290314195533631308867097853951 +_r = 115792089210356248762697446949407573529996955224135760342422259061068512044369 +# s = 0xc49d360886e704936a6678e1139d26b7819f7e90L +# c = 0x7efba1662985be9403cb055c75d4f7e0ce8d84a9c5114abcaf3177680104fa0dL +_b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b +_Gx = 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296 +_Gy = 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5 + +curve_256 = ellipticcurve.CurveFp(_p, -3, _b) +generator_256 = ellipticcurve.Point(curve_256, _Gx, _Gy, _r) + +# NIST Curve P-384: +_p = 39402006196394479212279040100143613805079739270465446667948293404245721771496870329047266088258938001861606973112319 +_r = 39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643 +# s = 0xa335926aa319a27a1d00896a6773a4827acdac73L +# c = 0x79d1e655f868f02fff48dcdee14151ddb80643c1406d0ca10dfe6fc52009540a495e8042ea5f744f6e184667cc722483L +_b = 0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef +_Gx = 0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7 +_Gy = 0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f + +curve_384 = ellipticcurve.CurveFp(_p, -3, _b) +generator_384 = ellipticcurve.Point(curve_384, _Gx, _Gy, _r) + +# NIST Curve P-521: +_p = 6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151 +_r = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005449 +# s = 0xd09e8800291cb85396cc6717393284aaa0da64baL +# c = 0x0b48bfa5f420a34949539d2bdfc264eeeeb077688e44fbf0ad8f6d0edb37bd6b533281000518e19f1b9ffbe0fe9ed8a3c2200b8f875e523868c70c1e5bf55bad637L +_b = 0x051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00 +_Gx = 0xc6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66 +_Gy = 0x11839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650 + +curve_521 = ellipticcurve.CurveFp(_p, -3, _b) +generator_521 = ellipticcurve.Point(curve_521, _Gx, _Gy, _r) + +# Certicom secp256-k1 +_a = 0x0000000000000000000000000000000000000000000000000000000000000000 +_b = 0x0000000000000000000000000000000000000000000000000000000000000007 +_p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f +_Gx = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 +_Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 +_r = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 + +curve_secp256k1 = ellipticcurve.CurveFp(_p, _a, _b) +generator_secp256k1 = ellipticcurve.Point(curve_secp256k1, _Gx, _Gy, _r) + diff --git a/ecdsa/ellipticcurve.py b/ecdsa/ellipticcurve.py new file mode 100755 index 0000000..60aaec2 --- /dev/null +++ b/ecdsa/ellipticcurve.py @@ -0,0 +1,195 @@ +#! /usr/bin/env python +# +# Implementation of elliptic curves, for cryptographic applications. +# +# This module doesn't provide any way to choose a random elliptic +# curve, nor to verify that an elliptic curve was chosen randomly, +# because one can simply use NIST's standard curves. +# +# Notes from X9.62-1998 (draft): +# Nomenclature: +# - Q is a public key. +# The "Elliptic Curve Domain Parameters" include: +# - q is the "field size", which in our case equals p. +# - p is a big prime. +# - G is a point of prime order (5.1.1.1). +# - n is the order of G (5.1.1.1). +# Public-key validation (5.2.2): +# - Verify that Q is not the point at infinity. +# - Verify that X_Q and Y_Q are in [0,p-1]. +# - Verify that Q is on the curve. +# - Verify that nQ is the point at infinity. +# Signature generation (5.3): +# - Pick random k from [1,n-1]. +# Signature checking (5.4.2): +# - Verify that r and s are in [1,n-1]. +# +# Version of 2008.11.25. +# +# Revision history: +# 2005.12.31 - Initial version. +# 2008.11.25 - Change CurveFp.is_on to contains_point. +# +# Written in 2005 by Peter Pearson and placed in the public domain. + +from __future__ import division + +from six import python_2_unicode_compatible +from . import numbertheory + +@python_2_unicode_compatible +class CurveFp(object): + """Elliptic Curve over the field of integers modulo a prime.""" + def __init__(self, p, a, b): + """The curve of points satisfying y^2 = x^3 + a*x + b (mod p).""" + self.__p = p + self.__a = a + self.__b = b + + def p(self): + return self.__p + + def a(self): + return self.__a + + def b(self): + return self.__b + + def contains_point(self, x, y): + """Is the point (x,y) on this curve?""" + return (y * y - (x * x * x + self.__a * x + self.__b)) % self.__p == 0 + + def __str__(self): + return "CurveFp(p=%d, a=%d, b=%d)" % (self.__p, self.__a, self.__b) + +class Point(object): + """A point on an elliptic curve. Altering x and y is forbidding, + but they can be read by the x() and y() methods.""" + def __init__(self, curve, x, y, order=None): + """curve, x, y, order; order (optional) is the order of this point.""" + self.__curve = curve + self.__x = x + self.__y = y + self.__order = order + # self.curve is allowed to be None only for INFINITY: + if self.__curve: + assert self.__curve.contains_point(x, y) + if order: + assert self * order == INFINITY + + def __eq__(self, other): + """Return True if the points are identical, False otherwise.""" + if self.__curve == other.__curve \ + and self.__x == other.__x \ + and self.__y == other.__y: + return True + else: + return False + + def __add__(self, other): + """Add one point to another point.""" + + # X9.62 B.3: + + if other == INFINITY: + return self + if self == INFINITY: + return other + # assert self.__curve == other.__curve + if self.__x == other.__x: + if (self.__y + other.__y) % self.__curve.p() == 0: + return INFINITY + else: + return self.double() + + p = self.__curve.p() + + l = ((other.__y - self.__y) * \ + numbertheory.inverse_mod(other.__x - self.__x, p)) % p + + x3 = (l * l - self.__x - other.__x) % p + y3 = (l * (self.__x - x3) - self.__y) % p + return Point(self.__curve, x3, y3) + + def __mul__(self, other): + """Multiply a point by an integer.""" + + def leftmost_bit(x): + assert x > 0 + result = 1 + while result <= x: + result = 2 * result + return result // 2 + + e = other + if self.__order: + e = e % self.__order + if e == 0: + return INFINITY + if self == INFINITY: + return INFINITY + assert e > 0 + + # From X9.62 D.3.2: + + e3 = 3 * e + negative_self = Point(self.__curve, self.__x, -self.__y, self.__order) + i = leftmost_bit(e3) // 2 + result = self + # print_("Multiplying %s by %d (e3 = %d):" % (self, other, e3)) + while i > 1: + result = result.double() + if (e3 & i) != 0 and (e & i) == 0: + result = result + self + if (e3 & i) == 0 and (e & i) != 0: + result = result + negative_self + # print_(". . . i = %d, result = %s" % ( i, result )) + i = i // 2 + + return result + + def __rmul__(self, other): + """Multiply a point by an integer.""" + + return self * other + + def __str__(self): + if self == INFINITY: + return "infinity" + return "(%d,%d)" % (self.__x, self.__y) + + def double(self): + """Return a new point that is twice the old.""" + + if self == INFINITY: + return INFINITY + + # X9.62 B.3: + + p = self.__curve.p() + a = self.__curve.a() + + l = ((3 * self.__x * self.__x + a) * \ + numbertheory.inverse_mod(2 * self.__y, p)) % p + + x3 = (l * l - 2 * self.__x) % p + y3 = (l * (self.__x - x3) - self.__y) % p + + return Point(self.__curve, x3, y3) + + def x(self): + return self.__x + + def y(self): + return self.__y + + def curve(self): + return self.__curve + + def order(self): + return self.__order + + +# This one point is the Point At Infinity for all purposes: +INFINITY = Point(None, None, None) + diff --git a/ecdsa/keys.py b/ecdsa/keys.py new file mode 100755 index 0000000..48dcf36 --- /dev/null +++ b/ecdsa/keys.py @@ -0,0 +1,289 @@ +import binascii + +from . import ecdsa +from . import der +from . import rfc6979 +from .curves import NIST192p, find_curve +from .util import string_to_number, number_to_string, randrange +from .util import sigencode_string, sigdecode_string +from .util import oid_ecPublicKey, encoded_oid_ecPublicKey +from six import PY3, b +from hashlib import sha1 + + +class BadSignatureError(Exception): + pass + + +class BadDigestError(Exception): + pass + + +class VerifyingKey: + def __init__(self, _error__please_use_generate=None): + if not _error__please_use_generate: + raise TypeError("Please use SigningKey.generate() to construct me") + + @classmethod + def from_public_point(klass, point, curve=NIST192p, hashfunc=sha1): + self = klass(_error__please_use_generate=True) + self.curve = curve + self.default_hashfunc = hashfunc + self.pubkey = ecdsa.Public_key(curve.generator, point) + self.pubkey.order = curve.order + return self + + @classmethod + def from_string(klass, string, curve=NIST192p, hashfunc=sha1, + validate_point=True): + order = curve.order + assert (len(string) == curve.verifying_key_length), \ + (len(string), curve.verifying_key_length) + xs = string[:curve.baselen] + ys = string[curve.baselen:] + assert len(xs) == curve.baselen, (len(xs), curve.baselen) + assert len(ys) == curve.baselen, (len(ys), curve.baselen) + x = string_to_number(xs) + y = string_to_number(ys) + if validate_point: + assert ecdsa.point_is_valid(curve.generator, x, y) + from . import ellipticcurve + point = ellipticcurve.Point(curve.curve, x, y, order) + return klass.from_public_point(point, curve, hashfunc) + + @classmethod + def from_pem(klass, string): + return klass.from_der(der.unpem(string)) + + @classmethod + def from_der(klass, string): + # [[oid_ecPublicKey,oid_curve], point_str_bitstring] + s1, empty = der.remove_sequence(string) + if empty != b(""): + raise der.UnexpectedDER("trailing junk after DER pubkey: %s" % + binascii.hexlify(empty)) + s2, point_str_bitstring = der.remove_sequence(s1) + # s2 = oid_ecPublicKey,oid_curve + oid_pk, rest = der.remove_object(s2) + oid_curve, empty = der.remove_object(rest) + if empty != b(""): + raise der.UnexpectedDER("trailing junk after DER pubkey objects: %s" % + binascii.hexlify(empty)) + assert oid_pk == oid_ecPublicKey, (oid_pk, oid_ecPublicKey) + curve = find_curve(oid_curve) + point_str, empty = der.remove_bitstring(point_str_bitstring) + if empty != b(""): + raise der.UnexpectedDER("trailing junk after pubkey pointstring: %s" % + binascii.hexlify(empty)) + assert point_str.startswith(b("\x00\x04")) + return klass.from_string(point_str[2:], curve) + + def to_string(self): + # VerifyingKey.from_string(vk.to_string()) == vk as long as the + # curves are the same: the curve itself is not included in the + # serialized form + order = self.pubkey.order + x_str = number_to_string(self.pubkey.point.x(), order) + y_str = number_to_string(self.pubkey.point.y(), order) + return x_str + y_str + + def to_pem(self): + return der.topem(self.to_der(), "PUBLIC KEY") + + def to_der(self): + order = self.pubkey.order + x_str = number_to_string(self.pubkey.point.x(), order) + y_str = number_to_string(self.pubkey.point.y(), order) + point_str = b("\x00\x04") + x_str + y_str + return der.encode_sequence(der.encode_sequence(encoded_oid_ecPublicKey, + self.curve.encoded_oid), + der.encode_bitstring(point_str)) + + def verify(self, signature, data, hashfunc=None, sigdecode=sigdecode_string): + hashfunc = hashfunc or self.default_hashfunc + digest = hashfunc(data).digest() + return self.verify_digest(signature, digest, sigdecode) + + def verify_digest(self, signature, digest, sigdecode=sigdecode_string): + if len(digest) > self.curve.baselen: + raise BadDigestError("this curve (%s) is too short " + "for your digest (%d)" % (self.curve.name, + 8 * len(digest))) + number = string_to_number(digest) + r, s = sigdecode(signature, self.pubkey.order) + sig = ecdsa.Signature(r, s) + if self.pubkey.verifies(number, sig): + return True + raise BadSignatureError + + +class SigningKey: + def __init__(self, _error__please_use_generate=None): + if not _error__please_use_generate: + raise TypeError("Please use SigningKey.generate() to construct me") + + @classmethod + def generate(klass, curve=NIST192p, entropy=None, hashfunc=sha1): + secexp = randrange(curve.order, entropy) + return klass.from_secret_exponent(secexp, curve, hashfunc) + + # to create a signing key from a short (arbitrary-length) seed, convert + # that seed into an integer with something like + # secexp=util.randrange_from_seed__X(seed, curve.order), and then pass + # that integer into SigningKey.from_secret_exponent(secexp, curve) + + @classmethod + def from_secret_exponent(klass, secexp, curve=NIST192p, hashfunc=sha1): + self = klass(_error__please_use_generate=True) + self.curve = curve + self.default_hashfunc = hashfunc + self.baselen = curve.baselen + n = curve.order + assert 1 <= secexp < n + pubkey_point = curve.generator * secexp + pubkey = ecdsa.Public_key(curve.generator, pubkey_point) + pubkey.order = n + self.verifying_key = VerifyingKey.from_public_point(pubkey_point, curve, + hashfunc) + self.privkey = ecdsa.Private_key(pubkey, secexp) + self.privkey.order = n + return self + + @classmethod + def from_string(klass, string, curve=NIST192p, hashfunc=sha1): + assert len(string) == curve.baselen, (len(string), curve.baselen) + secexp = string_to_number(string) + return klass.from_secret_exponent(secexp, curve, hashfunc) + + @classmethod + def from_pem(klass, string, hashfunc=sha1): + # the privkey pem file has two sections: "EC PARAMETERS" and "EC + # PRIVATE KEY". The first is redundant. + if PY3 and isinstance(string, str): + string = string.encode() + privkey_pem = string[string.index(b("-----BEGIN EC PRIVATE KEY-----")):] + return klass.from_der(der.unpem(privkey_pem), hashfunc) + + @classmethod + def from_der(klass, string, hashfunc=sha1): + # SEQ([int(1), octetstring(privkey),cont[0], oid(secp224r1), + # cont[1],bitstring]) + s, empty = der.remove_sequence(string) + if empty != b(""): + raise der.UnexpectedDER("trailing junk after DER privkey: %s" % + binascii.hexlify(empty)) + one, s = der.remove_integer(s) + if one != 1: + raise der.UnexpectedDER("expected '1' at start of DER privkey," + " got %d" % one) + privkey_str, s = der.remove_octet_string(s) + tag, curve_oid_str, s = der.remove_constructed(s) + if tag != 0: + raise der.UnexpectedDER("expected tag 0 in DER privkey," + " got %d" % tag) + curve_oid, empty = der.remove_object(curve_oid_str) + if empty != b(""): + raise der.UnexpectedDER("trailing junk after DER privkey " + "curve_oid: %s" % binascii.hexlify(empty)) + curve = find_curve(curve_oid) + + # we don't actually care about the following fields + # + # tag, pubkey_bitstring, s = der.remove_constructed(s) + # if tag != 1: + # raise der.UnexpectedDER("expected tag 1 in DER privkey, got %d" + # % tag) + # pubkey_str = der.remove_bitstring(pubkey_bitstring) + # if empty != "": + # raise der.UnexpectedDER("trailing junk after DER privkey " + # "pubkeystr: %s" % binascii.hexlify(empty)) + + # our from_string method likes fixed-length privkey strings + if len(privkey_str) < curve.baselen: + privkey_str = b("\x00") * (curve.baselen - len(privkey_str)) + privkey_str + return klass.from_string(privkey_str, curve, hashfunc) + + def to_string(self): + secexp = self.privkey.secret_multiplier + s = number_to_string(secexp, self.privkey.order) + return s + + def to_pem(self): + # TODO: "BEGIN ECPARAMETERS" + return der.topem(self.to_der(), "EC PRIVATE KEY") + + def to_der(self): + # SEQ([int(1), octetstring(privkey),cont[0], oid(secp224r1), + # cont[1],bitstring]) + encoded_vk = b("\x00\x04") + self.get_verifying_key().to_string() + return der.encode_sequence(der.encode_integer(1), + der.encode_octet_string(self.to_string()), + der.encode_constructed(0, self.curve.encoded_oid), + der.encode_constructed(1, der.encode_bitstring(encoded_vk)), + ) + + def get_verifying_key(self): + return self.verifying_key + + def sign_deterministic(self, data, hashfunc=None, sigencode=sigencode_string): + hashfunc = hashfunc or self.default_hashfunc + digest = hashfunc(data).digest() + + return self.sign_digest_deterministic(digest, hashfunc=hashfunc, sigencode=sigencode) + + def sign_digest_deterministic(self, digest, hashfunc=None, sigencode=sigencode_string): + """ + Calculates 'k' from data itself, removing the need for strong + random generator and producing deterministic (reproducible) signatures. + See RFC 6979 for more details. + """ + secexp = self.privkey.secret_multiplier + k = rfc6979.generate_k( + self.curve.generator.order(), secexp, hashfunc, digest) + + return self.sign_digest(digest, sigencode=sigencode, k=k) + + def sign(self, data, entropy=None, hashfunc=None, sigencode=sigencode_string, k=None): + """ + hashfunc= should behave like hashlib.sha1 . The output length of the + hash (in bytes) must not be longer than the length of the curve order + (rounded up to the nearest byte), so using SHA256 with nist256p is + ok, but SHA256 with nist192p is not. (In the 2**-96ish unlikely event + of a hash output larger than the curve order, the hash will + effectively be wrapped mod n). + + Use hashfunc=hashlib.sha1 to match openssl's -ecdsa-with-SHA1 mode, + or hashfunc=hashlib.sha256 for openssl-1.0.0's -ecdsa-with-SHA256. + """ + + hashfunc = hashfunc or self.default_hashfunc + h = hashfunc(data).digest() + return self.sign_digest(h, entropy, sigencode, k) + + def sign_digest(self, digest, entropy=None, sigencode=sigencode_string, k=None): + if len(digest) > self.curve.baselen: + raise BadDigestError("this curve (%s) is too short " + "for your digest (%d)" % (self.curve.name, + 8 * len(digest))) + number = string_to_number(digest) + r, s = self.sign_number(number, entropy, k) + return sigencode(r, s, self.privkey.order) + + def sign_number(self, number, entropy=None, k=None): + # returns a pair of numbers + order = self.privkey.order + # privkey.sign() may raise RuntimeError in the amazingly unlikely + # (2**-192) event that r=0 or s=0, because that would leak the key. + # We could re-try with a different 'k', but we couldn't test that + # code, so I choose to allow the signature to fail instead. + + # If k is set, it is used directly. In other cases + # it is generated using entropy function + if k is not None: + _k = k + else: + _k = randrange(order, entropy) + + assert 1 <= _k < order + sig = self.privkey.sign(number, _k) + return sig.r, sig.s diff --git a/ecdsa/numbertheory.py b/ecdsa/numbertheory.py new file mode 100755 index 0000000..2b49725 --- /dev/null +++ b/ecdsa/numbertheory.py @@ -0,0 +1,530 @@ +#! /usr/bin/env python +# +# Provide some simple capabilities from number theory. +# +# Version of 2008.11.14. +# +# Written in 2005 and 2006 by Peter Pearson and placed in the public domain. +# Revision history: +# 2008.11.14: Use pow(base, exponent, modulus) for modular_exp. +# Make gcd and lcm accept arbitrarly many arguments. + +from __future__ import division + +from six import integer_types +from six.moves import reduce + +import math + + +class Error(Exception): + """Base class for exceptions in this module.""" + pass + + +class SquareRootError(Error): + pass + + +class NegativeExponentError(Error): + pass + + +def modular_exp(base, exponent, modulus): + "Raise base to exponent, reducing by modulus" + if exponent < 0: + raise NegativeExponentError("Negative exponents (%d) not allowed" \ + % exponent) + return pow(base, exponent, modulus) +# result = 1L +# x = exponent +# b = base + 0L +# while x > 0: +# if x % 2 > 0: result = (result * b) % modulus +# x = x // 2 +# b = (b * b) % modulus +# return result + + +def polynomial_reduce_mod(poly, polymod, p): + """Reduce poly by polymod, integer arithmetic modulo p. + + Polynomials are represented as lists of coefficients + of increasing powers of x.""" + + # This module has been tested only by extensive use + # in calculating modular square roots. + + # Just to make this easy, require a monic polynomial: + assert polymod[-1] == 1 + + assert len(polymod) > 1 + + while len(poly) >= len(polymod): + if poly[-1] != 0: + for i in range(2, len(polymod) + 1): + poly[-i] = (poly[-i] - poly[-1] * polymod[-i]) % p + poly = poly[0:-1] + + return poly + + +def polynomial_multiply_mod(m1, m2, polymod, p): + """Polynomial multiplication modulo a polynomial over ints mod p. + + Polynomials are represented as lists of coefficients + of increasing powers of x.""" + + # This is just a seat-of-the-pants implementation. + + # This module has been tested only by extensive use + # in calculating modular square roots. + + # Initialize the product to zero: + + prod = (len(m1) + len(m2) - 1) * [0] + + # Add together all the cross-terms: + + for i in range(len(m1)): + for j in range(len(m2)): + prod[i + j] = (prod[i + j] + m1[i] * m2[j]) % p + + return polynomial_reduce_mod(prod, polymod, p) + + +def polynomial_exp_mod(base, exponent, polymod, p): + """Polynomial exponentiation modulo a polynomial over ints mod p. + + Polynomials are represented as lists of coefficients + of increasing powers of x.""" + + # Based on the Handbook of Applied Cryptography, algorithm 2.227. + + # This module has been tested only by extensive use + # in calculating modular square roots. + + assert exponent < p + + if exponent == 0: + return [1] + + G = base + k = exponent + if k % 2 == 1: + s = G + else: + s = [1] + + while k > 1: + k = k // 2 + G = polynomial_multiply_mod(G, G, polymod, p) + if k % 2 == 1: + s = polynomial_multiply_mod(G, s, polymod, p) + + return s + + +def jacobi(a, n): + """Jacobi symbol""" + + # Based on the Handbook of Applied Cryptography (HAC), algorithm 2.149. + + # This function has been tested by comparison with a small + # table printed in HAC, and by extensive use in calculating + # modular square roots. + + assert n >= 3 + assert n % 2 == 1 + a = a % n + if a == 0: + return 0 + if a == 1: + return 1 + a1, e = a, 0 + while a1 % 2 == 0: + a1, e = a1 // 2, e + 1 + if e % 2 == 0 or n % 8 == 1 or n % 8 == 7: + s = 1 + else: + s = -1 + if a1 == 1: + return s + if n % 4 == 3 and a1 % 4 == 3: + s = -s + return s * jacobi(n % a1, a1) + + +def square_root_mod_prime(a, p): + """Modular square root of a, mod p, p prime.""" + + # Based on the Handbook of Applied Cryptography, algorithms 3.34 to 3.39. + + # This module has been tested for all values in [0,p-1] for + # every prime p from 3 to 1229. + + assert 0 <= a < p + assert 1 < p + + if a == 0: + return 0 + if p == 2: + return a + + jac = jacobi(a, p) + if jac == -1: + raise SquareRootError("%d has no square root modulo %d" \ + % (a, p)) + + if p % 4 == 3: + return modular_exp(a, (p + 1) // 4, p) + + if p % 8 == 5: + d = modular_exp(a, (p - 1) // 4, p) + if d == 1: + return modular_exp(a, (p + 3) // 8, p) + if d == p - 1: + return (2 * a * modular_exp(4 * a, (p - 5) // 8, p)) % p + raise RuntimeError("Shouldn't get here.") + + for b in range(2, p): + if jacobi(b * b - 4 * a, p) == -1: + f = (a, -b, 1) + ff = polynomial_exp_mod((0, 1), (p + 1) // 2, f, p) + assert ff[1] == 0 + return ff[0] + raise RuntimeError("No b found.") + + +def inverse_mod(a, m): + """Inverse of a mod m.""" + + if a < 0 or m <= a: + a = a % m + + # From Ferguson and Schneier, roughly: + + c, d = a, m + uc, vc, ud, vd = 1, 0, 0, 1 + while c != 0: + q, c, d = divmod(d, c) + (c,) + uc, vc, ud, vd = ud - q * uc, vd - q * vc, uc, vc + + # At this point, d is the GCD, and ud*a+vd*m = d. + # If d == 1, this means that ud is a inverse. + + assert d == 1 + if ud > 0: + return ud + else: + return ud + m + + +def gcd2(a, b): + """Greatest common divisor using Euclid's algorithm.""" + while a: + a, b = b % a, a + return b + + +def gcd(*a): + """Greatest common divisor. + + Usage: gcd([ 2, 4, 6 ]) + or: gcd(2, 4, 6) + """ + + if len(a) > 1: + return reduce(gcd2, a) + if hasattr(a[0], "__iter__"): + return reduce(gcd2, a[0]) + return a[0] + + +def lcm2(a, b): + """Least common multiple of two integers.""" + + return (a * b) // gcd(a, b) + + +def lcm(*a): + """Least common multiple. + + Usage: lcm([ 3, 4, 5 ]) + or: lcm(3, 4, 5) + """ + + if len(a) > 1: + return reduce(lcm2, a) + if hasattr(a[0], "__iter__"): + return reduce(lcm2, a[0]) + return a[0] + + +def factorization(n): + """Decompose n into a list of (prime,exponent) pairs.""" + + assert isinstance(n, integer_types) + + if n < 2: + return [] + + result = [] + d = 2 + + # Test the small primes: + + for d in smallprimes: + if d > n: + break + q, r = divmod(n, d) + if r == 0: + count = 1 + while d <= n: + n = q + q, r = divmod(n, d) + if r != 0: + break + count = count + 1 + result.append((d, count)) + + # If n is still greater than the last of our small primes, + # it may require further work: + + if n > smallprimes[-1]: + if is_prime(n): # If what's left is prime, it's easy: + result.append((n, 1)) + else: # Ugh. Search stupidly for a divisor: + d = smallprimes[-1] + while 1: + d = d + 2 # Try the next divisor. + q, r = divmod(n, d) + if q < d: # n < d*d means we're done, n = 1 or prime. + break + if r == 0: # d divides n. How many times? + count = 1 + n = q + while d <= n: # As long as d might still divide n, + q, r = divmod(n, d) # see if it does. + if r != 0: + break + n = q # It does. Reduce n, increase count. + count = count + 1 + result.append((d, count)) + if n > 1: + result.append((n, 1)) + + return result + + +def phi(n): + """Return the Euler totient function of n.""" + + assert isinstance(n, integer_types) + + if n < 3: + return 1 + + result = 1 + ff = factorization(n) + for f in ff: + e = f[1] + if e > 1: + result = result * f[0] ** (e - 1) * (f[0] - 1) + else: + result = result * (f[0] - 1) + return result + + +def carmichael(n): + """Return Carmichael function of n. + + Carmichael(n) is the smallest integer x such that + m**x = 1 mod n for all m relatively prime to n. + """ + + return carmichael_of_factorized(factorization(n)) + + +def carmichael_of_factorized(f_list): + """Return the Carmichael function of a number that is + represented as a list of (prime,exponent) pairs. + """ + + if len(f_list) < 1: + return 1 + + result = carmichael_of_ppower(f_list[0]) + for i in range(1, len(f_list)): + result = lcm(result, carmichael_of_ppower(f_list[i])) + + return result + + +def carmichael_of_ppower(pp): + """Carmichael function of the given power of the given prime. + """ + + p, a = pp + if p == 2 and a > 2: + return 2**(a - 2) + else: + return (p - 1) * p**(a - 1) + + +def order_mod(x, m): + """Return the order of x in the multiplicative group mod m. + """ + + # Warning: this implementation is not very clever, and will + # take a long time if m is very large. + + if m <= 1: + return 0 + + assert gcd(x, m) == 1 + + z = x + result = 1 + while z != 1: + z = (z * x) % m + result = result + 1 + return result + + +def largest_factor_relatively_prime(a, b): + """Return the largest factor of a relatively prime to b. + """ + + while 1: + d = gcd(a, b) + if d <= 1: + break + b = d + while 1: + q, r = divmod(a, d) + if r > 0: + break + a = q + return a + + +def kinda_order_mod(x, m): + """Return the order of x in the multiplicative group mod m', + where m' is the largest factor of m relatively prime to x. + """ + + return order_mod(x, largest_factor_relatively_prime(m, x)) + + +def is_prime(n): + """Return True if x is prime, False otherwise. + + We use the Miller-Rabin test, as given in Menezes et al. p. 138. + This test is not exact: there are composite values n for which + it returns True. + + In testing the odd numbers from 10000001 to 19999999, + about 66 composites got past the first test, + 5 got past the second test, and none got past the third. + Since factors of 2, 3, 5, 7, and 11 were detected during + preliminary screening, the number of numbers tested by + Miller-Rabin was (19999999 - 10000001)*(2/3)*(4/5)*(6/7) + = 4.57 million. + """ + + # (This is used to study the risk of false positives:) + global miller_rabin_test_count + + miller_rabin_test_count = 0 + + if n <= smallprimes[-1]: + if n in smallprimes: + return True + else: + return False + + if gcd(n, 2 * 3 * 5 * 7 * 11) != 1: + return False + + # Choose a number of iterations sufficient to reduce the + # probability of accepting a composite below 2**-80 + # (from Menezes et al. Table 4.4): + + t = 40 + n_bits = 1 + int(math.log(n, 2)) + for k, tt in ((100, 27), + (150, 18), + (200, 15), + (250, 12), + (300, 9), + (350, 8), + (400, 7), + (450, 6), + (550, 5), + (650, 4), + (850, 3), + (1300, 2), + ): + if n_bits < k: + break + t = tt + + # Run the test t times: + + s = 0 + r = n - 1 + while (r % 2) == 0: + s = s + 1 + r = r // 2 + for i in range(t): + a = smallprimes[i] + y = modular_exp(a, r, n) + if y != 1 and y != n - 1: + j = 1 + while j <= s - 1 and y != n - 1: + y = modular_exp(y, 2, n) + if y == 1: + miller_rabin_test_count = i + 1 + return False + j = j + 1 + if y != n - 1: + miller_rabin_test_count = i + 1 + return False + return True + + +def next_prime(starting_value): + "Return the smallest prime larger than the starting value." + + if starting_value < 2: + return 2 + result = (starting_value + 1) | 1 + while not is_prime(result): + result = result + 2 + return result + + +smallprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, + 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, + 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, + 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, + 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, + 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, + 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, + 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, + 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, + 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, + 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, + 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, + 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, + 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, + 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, + 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, + 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, + 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, + 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, + 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229] + +miller_rabin_test_count = 0 + diff --git a/ecdsa/rfc6979.py b/ecdsa/rfc6979.py new file mode 100755 index 0000000..2614368 --- /dev/null +++ b/ecdsa/rfc6979.py @@ -0,0 +1,108 @@ +''' +RFC 6979: + Deterministic Usage of the Digital Signature Algorithm (DSA) and + Elliptic Curve Digital Signature Algorithm (ECDSA) + + http://tools.ietf.org/html/rfc6979 + +Many thanks to Coda Hale for his implementation in Go language: + https://github.com/codahale/rfc6979 +''' + +import hmac +from binascii import hexlify +from .util import number_to_string, number_to_string_crop +from six import b + +try: + bin(0) +except NameError: + binmap = {"0": "0000", "1": "0001", "2": "0010", "3": "0011", + "4": "0100", "5": "0101", "6": "0110", "7": "0111", + "8": "1000", "9": "1001", "a": "1010", "b": "1011", + "c": "1100", "d": "1101", "e": "1110", "f": "1111"} + + def bin(value): # for python2.5 + v = "".join(binmap[x] for x in "%x" % abs(value)).lstrip("0") + if value < 0: + return "-0b" + v + return "0b" + v + + +def bit_length(num): + # http://docs.python.org/dev/library/stdtypes.html#int.bit_length + s = bin(num) # binary representation: bin(-37) --> '-0b100101' + s = s.lstrip('-0b') # remove leading zeros and minus sign + return len(s) # len('100101') --> 6 + + +def bits2int(data, qlen): + x = int(hexlify(data), 16) + l = len(data) * 8 + + if l > qlen: + return x >> (l - qlen) + return x + + +def bits2octets(data, order): + z1 = bits2int(data, bit_length(order)) + z2 = z1 - order + + if z2 < 0: + z2 = z1 + + return number_to_string_crop(z2, order) + + +# https://tools.ietf.org/html/rfc6979#section-3.2 +def generate_k(order, secexp, hash_func, data): + ''' + order - order of the DSA generator used in the signature + secexp - secure exponent (private key) in numeric form + hash_func - reference to the same hash function used for generating hash + data - hash in binary form of the signing data + ''' + + qlen = bit_length(order) + holen = hash_func().digest_size + rolen = (qlen + 7) / 8 + bx = number_to_string(secexp, order) + bits2octets(data, order) + + # Step B + v = b('\x01') * holen + + # Step C + k = b('\x00') * holen + + # Step D + + k = hmac.new(k, v + b('\x00') + bx, hash_func).digest() + + # Step E + v = hmac.new(k, v, hash_func).digest() + + # Step F + k = hmac.new(k, v + b('\x01') + bx, hash_func).digest() + + # Step G + v = hmac.new(k, v, hash_func).digest() + + # Step H + while True: + # Step H1 + t = b('') + + # Step H2 + while len(t) < rolen: + v = hmac.new(k, v, hash_func).digest() + t += v + + # Step H3 + secret = bits2int(t, qlen) + + if secret >= 1 and secret < order: + return secret + + k = hmac.new(k, v + b('\x00'), hash_func).digest() + v = hmac.new(k, v, hash_func).digest() diff --git a/ecdsa/setup.cfg b/ecdsa/setup.cfg new file mode 100755 index 0000000..4cce32f --- /dev/null +++ b/ecdsa/setup.cfg @@ -0,0 +1,14 @@ +[wheel] +universal = 1 + +# See the docstring in versioneer.py for instructions. Note that you must +# re-run 'versioneer.py setup' after changing this section, and commit the +# resulting files. + +[versioneer] +VCS = git +style = pep440 +versionfile_source = src/ecdsa/_version.py +versionfile_build = ecdsa/_version.py +tag_prefix = python-ecdsa- +parentdir_prefix = ecdsa- diff --git a/ecdsa/setup.py b/ecdsa/setup.py new file mode 100755 index 0000000..8f1b664 --- /dev/null +++ b/ecdsa/setup.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +from setuptools import setup +import versioneer + +commands = versioneer.get_cmdclass().copy() + +setup(name="ecdsa", + version=versioneer.get_version(), + description="ECDSA cryptographic signature library (pure python)", + author="Brian Warner", + author_email="warner@lothar.com", + url="http://github.com/warner/python-ecdsa", + packages=["ecdsa"], + package_dir={"": "src"}, + license="MIT", + cmdclass=commands, + classifiers=[ + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.2", + "Programming Language :: Python :: 3.3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + ], + install_requires=['six'], + ) diff --git a/ecdsa/speed.py b/ecdsa/speed.py new file mode 100755 index 0000000..3f05309 --- /dev/null +++ b/ecdsa/speed.py @@ -0,0 +1,35 @@ +import six +import timeit + +def do(setup_statements, statement): + # extracted from timeit.py + t = timeit.Timer(stmt=statement, + setup="\n".join(setup_statements)) + # determine number so that 0.2 <= total time < 2.0 + for i in range(1, 10): + number = 10**i + x = t.timeit(number) + if x >= 0.2: + break + return x / number + +for curve in ["NIST192p", "NIST224p", "NIST256p", "SECP256k1", + "NIST384p", "NIST521p"]: + S1 = "import six; from ecdsa import SigningKey, %s" % curve + S2 = "sk = SigningKey.generate(%s)" % curve + S3 = "msg = six.b('msg')" + S4 = "sig = sk.sign(msg)" + S5 = "vk = sk.get_verifying_key()" + S6 = "vk.verify(sig, msg)" + # We happen to know that .generate() also calculates the + # verifying key, which is the time-consuming part. If the code + # were changed to lazily calculate vk, we'd need to change this + # benchmark to loop over S5 instead of S2 + keygen = do([S1], S2) + sign = do([S1,S2,S3], S4) + verf = do([S1,S2,S3,S4,S5], S6) + import ecdsa + c = getattr(ecdsa, curve) + sig = ecdsa.SigningKey.generate(c).sign(six.b("msg")) + print("%9s: siglen=%3d, keygen=%.3fs, sign=%.3fs, verify=%.3fs" \ + % (curve, len(sig), keygen, sign, verf)) diff --git a/ecdsa/test_ecdsa.py b/ecdsa/test_ecdsa.py new file mode 100755 index 0000000..d5a2455 --- /dev/null +++ b/ecdsa/test_ecdsa.py @@ -0,0 +1,301 @@ +from .ecdsa import (Private_key, Public_key, Signature, + curve_192, generator_192, + digest_integer, ellipticcurve, point_is_valid) +from six import print_ +import random + +def test_ecdsa(): + class TestFailure(Exception): + pass + + def test_point_validity(generator, x, y, expected): + """generator defines the curve; is (x,y) a point on + this curve? "expected" is True if the right answer is Yes.""" + if point_is_valid(generator, x, y) == expected: + print_("Point validity tested as expected.") + else: + raise TestFailure("*** Point validity test gave wrong result.") + + def test_signature_validity(Msg, Qx, Qy, R, S, expected): + """Msg = message, Qx and Qy represent the base point on + elliptic curve c192, R and S are the signature, and + "expected" is True iff the signature is expected to be valid.""" + pubk = Public_key(generator_192, + ellipticcurve.Point(curve_192, Qx, Qy)) + got = pubk.verifies(digest_integer(Msg), Signature(R, S)) + if got == expected: + print_("Signature tested as expected: got %s, expected %s." % \ + (got, expected)) + else: + raise TestFailure("*** Signature test failed: got %s, expected %s." % \ + (got, expected)) + + print_("NIST Curve P-192:") + + p192 = generator_192 + + # From X9.62: + + d = 651056770906015076056810763456358567190100156695615665659 + Q = d * p192 + if Q.x() != 0x62B12D60690CDCF330BABAB6E69763B471F994DD702D16A5: + raise TestFailure("*** p192 * d came out wrong.") + else: + print_("p192 * d came out right.") + + k = 6140507067065001063065065565667405560006161556565665656654 + R = k * p192 + if R.x() != 0x885052380FF147B734C330C43D39B2C4A89F29B0F749FEAD \ + or R.y() != 0x9CF9FA1CBEFEFB917747A3BB29C072B9289C2547884FD835: + raise TestFailure("*** k * p192 came out wrong.") + else: + print_("k * p192 came out right.") + + u1 = 2563697409189434185194736134579731015366492496392189760599 + u2 = 6266643813348617967186477710235785849136406323338782220568 + temp = u1 * p192 + u2 * Q + if temp.x() != 0x885052380FF147B734C330C43D39B2C4A89F29B0F749FEAD \ + or temp.y() != 0x9CF9FA1CBEFEFB917747A3BB29C072B9289C2547884FD835: + raise TestFailure("*** u1 * p192 + u2 * Q came out wrong.") + else: + print_("u1 * p192 + u2 * Q came out right.") + + e = 968236873715988614170569073515315707566766479517 + pubk = Public_key(generator_192, generator_192 * d) + privk = Private_key(pubk, d) + sig = privk.sign(e, k) + r, s = sig.r, sig.s + if r != 3342403536405981729393488334694600415596881826869351677613 \ + or s != 5735822328888155254683894997897571951568553642892029982342: + raise TestFailure("*** r or s came out wrong.") + else: + print_("r and s came out right.") + + valid = pubk.verifies(e, sig) + if valid: + print_("Signature verified OK.") + else: + raise TestFailure("*** Signature failed verification.") + + valid = pubk.verifies(e - 1, sig) + if not valid: + print_("Forgery was correctly rejected.") + else: + raise TestFailure("*** Forgery was erroneously accepted.") + + print_("Testing point validity, as per ECDSAVS.pdf B.2.2:") + + test_point_validity( \ + p192, \ + 0xcd6d0f029a023e9aaca429615b8f577abee685d8257cc83a, \ + 0x00019c410987680e9fb6c0b6ecc01d9a2647c8bae27721bacdfc, \ + False) + + test_point_validity( + p192, \ + 0x00017f2fce203639e9eaf9fb50b81fc32776b30e3b02af16c73b, \ + 0x95da95c5e72dd48e229d4748d4eee658a9a54111b23b2adb, \ + False) + + test_point_validity( + p192, \ + 0x4f77f8bc7fccbadd5760f4938746d5f253ee2168c1cf2792, \ + 0x000147156ff824d131629739817edb197717c41aab5c2a70f0f6, \ + False) + + test_point_validity( + p192, \ + 0xc58d61f88d905293bcd4cd0080bcb1b7f811f2ffa41979f6, \ + 0x8804dc7a7c4c7f8b5d437f5156f3312ca7d6de8a0e11867f, \ + True) + + test_point_validity( + p192, \ + 0xcdf56c1aa3d8afc53c521adf3ffb96734a6a630a4a5b5a70, \ + 0x97c1c44a5fb229007b5ec5d25f7413d170068ffd023caa4e, \ + True) + + test_point_validity( + p192, \ + 0x89009c0dc361c81e99280c8e91df578df88cdf4b0cdedced, \ + 0x27be44a529b7513e727251f128b34262a0fd4d8ec82377b9, \ + True) + + test_point_validity( + p192, \ + 0x6a223d00bd22c52833409a163e057e5b5da1def2a197dd15, \ + 0x7b482604199367f1f303f9ef627f922f97023e90eae08abf, \ + True) + + test_point_validity( + p192, \ + 0x6dccbde75c0948c98dab32ea0bc59fe125cf0fb1a3798eda, \ + 0x0001171a3e0fa60cf3096f4e116b556198de430e1fbd330c8835, \ + False) + + test_point_validity( + p192, \ + 0xd266b39e1f491fc4acbbbc7d098430931cfa66d55015af12, \ + 0x193782eb909e391a3148b7764e6b234aa94e48d30a16dbb2, \ + False) + + test_point_validity( + p192, \ + 0x9d6ddbcd439baa0c6b80a654091680e462a7d1d3f1ffeb43, \ + 0x6ad8efc4d133ccf167c44eb4691c80abffb9f82b932b8caa, \ + False) + + test_point_validity( + p192, \ + 0x146479d944e6bda87e5b35818aa666a4c998a71f4e95edbc, \ + 0xa86d6fe62bc8fbd88139693f842635f687f132255858e7f6, \ + False) + + test_point_validity( + p192, \ + 0xe594d4a598046f3598243f50fd2c7bd7d380edb055802253, \ + 0x509014c0c4d6b536e3ca750ec09066af39b4c8616a53a923, \ + False) + + print_("Trying signature-verification tests from ECDSAVS.pdf B.2.4:") + print_("P-192:") + Msg = 0x84ce72aa8699df436059f052ac51b6398d2511e49631bcb7e71f89c499b9ee425dfbc13a5f6d408471b054f2655617cbbaf7937b7c80cd8865cf02c8487d30d2b0fbd8b2c4e102e16d828374bbc47b93852f212d5043c3ea720f086178ff798cc4f63f787b9c2e419efa033e7644ea7936f54462dc21a6c4580725f7f0e7d158 + Qx = 0xd9dbfb332aa8e5ff091e8ce535857c37c73f6250ffb2e7ac + Qy = 0x282102e364feded3ad15ddf968f88d8321aa268dd483ebc4 + R = 0x64dca58a20787c488d11d6dd96313f1b766f2d8efe122916 + S = 0x1ecba28141e84ab4ecad92f56720e2cc83eb3d22dec72479 + test_signature_validity(Msg, Qx, Qy, R, S, True) + + Msg = 0x94bb5bacd5f8ea765810024db87f4224ad71362a3c28284b2b9f39fab86db12e8beb94aae899768229be8fdb6c4f12f28912bb604703a79ccff769c1607f5a91450f30ba0460d359d9126cbd6296be6d9c4bb96c0ee74cbb44197c207f6db326ab6f5a659113a9034e54be7b041ced9dcf6458d7fb9cbfb2744d999f7dfd63f4 + Qx = 0x3e53ef8d3112af3285c0e74842090712cd324832d4277ae7 + Qy = 0xcc75f8952d30aec2cbb719fc6aa9934590b5d0ff5a83adb7 + R = 0x8285261607283ba18f335026130bab31840dcfd9c3e555af + S = 0x356d89e1b04541afc9704a45e9c535ce4a50929e33d7e06c + test_signature_validity(Msg, Qx, Qy, R, S, True) + + Msg = 0xf6227a8eeb34afed1621dcc89a91d72ea212cb2f476839d9b4243c66877911b37b4ad6f4448792a7bbba76c63bdd63414b6facab7dc71c3396a73bd7ee14cdd41a659c61c99b779cecf07bc51ab391aa3252386242b9853ea7da67fd768d303f1b9b513d401565b6f1eb722dfdb96b519fe4f9bd5de67ae131e64b40e78c42dd + Qx = 0x16335dbe95f8e8254a4e04575d736befb258b8657f773cb7 + Qy = 0x421b13379c59bc9dce38a1099ca79bbd06d647c7f6242336 + R = 0x4141bd5d64ea36c5b0bd21ef28c02da216ed9d04522b1e91 + S = 0x159a6aa852bcc579e821b7bb0994c0861fb08280c38daa09 + test_signature_validity(Msg, Qx, Qy, R, S, False) + + Msg = 0x16b5f93afd0d02246f662761ed8e0dd9504681ed02a253006eb36736b563097ba39f81c8e1bce7a16c1339e345efabbc6baa3efb0612948ae51103382a8ee8bc448e3ef71e9f6f7a9676694831d7f5dd0db5446f179bcb737d4a526367a447bfe2c857521c7f40b6d7d7e01a180d92431fb0bbd29c04a0c420a57b3ed26ccd8a + Qx = 0xfd14cdf1607f5efb7b1793037b15bdf4baa6f7c16341ab0b + Qy = 0x83fa0795cc6c4795b9016dac928fd6bac32f3229a96312c4 + R = 0x8dfdb832951e0167c5d762a473c0416c5c15bc1195667dc1 + S = 0x1720288a2dc13fa1ec78f763f8fe2ff7354a7e6fdde44520 + test_signature_validity(Msg, Qx, Qy, R, S, False) + + Msg = 0x08a2024b61b79d260e3bb43ef15659aec89e5b560199bc82cf7c65c77d39192e03b9a895d766655105edd9188242b91fbde4167f7862d4ddd61e5d4ab55196683d4f13ceb90d87aea6e07eb50a874e33086c4a7cb0273a8e1c4408f4b846bceae1ebaac1b2b2ea851a9b09de322efe34cebe601653efd6ddc876ce8c2f2072fb + Qx = 0x674f941dc1a1f8b763c9334d726172d527b90ca324db8828 + Qy = 0x65adfa32e8b236cb33a3e84cf59bfb9417ae7e8ede57a7ff + R = 0x9508b9fdd7daf0d8126f9e2bc5a35e4c6d800b5b804d7796 + S = 0x36f2bf6b21b987c77b53bb801b3435a577e3d493744bfab0 + test_signature_validity(Msg, Qx, Qy, R, S, False) + + Msg = 0x1843aba74b0789d4ac6b0b8923848023a644a7b70afa23b1191829bbe4397ce15b629bf21a8838298653ed0c19222b95fa4f7390d1b4c844d96e645537e0aae98afb5c0ac3bd0e4c37f8daaff25556c64e98c319c52687c904c4de7240a1cc55cd9756b7edaef184e6e23b385726e9ffcba8001b8f574987c1a3fedaaa83ca6d + Qx = 0x10ecca1aad7220b56a62008b35170bfd5e35885c4014a19f + Qy = 0x04eb61984c6c12ade3bc47f3c629ece7aa0a033b9948d686 + R = 0x82bfa4e82c0dfe9274169b86694e76ce993fd83b5c60f325 + S = 0xa97685676c59a65dbde002fe9d613431fb183e8006d05633 + test_signature_validity(Msg, Qx, Qy, R, S, False) + + Msg = 0x5a478f4084ddd1a7fea038aa9732a822106385797d02311aeef4d0264f824f698df7a48cfb6b578cf3da416bc0799425bb491be5b5ecc37995b85b03420a98f2c4dc5c31a69a379e9e322fbe706bbcaf0f77175e05cbb4fa162e0da82010a278461e3e974d137bc746d1880d6eb02aa95216014b37480d84b87f717bb13f76e1 + Qx = 0x6636653cb5b894ca65c448277b29da3ad101c4c2300f7c04 + Qy = 0xfdf1cbb3fc3fd6a4f890b59e554544175fa77dbdbeb656c1 + R = 0xeac2ddecddfb79931a9c3d49c08de0645c783a24cb365e1c + S = 0x3549fee3cfa7e5f93bc47d92d8ba100e881a2a93c22f8d50 + test_signature_validity(Msg, Qx, Qy, R, S, False) + + Msg = 0xc598774259a058fa65212ac57eaa4f52240e629ef4c310722088292d1d4af6c39b49ce06ba77e4247b20637174d0bd67c9723feb57b5ead232b47ea452d5d7a089f17c00b8b6767e434a5e16c231ba0efa718a340bf41d67ea2d295812ff1b9277daacb8bc27b50ea5e6443bcf95ef4e9f5468fe78485236313d53d1c68f6ba2 + Qx = 0xa82bd718d01d354001148cd5f69b9ebf38ff6f21898f8aaa + Qy = 0xe67ceede07fc2ebfafd62462a51e4b6c6b3d5b537b7caf3e + R = 0x4d292486c620c3de20856e57d3bb72fcde4a73ad26376955 + S = 0xa85289591a6081d5728825520e62ff1c64f94235c04c7f95 + test_signature_validity(Msg, Qx, Qy, R, S, False) + + Msg = 0xca98ed9db081a07b7557f24ced6c7b9891269a95d2026747add9e9eb80638a961cf9c71a1b9f2c29744180bd4c3d3db60f2243c5c0b7cc8a8d40a3f9a7fc910250f2187136ee6413ffc67f1a25e1c4c204fa9635312252ac0e0481d89b6d53808f0c496ba87631803f6c572c1f61fa049737fdacce4adff757afed4f05beb658 + Qx = 0x7d3b016b57758b160c4fca73d48df07ae3b6b30225126c2f + Qy = 0x4af3790d9775742bde46f8da876711be1b65244b2b39e7ec + R = 0x95f778f5f656511a5ab49a5d69ddd0929563c29cbc3a9e62 + S = 0x75c87fc358c251b4c83d2dd979faad496b539f9f2ee7a289 + test_signature_validity(Msg, Qx, Qy, R, S, False) + + Msg = 0x31dd9a54c8338bea06b87eca813d555ad1850fac9742ef0bbe40dad400e10288acc9c11ea7dac79eb16378ebea9490e09536099f1b993e2653cd50240014c90a9c987f64545abc6a536b9bd2435eb5e911fdfde2f13be96ea36ad38df4ae9ea387b29cced599af777338af2794820c9cce43b51d2112380a35802ab7e396c97a + Qx = 0x9362f28c4ef96453d8a2f849f21e881cd7566887da8beb4a + Qy = 0xe64d26d8d74c48a024ae85d982ee74cd16046f4ee5333905 + R = 0xf3923476a296c88287e8de914b0b324ad5a963319a4fe73b + S = 0xf0baeed7624ed00d15244d8ba2aede085517dbdec8ac65f5 + test_signature_validity(Msg, Qx, Qy, R, S, True) + + Msg = 0xb2b94e4432267c92f9fdb9dc6040c95ffa477652761290d3c7de312283f6450d89cc4aabe748554dfb6056b2d8e99c7aeaad9cdddebdee9dbc099839562d9064e68e7bb5f3a6bba0749ca9a538181fc785553a4000785d73cc207922f63e8ce1112768cb1de7b673aed83a1e4a74592f1268d8e2a4e9e63d414b5d442bd0456d + Qx = 0xcc6fc032a846aaac25533eb033522824f94e670fa997ecef + Qy = 0xe25463ef77a029eccda8b294fd63dd694e38d223d30862f1 + R = 0x066b1d07f3a40e679b620eda7f550842a35c18b80c5ebe06 + S = 0xa0b0fb201e8f2df65e2c4508ef303bdc90d934016f16b2dc + test_signature_validity(Msg, Qx, Qy, R, S, False) + + Msg = 0x4366fcadf10d30d086911de30143da6f579527036937007b337f7282460eae5678b15cccda853193ea5fc4bc0a6b9d7a31128f27e1214988592827520b214eed5052f7775b750b0c6b15f145453ba3fee24a085d65287e10509eb5d5f602c440341376b95c24e5c4727d4b859bfe1483d20538acdd92c7997fa9c614f0f839d7 + Qx = 0x955c908fe900a996f7e2089bee2f6376830f76a19135e753 + Qy = 0xba0c42a91d3847de4a592a46dc3fdaf45a7cc709b90de520 + R = 0x1f58ad77fc04c782815a1405b0925e72095d906cbf52a668 + S = 0xf2e93758b3af75edf784f05a6761c9b9a6043c66b845b599 + test_signature_validity(Msg, Qx, Qy, R, S, False) + + Msg = 0x543f8af57d750e33aa8565e0cae92bfa7a1ff78833093421c2942cadf9986670a5ff3244c02a8225e790fbf30ea84c74720abf99cfd10d02d34377c3d3b41269bea763384f372bb786b5846f58932defa68023136cd571863b304886e95e52e7877f445b9364b3f06f3c28da12707673fecb4b8071de06b6e0a3c87da160cef3 + Qx = 0x31f7fa05576d78a949b24812d4383107a9a45bb5fccdd835 + Qy = 0x8dc0eb65994a90f02b5e19bd18b32d61150746c09107e76b + R = 0xbe26d59e4e883dde7c286614a767b31e49ad88789d3a78ff + S = 0x8762ca831c1ce42df77893c9b03119428e7a9b819b619068 + test_signature_validity(Msg, Qx, Qy, R, S, False) + + Msg = 0xd2e8454143ce281e609a9d748014dcebb9d0bc53adb02443a6aac2ffe6cb009f387c346ecb051791404f79e902ee333ad65e5c8cb38dc0d1d39a8dc90add5023572720e5b94b190d43dd0d7873397504c0c7aef2727e628eb6a74411f2e400c65670716cb4a815dc91cbbfeb7cfe8c929e93184c938af2c078584da045e8f8d1 + Qx = 0x66aa8edbbdb5cf8e28ceb51b5bda891cae2df84819fe25c0 + Qy = 0x0c6bc2f69030a7ce58d4a00e3b3349844784a13b8936f8da + R = 0xa4661e69b1734f4a71b788410a464b71e7ffe42334484f23 + S = 0x738421cf5e049159d69c57a915143e226cac8355e149afe9 + test_signature_validity(Msg, Qx, Qy, R, S, False) + + Msg = 0x6660717144040f3e2f95a4e25b08a7079c702a8b29babad5a19a87654bc5c5afa261512a11b998a4fb36b5d8fe8bd942792ff0324b108120de86d63f65855e5461184fc96a0a8ffd2ce6d5dfb0230cbbdd98f8543e361b3205f5da3d500fdc8bac6db377d75ebef3cb8f4d1ff738071ad0938917889250b41dd1d98896ca06fb + Qx = 0xbcfacf45139b6f5f690a4c35a5fffa498794136a2353fc77 + Qy = 0x6f4a6c906316a6afc6d98fe1f0399d056f128fe0270b0f22 + R = 0x9db679a3dafe48f7ccad122933acfe9da0970b71c94c21c1 + S = 0x984c2db99827576c0a41a5da41e07d8cc768bc82f18c9da9 + test_signature_validity(Msg, Qx, Qy, R, S, False) + + print_("Testing the example code:") + + # Building a public/private key pair from the NIST Curve P-192: + + g = generator_192 + n = g.order() + + # (random.SystemRandom is supposed to provide + # crypto-quality random numbers, but as Debian recently + # illustrated, a systems programmer can accidentally + # demolish this security, so in serious applications + # further precautions are appropriate.) + + randrange = random.SystemRandom().randrange + + secret = randrange(1, n) + pubkey = Public_key(g, g * secret) + privkey = Private_key(pubkey, secret) + + # Signing a hash value: + + hash = randrange(1, n) + signature = privkey.sign(hash, randrange(1, n)) + + # Verifying a signature for a hash value: + + if pubkey.verifies(hash, signature): + print_("Demo verification succeeded.") + else: + raise TestFailure("*** Demo verification failed.") + + if pubkey.verifies(hash - 1, signature): + raise TestFailure("**** Demo verification failed to reject tampered hash.") + else: + print_("Demo verification correctly rejected tampered hash.") diff --git a/ecdsa/test_ellipticcurve.py b/ecdsa/test_ellipticcurve.py new file mode 100755 index 0000000..90151ff --- /dev/null +++ b/ecdsa/test_ellipticcurve.py @@ -0,0 +1,111 @@ +from .ellipticcurve import CurveFp, INFINITY, Point +from six import print_ + +def test_ellipticcurve(): + + class FailedTest(Exception): + pass + + def test_add(c, x1, y1, x2, y2, x3, y3): + """We expect that on curve c, (x1,y1) + (x2, y2 ) = (x3, y3).""" + p1 = Point(c, x1, y1) + p2 = Point(c, x2, y2) + p3 = p1 + p2 + print_("%s + %s = %s" % (p1, p2, p3), end=' ') + if p3.x() != x3 or p3.y() != y3: + raise FailedTest("Failure: should give (%d,%d)." % (x3, y3)) + else: + print_(" Good.") + + def test_double(c, x1, y1, x3, y3): + """We expect that on curve c, 2*(x1,y1) = (x3, y3).""" + p1 = Point(c, x1, y1) + p3 = p1.double() + print_("%s doubled = %s" % (p1, p3), end=' ') + if p3.x() != x3 or p3.y() != y3: + raise FailedTest("Failure: should give (%d,%d)." % (x3, y3)) + else: + print_(" Good.") + + def test_double_infinity(c): + """We expect that on curve c, 2*INFINITY = INFINITY.""" + p1 = INFINITY + p3 = p1.double() + print_("%s doubled = %s" % (p1, p3), end=' ') + if p3.x() != INFINITY.x() or p3.y() != INFINITY.y(): + raise FailedTest("Failure: should give (%d,%d)." % (INFINITY.x(), INFINITY.y())) + else: + print_(" Good.") + + def test_multiply(c, x1, y1, m, x3, y3): + """We expect that on curve c, m*(x1,y1) = (x3,y3).""" + p1 = Point(c, x1, y1) + p3 = p1 * m + print_("%s * %d = %s" % (p1, m, p3), end=' ') + if p3.x() != x3 or p3.y() != y3: + raise FailedTest("Failure: should give (%d,%d)." % (x3, y3)) + else: + print_(" Good.") + + # A few tests from X9.62 B.3: + + c = CurveFp(23, 1, 1) + test_add(c, 3, 10, 9, 7, 17, 20) + test_double(c, 3, 10, 7, 12) + test_add(c, 3, 10, 3, 10, 7, 12) # (Should just invoke double.) + test_multiply(c, 3, 10, 2, 7, 12) + + test_double_infinity(c) + + # From X9.62 I.1 (p. 96): + + g = Point(c, 13, 7, 7) + + check = INFINITY + for i in range(7 + 1): + p = (i % 7) * g + print_("%s * %d = %s, expected %s . . ." % (g, i, p, check), end=' ') + if p == check: + print_(" Good.") + else: + raise FailedTest("Bad.") + check = check + g + + # NIST Curve P-192: + p = 6277101735386680763835789423207666416083908700390324961279 + r = 6277101735386680763835789423176059013767194773182842284081 + # s = 0x3045ae6fc8422f64ed579528d38120eae12196d5L + c = 0x3099d2bbbfcb2538542dcd5fb078b6ef5f3d6fe2c745de65 + b = 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1 + Gx = 0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012 + Gy = 0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811 + + c192 = CurveFp(p, -3, b) + p192 = Point(c192, Gx, Gy, r) + + # Checking against some sample computations presented + # in X9.62: + + d = 651056770906015076056810763456358567190100156695615665659 + Q = d * p192 + if Q.x() != 0x62B12D60690CDCF330BABAB6E69763B471F994DD702D16A5: + raise FailedTest("p192 * d came out wrong.") + else: + print_("p192 * d came out right.") + + k = 6140507067065001063065065565667405560006161556565665656654 + R = k * p192 + if R.x() != 0x885052380FF147B734C330C43D39B2C4A89F29B0F749FEAD \ + or R.y() != 0x9CF9FA1CBEFEFB917747A3BB29C072B9289C2547884FD835: + raise FailedTest("k * p192 came out wrong.") + else: + print_("k * p192 came out right.") + + u1 = 2563697409189434185194736134579731015366492496392189760599 + u2 = 6266643813348617967186477710235785849136406323338782220568 + temp = u1 * p192 + u2 * Q + if temp.x() != 0x885052380FF147B734C330C43D39B2C4A89F29B0F749FEAD \ + or temp.y() != 0x9CF9FA1CBEFEFB917747A3BB29C072B9289C2547884FD835: + raise FailedTest("u1 * p192 + u2 * Q came out wrong.") + else: + print_("u1 * p192 + u2 * Q came out right.") diff --git a/ecdsa/test_numbertheory.py b/ecdsa/test_numbertheory.py new file mode 100755 index 0000000..8eea51f --- /dev/null +++ b/ecdsa/test_numbertheory.py @@ -0,0 +1,124 @@ +from .numbertheory import (SquareRootError, factorization, gcd, lcm, + jacobi, inverse_mod, + is_prime, next_prime, smallprimes, + square_root_mod_prime) +from six import print_ + +def test_numbertheory(): + + # Making sure locally defined exceptions work: + # p = modular_exp(2, -2, 3) + # p = square_root_mod_prime(2, 3) + + print_("Testing gcd...") + assert gcd(3 * 5 * 7, 3 * 5 * 11, 3 * 5 * 13) == 3 * 5 + assert gcd([3 * 5 * 7, 3 * 5 * 11, 3 * 5 * 13]) == 3 * 5 + assert gcd(3) == 3 + + print_("Testing lcm...") + assert lcm(3, 5 * 3, 7 * 3) == 3 * 5 * 7 + assert lcm([3, 5 * 3, 7 * 3]) == 3 * 5 * 7 + assert lcm(3) == 3 + + print_("Testing next_prime...") + bigprimes = (999671, + 999683, + 999721, + 999727, + 999749, + 999763, + 999769, + 999773, + 999809, + 999853, + 999863, + 999883, + 999907, + 999917, + 999931, + 999953, + 999959, + 999961, + 999979, + 999983) + + for i in range(len(bigprimes) - 1): + assert next_prime(bigprimes[i]) == bigprimes[i + 1] + + error_tally = 0 + + # Test the square_root_mod_prime function: + + for p in smallprimes: + print_("Testing square_root_mod_prime for modulus p = %d." % p) + squares = [] + + for root in range(0, 1 + p // 2): + sq = (root * root) % p + squares.append(sq) + calculated = square_root_mod_prime(sq, p) + if (calculated * calculated) % p != sq: + error_tally = error_tally + 1 + print_("Failed to find %d as sqrt( %d ) mod %d. Said %d." % \ + (root, sq, p, calculated)) + + for nonsquare in range(0, p): + if nonsquare not in squares: + try: + calculated = square_root_mod_prime(nonsquare, p) + except SquareRootError: + pass + else: + error_tally = error_tally + 1 + print_("Failed to report no root for sqrt( %d ) mod %d." % \ + (nonsquare, p)) + + # Test the jacobi function: + for m in range(3, 400, 2): + print_("Testing jacobi for modulus m = %d." % m) + if is_prime(m): + squares = [] + for root in range(1, m): + if jacobi(root * root, m) != 1: + error_tally = error_tally + 1 + print_("jacobi( %d * %d, %d) != 1" % (root, root, m)) + squares.append(root * root % m) + for i in range(1, m): + if i not in squares: + if jacobi(i, m) != -1: + error_tally = error_tally + 1 + print_("jacobi( %d, %d ) != -1" % (i, m)) + else: # m is not prime. + f = factorization(m) + for a in range(1, m): + c = 1 + for i in f: + c = c * jacobi(a, i[0]) ** i[1] + if c != jacobi(a, m): + error_tally = error_tally + 1 + print_("%d != jacobi( %d, %d )" % (c, a, m)) + + +# Test the inverse_mod function: + print_("Testing inverse_mod . . .") + import random + n_tests = 0 + for i in range(100): + m = random.randint(20, 10000) + for j in range(100): + a = random.randint(1, m - 1) + if gcd(a, m) == 1: + n_tests = n_tests + 1 + inv = inverse_mod(a, m) + if inv <= 0 or inv >= m or (a * inv) % m != 1: + error_tally = error_tally + 1 + print_("%d = inverse_mod( %d, %d ) is wrong." % (inv, a, m)) + assert n_tests > 1000 + print_(n_tests, " tests of inverse_mod completed.") + + class FailedTest(Exception): + pass + + print_(error_tally, "errors detected.") + if error_tally != 0: + raise FailedTest("%d errors detected" % error_tally) diff --git a/ecdsa/test_pyecdsa.py b/ecdsa/test_pyecdsa.py new file mode 100755 index 0000000..31da24d --- /dev/null +++ b/ecdsa/test_pyecdsa.py @@ -0,0 +1,701 @@ +from __future__ import with_statement, division + +import unittest +import os +import time +import shutil +import subprocess +from binascii import hexlify, unhexlify +from hashlib import sha1, sha256, sha512 + +from six import b, print_, binary_type +from .keys import SigningKey, VerifyingKey +from .keys import BadSignatureError +from . import util +from .util import sigencode_der, sigencode_strings +from .util import sigdecode_der, sigdecode_strings +from .curves import Curve, UnknownCurveError +from .curves import NIST192p, NIST224p, NIST256p, NIST384p, NIST521p, SECP256k1 +from .ellipticcurve import Point +from . import der +from . import rfc6979 + + +class SubprocessError(Exception): + pass + + +def run_openssl(cmd): + OPENSSL = "openssl" + p = subprocess.Popen([OPENSSL] + cmd.split(), + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + stdout, ignored = p.communicate() + if p.returncode != 0: + raise SubprocessError("cmd '%s %s' failed: rc=%s, stdout/err was %s" % + (OPENSSL, cmd, p.returncode, stdout)) + return stdout.decode() + + +BENCH = False + + +class ECDSA(unittest.TestCase): + def test_basic(self): + priv = SigningKey.generate() + pub = priv.get_verifying_key() + + data = b("blahblah") + sig = priv.sign(data) + + self.assertTrue(pub.verify(sig, data)) + self.assertRaises(BadSignatureError, pub.verify, sig, data + b("bad")) + + pub2 = VerifyingKey.from_string(pub.to_string()) + self.assertTrue(pub2.verify(sig, data)) + + def test_deterministic(self): + data = b("blahblah") + secexp = int("9d0219792467d7d37b4d43298a7d0c05", 16) + + priv = SigningKey.from_secret_exponent(secexp, SECP256k1, sha256) + pub = priv.get_verifying_key() + + k = rfc6979.generate_k( + SECP256k1.generator.order(), secexp, sha256, sha256(data).digest()) + + sig1 = priv.sign(data, k=k) + self.assertTrue(pub.verify(sig1, data)) + + sig2 = priv.sign(data, k=k) + self.assertTrue(pub.verify(sig2, data)) + + sig3 = priv.sign_deterministic(data, sha256) + self.assertTrue(pub.verify(sig3, data)) + + self.assertEqual(sig1, sig2) + self.assertEqual(sig1, sig3) + + def test_bad_usage(self): + # sk=SigningKey() is wrong + self.assertRaises(TypeError, SigningKey) + self.assertRaises(TypeError, VerifyingKey) + + def test_lengths(self): + default = NIST192p + priv = SigningKey.generate() + pub = priv.get_verifying_key() + self.assertEqual(len(pub.to_string()), default.verifying_key_length) + sig = priv.sign(b("data")) + self.assertEqual(len(sig), default.signature_length) + if BENCH: + print_() + for curve in (NIST192p, NIST224p, NIST256p, NIST384p, NIST521p): + start = time.time() + priv = SigningKey.generate(curve=curve) + pub1 = priv.get_verifying_key() + keygen_time = time.time() - start + pub2 = VerifyingKey.from_string(pub1.to_string(), curve) + self.assertEqual(pub1.to_string(), pub2.to_string()) + self.assertEqual(len(pub1.to_string()), + curve.verifying_key_length) + start = time.time() + sig = priv.sign(b("data")) + sign_time = time.time() - start + self.assertEqual(len(sig), curve.signature_length) + if BENCH: + start = time.time() + pub1.verify(sig, b("data")) + verify_time = time.time() - start + print_("%s: siglen=%d, keygen=%0.3fs, sign=%0.3f, verify=%0.3f" \ + % (curve.name, curve.signature_length, + keygen_time, sign_time, verify_time)) + + def test_serialize(self): + seed = b("secret") + curve = NIST192p + secexp1 = util.randrange_from_seed__trytryagain(seed, curve.order) + secexp2 = util.randrange_from_seed__trytryagain(seed, curve.order) + self.assertEqual(secexp1, secexp2) + priv1 = SigningKey.from_secret_exponent(secexp1, curve) + priv2 = SigningKey.from_secret_exponent(secexp2, curve) + self.assertEqual(hexlify(priv1.to_string()), + hexlify(priv2.to_string())) + self.assertEqual(priv1.to_pem(), priv2.to_pem()) + pub1 = priv1.get_verifying_key() + pub2 = priv2.get_verifying_key() + data = b("data") + sig1 = priv1.sign(data) + sig2 = priv2.sign(data) + self.assertTrue(pub1.verify(sig1, data)) + self.assertTrue(pub2.verify(sig1, data)) + self.assertTrue(pub1.verify(sig2, data)) + self.assertTrue(pub2.verify(sig2, data)) + self.assertEqual(hexlify(pub1.to_string()), + hexlify(pub2.to_string())) + + def test_nonrandom(self): + s = b("all the entropy in the entire world, compressed into one line") + + def not_much_entropy(numbytes): + return s[:numbytes] + + # we control the entropy source, these two keys should be identical: + priv1 = SigningKey.generate(entropy=not_much_entropy) + priv2 = SigningKey.generate(entropy=not_much_entropy) + self.assertEqual(hexlify(priv1.get_verifying_key().to_string()), + hexlify(priv2.get_verifying_key().to_string())) + # likewise, signatures should be identical. Obviously you'd never + # want to do this with keys you care about, because the secrecy of + # the private key depends upon using different random numbers for + # each signature + sig1 = priv1.sign(b("data"), entropy=not_much_entropy) + sig2 = priv2.sign(b("data"), entropy=not_much_entropy) + self.assertEqual(hexlify(sig1), hexlify(sig2)) + + def assertTruePrivkeysEqual(self, priv1, priv2): + self.assertEqual(priv1.privkey.secret_multiplier, + priv2.privkey.secret_multiplier) + self.assertEqual(priv1.privkey.public_key.generator, + priv2.privkey.public_key.generator) + + def failIfPrivkeysEqual(self, priv1, priv2): + self.failIfEqual(priv1.privkey.secret_multiplier, + priv2.privkey.secret_multiplier) + + def test_privkey_creation(self): + s = b("all the entropy in the entire world, compressed into one line") + + def not_much_entropy(numbytes): + return s[:numbytes] + + priv1 = SigningKey.generate() + self.assertEqual(priv1.baselen, NIST192p.baselen) + + priv1 = SigningKey.generate(curve=NIST224p) + self.assertEqual(priv1.baselen, NIST224p.baselen) + + priv1 = SigningKey.generate(entropy=not_much_entropy) + self.assertEqual(priv1.baselen, NIST192p.baselen) + priv2 = SigningKey.generate(entropy=not_much_entropy) + self.assertEqual(priv2.baselen, NIST192p.baselen) + self.assertTruePrivkeysEqual(priv1, priv2) + + priv1 = SigningKey.from_secret_exponent(secexp=3) + self.assertEqual(priv1.baselen, NIST192p.baselen) + priv2 = SigningKey.from_secret_exponent(secexp=3) + self.assertTruePrivkeysEqual(priv1, priv2) + + priv1 = SigningKey.from_secret_exponent(secexp=4, curve=NIST224p) + self.assertEqual(priv1.baselen, NIST224p.baselen) + + def test_privkey_strings(self): + priv1 = SigningKey.generate() + s1 = priv1.to_string() + self.assertEqual(type(s1), binary_type) + self.assertEqual(len(s1), NIST192p.baselen) + priv2 = SigningKey.from_string(s1) + self.assertTruePrivkeysEqual(priv1, priv2) + + s1 = priv1.to_pem() + self.assertEqual(type(s1), binary_type) + self.assertTrue(s1.startswith(b("-----BEGIN EC PRIVATE KEY-----"))) + self.assertTrue(s1.strip().endswith(b("-----END EC PRIVATE KEY-----"))) + priv2 = SigningKey.from_pem(s1) + self.assertTruePrivkeysEqual(priv1, priv2) + + s1 = priv1.to_der() + self.assertEqual(type(s1), binary_type) + priv2 = SigningKey.from_der(s1) + self.assertTruePrivkeysEqual(priv1, priv2) + + priv1 = SigningKey.generate(curve=NIST256p) + s1 = priv1.to_pem() + self.assertEqual(type(s1), binary_type) + self.assertTrue(s1.startswith(b("-----BEGIN EC PRIVATE KEY-----"))) + self.assertTrue(s1.strip().endswith(b("-----END EC PRIVATE KEY-----"))) + priv2 = SigningKey.from_pem(s1) + self.assertTruePrivkeysEqual(priv1, priv2) + + s1 = priv1.to_der() + self.assertEqual(type(s1), binary_type) + priv2 = SigningKey.from_der(s1) + self.assertTruePrivkeysEqual(priv1, priv2) + + def assertTruePubkeysEqual(self, pub1, pub2): + self.assertEqual(pub1.pubkey.point, pub2.pubkey.point) + self.assertEqual(pub1.pubkey.generator, pub2.pubkey.generator) + self.assertEqual(pub1.curve, pub2.curve) + + def test_pubkey_strings(self): + priv1 = SigningKey.generate() + pub1 = priv1.get_verifying_key() + s1 = pub1.to_string() + self.assertEqual(type(s1), binary_type) + self.assertEqual(len(s1), NIST192p.verifying_key_length) + pub2 = VerifyingKey.from_string(s1) + self.assertTruePubkeysEqual(pub1, pub2) + + priv1 = SigningKey.generate(curve=NIST256p) + pub1 = priv1.get_verifying_key() + s1 = pub1.to_string() + self.assertEqual(type(s1), binary_type) + self.assertEqual(len(s1), NIST256p.verifying_key_length) + pub2 = VerifyingKey.from_string(s1, curve=NIST256p) + self.assertTruePubkeysEqual(pub1, pub2) + + pub1_der = pub1.to_der() + self.assertEqual(type(pub1_der), binary_type) + pub2 = VerifyingKey.from_der(pub1_der) + self.assertTruePubkeysEqual(pub1, pub2) + + self.assertRaises(der.UnexpectedDER, + VerifyingKey.from_der, pub1_der + b("junk")) + badpub = VerifyingKey.from_der(pub1_der) + + class FakeGenerator: + def order(self): + return 123456789 + + badcurve = Curve("unknown", None, FakeGenerator(), (1, 2, 3, 4, 5, 6), None) + badpub.curve = badcurve + badder = badpub.to_der() + self.assertRaises(UnknownCurveError, VerifyingKey.from_der, badder) + + pem = pub1.to_pem() + self.assertEqual(type(pem), binary_type) + self.assertTrue(pem.startswith(b("-----BEGIN PUBLIC KEY-----")), pem) + self.assertTrue(pem.strip().endswith(b("-----END PUBLIC KEY-----")), pem) + pub2 = VerifyingKey.from_pem(pem) + self.assertTruePubkeysEqual(pub1, pub2) + + def test_signature_strings(self): + priv1 = SigningKey.generate() + pub1 = priv1.get_verifying_key() + data = b("data") + + sig = priv1.sign(data) + self.assertEqual(type(sig), binary_type) + self.assertEqual(len(sig), NIST192p.signature_length) + self.assertTrue(pub1.verify(sig, data)) + + sig = priv1.sign(data, sigencode=sigencode_strings) + self.assertEqual(type(sig), tuple) + self.assertEqual(len(sig), 2) + self.assertEqual(type(sig[0]), binary_type) + self.assertEqual(type(sig[1]), binary_type) + self.assertEqual(len(sig[0]), NIST192p.baselen) + self.assertEqual(len(sig[1]), NIST192p.baselen) + self.assertTrue(pub1.verify(sig, data, sigdecode=sigdecode_strings)) + + sig_der = priv1.sign(data, sigencode=sigencode_der) + self.assertEqual(type(sig_der), binary_type) + self.assertTrue(pub1.verify(sig_der, data, sigdecode=sigdecode_der)) + + def test_hashfunc(self): + sk = SigningKey.generate(curve=NIST256p, hashfunc=sha256) + data = b("security level is 128 bits") + sig = sk.sign(data) + vk = VerifyingKey.from_string(sk.get_verifying_key().to_string(), + curve=NIST256p, hashfunc=sha256) + self.assertTrue(vk.verify(sig, data)) + + sk2 = SigningKey.generate(curve=NIST256p) + sig2 = sk2.sign(data, hashfunc=sha256) + vk2 = VerifyingKey.from_string(sk2.get_verifying_key().to_string(), + curve=NIST256p, hashfunc=sha256) + self.assertTrue(vk2.verify(sig2, data)) + + vk3 = VerifyingKey.from_string(sk.get_verifying_key().to_string(), + curve=NIST256p) + self.assertTrue(vk3.verify(sig, data, hashfunc=sha256)) + + +class OpenSSL(unittest.TestCase): + # test interoperability with OpenSSL tools. Note that openssl's ECDSA + # sign/verify arguments changed between 0.9.8 and 1.0.0: the early + # versions require "-ecdsa-with-SHA1", the later versions want just + # "-SHA1" (or to leave out that argument entirely, which means the + # signature will use some default digest algorithm, probably determined + # by the key, probably always SHA1). + # + # openssl ecparam -name secp224r1 -genkey -out privkey.pem + # openssl ec -in privkey.pem -text -noout # get the priv/pub keys + # openssl dgst -ecdsa-with-SHA1 -sign privkey.pem -out data.sig data.txt + # openssl asn1parse -in data.sig -inform DER + # data.sig is 64 bytes, probably 56b plus ASN1 overhead + # openssl dgst -ecdsa-with-SHA1 -prverify privkey.pem -signature data.sig data.txt ; echo $? + # openssl ec -in privkey.pem -pubout -out pubkey.pem + # openssl ec -in privkey.pem -pubout -outform DER -out pubkey.der + + def get_openssl_messagedigest_arg(self): + v = run_openssl("version") + # e.g. "OpenSSL 1.0.0 29 Mar 2010", or "OpenSSL 1.0.0a 1 Jun 2010", + # or "OpenSSL 0.9.8o 01 Jun 2010" + vs = v.split()[1].split(".") + if vs >= ["1", "0", "0"]: + return "-SHA1" + else: + return "-ecdsa-with-SHA1" + + # sk: 1:OpenSSL->python 2:python->OpenSSL + # vk: 3:OpenSSL->python 4:python->OpenSSL + # sig: 5:OpenSSL->python 6:python->OpenSSL + + def test_from_openssl_nist192p(self): + return self.do_test_from_openssl(NIST192p) + + def test_from_openssl_nist224p(self): + return self.do_test_from_openssl(NIST224p) + + def test_from_openssl_nist256p(self): + return self.do_test_from_openssl(NIST256p) + + def test_from_openssl_nist384p(self): + return self.do_test_from_openssl(NIST384p) + + def test_from_openssl_nist521p(self): + return self.do_test_from_openssl(NIST521p) + + def test_from_openssl_secp256k1(self): + return self.do_test_from_openssl(SECP256k1) + + def do_test_from_openssl(self, curve): + curvename = curve.openssl_name + assert curvename + # OpenSSL: create sk, vk, sign. + # Python: read vk(3), checksig(5), read sk(1), sign, check + mdarg = self.get_openssl_messagedigest_arg() + if os.path.isdir("t"): + shutil.rmtree("t") + os.mkdir("t") + run_openssl("ecparam -name %s -genkey -out t/privkey.pem" % curvename) + run_openssl("ec -in t/privkey.pem -pubout -out t/pubkey.pem") + data = b("data") + with open("t/data.txt", "wb") as e: + e.write(data) + run_openssl("dgst %s -sign t/privkey.pem -out t/data.sig t/data.txt" % mdarg) + run_openssl("dgst %s -verify t/pubkey.pem -signature t/data.sig t/data.txt" % mdarg) + with open("t/pubkey.pem", "rb") as e: + pubkey_pem = e.read() + vk = VerifyingKey.from_pem(pubkey_pem) # 3 + with open("t/data.sig", "rb") as e: + sig_der = e.read() + self.assertTrue(vk.verify(sig_der, data, # 5 + hashfunc=sha1, sigdecode=sigdecode_der)) + + with open("t/privkey.pem") as e: + fp = e.read() + sk = SigningKey.from_pem(fp) # 1 + sig = sk.sign(data) + self.assertTrue(vk.verify(sig, data)) + + def test_to_openssl_nist192p(self): + self.do_test_to_openssl(NIST192p) + + def test_to_openssl_nist224p(self): + self.do_test_to_openssl(NIST224p) + + def test_to_openssl_nist256p(self): + self.do_test_to_openssl(NIST256p) + + def test_to_openssl_nist384p(self): + self.do_test_to_openssl(NIST384p) + + def test_to_openssl_nist521p(self): + self.do_test_to_openssl(NIST521p) + + def test_to_openssl_secp256k1(self): + self.do_test_to_openssl(SECP256k1) + + def do_test_to_openssl(self, curve): + curvename = curve.openssl_name + assert curvename + # Python: create sk, vk, sign. + # OpenSSL: read vk(4), checksig(6), read sk(2), sign, check + mdarg = self.get_openssl_messagedigest_arg() + if os.path.isdir("t"): + shutil.rmtree("t") + os.mkdir("t") + sk = SigningKey.generate(curve=curve) + vk = sk.get_verifying_key() + data = b("data") + with open("t/pubkey.der", "wb") as e: + e.write(vk.to_der()) # 4 + with open("t/pubkey.pem", "wb") as e: + e.write(vk.to_pem()) # 4 + sig_der = sk.sign(data, hashfunc=sha1, sigencode=sigencode_der) + + with open("t/data.sig", "wb") as e: + e.write(sig_der) # 6 + with open("t/data.txt", "wb") as e: + e.write(data) + with open("t/baddata.txt", "wb") as e: + e.write(data + b("corrupt")) + + self.assertRaises(SubprocessError, run_openssl, + "dgst %s -verify t/pubkey.der -keyform DER -signature t/data.sig t/baddata.txt" % mdarg) + run_openssl("dgst %s -verify t/pubkey.der -keyform DER -signature t/data.sig t/data.txt" % mdarg) + + with open("t/privkey.pem", "wb") as e: + e.write(sk.to_pem()) # 2 + run_openssl("dgst %s -sign t/privkey.pem -out t/data.sig2 t/data.txt" % mdarg) + run_openssl("dgst %s -verify t/pubkey.pem -signature t/data.sig2 t/data.txt" % mdarg) + + +class DER(unittest.TestCase): + def test_oids(self): + oid_ecPublicKey = der.encode_oid(1, 2, 840, 10045, 2, 1) + self.assertEqual(hexlify(oid_ecPublicKey), b("06072a8648ce3d0201")) + self.assertEqual(hexlify(NIST224p.encoded_oid), b("06052b81040021")) + self.assertEqual(hexlify(NIST256p.encoded_oid), + b("06082a8648ce3d030107")) + x = oid_ecPublicKey + b("more") + x1, rest = der.remove_object(x) + self.assertEqual(x1, (1, 2, 840, 10045, 2, 1)) + self.assertEqual(rest, b("more")) + + def test_integer(self): + self.assertEqual(der.encode_integer(0), b("\x02\x01\x00")) + self.assertEqual(der.encode_integer(1), b("\x02\x01\x01")) + self.assertEqual(der.encode_integer(127), b("\x02\x01\x7f")) + self.assertEqual(der.encode_integer(128), b("\x02\x02\x00\x80")) + self.assertEqual(der.encode_integer(256), b("\x02\x02\x01\x00")) + # self.assertEqual(der.encode_integer(-1), b("\x02\x01\xff")) + + def s(n): + return der.remove_integer(der.encode_integer(n) + b("junk")) + self.assertEqual(s(0), (0, b("junk"))) + self.assertEqual(s(1), (1, b("junk"))) + self.assertEqual(s(127), (127, b("junk"))) + self.assertEqual(s(128), (128, b("junk"))) + self.assertEqual(s(256), (256, b("junk"))) + self.assertEqual(s(1234567890123456789012345678901234567890), + (1234567890123456789012345678901234567890, b("junk"))) + + def test_number(self): + self.assertEqual(der.encode_number(0), b("\x00")) + self.assertEqual(der.encode_number(127), b("\x7f")) + self.assertEqual(der.encode_number(128), b("\x81\x00")) + self.assertEqual(der.encode_number(3 * 128 + 7), b("\x83\x07")) + # self.assertEqual(der.read_number("\x81\x9b" + "more"), (155, 2)) + # self.assertEqual(der.encode_number(155), b("\x81\x9b")) + for n in (0, 1, 2, 127, 128, 3 * 128 + 7, 840, 10045): # , 155): + x = der.encode_number(n) + b("more") + n1, llen = der.read_number(x) + self.assertEqual(n1, n) + self.assertEqual(x[llen:], b("more")) + + def test_length(self): + self.assertEqual(der.encode_length(0), b("\x00")) + self.assertEqual(der.encode_length(127), b("\x7f")) + self.assertEqual(der.encode_length(128), b("\x81\x80")) + self.assertEqual(der.encode_length(255), b("\x81\xff")) + self.assertEqual(der.encode_length(256), b("\x82\x01\x00")) + self.assertEqual(der.encode_length(3 * 256 + 7), b("\x82\x03\x07")) + self.assertEqual(der.read_length(b("\x81\x9b") + b("more")), (155, 2)) + self.assertEqual(der.encode_length(155), b("\x81\x9b")) + for n in (0, 1, 2, 127, 128, 255, 256, 3 * 256 + 7, 155): + x = der.encode_length(n) + b("more") + n1, llen = der.read_length(x) + self.assertEqual(n1, n) + self.assertEqual(x[llen:], b("more")) + + def test_sequence(self): + x = der.encode_sequence(b("ABC"), b("DEF")) + b("GHI") + self.assertEqual(x, b("\x30\x06ABCDEFGHI")) + x1, rest = der.remove_sequence(x) + self.assertEqual(x1, b("ABCDEF")) + self.assertEqual(rest, b("GHI")) + + def test_constructed(self): + x = der.encode_constructed(0, NIST224p.encoded_oid) + self.assertEqual(hexlify(x), b("a007") + b("06052b81040021")) + x = der.encode_constructed(1, unhexlify(b("0102030a0b0c"))) + self.assertEqual(hexlify(x), b("a106") + b("0102030a0b0c")) + + +class Util(unittest.TestCase): + def test_trytryagain(self): + tta = util.randrange_from_seed__trytryagain + for i in range(1000): + seed = "seed-%d" % i + for order in (2**8 - 2, 2**8 - 1, 2**8, 2**8 + 1, 2**8 + 2, + 2**16 - 1, 2**16 + 1): + n = tta(seed, order) + self.assertTrue(1 <= n < order, (1, n, order)) + # this trytryagain *does* provide long-term stability + self.assertEqual(("%x" % (tta("seed", NIST224p.order))).encode(), + b("6fa59d73bf0446ae8743cf748fc5ac11d5585a90356417e97155c3bc")) + + def test_randrange(self): + # util.randrange does not provide long-term stability: we might + # change the algorithm in the future. + for i in range(1000): + entropy = util.PRNG("seed-%d" % i) + for order in (2**8 - 2, 2**8 - 1, 2**8, + 2**16 - 1, 2**16 + 1, + ): + # that oddball 2**16+1 takes half our runtime + n = util.randrange(order, entropy=entropy) + self.assertTrue(1 <= n < order, (1, n, order)) + + def OFF_test_prove_uniformity(self): + order = 2**8 - 2 + counts = dict([(i, 0) for i in range(1, order)]) + assert 0 not in counts + assert order not in counts + for i in range(1000000): + seed = "seed-%d" % i + n = util.randrange_from_seed__trytryagain(seed, order) + counts[n] += 1 + # this technique should use the full range + self.assertTrue(counts[order - 1]) + for i in range(1, order): + print_("%3d: %s" % (i, "*" * (counts[i] // 100))) + + +class RFC6979(unittest.TestCase): + # https://tools.ietf.org/html/rfc6979#appendix-A.1 + def _do(self, generator, secexp, hsh, hash_func, expected): + actual = rfc6979.generate_k(generator.order(), secexp, hash_func, hsh) + self.assertEqual(expected, actual) + + def test_SECP256k1(self): + '''RFC doesn't contain test vectors for SECP256k1 used in bitcoin. + This vector has been computed by Golang reference implementation instead.''' + self._do( + generator=SECP256k1.generator, + secexp=int("9d0219792467d7d37b4d43298a7d0c05", 16), + hsh=sha256(b("sample")).digest(), + hash_func=sha256, + expected=int("8fa1f95d514760e498f28957b824ee6ec39ed64826ff4fecc2b5739ec45b91cd", 16)) + + def test_SECP256k1_2(self): + self._do( + generator=SECP256k1.generator, + secexp=int("cca9fbcc1b41e5a95d369eaa6ddcff73b61a4efaa279cfc6567e8daa39cbaf50", 16), + hsh=sha256(b("sample")).digest(), + hash_func=sha256, + expected=int("2df40ca70e639d89528a6b670d9d48d9165fdc0febc0974056bdce192b8e16a3", 16)) + + def test_SECP256k1_3(self): + self._do( + generator=SECP256k1.generator, + secexp=0x1, + hsh=sha256(b("Satoshi Nakamoto")).digest(), + hash_func=sha256, + expected=0x8F8A276C19F4149656B280621E358CCE24F5F52542772691EE69063B74F15D15) + + def test_SECP256k1_4(self): + self._do( + generator=SECP256k1.generator, + secexp=0x1, + hsh=sha256(b("All those moments will be lost in time, like tears in rain. Time to die...")).digest(), + hash_func=sha256, + expected=0x38AA22D72376B4DBC472E06C3BA403EE0A394DA63FC58D88686C611ABA98D6B3) + + def test_SECP256k1_5(self): + self._do( + generator=SECP256k1.generator, + secexp=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140, + hsh=sha256(b("Satoshi Nakamoto")).digest(), + hash_func=sha256, + expected=0x33A19B60E25FB6F4435AF53A3D42D493644827367E6453928554F43E49AA6F90) + + def test_SECP256k1_6(self): + self._do( + generator=SECP256k1.generator, + secexp=0xf8b8af8ce3c7cca5e300d33939540c10d45ce001b8f252bfbc57ba0342904181, + hsh=sha256(b("Alan Turing")).digest(), + hash_func=sha256, + expected=0x525A82B70E67874398067543FD84C83D30C175FDC45FDEEE082FE13B1D7CFDF1) + + def test_1(self): + # Basic example of the RFC, it also tests 'try-try-again' from Step H of rfc6979 + self._do( + generator=Point(None, 0, 0, int("4000000000000000000020108A2E0CC0D99F8A5EF", 16)), + secexp=int("09A4D6792295A7F730FC3F2B49CBC0F62E862272F", 16), + hsh=unhexlify(b("AF2BDBE1AA9B6EC1E2ADE1D694F41FC71A831D0268E9891562113D8A62ADD1BF")), + hash_func=sha256, + expected=int("23AF4074C90A02B3FE61D286D5C87F425E6BDD81B", 16)) + + def test_2(self): + self._do( + generator=NIST192p.generator, + secexp=int("6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4", 16), + hsh=sha1(b("sample")).digest(), + hash_func=sha1, + expected=int("37D7CA00D2C7B0E5E412AC03BD44BA837FDD5B28CD3B0021", 16)) + + def test_3(self): + self._do( + generator=NIST192p.generator, + secexp=int("6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4", 16), + hsh=sha256(b("sample")).digest(), + hash_func=sha256, + expected=int("32B1B6D7D42A05CB449065727A84804FB1A3E34D8F261496", 16)) + + def test_4(self): + self._do( + generator=NIST192p.generator, + secexp=int("6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4", 16), + hsh=sha512(b("sample")).digest(), + hash_func=sha512, + expected=int("A2AC7AB055E4F20692D49209544C203A7D1F2C0BFBC75DB1", 16)) + + def test_5(self): + self._do( + generator=NIST192p.generator, + secexp=int("6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4", 16), + hsh=sha1(b("test")).digest(), + hash_func=sha1, + expected=int("D9CF9C3D3297D3260773A1DA7418DB5537AB8DD93DE7FA25", 16)) + + def test_6(self): + self._do( + generator=NIST192p.generator, + secexp=int("6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4", 16), + hsh=sha256(b("test")).digest(), + hash_func=sha256, + expected=int("5C4CE89CF56D9E7C77C8585339B006B97B5F0680B4306C6C", 16)) + + def test_7(self): + self._do( + generator=NIST192p.generator, + secexp=int("6FAB034934E4C0FC9AE67F5B5659A9D7D1FEFD187EE09FD4", 16), + hsh=sha512(b("test")).digest(), + hash_func=sha512, + expected=int("0758753A5254759C7CFBAD2E2D9B0792EEE44136C9480527", 16)) + + def test_8(self): + self._do( + generator=NIST521p.generator, + secexp=int("0FAD06DAA62BA3B25D2FB40133DA757205DE67F5BB0018FEE8C86E1B68C7E75CAA896EB32F1F47C70855836A6D16FCC1466F6D8FBEC67DB89EC0C08B0E996B83538", 16), + hsh=sha1(b("sample")).digest(), + hash_func=sha1, + expected=int("089C071B419E1C2820962321787258469511958E80582E95D8378E0C2CCDB3CB42BEDE42F50E3FA3C71F5A76724281D31D9C89F0F91FC1BE4918DB1C03A5838D0F9", 16)) + + def test_9(self): + self._do( + generator=NIST521p.generator, + secexp=int("0FAD06DAA62BA3B25D2FB40133DA757205DE67F5BB0018FEE8C86E1B68C7E75CAA896EB32F1F47C70855836A6D16FCC1466F6D8FBEC67DB89EC0C08B0E996B83538", 16), + hsh=sha256(b("sample")).digest(), + hash_func=sha256, + expected=int("0EDF38AFCAAECAB4383358B34D67C9F2216C8382AAEA44A3DAD5FDC9C32575761793FEF24EB0FC276DFC4F6E3EC476752F043CF01415387470BCBD8678ED2C7E1A0", 16)) + + def test_10(self): + self._do( + generator=NIST521p.generator, + secexp=int("0FAD06DAA62BA3B25D2FB40133DA757205DE67F5BB0018FEE8C86E1B68C7E75CAA896EB32F1F47C70855836A6D16FCC1466F6D8FBEC67DB89EC0C08B0E996B83538", 16), + hsh=sha512(b("test")).digest(), + hash_func=sha512, + expected=int("16200813020EC986863BEDFC1B121F605C1215645018AEA1A7B215A564DE9EB1B38A67AA1128B80CE391C4FB71187654AAA3431027BFC7F395766CA988C964DC56D", 16)) + + +def __main__(): + unittest.main() + + +if __name__ == "__main__": + __main__() diff --git a/ecdsa/tox.ini b/ecdsa/tox.ini new file mode 100755 index 0000000..1aab69a --- /dev/null +++ b/ecdsa/tox.ini @@ -0,0 +1,41 @@ + +[tox] +envlist = py26, py27, py33, py34, py35 + +[testenv] +deps = + pytest +commands = py.test {posargs:src/ecdsa} + +[testenv:coverage] +deps = + coverage + pytest +commands = coverage run -m pytest {posargs:src/ecdsa} + +[testenv:speed] +commands = {envpython} speed.py + +[testenv:codechecks] +basepython = python3.5 +deps = + pyflakes + flake8 +commands = + flake8 setup.py speed.py src + + +[flake8] +exclude = src/ecdsa/test*.py +# We're just getting started. For now, ignore the following problems: +# E111: indentation is not a multiple of four +# E114: indentation is not a multiple of four (comment) +# E226: missing whitespace around arithmetic operator +# E231: missing whitespace after ',' +# E266: too many leading '#' for block comment +# E302: expected 2 blank lines, found 1 +# E305: expected 2 blank lines after class or function defintion, found 1 +# E501: line too long +# E502: the backslash is redundant between brackets +# W391: blank line at end of file +ignore = E111,E114,E226,E231,E266,E302,E305,E501,E502,W391 diff --git a/ecdsa/util.py b/ecdsa/util.py new file mode 100755 index 0000000..c727179 --- /dev/null +++ b/ecdsa/util.py @@ -0,0 +1,265 @@ +from __future__ import division + +import os +import math +import binascii +from hashlib import sha256 +from . import der +from .curves import orderlen +from six import PY3, int2byte, b, next + +# RFC5480: +# The "unrestricted" algorithm identifier is: +# id-ecPublicKey OBJECT IDENTIFIER ::= { +# iso(1) member-body(2) us(840) ansi-X9-62(10045) keyType(2) 1 } + +oid_ecPublicKey = (1, 2, 840, 10045, 2, 1) +encoded_oid_ecPublicKey = der.encode_oid(*oid_ecPublicKey) + + +def randrange(order, entropy=None): + """Return a random integer k such that 1 <= k < order, uniformly + distributed across that range. For simplicity, this only behaves well if + 'order' is fairly close (but below) a power of 256. The try-try-again + algorithm we use takes longer and longer time (on average) to complete as + 'order' falls, rising to a maximum of avg=512 loops for the worst-case + (256**k)+1 . All of the standard curves behave well. There is a cutoff at + 10k loops (which raises RuntimeError) to prevent an infinite loop when + something is really broken like the entropy function not working. + + Note that this function is not declared to be forwards-compatible: we may + change the behavior in future releases. The entropy= argument (which + should get a callable that behaves like os.urandom) can be used to + achieve stability within a given release (for repeatable unit tests), but + should not be used as a long-term-compatible key generation algorithm. + """ + # we could handle arbitrary orders (even 256**k+1) better if we created + # candidates bit-wise instead of byte-wise, which would reduce the + # worst-case behavior to avg=2 loops, but that would be more complex. The + # change would be to round the order up to a power of 256, subtract one + # (to get 0xffff..), use that to get a byte-long mask for the top byte, + # generate the len-1 entropy bytes, generate one extra byte and mask off + # the top bits, then combine it with the rest. Requires jumping back and + # forth between strings and integers a lot. + + if entropy is None: + entropy = os.urandom + assert order > 1 + bytes = orderlen(order) + dont_try_forever = 10000 # gives about 2**-60 failures for worst case + while dont_try_forever > 0: + dont_try_forever -= 1 + candidate = string_to_number(entropy(bytes)) + 1 + if 1 <= candidate < order: + return candidate + continue + raise RuntimeError("randrange() tried hard but gave up, either something" + " is very wrong or you got realllly unlucky. Order was" + " %x" % order) + + +class PRNG: + # this returns a callable which, when invoked with an integer N, will + # return N pseudorandom bytes. Note: this is a short-term PRNG, meant + # primarily for the needs of randrange_from_seed__trytryagain(), which + # only needs to run it a few times per seed. It does not provide + # protection against state compromise (forward security). + def __init__(self, seed): + self.generator = self.block_generator(seed) + + def __call__(self, numbytes): + a = [next(self.generator) for i in range(numbytes)] + + if PY3: + return bytes(a) + else: + return "".join(a) + + def block_generator(self, seed): + counter = 0 + while True: + for byte in sha256(("prng-%d-%s" % (counter, seed)).encode()).digest(): + yield byte + counter += 1 + + +def randrange_from_seed__overshoot_modulo(seed, order): + # hash the data, then turn the digest into a number in [1,order). + # + # We use David-Sarah Hopwood's suggestion: turn it into a number that's + # sufficiently larger than the group order, then modulo it down to fit. + # This should give adequate (but not perfect) uniformity, and simple + # code. There are other choices: try-try-again is the main one. + base = PRNG(seed)(2 * orderlen(order)) + number = (int(binascii.hexlify(base), 16) % (order - 1)) + 1 + assert 1 <= number < order, (1, number, order) + return number + + +def lsb_of_ones(numbits): + return (1 << numbits) - 1 + + +def bits_and_bytes(order): + bits = int(math.log(order - 1, 2) + 1) + bytes = bits // 8 + extrabits = bits % 8 + return bits, bytes, extrabits + + +# the following randrange_from_seed__METHOD() functions take an +# arbitrarily-sized secret seed and turn it into a number that obeys the same +# range limits as randrange() above. They are meant for deriving consistent +# signing keys from a secret rather than generating them randomly, for +# example a protocol in which three signing keys are derived from a master +# secret. You should use a uniformly-distributed unguessable seed with about +# curve.baselen bytes of entropy. To use one, do this: +# seed = os.urandom(curve.baselen) # or other starting point +# secexp = ecdsa.util.randrange_from_seed__trytryagain(sed, curve.order) +# sk = SigningKey.from_secret_exponent(secexp, curve) + +def randrange_from_seed__truncate_bytes(seed, order, hashmod=sha256): + # hash the seed, then turn the digest into a number in [1,order), but + # don't worry about trying to uniformly fill the range. This will lose, + # on average, four bits of entropy. + bits, _bytes, extrabits = bits_and_bytes(order) + if extrabits: + _bytes += 1 + base = hashmod(seed).digest()[:_bytes] + base = "\x00" * (_bytes - len(base)) + base + number = 1 + int(binascii.hexlify(base), 16) + assert 1 <= number < order + return number + + +def randrange_from_seed__truncate_bits(seed, order, hashmod=sha256): + # like string_to_randrange_truncate_bytes, but only lose an average of + # half a bit + bits = int(math.log(order - 1, 2) + 1) + maxbytes = (bits + 7) // 8 + base = hashmod(seed).digest()[:maxbytes] + base = "\x00" * (maxbytes - len(base)) + base + topbits = 8 * maxbytes - bits + if topbits: + base = int2byte(ord(base[0]) & lsb_of_ones(topbits)) + base[1:] + number = 1 + int(binascii.hexlify(base), 16) + assert 1 <= number < order + return number + + +def randrange_from_seed__trytryagain(seed, order): + # figure out exactly how many bits we need (rounded up to the nearest + # bit), so we can reduce the chance of looping to less than 0.5 . This is + # specified to feed from a byte-oriented PRNG, and discards the + # high-order bits of the first byte as necessary to get the right number + # of bits. The average number of loops will range from 1.0 (when + # order=2**k-1) to 2.0 (when order=2**k+1). + assert order > 1 + bits, bytes, extrabits = bits_and_bytes(order) + generate = PRNG(seed) + while True: + extrabyte = b("") + if extrabits: + extrabyte = int2byte(ord(generate(1)) & lsb_of_ones(extrabits)) + guess = string_to_number(extrabyte + generate(bytes)) + 1 + if 1 <= guess < order: + return guess + + +def number_to_string(num, order): + l = orderlen(order) + fmt_str = "%0" + str(2 * l) + "x" + string = binascii.unhexlify((fmt_str % num).encode()) + assert len(string) == l, (len(string), l) + return string + + +def number_to_string_crop(num, order): + l = orderlen(order) + fmt_str = "%0" + str(2 * l) + "x" + string = binascii.unhexlify((fmt_str % num).encode()) + return string[:l] + + +def string_to_number(string): + return int(binascii.hexlify(string), 16) + + +def string_to_number_fixedlen(string, order): + l = orderlen(order) + assert len(string) == l, (len(string), l) + return int(binascii.hexlify(string), 16) + + +# these methods are useful for the sigencode= argument to SK.sign() and the +# sigdecode= argument to VK.verify(), and control how the signature is packed +# or unpacked. + +def sigencode_strings(r, s, order): + r_str = number_to_string(r, order) + s_str = number_to_string(s, order) + return (r_str, s_str) + + +def sigencode_string(r, s, order): + # for any given curve, the size of the signature numbers is + # fixed, so just use simple concatenation + r_str, s_str = sigencode_strings(r, s, order) + return r_str + s_str + + +def sigencode_der(r, s, order): + return der.encode_sequence(der.encode_integer(r), der.encode_integer(s)) + + +# canonical versions of sigencode methods +# these enforce low S values, by negating the value (modulo the order) if above order/2 +# see CECKey::Sign() https://github.com/bitcoin/bitcoin/blob/master/src/key.cpp#L214 +def sigencode_strings_canonize(r, s, order): + if s > order / 2: + s = order - s + return sigencode_strings(r, s, order) + + +def sigencode_string_canonize(r, s, order): + if s > order / 2: + s = order - s + return sigencode_string(r, s, order) + + +def sigencode_der_canonize(r, s, order): + if s > order / 2: + s = order - s + return sigencode_der(r, s, order) + + +def sigdecode_string(signature, order): + l = orderlen(order) + assert len(signature) == 2 * l, (len(signature), 2 * l) + r = string_to_number_fixedlen(signature[:l], order) + s = string_to_number_fixedlen(signature[l:], order) + return r, s + + +def sigdecode_strings(rs_strings, order): + (r_str, s_str) = rs_strings + l = orderlen(order) + assert len(r_str) == l, (len(r_str), l) + assert len(s_str) == l, (len(s_str), l) + r = string_to_number_fixedlen(r_str, order) + s = string_to_number_fixedlen(s_str, order) + return r, s + + +def sigdecode_der(sig_der, order): + # return der.encode_sequence(der.encode_integer(r), der.encode_integer(s)) + rs_strings, empty = der.remove_sequence(sig_der) + if empty != b(""): + raise der.UnexpectedDER("trailing junk after DER sig: %s" % + binascii.hexlify(empty)) + r, rest = der.remove_integer(rs_strings) + s, empty = der.remove_integer(rest) + if empty != b(""): + raise der.UnexpectedDER("trailing junk after DER numbers: %s" % + binascii.hexlify(empty)) + return r, s diff --git a/ecdsa/versioneer.py b/ecdsa/versioneer.py new file mode 100755 index 0000000..f250cde --- /dev/null +++ b/ecdsa/versioneer.py @@ -0,0 +1,1817 @@ + +# Version: 0.17 + +"""The Versioneer - like a rocketeer, but for versions. + +The Versioneer +============== + +* like a rocketeer, but for versions! +* https://github.com/warner/python-versioneer +* Brian Warner +* License: Public Domain +* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, 3.5, and pypy +* [![Latest Version] +(https://pypip.in/version/versioneer/badge.svg?style=flat) +](https://pypi.python.org/pypi/versioneer/) +* [![Build Status] +(https://travis-ci.org/warner/python-versioneer.png?branch=master) +](https://travis-ci.org/warner/python-versioneer) + +This is a tool for managing a recorded version number in distutils-based +python projects. The goal is to remove the tedious and error-prone "update +the embedded version string" step from your release process. Making a new +release should be as easy as recording a new tag in your version-control +system, and maybe making new tarballs. + + +## Quick Install + +* `pip install versioneer` to somewhere to your $PATH +* add a `[versioneer]` section to your setup.cfg (see below) +* run `versioneer install` in your source tree, commit the results + +## Version Identifiers + +Source trees come from a variety of places: + +* a version-control system checkout (mostly used by developers) +* a nightly tarball, produced by build automation +* a snapshot tarball, produced by a web-based VCS browser, like github's + "tarball from tag" feature +* a release tarball, produced by "setup.py sdist", distributed through PyPI + +Within each source tree, the version identifier (either a string or a number, +this tool is format-agnostic) can come from a variety of places: + +* ask the VCS tool itself, e.g. "git describe" (for checkouts), which knows + about recent "tags" and an absolute revision-id +* the name of the directory into which the tarball was unpacked +* an expanded VCS keyword ($Id$, etc) +* a `_version.py` created by some earlier build step + +For released software, the version identifier is closely related to a VCS +tag. Some projects use tag names that include more than just the version +string (e.g. "myproject-1.2" instead of just "1.2"), in which case the tool +needs to strip the tag prefix to extract the version identifier. For +unreleased software (between tags), the version identifier should provide +enough information to help developers recreate the same tree, while also +giving them an idea of roughly how old the tree is (after version 1.2, before +version 1.3). Many VCS systems can report a description that captures this, +for example `git describe --tags --dirty --always` reports things like +"0.7-1-g574ab98-dirty" to indicate that the checkout is one revision past the +0.7 tag, has a unique revision id of "574ab98", and is "dirty" (it has +uncommitted changes. + +The version identifier is used for multiple purposes: + +* to allow the module to self-identify its version: `myproject.__version__` +* to choose a name and prefix for a 'setup.py sdist' tarball + +## Theory of Operation + +Versioneer works by adding a special `_version.py` file into your source +tree, where your `__init__.py` can import it. This `_version.py` knows how to +dynamically ask the VCS tool for version information at import time. + +`_version.py` also contains `$Revision$` markers, and the installation +process marks `_version.py` to have this marker rewritten with a tag name +during the `git archive` command. As a result, generated tarballs will +contain enough information to get the proper version. + +To allow `setup.py` to compute a version too, a `versioneer.py` is added to +the top level of your source tree, next to `setup.py` and the `setup.cfg` +that configures it. This overrides several distutils/setuptools commands to +compute the version when invoked, and changes `setup.py build` and `setup.py +sdist` to replace `_version.py` with a small static file that contains just +the generated version data. + +## Installation + +See [INSTALL.md](./INSTALL.md) for detailed installation instructions. + +## Version-String Flavors + +Code which uses Versioneer can learn about its version string at runtime by +importing `_version` from your main `__init__.py` file and running the +`get_versions()` function. From the "outside" (e.g. in `setup.py`), you can +import the top-level `versioneer.py` and run `get_versions()`. + +Both functions return a dictionary with different flavors of version +information: + +* `['version']`: A condensed version string, rendered using the selected + style. This is the most commonly used value for the project's version + string. The default "pep440" style yields strings like `0.11`, + `0.11+2.g1076c97`, or `0.11+2.g1076c97.dirty`. See the "Styles" section + below for alternative styles. + +* `['full-revisionid']`: detailed revision identifier. For Git, this is the + full SHA1 commit id, e.g. "1076c978a8d3cfc70f408fe5974aa6c092c949ac". + +* `['date']`: Date and time of the latest `HEAD` commit. For Git, it is the + commit date in ISO 8601 format. This will be None if the date is not + available. + +* `['dirty']`: a boolean, True if the tree has uncommitted changes. Note that + this is only accurate if run in a VCS checkout, otherwise it is likely to + be False or None + +* `['error']`: if the version string could not be computed, this will be set + to a string describing the problem, otherwise it will be None. It may be + useful to throw an exception in setup.py if this is set, to avoid e.g. + creating tarballs with a version string of "unknown". + +Some variants are more useful than others. Including `full-revisionid` in a +bug report should allow developers to reconstruct the exact code being tested +(or indicate the presence of local changes that should be shared with the +developers). `version` is suitable for display in an "about" box or a CLI +`--version` output: it can be easily compared against release notes and lists +of bugs fixed in various releases. + +The installer adds the following text to your `__init__.py` to place a basic +version in `YOURPROJECT.__version__`: + + from ._version import get_versions + __version__ = get_versions()['version'] + del get_versions + +## Styles + +The setup.cfg `style=` configuration controls how the VCS information is +rendered into a version string. + +The default style, "pep440", produces a PEP440-compliant string, equal to the +un-prefixed tag name for actual releases, and containing an additional "local +version" section with more detail for in-between builds. For Git, this is +TAG[+DISTANCE.gHEX[.dirty]] , using information from `git describe --tags +--dirty --always`. For example "0.11+2.g1076c97.dirty" indicates that the +tree is like the "1076c97" commit but has uncommitted changes (".dirty"), and +that this commit is two revisions ("+2") beyond the "0.11" tag. For released +software (exactly equal to a known tag), the identifier will only contain the +stripped tag, e.g. "0.11". + +Other styles are available. See details.md in the Versioneer source tree for +descriptions. + +## Debugging + +Versioneer tries to avoid fatal errors: if something goes wrong, it will tend +to return a version of "0+unknown". To investigate the problem, run `setup.py +version`, which will run the version-lookup code in a verbose mode, and will +display the full contents of `get_versions()` (including the `error` string, +which may help identify what went wrong). + +## Known Limitations + +Some situations are known to cause problems for Versioneer. This details the +most significant ones. More can be found on Github +[issues page](https://github.com/warner/python-versioneer/issues). + +### Subprojects + +Versioneer has limited support for source trees in which `setup.py` is not in +the root directory (e.g. `setup.py` and `.git/` are *not* siblings). The are +two common reasons why `setup.py` might not be in the root: + +* Source trees which contain multiple subprojects, such as + [Buildbot](https://github.com/buildbot/buildbot), which contains both + "master" and "slave" subprojects, each with their own `setup.py`, + `setup.cfg`, and `tox.ini`. Projects like these produce multiple PyPI + distributions (and upload multiple independently-installable tarballs). +* Source trees whose main purpose is to contain a C library, but which also + provide bindings to Python (and perhaps other langauges) in subdirectories. + +Versioneer will look for `.git` in parent directories, and most operations +should get the right version string. However `pip` and `setuptools` have bugs +and implementation details which frequently cause `pip install .` from a +subproject directory to fail to find a correct version string (so it usually +defaults to `0+unknown`). + +`pip install --editable .` should work correctly. `setup.py install` might +work too. + +Pip-8.1.1 is known to have this problem, but hopefully it will get fixed in +some later version. + +[Bug #38](https://github.com/warner/python-versioneer/issues/38) is tracking +this issue. The discussion in +[PR #61](https://github.com/warner/python-versioneer/pull/61) describes the +issue from the Versioneer side in more detail. +[pip PR#3176](https://github.com/pypa/pip/pull/3176) and +[pip PR#3615](https://github.com/pypa/pip/pull/3615) contain work to improve +pip to let Versioneer work correctly. + +Versioneer-0.16 and earlier only looked for a `.git` directory next to the +`setup.cfg`, so subprojects were completely unsupported with those releases. + +### Editable installs with setuptools <= 18.5 + +`setup.py develop` and `pip install --editable .` allow you to install a +project into a virtualenv once, then continue editing the source code (and +test) without re-installing after every change. + +"Entry-point scripts" (`setup(entry_points={"console_scripts": ..})`) are a +convenient way to specify executable scripts that should be installed along +with the python package. + +These both work as expected when using modern setuptools. When using +setuptools-18.5 or earlier, however, certain operations will cause +`pkg_resources.DistributionNotFound` errors when running the entrypoint +script, which must be resolved by re-installing the package. This happens +when the install happens with one version, then the egg_info data is +regenerated while a different version is checked out. Many setup.py commands +cause egg_info to be rebuilt (including `sdist`, `wheel`, and installing into +a different virtualenv), so this can be surprising. + +[Bug #83](https://github.com/warner/python-versioneer/issues/83) describes +this one, but upgrading to a newer version of setuptools should probably +resolve it. + +### Unicode version strings + +While Versioneer works (and is continually tested) with both Python 2 and +Python 3, it is not entirely consistent with bytes-vs-unicode distinctions. +Newer releases probably generate unicode version strings on py2. It's not +clear that this is wrong, but it may be surprising for applications when then +write these strings to a network connection or include them in bytes-oriented +APIs like cryptographic checksums. + +[Bug #71](https://github.com/warner/python-versioneer/issues/71) investigates +this question. + + +## Updating Versioneer + +To upgrade your project to a new release of Versioneer, do the following: + +* install the new Versioneer (`pip install -U versioneer` or equivalent) +* edit `setup.cfg`, if necessary, to include any new configuration settings + indicated by the release notes. See [UPGRADING](./UPGRADING.md) for details. +* re-run `versioneer install` in your source tree, to replace + `SRC/_version.py` +* commit any changed files + +## Future Directions + +This tool is designed to make it easily extended to other version-control +systems: all VCS-specific components are in separate directories like +src/git/ . The top-level `versioneer.py` script is assembled from these +components by running make-versioneer.py . In the future, make-versioneer.py +will take a VCS name as an argument, and will construct a version of +`versioneer.py` that is specific to the given VCS. It might also take the +configuration arguments that are currently provided manually during +installation by editing setup.py . Alternatively, it might go the other +direction and include code from all supported VCS systems, reducing the +number of intermediate scripts. + + +## License + +To make Versioneer easier to embed, all its code is dedicated to the public +domain. The `_version.py` that it creates is also in the public domain. +Specifically, both are released under the Creative Commons "Public Domain +Dedication" license (CC0-1.0), as described in +https://creativecommons.org/publicdomain/zero/1.0/ . + +""" + +from __future__ import print_function +try: + import configparser +except ImportError: + import ConfigParser as configparser +import errno +import json +import os +import re +import subprocess +import sys + + +class VersioneerConfig: + """Container for Versioneer configuration parameters.""" + + +def get_root(): + """Get the project root directory. + + We require that all commands are run from the project root, i.e. the + directory that contains setup.py, setup.cfg, and versioneer.py . + """ + root = os.path.realpath(os.path.abspath(os.getcwd())) + setup_py = os.path.join(root, "setup.py") + versioneer_py = os.path.join(root, "versioneer.py") + if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)): + # allow 'python path/to/setup.py COMMAND' + root = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0]))) + setup_py = os.path.join(root, "setup.py") + versioneer_py = os.path.join(root, "versioneer.py") + if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)): + err = ("Versioneer was unable to run the project root directory. " + "Versioneer requires setup.py to be executed from " + "its immediate directory (like 'python setup.py COMMAND'), " + "or in a way that lets it use sys.argv[0] to find the root " + "(like 'python path/to/setup.py COMMAND').") + raise VersioneerBadRootError(err) + try: + # Certain runtime workflows (setup.py install/develop in a setuptools + # tree) execute all dependencies in a single python process, so + # "versioneer" may be imported multiple times, and python's shared + # module-import table will cache the first one. So we can't use + # os.path.dirname(__file__), as that will find whichever + # versioneer.py was first imported, even in later projects. + me = os.path.realpath(os.path.abspath(__file__)) + me_dir = os.path.normcase(os.path.splitext(me)[0]) + vsr_dir = os.path.normcase(os.path.splitext(versioneer_py)[0]) + if me_dir != vsr_dir: + print("Warning: build in %s is using versioneer.py from %s" + % (os.path.dirname(me), versioneer_py)) + except NameError: + pass + return root + + +def get_config_from_root(root): + """Read the project setup.cfg file to determine Versioneer config.""" + # This might raise EnvironmentError (if setup.cfg is missing), or + # configparser.NoSectionError (if it lacks a [versioneer] section), or + # configparser.NoOptionError (if it lacks "VCS="). See the docstring at + # the top of versioneer.py for instructions on writing your setup.cfg . + setup_cfg = os.path.join(root, "setup.cfg") + parser = configparser.SafeConfigParser() + with open(setup_cfg, "r") as f: + parser.readfp(f) + VCS = parser.get("versioneer", "VCS") # mandatory + + def get(parser, name): + if parser.has_option("versioneer", name): + return parser.get("versioneer", name) + return None + cfg = VersioneerConfig() + cfg.VCS = VCS + cfg.style = get(parser, "style") or "" + cfg.versionfile_source = get(parser, "versionfile_source") + cfg.versionfile_build = get(parser, "versionfile_build") + cfg.tag_prefix = get(parser, "tag_prefix") + if cfg.tag_prefix in ("''", '""'): + cfg.tag_prefix = "" + cfg.parentdir_prefix = get(parser, "parentdir_prefix") + cfg.verbose = get(parser, "verbose") + return cfg + + +class NotThisMethod(Exception): + """Exception raised if a method is not valid for the current scenario.""" + +# these dictionaries contain VCS-specific tools +LONG_VERSION_PY = {} +HANDLERS = {} + + +def register_vcs_handler(vcs, method): # decorator + """Decorator to mark a method as the handler for a particular VCS.""" + def decorate(f): + """Store f in HANDLERS[vcs][method].""" + if vcs not in HANDLERS: + HANDLERS[vcs] = {} + HANDLERS[vcs][method] = f + return f + return decorate + + +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, + env=None): + """Call the given command(s).""" + assert isinstance(commands, list) + p = None + for c in commands: + try: + dispcmd = str([c] + args) + # remember shell=False, so use git.cmd on windows, not just git + p = subprocess.Popen([c] + args, cwd=cwd, env=env, + stdout=subprocess.PIPE, + stderr=(subprocess.PIPE if hide_stderr + else None)) + break + except EnvironmentError: + e = sys.exc_info()[1] + if e.errno == errno.ENOENT: + continue + if verbose: + print("unable to run %s" % dispcmd) + print(e) + return None, None + else: + if verbose: + print("unable to find command, tried %s" % (commands,)) + return None, None + stdout = p.communicate()[0].strip() + if sys.version_info[0] >= 3: + stdout = stdout.decode() + if p.returncode != 0: + if verbose: + print("unable to run %s (error)" % dispcmd) + print("stdout was %s" % stdout) + return None, p.returncode + return stdout, p.returncode +LONG_VERSION_PY['git'] = ''' +# This file helps to compute a version number in source trees obtained from +# git-archive tarball (such as those provided by githubs download-from-tag +# feature). Distribution tarballs (built by setup.py sdist) and build +# directories (produced by setup.py build) will contain a much shorter file +# that just contains the computed version number. + +# This file is released into the public domain. Generated by +# versioneer-0.17 (https://github.com/warner/python-versioneer) + +"""Git implementation of _version.py.""" + +import errno +import os +import re +import subprocess +import sys + + +def get_keywords(): + """Get the keywords needed to look up the version information.""" + # these strings will be replaced by git during git-archive. + # setup.py/versioneer.py will grep for the variable names, so they must + # each be defined on a line of their own. _version.py will just call + # get_keywords(). + git_refnames = "%(DOLLAR)sFormat:%%d%(DOLLAR)s" + git_full = "%(DOLLAR)sFormat:%%H%(DOLLAR)s" + git_date = "%(DOLLAR)sFormat:%%ci%(DOLLAR)s" + keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} + return keywords + + +class VersioneerConfig: + """Container for Versioneer configuration parameters.""" + + +def get_config(): + """Create, populate and return the VersioneerConfig() object.""" + # these strings are filled in when 'setup.py versioneer' creates + # _version.py + cfg = VersioneerConfig() + cfg.VCS = "git" + cfg.style = "%(STYLE)s" + cfg.tag_prefix = "%(TAG_PREFIX)s" + cfg.parentdir_prefix = "%(PARENTDIR_PREFIX)s" + cfg.versionfile_source = "%(VERSIONFILE_SOURCE)s" + cfg.verbose = False + return cfg + + +class NotThisMethod(Exception): + """Exception raised if a method is not valid for the current scenario.""" + + +LONG_VERSION_PY = {} +HANDLERS = {} + + +def register_vcs_handler(vcs, method): # decorator + """Decorator to mark a method as the handler for a particular VCS.""" + def decorate(f): + """Store f in HANDLERS[vcs][method].""" + if vcs not in HANDLERS: + HANDLERS[vcs] = {} + HANDLERS[vcs][method] = f + return f + return decorate + + +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, + env=None): + """Call the given command(s).""" + assert isinstance(commands, list) + p = None + for c in commands: + try: + dispcmd = str([c] + args) + # remember shell=False, so use git.cmd on windows, not just git + p = subprocess.Popen([c] + args, cwd=cwd, env=env, + stdout=subprocess.PIPE, + stderr=(subprocess.PIPE if hide_stderr + else None)) + break + except EnvironmentError: + e = sys.exc_info()[1] + if e.errno == errno.ENOENT: + continue + if verbose: + print("unable to run %%s" %% dispcmd) + print(e) + return None, None + else: + if verbose: + print("unable to find command, tried %%s" %% (commands,)) + return None, None + stdout = p.communicate()[0].strip() + if sys.version_info[0] >= 3: + stdout = stdout.decode() + if p.returncode != 0: + if verbose: + print("unable to run %%s (error)" %% dispcmd) + print("stdout was %%s" %% stdout) + return None, p.returncode + return stdout, p.returncode + + +def versions_from_parentdir(parentdir_prefix, root, verbose): + """Try to determine the version from the parent directory name. + + Source tarballs conventionally unpack into a directory that includes both + the project name and a version string. We will also support searching up + two directory levels for an appropriately named parent directory + """ + rootdirs = [] + + for i in range(3): + dirname = os.path.basename(root) + if dirname.startswith(parentdir_prefix): + return {"version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, "error": None, "date": None} + else: + rootdirs.append(root) + root = os.path.dirname(root) # up a level + + if verbose: + print("Tried directories %%s but none started with prefix %%s" %% + (str(rootdirs), parentdir_prefix)) + raise NotThisMethod("rootdir doesn't start with parentdir_prefix") + + +@register_vcs_handler("git", "get_keywords") +def git_get_keywords(versionfile_abs): + """Extract version information from the given file.""" + # the code embedded in _version.py can just fetch the value of these + # keywords. When used from setup.py, we don't want to import _version.py, + # so we do it with a regexp instead. This function is not used from + # _version.py. + keywords = {} + try: + f = open(versionfile_abs, "r") + for line in f.readlines(): + if line.strip().startswith("git_refnames ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["refnames"] = mo.group(1) + if line.strip().startswith("git_full ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["full"] = mo.group(1) + if line.strip().startswith("git_date ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["date"] = mo.group(1) + f.close() + except EnvironmentError: + pass + return keywords + + +@register_vcs_handler("git", "keywords") +def git_versions_from_keywords(keywords, tag_prefix, verbose): + """Get version information from git keywords.""" + if not keywords: + raise NotThisMethod("no keywords at all, weird") + date = keywords.get("date") + if date is not None: + # git-2.2.0 added "%%cI", which expands to an ISO-8601 -compliant + # datestamp. However we prefer "%%ci" (which expands to an "ISO-8601 + # -like" string, which we must then edit to make compliant), because + # it's been around since git-1.5.3, and it's too difficult to + # discover which version we're using, or to work around using an + # older one. + date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + refnames = keywords["refnames"].strip() + if refnames.startswith("$Format"): + if verbose: + print("keywords are unexpanded, not using") + raise NotThisMethod("unexpanded keywords, not a git-archive tarball") + refs = set([r.strip() for r in refnames.strip("()").split(",")]) + # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of + # just "foo-1.0". If we see a "tag: " prefix, prefer those. + TAG = "tag: " + tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) + if not tags: + # Either we're using git < 1.8.3, or there really are no tags. We use + # a heuristic: assume all version tags have a digit. The old git %%d + # expansion behaves like git log --decorate=short and strips out the + # refs/heads/ and refs/tags/ prefixes that would let us distinguish + # between branches and tags. By ignoring refnames without digits, we + # filter out many common branch names like "release" and + # "stabilization", as well as "HEAD" and "master". + tags = set([r for r in refs if re.search(r'\d', r)]) + if verbose: + print("discarding '%%s', no digits" %% ",".join(refs - tags)) + if verbose: + print("likely tags: %%s" %% ",".join(sorted(tags))) + for ref in sorted(tags): + # sorting will prefer e.g. "2.0" over "2.0rc1" + if ref.startswith(tag_prefix): + r = ref[len(tag_prefix):] + if verbose: + print("picking %%s" %% r) + return {"version": r, + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": None, + "date": date} + # no suitable tags, so version is "0+unknown", but full hex is still there + if verbose: + print("no suitable tags, using unknown + full revision id") + return {"version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": "no suitable tags", "date": None} + + +@register_vcs_handler("git", "pieces_from_vcs") +def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): + """Get version from 'git describe' in the root of the source tree. + + This only gets called if the git-archive 'subst' keywords were *not* + expanded, and _version.py hasn't already been rewritten with a short + version string, meaning we're inside a checked out source tree. + """ + GITS = ["git"] + if sys.platform == "win32": + GITS = ["git.cmd", "git.exe"] + + out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, + hide_stderr=True) + if rc != 0: + if verbose: + print("Directory %%s not under git control" %% root) + raise NotThisMethod("'git rev-parse --git-dir' returned error") + + # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] + # if there isn't one, this yields HEX[-dirty] (no NUM) + describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", + "--always", "--long", + "--match", "%%s*" %% tag_prefix], + cwd=root) + # --long was added in git-1.5.5 + if describe_out is None: + raise NotThisMethod("'git describe' failed") + describe_out = describe_out.strip() + full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) + if full_out is None: + raise NotThisMethod("'git rev-parse' failed") + full_out = full_out.strip() + + pieces = {} + pieces["long"] = full_out + pieces["short"] = full_out[:7] # maybe improved later + pieces["error"] = None + + # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] + # TAG might have hyphens. + git_describe = describe_out + + # look for -dirty suffix + dirty = git_describe.endswith("-dirty") + pieces["dirty"] = dirty + if dirty: + git_describe = git_describe[:git_describe.rindex("-dirty")] + + # now we have TAG-NUM-gHEX or HEX + + if "-" in git_describe: + # TAG-NUM-gHEX + mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) + if not mo: + # unparseable. Maybe git-describe is misbehaving? + pieces["error"] = ("unable to parse git-describe output: '%%s'" + %% describe_out) + return pieces + + # tag + full_tag = mo.group(1) + if not full_tag.startswith(tag_prefix): + if verbose: + fmt = "tag '%%s' doesn't start with prefix '%%s'" + print(fmt %% (full_tag, tag_prefix)) + pieces["error"] = ("tag '%%s' doesn't start with prefix '%%s'" + %% (full_tag, tag_prefix)) + return pieces + pieces["closest-tag"] = full_tag[len(tag_prefix):] + + # distance: number of commits since tag + pieces["distance"] = int(mo.group(2)) + + # commit: short hex revision ID + pieces["short"] = mo.group(3) + + else: + # HEX: no tags + pieces["closest-tag"] = None + count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], + cwd=root) + pieces["distance"] = int(count_out) # total number of commits + + # commit date: see ISO-8601 comment in git_versions_from_keywords() + date = run_command(GITS, ["show", "-s", "--format=%%ci", "HEAD"], + cwd=root)[0].strip() + pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + + return pieces + + +def plus_or_dot(pieces): + """Return a + if we don't already have one, else return a .""" + if "+" in pieces.get("closest-tag", ""): + return "." + return "+" + + +def render_pep440(pieces): + """Build up version string, with post-release "local version identifier". + + Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you + get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty + + Exceptions: + 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += plus_or_dot(pieces) + rendered += "%%d.g%%s" %% (pieces["distance"], pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0+untagged.%%d.g%%s" %% (pieces["distance"], + pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def render_pep440_pre(pieces): + """TAG[.post.devDISTANCE] -- No -dirty. + + Exceptions: + 1: no tags. 0.post.devDISTANCE + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += ".post.dev%%d" %% pieces["distance"] + else: + # exception #1 + rendered = "0.post.dev%%d" %% pieces["distance"] + return rendered + + +def render_pep440_post(pieces): + """TAG[.postDISTANCE[.dev0]+gHEX] . + + The ".dev0" means dirty. Note that .dev0 sorts backwards + (a dirty tree will appear "older" than the corresponding clean one), + but you shouldn't be releasing software with -dirty anyways. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%%d" %% pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "g%%s" %% pieces["short"] + else: + # exception #1 + rendered = "0.post%%d" %% pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += "+g%%s" %% pieces["short"] + return rendered + + +def render_pep440_old(pieces): + """TAG[.postDISTANCE[.dev0]] . + + The ".dev0" means dirty. + + Eexceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%%d" %% pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + else: + # exception #1 + rendered = "0.post%%d" %% pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + return rendered + + +def render_git_describe(pieces): + """TAG[-DISTANCE-gHEX][-dirty]. + + Like 'git describe --tags --dirty --always'. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += "-%%d-g%%s" %% (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render_git_describe_long(pieces): + """TAG-DISTANCE-gHEX[-dirty]. + + Like 'git describe --tags --dirty --always -long'. + The distance/hash is unconditional. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + rendered += "-%%d-g%%s" %% (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render(pieces, style): + """Render the given version pieces into the requested style.""" + if pieces["error"]: + return {"version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None} + + if not style or style == "default": + style = "pep440" # the default + + if style == "pep440": + rendered = render_pep440(pieces) + elif style == "pep440-pre": + rendered = render_pep440_pre(pieces) + elif style == "pep440-post": + rendered = render_pep440_post(pieces) + elif style == "pep440-old": + rendered = render_pep440_old(pieces) + elif style == "git-describe": + rendered = render_git_describe(pieces) + elif style == "git-describe-long": + rendered = render_git_describe_long(pieces) + else: + raise ValueError("unknown style '%%s'" %% style) + + return {"version": rendered, "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], "error": None, + "date": pieces.get("date")} + + +def get_versions(): + """Get version information or return default if unable to do so.""" + # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have + # __file__, we can work backwards from there to the root. Some + # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which + # case we can only use expanded keywords. + + cfg = get_config() + verbose = cfg.verbose + + try: + return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, + verbose) + except NotThisMethod: + pass + + try: + root = os.path.realpath(__file__) + # versionfile_source is the relative path from the top of the source + # tree (where the .git directory might live) to this file. Invert + # this to find the root from __file__. + for i in cfg.versionfile_source.split('/'): + root = os.path.dirname(root) + except NameError: + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to find root of source tree", + "date": None} + + try: + pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) + return render(pieces, cfg.style) + except NotThisMethod: + pass + + try: + if cfg.parentdir_prefix: + return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) + except NotThisMethod: + pass + + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to compute version", "date": None} +''' + + +@register_vcs_handler("git", "get_keywords") +def git_get_keywords(versionfile_abs): + """Extract version information from the given file.""" + # the code embedded in _version.py can just fetch the value of these + # keywords. When used from setup.py, we don't want to import _version.py, + # so we do it with a regexp instead. This function is not used from + # _version.py. + keywords = {} + try: + f = open(versionfile_abs, "r") + for line in f.readlines(): + if line.strip().startswith("git_refnames ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["refnames"] = mo.group(1) + if line.strip().startswith("git_full ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["full"] = mo.group(1) + if line.strip().startswith("git_date ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["date"] = mo.group(1) + f.close() + except EnvironmentError: + pass + return keywords + + +@register_vcs_handler("git", "keywords") +def git_versions_from_keywords(keywords, tag_prefix, verbose): + """Get version information from git keywords.""" + if not keywords: + raise NotThisMethod("no keywords at all, weird") + date = keywords.get("date") + if date is not None: + # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant + # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 + # -like" string, which we must then edit to make compliant), because + # it's been around since git-1.5.3, and it's too difficult to + # discover which version we're using, or to work around using an + # older one. + date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + refnames = keywords["refnames"].strip() + if refnames.startswith("$Format"): + if verbose: + print("keywords are unexpanded, not using") + raise NotThisMethod("unexpanded keywords, not a git-archive tarball") + refs = set([r.strip() for r in refnames.strip("()").split(",")]) + # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of + # just "foo-1.0". If we see a "tag: " prefix, prefer those. + TAG = "tag: " + tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) + if not tags: + # Either we're using git < 1.8.3, or there really are no tags. We use + # a heuristic: assume all version tags have a digit. The old git %d + # expansion behaves like git log --decorate=short and strips out the + # refs/heads/ and refs/tags/ prefixes that would let us distinguish + # between branches and tags. By ignoring refnames without digits, we + # filter out many common branch names like "release" and + # "stabilization", as well as "HEAD" and "master". + tags = set([r for r in refs if re.search(r'\d', r)]) + if verbose: + print("discarding '%s', no digits" % ",".join(refs - tags)) + if verbose: + print("likely tags: %s" % ",".join(sorted(tags))) + for ref in sorted(tags): + # sorting will prefer e.g. "2.0" over "2.0rc1" + if ref.startswith(tag_prefix): + r = ref[len(tag_prefix):] + if verbose: + print("picking %s" % r) + return {"version": r, + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": None, + "date": date} + # no suitable tags, so version is "0+unknown", but full hex is still there + if verbose: + print("no suitable tags, using unknown + full revision id") + return {"version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": "no suitable tags", "date": None} + + +@register_vcs_handler("git", "pieces_from_vcs") +def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): + """Get version from 'git describe' in the root of the source tree. + + This only gets called if the git-archive 'subst' keywords were *not* + expanded, and _version.py hasn't already been rewritten with a short + version string, meaning we're inside a checked out source tree. + """ + GITS = ["git"] + if sys.platform == "win32": + GITS = ["git.cmd", "git.exe"] + + out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, + hide_stderr=True) + if rc != 0: + if verbose: + print("Directory %s not under git control" % root) + raise NotThisMethod("'git rev-parse --git-dir' returned error") + + # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] + # if there isn't one, this yields HEX[-dirty] (no NUM) + describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", + "--always", "--long", + "--match", "%s*" % tag_prefix], + cwd=root) + # --long was added in git-1.5.5 + if describe_out is None: + raise NotThisMethod("'git describe' failed") + describe_out = describe_out.strip() + full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) + if full_out is None: + raise NotThisMethod("'git rev-parse' failed") + full_out = full_out.strip() + + pieces = {} + pieces["long"] = full_out + pieces["short"] = full_out[:7] # maybe improved later + pieces["error"] = None + + # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] + # TAG might have hyphens. + git_describe = describe_out + + # look for -dirty suffix + dirty = git_describe.endswith("-dirty") + pieces["dirty"] = dirty + if dirty: + git_describe = git_describe[:git_describe.rindex("-dirty")] + + # now we have TAG-NUM-gHEX or HEX + + if "-" in git_describe: + # TAG-NUM-gHEX + mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) + if not mo: + # unparseable. Maybe git-describe is misbehaving? + pieces["error"] = ("unable to parse git-describe output: '%s'" + % describe_out) + return pieces + + # tag + full_tag = mo.group(1) + if not full_tag.startswith(tag_prefix): + if verbose: + fmt = "tag '%s' doesn't start with prefix '%s'" + print(fmt % (full_tag, tag_prefix)) + pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" + % (full_tag, tag_prefix)) + return pieces + pieces["closest-tag"] = full_tag[len(tag_prefix):] + + # distance: number of commits since tag + pieces["distance"] = int(mo.group(2)) + + # commit: short hex revision ID + pieces["short"] = mo.group(3) + + else: + # HEX: no tags + pieces["closest-tag"] = None + count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], + cwd=root) + pieces["distance"] = int(count_out) # total number of commits + + # commit date: see ISO-8601 comment in git_versions_from_keywords() + date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], + cwd=root)[0].strip() + pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + + return pieces + + +def do_vcs_install(manifest_in, versionfile_source, ipy): + """Git-specific installation logic for Versioneer. + + For Git, this means creating/changing .gitattributes to mark _version.py + for export-subst keyword substitution. + """ + GITS = ["git"] + if sys.platform == "win32": + GITS = ["git.cmd", "git.exe"] + files = [manifest_in, versionfile_source] + if ipy: + files.append(ipy) + try: + me = __file__ + if me.endswith(".pyc") or me.endswith(".pyo"): + me = os.path.splitext(me)[0] + ".py" + versioneer_file = os.path.relpath(me) + except NameError: + versioneer_file = "versioneer.py" + files.append(versioneer_file) + present = False + try: + f = open(".gitattributes", "r") + for line in f.readlines(): + if line.strip().startswith(versionfile_source): + if "export-subst" in line.strip().split()[1:]: + present = True + f.close() + except EnvironmentError: + pass + if not present: + f = open(".gitattributes", "a+") + f.write("%s export-subst\n" % versionfile_source) + f.close() + files.append(".gitattributes") + run_command(GITS, ["add", "--"] + files) + + +def versions_from_parentdir(parentdir_prefix, root, verbose): + """Try to determine the version from the parent directory name. + + Source tarballs conventionally unpack into a directory that includes both + the project name and a version string. We will also support searching up + two directory levels for an appropriately named parent directory + """ + rootdirs = [] + + for i in range(3): + dirname = os.path.basename(root) + if dirname.startswith(parentdir_prefix): + return {"version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, "error": None, "date": None} + else: + rootdirs.append(root) + root = os.path.dirname(root) # up a level + + if verbose: + print("Tried directories %s but none started with prefix %s" % + (str(rootdirs), parentdir_prefix)) + raise NotThisMethod("rootdir doesn't start with parentdir_prefix") + +SHORT_VERSION_PY = """ +# This file was generated by 'versioneer.py' (0.17) from +# revision-control system data, or from the parent directory name of an +# unpacked source archive. Distribution tarballs contain a pre-generated copy +# of this file. + +import json + +version_json = ''' +%s +''' # END VERSION_JSON + + +def get_versions(): + return json.loads(version_json) +""" + + +def versions_from_file(filename): + """Try to determine the version from _version.py if present.""" + try: + with open(filename) as f: + contents = f.read() + except EnvironmentError: + raise NotThisMethod("unable to read _version.py") + mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON", + contents, re.M | re.S) + if not mo: + mo = re.search(r"version_json = '''\r\n(.*)''' # END VERSION_JSON", + contents, re.M | re.S) + if not mo: + raise NotThisMethod("no version_json in _version.py") + return json.loads(mo.group(1)) + + +def write_to_version_file(filename, versions): + """Write the given version number to the given _version.py file.""" + os.unlink(filename) + contents = json.dumps(versions, sort_keys=True, + indent=1, separators=(",", ": ")) + with open(filename, "w") as f: + f.write(SHORT_VERSION_PY % contents) + + print("set %s to '%s'" % (filename, versions["version"])) + + +def plus_or_dot(pieces): + """Return a + if we don't already have one, else return a .""" + if "+" in pieces.get("closest-tag", ""): + return "." + return "+" + + +def render_pep440(pieces): + """Build up version string, with post-release "local version identifier". + + Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you + get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty + + Exceptions: + 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += plus_or_dot(pieces) + rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0+untagged.%d.g%s" % (pieces["distance"], + pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def render_pep440_pre(pieces): + """TAG[.post.devDISTANCE] -- No -dirty. + + Exceptions: + 1: no tags. 0.post.devDISTANCE + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += ".post.dev%d" % pieces["distance"] + else: + # exception #1 + rendered = "0.post.dev%d" % pieces["distance"] + return rendered + + +def render_pep440_post(pieces): + """TAG[.postDISTANCE[.dev0]+gHEX] . + + The ".dev0" means dirty. Note that .dev0 sorts backwards + (a dirty tree will appear "older" than the corresponding clean one), + but you shouldn't be releasing software with -dirty anyways. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "g%s" % pieces["short"] + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += "+g%s" % pieces["short"] + return rendered + + +def render_pep440_old(pieces): + """TAG[.postDISTANCE[.dev0]] . + + The ".dev0" means dirty. + + Eexceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + return rendered + + +def render_git_describe(pieces): + """TAG[-DISTANCE-gHEX][-dirty]. + + Like 'git describe --tags --dirty --always'. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render_git_describe_long(pieces): + """TAG-DISTANCE-gHEX[-dirty]. + + Like 'git describe --tags --dirty --always -long'. + The distance/hash is unconditional. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render(pieces, style): + """Render the given version pieces into the requested style.""" + if pieces["error"]: + return {"version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None} + + if not style or style == "default": + style = "pep440" # the default + + if style == "pep440": + rendered = render_pep440(pieces) + elif style == "pep440-pre": + rendered = render_pep440_pre(pieces) + elif style == "pep440-post": + rendered = render_pep440_post(pieces) + elif style == "pep440-old": + rendered = render_pep440_old(pieces) + elif style == "git-describe": + rendered = render_git_describe(pieces) + elif style == "git-describe-long": + rendered = render_git_describe_long(pieces) + else: + raise ValueError("unknown style '%s'" % style) + + return {"version": rendered, "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], "error": None, + "date": pieces.get("date")} + + +class VersioneerBadRootError(Exception): + """The project root directory is unknown or missing key files.""" + + +def get_versions(verbose=False): + """Get the project version from whatever source is available. + + Returns dict with two keys: 'version' and 'full'. + """ + if "versioneer" in sys.modules: + # see the discussion in cmdclass.py:get_cmdclass() + del sys.modules["versioneer"] + + root = get_root() + cfg = get_config_from_root(root) + + assert cfg.VCS is not None, "please set [versioneer]VCS= in setup.cfg" + handlers = HANDLERS.get(cfg.VCS) + assert handlers, "unrecognized VCS '%s'" % cfg.VCS + verbose = verbose or cfg.verbose + assert cfg.versionfile_source is not None, \ + "please set versioneer.versionfile_source" + assert cfg.tag_prefix is not None, "please set versioneer.tag_prefix" + + versionfile_abs = os.path.join(root, cfg.versionfile_source) + + # extract version from first of: _version.py, VCS command (e.g. 'git + # describe'), parentdir. This is meant to work for developers using a + # source checkout, for users of a tarball created by 'setup.py sdist', + # and for users of a tarball/zipball created by 'git archive' or github's + # download-from-tag feature or the equivalent in other VCSes. + + get_keywords_f = handlers.get("get_keywords") + from_keywords_f = handlers.get("keywords") + if get_keywords_f and from_keywords_f: + try: + keywords = get_keywords_f(versionfile_abs) + ver = from_keywords_f(keywords, cfg.tag_prefix, verbose) + if verbose: + print("got version from expanded keyword %s" % ver) + return ver + except NotThisMethod: + pass + + try: + ver = versions_from_file(versionfile_abs) + if verbose: + print("got version from file %s %s" % (versionfile_abs, ver)) + return ver + except NotThisMethod: + pass + + from_vcs_f = handlers.get("pieces_from_vcs") + if from_vcs_f: + try: + pieces = from_vcs_f(cfg.tag_prefix, root, verbose) + ver = render(pieces, cfg.style) + if verbose: + print("got version from VCS %s" % ver) + return ver + except NotThisMethod: + pass + + try: + if cfg.parentdir_prefix: + ver = versions_from_parentdir(cfg.parentdir_prefix, root, verbose) + if verbose: + print("got version from parentdir %s" % ver) + return ver + except NotThisMethod: + pass + + if verbose: + print("unable to compute version") + + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, "error": "unable to compute version", + "date": None} + + +def get_version(): + """Get the short version string for this project.""" + return get_versions()["version"] + + +def get_cmdclass(): + """Get the custom setuptools/distutils subclasses used by Versioneer.""" + if "versioneer" in sys.modules: + del sys.modules["versioneer"] + # this fixes the "python setup.py develop" case (also 'install' and + # 'easy_install .'), in which subdependencies of the main project are + # built (using setup.py bdist_egg) in the same python process. Assume + # a main project A and a dependency B, which use different versions + # of Versioneer. A's setup.py imports A's Versioneer, leaving it in + # sys.modules by the time B's setup.py is executed, causing B to run + # with the wrong versioneer. Setuptools wraps the sub-dep builds in a + # sandbox that restores sys.modules to it's pre-build state, so the + # parent is protected against the child's "import versioneer". By + # removing ourselves from sys.modules here, before the child build + # happens, we protect the child from the parent's versioneer too. + # Also see https://github.com/warner/python-versioneer/issues/52 + + cmds = {} + + # we add "version" to both distutils and setuptools + from distutils.core import Command + + class cmd_version(Command): + description = "report generated version string" + user_options = [] + boolean_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + vers = get_versions(verbose=True) + print("Version: %s" % vers["version"]) + print(" full-revisionid: %s" % vers.get("full-revisionid")) + print(" dirty: %s" % vers.get("dirty")) + print(" date: %s" % vers.get("date")) + if vers["error"]: + print(" error: %s" % vers["error"]) + cmds["version"] = cmd_version + + # we override "build_py" in both distutils and setuptools + # + # most invocation pathways end up running build_py: + # distutils/build -> build_py + # distutils/install -> distutils/build ->.. + # setuptools/bdist_wheel -> distutils/install ->.. + # setuptools/bdist_egg -> distutils/install_lib -> build_py + # setuptools/install -> bdist_egg ->.. + # setuptools/develop -> ? + # pip install: + # copies source tree to a tempdir before running egg_info/etc + # if .git isn't copied too, 'git describe' will fail + # then does setup.py bdist_wheel, or sometimes setup.py install + # setup.py egg_info -> ? + + # we override different "build_py" commands for both environments + if "setuptools" in sys.modules: + from setuptools.command.build_py import build_py as _build_py + else: + from distutils.command.build_py import build_py as _build_py + + class cmd_build_py(_build_py): + def run(self): + root = get_root() + cfg = get_config_from_root(root) + versions = get_versions() + _build_py.run(self) + # now locate _version.py in the new build/ directory and replace + # it with an updated value + if cfg.versionfile_build: + target_versionfile = os.path.join(self.build_lib, + cfg.versionfile_build) + print("UPDATING %s" % target_versionfile) + write_to_version_file(target_versionfile, versions) + cmds["build_py"] = cmd_build_py + + if "cx_Freeze" in sys.modules: # cx_freeze enabled? + from cx_Freeze.dist import build_exe as _build_exe + # nczeczulin reports that py2exe won't like the pep440-style string + # as FILEVERSION, but it can be used for PRODUCTVERSION, e.g. + # setup(console=[{ + # "version": versioneer.get_version().split("+", 1)[0], # FILEVERSION + # "product_version": versioneer.get_version(), + # ... + + class cmd_build_exe(_build_exe): + def run(self): + root = get_root() + cfg = get_config_from_root(root) + versions = get_versions() + target_versionfile = cfg.versionfile_source + print("UPDATING %s" % target_versionfile) + write_to_version_file(target_versionfile, versions) + + _build_exe.run(self) + os.unlink(target_versionfile) + with open(cfg.versionfile_source, "w") as f: + LONG = LONG_VERSION_PY[cfg.VCS] + f.write(LONG % + {"DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + cmds["build_exe"] = cmd_build_exe + del cmds["build_py"] + + if 'py2exe' in sys.modules: # py2exe enabled? + try: + from py2exe.distutils_buildexe import py2exe as _py2exe # py3 + except ImportError: + from py2exe.build_exe import py2exe as _py2exe # py2 + + class cmd_py2exe(_py2exe): + def run(self): + root = get_root() + cfg = get_config_from_root(root) + versions = get_versions() + target_versionfile = cfg.versionfile_source + print("UPDATING %s" % target_versionfile) + write_to_version_file(target_versionfile, versions) + + _py2exe.run(self) + os.unlink(target_versionfile) + with open(cfg.versionfile_source, "w") as f: + LONG = LONG_VERSION_PY[cfg.VCS] + f.write(LONG % + {"DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + cmds["py2exe"] = cmd_py2exe + + # we override different "sdist" commands for both environments + if "setuptools" in sys.modules: + from setuptools.command.sdist import sdist as _sdist + else: + from distutils.command.sdist import sdist as _sdist + + class cmd_sdist(_sdist): + def run(self): + versions = get_versions() + self._versioneer_generated_versions = versions + # unless we update this, the command will keep using the old + # version + self.distribution.metadata.version = versions["version"] + return _sdist.run(self) + + def make_release_tree(self, base_dir, files): + root = get_root() + cfg = get_config_from_root(root) + _sdist.make_release_tree(self, base_dir, files) + # now locate _version.py in the new base_dir directory + # (remembering that it may be a hardlink) and replace it with an + # updated value + target_versionfile = os.path.join(base_dir, cfg.versionfile_source) + print("UPDATING %s" % target_versionfile) + write_to_version_file(target_versionfile, + self._versioneer_generated_versions) + cmds["sdist"] = cmd_sdist + + return cmds + + +CONFIG_ERROR = """ +setup.cfg is missing the necessary Versioneer configuration. You need +a section like: + + [versioneer] + VCS = git + style = pep440 + versionfile_source = src/myproject/_version.py + versionfile_build = myproject/_version.py + tag_prefix = + parentdir_prefix = myproject- + +You will also need to edit your setup.py to use the results: + + import versioneer + setup(version=versioneer.get_version(), + cmdclass=versioneer.get_cmdclass(), ...) + +Please read the docstring in ./versioneer.py for configuration instructions, +edit setup.cfg, and re-run the installer or 'python versioneer.py setup'. +""" + +SAMPLE_CONFIG = """ +# See the docstring in versioneer.py for instructions. Note that you must +# re-run 'versioneer.py setup' after changing this section, and commit the +# resulting files. + +[versioneer] +#VCS = git +#style = pep440 +#versionfile_source = +#versionfile_build = +#tag_prefix = +#parentdir_prefix = + +""" + +INIT_PY_SNIPPET = """ +from ._version import get_versions +__version__ = get_versions()['version'] +del get_versions +""" + + +def do_setup(): + """Main VCS-independent setup function for installing Versioneer.""" + root = get_root() + try: + cfg = get_config_from_root(root) + except (EnvironmentError, configparser.NoSectionError, + configparser.NoOptionError) as e: + if isinstance(e, (EnvironmentError, configparser.NoSectionError)): + print("Adding sample versioneer config to setup.cfg", + file=sys.stderr) + with open(os.path.join(root, "setup.cfg"), "a") as f: + f.write(SAMPLE_CONFIG) + print(CONFIG_ERROR, file=sys.stderr) + return 1 + + print(" creating %s" % cfg.versionfile_source) + with open(cfg.versionfile_source, "w") as f: + LONG = LONG_VERSION_PY[cfg.VCS] + f.write(LONG % {"DOLLAR": "$", + "STYLE": cfg.style, + "TAG_PREFIX": cfg.tag_prefix, + "PARENTDIR_PREFIX": cfg.parentdir_prefix, + "VERSIONFILE_SOURCE": cfg.versionfile_source, + }) + + ipy = os.path.join(os.path.dirname(cfg.versionfile_source), + "__init__.py") + if os.path.exists(ipy): + try: + with open(ipy, "r") as f: + old = f.read() + except EnvironmentError: + old = "" + if INIT_PY_SNIPPET not in old: + print(" appending to %s" % ipy) + with open(ipy, "a") as f: + f.write(INIT_PY_SNIPPET) + else: + print(" %s unmodified" % ipy) + else: + print(" %s doesn't exist, ok" % ipy) + ipy = None + + # Make sure both the top-level "versioneer.py" and versionfile_source + # (PKG/_version.py, used by runtime code) are in MANIFEST.in, so + # they'll be copied into source distributions. Pip won't be able to + # install the package without this. + manifest_in = os.path.join(root, "MANIFEST.in") + simple_includes = set() + try: + with open(manifest_in, "r") as f: + for line in f: + if line.startswith("include "): + for include in line.split()[1:]: + simple_includes.add(include) + except EnvironmentError: + pass + # That doesn't cover everything MANIFEST.in can do + # (http://docs.python.org/2/distutils/sourcedist.html#commands), so + # it might give some false negatives. Appending redundant 'include' + # lines is safe, though. + if "versioneer.py" not in simple_includes: + print(" appending 'versioneer.py' to MANIFEST.in") + with open(manifest_in, "a") as f: + f.write("include versioneer.py\n") + else: + print(" 'versioneer.py' already in MANIFEST.in") + if cfg.versionfile_source not in simple_includes: + print(" appending versionfile_source ('%s') to MANIFEST.in" % + cfg.versionfile_source) + with open(manifest_in, "a") as f: + f.write("include %s\n" % cfg.versionfile_source) + else: + print(" versionfile_source already in MANIFEST.in") + + # Make VCS-specific changes. For git, this means creating/changing + # .gitattributes to mark _version.py for export-subst keyword + # substitution. + do_vcs_install(manifest_in, cfg.versionfile_source, ipy) + return 0 + + +def scan_setup_py(): + """Validate the contents of setup.py against Versioneer's expectations.""" + found = set() + setters = False + errors = 0 + with open("setup.py", "r") as f: + for line in f.readlines(): + if "import versioneer" in line: + found.add("import") + if "versioneer.get_cmdclass()" in line: + found.add("cmdclass") + if "versioneer.get_version()" in line: + found.add("get_version") + if "versioneer.VCS" in line: + setters = True + if "versioneer.versionfile_source" in line: + setters = True + if len(found) != 3: + print("") + print("Your setup.py appears to be missing some important items") + print("(but I might be wrong). Please make sure it has something") + print("roughly like the following:") + print("") + print(" import versioneer") + print(" setup( version=versioneer.get_version(),") + print(" cmdclass=versioneer.get_cmdclass(), ...)") + print("") + errors += 1 + if setters: + print("You should remove lines like 'versioneer.VCS = ' and") + print("'versioneer.versionfile_source = ' . This configuration") + print("now lives in setup.cfg, and should be removed from setup.py") + print("") + errors += 1 + return errors + +if __name__ == "__main__": + cmd = sys.argv[1] + if cmd == "setup": + errors = do_setup() + errors += scan_setup_py() + if errors: + sys.exit(1) diff --git a/from linkable_ring_signature import ring_signature b/from linkable_ring_signature import ring_signature new file mode 100644 index 0000000..04df51e --- /dev/null +++ b/from linkable_ring_signature import ring_signature @@ -0,0 +1,16 @@ +from linkable_ring_signature import ring_signature, verify_ring_signature + +from ecdsa.util import randrange +from ecdsa.curves import SECP256k1 + +number_participants = 10 + +x = [ randrange(SECP256k1.order) for i in range(number_participants)] +y = list(map(lambda xi: SECP256k1.generator * xi, x)) + +message = "Every move we made was a kiss" + +i = 2 +signature = ring_signature(x[i], i, message, y) + +assert(verify_ring_signature(message, y, *signature)) \ No newline at end of file diff --git a/hexing.py b/hexing.py new file mode 100644 index 0000000..c241458 --- /dev/null +++ b/hexing.py @@ -0,0 +1,5 @@ +s = [[17894092106562848435067292938716040659248437122849612945085075795729969040294, 53142642945145057284681326701050926936378111872480479105918120588587450943875]] +hexs = [] +for i in s: + hexs.append([hex(i[0]),hex(i[1])]) +print(hexs) diff --git a/linkable_ring_signature.py b/linkable_ring_signature.py new file mode 100755 index 0000000..a8fcee3 --- /dev/null +++ b/linkable_ring_signature.py @@ -0,0 +1,367 @@ +#! /usr/bin/env python +# +# Provide an implementation of Linkable Spontaneus Anonymous Group Signature +# over elliptic curve cryptography. +# +# Implementation of cryptographic scheme from: https://eprint.iacr.org/2004/027.pdf +# +# +# Written in 2017 by Fernanddo Lobato Meeser and placed in the public domain. + +import os +import hashlib +import functools +import ecdsa + +from ecdsa.util import randrange +from ecdsa.ecdsa import curve_secp256k1 +from ecdsa.curves import SECP256k1 +from ecdsa import numbertheory +from eth_abi.packed import encode_single_packed, encode_abi_packed + + +def ring_signature(siging_key, key_idx, M, y, G=SECP256k1.generator, hash_func=hashlib.sha3_256): + """ + Generates a ring signature for a message given a specific set of + public keys and a signing key belonging to one of the public keys + in the set. + + PARAMS + ------ + + signing_key: (int) The with which the message is to be anonymously signed. + + key_idx: (int) The index of the public key corresponding to the signature + private key over the list of public keys that compromise the signature. + + M: (str) Message to be signed. + + y: (list) The list of public keys which over which the anonymous signature + will be compose. + + G: (ecdsa.ellipticcurve.Point) Base point for the elliptic curve. + + hash_func: (function) Cryptographic hash function that recieves an input + and outputs a digest. + + RETURNS + ------- + + Signature (c_0, s, Y) : + c_0: Initial value to reconstruct signature. + s = vector of randomly generated values with encrypted secret to + reconstruct signature. + Y = Link for current signer. + + """ + n = len(y) + c = [0] * n + s = [0] * n + + # STEP 1 + H = H2(y, hash_func=hash_func) + Y = H * siging_key + + # STEP 2 + u = randrange(SECP256k1.order) + c[(key_idx + 1) % n] = H1([y, Y, M, G * u, H * u], hash_func=hash_func) + + # STEP 3 + for i in [ i for i in range(key_idx + 1, n) ] + [i for i in range(key_idx)]: + + s[i] = randrange(SECP256k1.order) + + z_1 = (G * s[i]) + (y[i] * c[i]) + z_2 = (H * s[i]) + (Y * c[i]) + + c[(i + 1) % n] = H1([y, Y, M, z_1, z_2], hash_func=hash_func) + + # STEP 4 + s[key_idx] = (u - siging_key * c[key_idx]) % SECP256k1.order + return (c[0], s, Y) + + +def verify_ring_signature(message, y, c_0, s, Y, G=SECP256k1.generator, hash_func=hashlib.sha3_256): + """ + Verifies if a valid signature was made by a key inside a set of keys. + + + PARAMS + ------ + message: (str) message whos' signature is being verified. + + y: (list) set of public keys with which the message was signed. + + Signature: + c_0: (int) initial value to reconstruct the ring. + + s: (list) vector of secrets used to create ring. + + Y = (int) Link of unique signer. + + G: (ecdsa.ellipticcurve.Point) Base point for the elliptic curve. + + hash_func: (function) Cryptographic hash function that recieves an input + and outputs a digest. + + RETURNS + ------- + Boolean value indicating if signature is valid. + + """ + n = len(y) + c = [c_0] + [0] * (n - 1) + + H = H2(y, hash_func=hash_func) + + for i in range(n): + z_1 = (G * s[i]) + (y[i] * c[i]) + print (type(z_1).x) + print (z_1) + z_2 = (H * s[i]) + (Y * c[i]) + + if i < n - 1: + c[i + 1] = H1([y, Y, message, z_1, z_2], hash_func=hash_func) + else: + return c_0 == H1([y, Y, message, z_1, z_2], hash_func=hash_func) + + return False + + +def map_to_curve(x, P=curve_secp256k1.p()): + """ + Maps an integer to an elliptic curve. + + Using the try and increment algorithm, not quite + as efficient as I would like, but c'est la vie. + + PARAMS + ------ + x: (int) number to be mapped into E. + + P: (ecdsa.curves.curve_secp256k1.p) Modulo for elliptic curve. + + RETURNS + ------- + (ecdsa.ellipticcurve.Point) Point in Curve + """ + x -= 1 + y = 0 + found = False + + while not found: + x += 1 + f_x = (x * x * x + 7) % P + + try: + y = numbertheory.square_root_mod_prime(f_x, P) + found = True + except Exception as e: + pass + + return ecdsa.ellipticcurve.Point(curve_secp256k1, x, y) + + +def H1(msg, hash_func=hashlib.sha3_256): + """ + Return an integer representation of the hash of a message. The + message can be a list of messages that are concatenated with the + concat() function. + + PARAMS + ------ + msg: (str or list) message(s) to be hashed. + + hash_func: (function) a hash function which can recieve an input + string and return a hexadecimal digest. + + RETURNS + ------- + Integer representation of hexadecimal digest from hash function. + """ + return int('0x'+ hash_func(concat(msg)).hexdigest(), 16) + + +def H2(msg, hash_func=hashlib.sha3_256): + """ + Hashes a message into an elliptic curve point. + + PARAMS + ------ + msg: (str or list) message(s) to be hashed. + + hash_func: (function) Cryptographic hash function that recieves an input + and outputs a digest. + RETURNS + ------- + ecdsa.ellipticcurve.Point to curve. + """ + return map_to_curve(H1(msg, hash_func=hash_func)) + +def H1_improv(y, Y, message, z_1, z_2, hash_func=hashlib.sha3_256): + + return int('0x'+ hash_func(concat2(y, Y, message, z_1, z_2)).hexdigest(), 16) + +def concat2(y, Y, message, z_1, z_2): + + return encode_abi_packed(['int256[2][]', 'uint256[2]', 'bytes32', 'uint256[2]', 'uint256[2]'], (y, Y, message, z_1, z_2)) + + +def concat(params): + """ + Concatenates a list of parameters into a bytes. If one + of the parameters is a list, calls itself recursively. + + PARAMS + ------ + params: (list) list of elements, must be of type: + - int + - list + - str + - ecdsa.ellipticcurve.Point + + RETURNS + ------- + concatenated bytes of all values. + """ + n = len(params) + bytes_value = [0] * n + + for i in range(n): + + if type(params[i]) is int: + bytes_value[i] = params[i].to_bytes(32, 'big') + # print (bytes_value[i]) + if type(params[i]) is list: + bytes_value[i] = concat(params[i]) + # print (bytes_value[i]) + if type(params[i]) is ecdsa.ellipticcurve.Point: + bytes_value[i] = params[i].x().to_bytes(32, 'big') + params[i].y().to_bytes(32, 'big') + if type(params[i]) is str: + bytes_value[i] = params[i].encode() + # print (bytes_value[i]) + if bytes_value[i] == 0: + bytes_value[i] = params[i].x().to_bytes(32, 'big') + params[i].y().to_bytes(32, 'big') + + # print (bytes_value) + return functools.reduce(lambda x, y: x + y, bytes_value) + + +def stringify_point(p): + """ + Represents an elliptic curve point as a string coordinate. + + PARAMS + ------ + p: ecdsa.ellipticcurve.Point - Point to represent as string. + + RETURNS + ------- + (str) Representation of a point (x, y) + """ + return '{},{}'.format(p.x(), p.y()) + + +def stringify_point_js(p): + """ + Represents an elliptic curve point as a string coordinate, the + string format is javascript so other javascript scripts can + consume this. + + PARAMS + ------ + p: ecdsa.ellipticcurve.Point - Point to represent as string. + + RETURNS + ------- + (str) Javascript string representation of a point (x, y) + """ + return 'new BigNumber("{}"), new BigNumber("{}")'.format(p.x(), p.y()) + + +def export_signature(y, message, signature, foler_name='./data', file_name='signature.txt'): + """ Exports a signature to a specific folder and filename provided. + + The file contains the signature, the ring used to generate signature + and the message being signed. + """ + if not os.path.exists(foler_name): + os.makedirs(foler_name) + + arch = open(os.path.join(foler_name, file_name), 'w') + S = ''.join(map(lambda x: str(x) + ',', signature[1]))[:-1] + Y = stringify_point(signature[2]) + + dump = '{}\n'.format(signature[0]) + dump += '{}\n'.format(S) + dump += '{}\n'.format(Y) + + arch.write(dump) + + pub_keys = ''.join(map(lambda yi: stringify_point(yi) + ';', y))[:-1] + data = '{}\n'.format(''.join([ '{},'.format(m) for m in message])[:-1]) + data += '{}\n,'.format(pub_keys)[:-1] + + arch.write(data) + arch.close() + + +def export_private_keys(s_keys, foler_name='./data', file_name='secrets.txt'): + """ Exports a set of private keys to a file. + + Each line in the file is one key. + """ + if not os.path.exists(foler_name): + os.makedirs(foler_name) + + arch = open(os.path.join(foler_name, file_name), 'w') + + for key in s_keys: + arch.write('{}\n'.format(key)) + + arch.close() + + +def export_signature_javascript(y, message, signature, foler_name='./data', file_name='signature.js'): + """ Exports a signatrue in javascript format to a file and folder. + """ + if not os.path.exists(foler_name): + os.makedirs(foler_name) + + arch = open(os.path.join(foler_name, file_name), 'w') + + S = ''.join(map(lambda x: 'new BigNumber("' + str(x) + '"),', signature[1]))[:-1] + Y = stringify_point_js(signature[2]) + + dump = 'var c_0 = new BigNumber("{}");\n'.format(signature[0]) + dump += 'var s = [{}];\n'.format(S) + dump += 'var Y = [{}];\n'.format(Y) + + arch.write(dump) + + pub_keys = ''.join(map(lambda yi: stringify_point_js(yi) + ',', y))[:-1] + + data = 'var message = [{}];\n'.format(''.join([ 'new BigNumber("{}"),'.format(m) for m in message])[:-1]) + data += 'var pub_keys = [{}];'.format(pub_keys) + + arch.write(data + '\n') + arch.close() + + +def main(): + number_participants = 10 + + x = [ randrange(SECP256k1.order) for i in range(number_participants)] + y = list(map(lambda xi: SECP256k1.generator * xi, x)) + + message = 1 + i = 2 + signature = ring_signature(x[i], i, message, y) + + print (y) + print (signature) + + assert(verify_ring_signature(message, y, *signature)) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/migrations/1_initial_migration.js b/migrations/1_initial_migration.js new file mode 100644 index 0000000..ee2135d --- /dev/null +++ b/migrations/1_initial_migration.js @@ -0,0 +1,5 @@ +const Migrations = artifacts.require("Migrations"); + +module.exports = function(deployer) { + deployer.deploy(Migrations); +}; diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js new file mode 100644 index 0000000..9349abd --- /dev/null +++ b/migrations/2_deploy_contracts.js @@ -0,0 +1,19 @@ +const EVoting = artifacts.require("EVoting"); +const AltBn128 = artifacts.require("AltBn128"); +const LSAG = artifacts.require("LSAG"); +const EllipticCurve = artifacts.require("EllipticCurve"); +const secp256k1 = artifacts.require("secp256k1"); + +module.exports = function(deployer) { + + deployer.deploy(AltBn128); + deployer.deploy(EllipticCurve); + deployer.link(AltBn128, LSAG); + deployer.link(EllipticCurve, secp256k1); + deployer.deploy(secp256k1); + deployer.link(secp256k1, LSAG); + deployer.deploy(LSAG); + deployer.link(LSAG, EVoting); + var pub_keys = [[76860218087793983084535703376981386467447611172084071853258931251531655143810,31412445800597707204000296306981535369487689728022294203473644188534598278433],[38383509265263568403091993992632738089196255623116815243548433385026133154873,6177458042690818063654998812321100640246417077410401798821997202074455067658],[109494974759407544115980221650269989415835863198723097195991870480545591748694,88373887815570028484318636992066972615473624433958557212898599653752288516553],[62024398634874066443962845630678733310841268459352721513836874076957014825693,17523914466505763903401497950553046259382636897003925910700830930167415374845],[63717588402740889593319833542751400718873158538928593038126726953424863531161,81834072601552631999151743416373775064561835219024365947336813467257575949287],[94488627319558170444192963521553866738182271320922938361822272954834163056706,75117489132020203438334222530089728350198927250708518444467009567047301998524],[72073121700845816532409909568957092975560328036852544806670390063697244167579,88008882899030566411419232439265353825316367124231879120604152247564011428118],[69302663261811420267463647311565591458354544084275858903094017435028909835870,76244600855121168108544883604098564729610790293645164381848998871531984754082],[21062411477782016300649284598637628528529199124745416083435916321565775381913,89400255616484687868490880757687246913068397762041460105517838105693640679676],[11324961394441086302516068549805884234494603864143349084821232258857030082588,47850239753691939370379379177679604685639311272023121432695464273305267682132]]; + deployer.deploy(EVoting/*10, 0x17458104Da8654E7C067e3410a65080D9dDB14F3, pub_keys, 10*/); +}; diff --git a/node_modules/assertion-error/History.md b/node_modules/assertion-error/History.md new file mode 100644 index 0000000..b240018 --- /dev/null +++ b/node_modules/assertion-error/History.md @@ -0,0 +1,24 @@ +1.1.0 / 2018-01-02 +================== + + * Add type definitions ([#11](https://github.com/chaijs/assertion-error/pull/11)) + +1.0.1 / 2015-03-04 +================== + + * Merge pull request #2 from simonzack/master + * fixes `.stack` on firefox + +1.0.0 / 2013-06-08 +================== + + * readme: change travis and component urls + * refactor: [*] prepare for move to chaijs gh org + +0.1.0 / 2013-04-07 +================== + + * test: use vanilla test runner/assert + * pgk: remove unused deps + * lib: implement + * "Initial commit" diff --git a/node_modules/assertion-error/README.md b/node_modules/assertion-error/README.md new file mode 100644 index 0000000..6cf03c8 --- /dev/null +++ b/node_modules/assertion-error/README.md @@ -0,0 +1,41 @@ +# AssertionError [![Build Status](https://travis-ci.org/chaijs/assertion-error.png?branch=master)](https://travis-ci.org/chaijs/assertion-error) + +> Error constructor for test and validation frameworks that implements standardized AssertionError specification. + +## Installation + +### Node.js + +`assertion-error` is available on [npm](http://npmjs.org). + + $ npm install assertion-error + +### Component + +`assertion-error` is available as a [component](https://github.com/component/component). + + $ component install chaijs/assertion-error + +## License + +(The MIT License) + +Copyright (c) 2013 Jake Luer (http://qualiancy.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/assertion-error/index.d.ts b/node_modules/assertion-error/index.d.ts new file mode 100644 index 0000000..2b9becd --- /dev/null +++ b/node_modules/assertion-error/index.d.ts @@ -0,0 +1,11 @@ +type AssertionError = Error & T & { + showDiff: boolean; +}; + +interface AssertionErrorConstructor { + new(message: string, props?: T, ssf?: Function): AssertionError; +} + +declare const AssertionError: AssertionErrorConstructor; + +export = AssertionError; diff --git a/node_modules/assertion-error/index.js b/node_modules/assertion-error/index.js new file mode 100644 index 0000000..8466da8 --- /dev/null +++ b/node_modules/assertion-error/index.js @@ -0,0 +1,116 @@ +/*! + * assertion-error + * Copyright(c) 2013 Jake Luer + * MIT Licensed + */ + +/*! + * Return a function that will copy properties from + * one object to another excluding any originally + * listed. Returned function will create a new `{}`. + * + * @param {String} excluded properties ... + * @return {Function} + */ + +function exclude () { + var excludes = [].slice.call(arguments); + + function excludeProps (res, obj) { + Object.keys(obj).forEach(function (key) { + if (!~excludes.indexOf(key)) res[key] = obj[key]; + }); + } + + return function extendExclude () { + var args = [].slice.call(arguments) + , i = 0 + , res = {}; + + for (; i < args.length; i++) { + excludeProps(res, args[i]); + } + + return res; + }; +}; + +/*! + * Primary Exports + */ + +module.exports = AssertionError; + +/** + * ### AssertionError + * + * An extension of the JavaScript `Error` constructor for + * assertion and validation scenarios. + * + * @param {String} message + * @param {Object} properties to include (optional) + * @param {callee} start stack function (optional) + */ + +function AssertionError (message, _props, ssf) { + var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON') + , props = extend(_props || {}); + + // default values + this.message = message || 'Unspecified AssertionError'; + this.showDiff = false; + + // copy from properties + for (var key in props) { + this[key] = props[key]; + } + + // capture stack trace + ssf = ssf || AssertionError; + if (Error.captureStackTrace) { + Error.captureStackTrace(this, ssf); + } else { + try { + throw new Error(); + } catch(e) { + this.stack = e.stack; + } + } +} + +/*! + * Inherit from Error.prototype + */ + +AssertionError.prototype = Object.create(Error.prototype); + +/*! + * Statically set name + */ + +AssertionError.prototype.name = 'AssertionError'; + +/*! + * Ensure correct constructor + */ + +AssertionError.prototype.constructor = AssertionError; + +/** + * Allow errors to be converted to JSON for static transfer. + * + * @param {Boolean} include stack (default: `true`) + * @return {Object} object that can be `JSON.stringify` + */ + +AssertionError.prototype.toJSON = function (stack) { + var extend = exclude('constructor', 'toJSON', 'stack') + , props = extend({ name: this.name }, this); + + // include stack if exists and not turned off + if (false !== stack && this.stack) { + props.stack = this.stack; + } + + return props; +}; diff --git a/node_modules/assertion-error/package.json b/node_modules/assertion-error/package.json new file mode 100644 index 0000000..efbffb3 --- /dev/null +++ b/node_modules/assertion-error/package.json @@ -0,0 +1,62 @@ +{ + "_from": "assertion-error@^1.1.0", + "_id": "assertion-error@1.1.0", + "_inBundle": false, + "_integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "_location": "/assertion-error", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "assertion-error@^1.1.0", + "name": "assertion-error", + "escapedName": "assertion-error", + "rawSpec": "^1.1.0", + "saveSpec": null, + "fetchSpec": "^1.1.0" + }, + "_requiredBy": [ + "/truffle-assertions" + ], + "_resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "_shasum": "e60b6b0e8f301bd97e5375215bda406c85118c0b", + "_spec": "assertion-error@^1.1.0", + "_where": "/Users/suchetaaa/Desktop/Anonymous-e-voting/node_modules/truffle-assertions", + "author": { + "name": "Jake Luer", + "email": "jake@qualiancy.com", + "url": "http://qualiancy.com" + }, + "bugs": { + "url": "https://github.com/chaijs/assertion-error/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "Error constructor for test and validation frameworks that implements standardized AssertionError specification.", + "devDependencies": { + "component": "*", + "typescript": "^2.6.1" + }, + "engines": { + "node": "*" + }, + "homepage": "https://github.com/chaijs/assertion-error#readme", + "keywords": [ + "test", + "assertion", + "assertion-error" + ], + "license": "MIT", + "main": "./index", + "name": "assertion-error", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/chaijs/assertion-error.git" + }, + "scripts": { + "test": "make test" + }, + "types": "./index.d.ts", + "version": "1.1.0" +} diff --git a/node_modules/lodash.isequal/LICENSE b/node_modules/lodash.isequal/LICENSE new file mode 100644 index 0000000..c6f2f61 --- /dev/null +++ b/node_modules/lodash.isequal/LICENSE @@ -0,0 +1,47 @@ +Copyright JS Foundation and other contributors + +Based on Underscore.js, copyright Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/node_modules/lodash.isequal/README.md b/node_modules/lodash.isequal/README.md new file mode 100644 index 0000000..7421565 --- /dev/null +++ b/node_modules/lodash.isequal/README.md @@ -0,0 +1,18 @@ +# lodash.isequal v4.5.0 + +The [Lodash](https://lodash.com/) method `_.isEqual` exported as a [Node.js](https://nodejs.org/) module. + +## Installation + +Using npm: +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash.isequal +``` + +In Node.js: +```js +var isEqual = require('lodash.isequal'); +``` + +See the [documentation](https://lodash.com/docs#isEqual) or [package source](https://github.com/lodash/lodash/blob/4.5.0-npm-packages/lodash.isequal) for more details. diff --git a/node_modules/lodash.isequal/index.js b/node_modules/lodash.isequal/index.js new file mode 100644 index 0000000..c249083 --- /dev/null +++ b/node_modules/lodash.isequal/index.js @@ -0,0 +1,1848 @@ +/** + * Lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright JS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ + +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; + +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; + +/** Used to compose bitmasks for value comparisons. */ +var COMPARE_PARTIAL_FLAG = 1, + COMPARE_UNORDERED_FLAG = 2; + +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; + +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + asyncTag = '[object AsyncFunction]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + mapTag = '[object Map]', + numberTag = '[object Number]', + nullTag = '[object Null]', + objectTag = '[object Object]', + promiseTag = '[object Promise]', + proxyTag = '[object Proxy]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]', + undefinedTag = '[object Undefined]', + weakMapTag = '[object WeakMap]'; + +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; + +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; + +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = +typedArrayTags[errorTag] = typedArrayTags[funcTag] = +typedArrayTags[mapTag] = typedArrayTags[numberTag] = +typedArrayTags[objectTag] = typedArrayTags[regexpTag] = +typedArrayTags[setTag] = typedArrayTags[stringTag] = +typedArrayTags[weakMapTag] = false; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** Detect free variable `exports`. */ +var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; + +/** Detect free variable `module`. */ +var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; + +/** Detect free variable `process` from Node.js. */ +var freeProcess = moduleExports && freeGlobal.process; + +/** Used to access faster Node.js helpers. */ +var nodeUtil = (function() { + try { + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} +}()); + +/* Node.js helper references. */ +var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + +/** + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ +function arrayFilter(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length, + resIndex = 0, + result = []; + + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result[resIndex++] = value; + } + } + return result; +} + +/** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ +function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; + + while (++index < length) { + array[offset + index] = values[index]; + } + return array; +} + +/** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ +function arraySome(array, predicate) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; +} + +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); + + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} + +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ +function baseUnary(func) { + return function(value) { + return func(value); + }; +} + +/** + * Checks if a `cache` value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function cacheHas(cache, key) { + return cache.has(key); +} + +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} + +/** + * Converts `map` to its key-value pairs. + * + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. + */ +function mapToArray(map) { + var index = -1, + result = Array(map.size); + + map.forEach(function(value, key) { + result[++index] = [key, value]; + }); + return result; +} + +/** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} + +/** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ +function setToArray(set) { + var index = -1, + result = Array(set.size); + + set.forEach(function(value) { + result[++index] = value; + }); + return result; +} + +/** Used for built-in method references. */ +var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); + +/** Built-in value references. */ +var Buffer = moduleExports ? root.Buffer : undefined, + Symbol = root.Symbol, + Uint8Array = root.Uint8Array, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + splice = arrayProto.splice, + symToStringTag = Symbol ? Symbol.toStringTag : undefined; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeGetSymbols = Object.getOwnPropertySymbols, + nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, + nativeKeys = overArg(Object.keys, Object); + +/* Built-in method references that are verified to be native. */ +var DataView = getNative(root, 'DataView'), + Map = getNative(root, 'Map'), + Promise = getNative(root, 'Promise'), + Set = getNative(root, 'Set'), + WeakMap = getNative(root, 'WeakMap'), + nativeCreate = getNative(Object, 'create'); + +/** Used to detect maps, sets, and weakmaps. */ +var dataViewCtorString = toSource(DataView), + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; + +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; +} + +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; +} + +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} + +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); +} + +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ +function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} + +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function ListCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; + this.size = 0; +} + +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + --this.size; + return true; +} + +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; +} + +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} + +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + ++this.size; + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; +} + +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function MapCache(entries) { + var index = -1, + length = entries == null ? 0 : entries.length; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} + +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ +function mapCacheClear() { + this.size = 0; + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; +} + +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function mapCacheDelete(key) { + var result = getMapData(this, key)['delete'](key); + this.size -= result ? 1 : 0; + return result; +} + +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function mapCacheGet(key) { + return getMapData(this, key).get(key); +} + +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function mapCacheHas(key) { + return getMapData(this, key).has(key); +} + +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ +function mapCacheSet(key, value) { + var data = getMapData(this, key), + size = data.size; + + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; +} + +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ +function SetCache(values) { + var index = -1, + length = values == null ? 0 : values.length; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } +} + +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; +} + +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ +function setCacheHas(value) { + return this.__data__.has(value); +} + +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; + +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; +} + +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ +function stackClear() { + this.__data__ = new ListCache; + this.size = 0; +} + +/** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function stackDelete(key) { + var data = this.__data__, + result = data['delete'](key); + + this.size = data.size; + return result; +} + +/** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function stackGet(key) { + return this.__data__.get(key); +} + +/** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function stackHas(key) { + return this.__data__.has(key); +} + +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ +function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { + pairs.push([key, value]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache(pairs); + } + data.set(key, value); + this.size = data.size; + return this; +} + +// Add methods to `Stack`. +Stack.prototype.clear = stackClear; +Stack.prototype['delete'] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; + +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; + + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); + } + } + return result; +} + +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} + +/** + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. + */ +function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); +} + +/** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); +} + +/** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ +function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; +} + +/** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {boolean} bitmask The bitmask flags. + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Function} [customizer] The function to customize comparisons. + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ +function baseIsEqual(value, other, bitmask, customizer, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); +} + +/** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = objIsArr ? arrayTag : getTag(object), + othTag = othIsArr ? arrayTag : getTag(other); + + objTag = objTag == argsTag ? objectTag : objTag; + othTag = othTag == argsTag ? objectTag : othTag; + + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, + isSameTag = objTag == othTag; + + if (isSameTag && isBuffer(object)) { + if (!isBuffer(other)) { + return false; + } + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack); + return (objIsArr || isTypedArray(object)) + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; + + stack || (stack = new Stack); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack); + return equalObjects(object, other, bitmask, customizer, equalFunc, stack); +} + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} + +/** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ +function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; +} + +/** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} + +/** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ +function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(array); + if (stacked && stack.get(other)) { + return stacked == other; + } + var index = -1, + result = true, + seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; + + stack.set(array, other); + stack.set(other, array); + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); + } + if (compared !== undefined) { + if (compared) { + continue; + } + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { + result = false; + break; + } + } else if (!( + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { + result = false; + break; + } + } + stack['delete'](array); + stack['delete'](other); + return result; +} + +/** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { + switch (tag) { + case dataViewTag: + if ((object.byteLength != other.byteLength) || + (object.byteOffset != other.byteOffset)) { + return false; + } + object = object.buffer; + other = other.buffer; + + case arrayBufferTag: + if ((object.byteLength != other.byteLength) || + !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; + + case boolTag: + case dateTag: + case numberTag: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq(+object, +other); + + case errorTag: + return object.name == other.name && object.message == other.message; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == (other + ''); + + case mapTag: + var convert = mapToArray; + + case setTag: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG; + convert || (convert = setToArray); + + if (object.size != other.size && !isPartial) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= COMPARE_UNORDERED_FLAG; + + // Recursively compare objects (susceptible to call stack limits). + stack.set(object, other); + var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + stack['delete'](object); + return result; + + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + } + return false; +} + +/** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, + objProps = getAllKeys(object), + objLength = objProps.length, + othProps = getAllKeys(other), + othLength = othProps.length; + + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked && stack.get(other)) { + return stacked == other; + } + var result = true; + stack.set(object, other); + stack.set(other, object); + + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); + } + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { + result = false; + break; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (result && !skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { + result = false; + } + } + stack['delete'](object); + stack['delete'](other); + return result; +} + +/** + * Creates an array of own enumerable property names and symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ +function getAllKeys(object) { + return baseGetAllKeys(object, keys, getSymbols); +} + +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; +} + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} + +/** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ +function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; +} + +/** + * Creates an array of the own enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ +var getSymbols = !nativeGetSymbols ? stubArray : function(object) { + if (object == null) { + return []; + } + object = Object(object); + return arrayFilter(nativeGetSymbols(object), function(symbol) { + return propertyIsEnumerable.call(object, symbol); + }); +}; + +/** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +var getTag = baseGetTag; + +// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. +if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || + (Map && getTag(new Map) != mapTag) || + (Promise && getTag(Promise.resolve()) != promiseTag) || + (Set && getTag(new Set) != setTag) || + (WeakMap && getTag(new WeakMap) != weakMapTag)) { + getTag = function(value) { + var result = baseGetTag(value), + Ctor = result == objectTag ? value.constructor : undefined, + ctorString = Ctor ? toSource(Ctor) : ''; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: return dataViewTag; + case mapCtorString: return mapTag; + case promiseCtorString: return promiseTag; + case setCtorString: return setTag; + case weakMapCtorString: return weakMapTag; + } + } + return result; + }; +} + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); +} + +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); +} + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); +} + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; +} + +/** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ +function objectToString(value) { + return nativeObjectToString.call(value); +} + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; +} + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); +} + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && + !propertyIsEnumerable.call(value, 'callee'); +}; + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} + +/** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ +var isBuffer = nativeIsBuffer || stubFalse; + +/** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are compared by strict equality, i.e. `===`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ +function isEqual(value, other) { + return baseIsEqual(value, other); +} + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; +} + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return value != null && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ +var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); +} + +/** + * This method returns a new empty array. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {Array} Returns the new empty array. + * @example + * + * var arrays = _.times(2, _.stubArray); + * + * console.log(arrays); + * // => [[], []] + * + * console.log(arrays[0] === arrays[1]); + * // => false + */ +function stubArray() { + return []; +} + +/** + * This method returns `false`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `false`. + * @example + * + * _.times(2, _.stubFalse); + * // => [false, false] + */ +function stubFalse() { + return false; +} + +module.exports = isEqual; diff --git a/node_modules/lodash.isequal/package.json b/node_modules/lodash.isequal/package.json new file mode 100644 index 0000000..a0257a5 --- /dev/null +++ b/node_modules/lodash.isequal/package.json @@ -0,0 +1,64 @@ +{ + "_from": "lodash.isequal@^4.5.0", + "_id": "lodash.isequal@4.5.0", + "_inBundle": false, + "_integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", + "_location": "/lodash.isequal", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "lodash.isequal@^4.5.0", + "name": "lodash.isequal", + "escapedName": "lodash.isequal", + "rawSpec": "^4.5.0", + "saveSpec": null, + "fetchSpec": "^4.5.0" + }, + "_requiredBy": [ + "/truffle-assertions" + ], + "_resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "_shasum": "415c4478f2bcc30120c22ce10ed3226f7d3e18e0", + "_spec": "lodash.isequal@^4.5.0", + "_where": "/Users/suchetaaa/Desktop/Anonymous-e-voting/node_modules/truffle-assertions", + "author": { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + "bugs": { + "url": "https://github.com/lodash/lodash/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "John-David Dalton", + "email": "john.david.dalton@gmail.com", + "url": "http://allyoucanleet.com/" + }, + { + "name": "Mathias Bynens", + "email": "mathias@qiwi.be", + "url": "https://mathiasbynens.be/" + } + ], + "deprecated": false, + "description": "The Lodash method `_.isEqual` exported as a module.", + "homepage": "https://lodash.com/", + "icon": "https://lodash.com/icon.svg", + "keywords": [ + "lodash-modularized", + "isequal" + ], + "license": "MIT", + "name": "lodash.isequal", + "repository": { + "type": "git", + "url": "git+https://github.com/lodash/lodash.git" + }, + "scripts": { + "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" + }, + "version": "4.5.0" +} diff --git a/node_modules/truffle-assertions/LICENSE b/node_modules/truffle-assertions/LICENSE new file mode 100644 index 0000000..27c0e4f --- /dev/null +++ b/node_modules/truffle-assertions/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Rosco Kalis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/truffle-assertions/README.md b/node_modules/truffle-assertions/README.md new file mode 100644 index 0000000..7ffd90e --- /dev/null +++ b/node_modules/truffle-assertions/README.md @@ -0,0 +1,234 @@ +# truffle-assertions + +[![Build Status](https://travis-ci.org/rkalis/truffle-assertions.svg)](https://travis-ci.org/rkalis/truffle-assertions) +[![Coverage Status](https://img.shields.io/codecov/c/github/rkalis/truffle-assertions.svg)](https://codecov.io/gh/rkalis/truffle-assertions/) +[![NPM Version](https://img.shields.io/npm/v/truffle-assertions.svg)](https://www.npmjs.com/package/truffle-assertions) +[![NPM Monthly Downloads](https://img.shields.io/npm/dm/truffle-assertions.svg)](https://www.npmjs.com/package/truffle-assertions) +[![NPM License](https://img.shields.io/npm/l/truffle-assertions.svg)](https://www.npmjs.com/package/truffle-assertions) + +This package adds additional assertions that can be used to test Ethereum smart contracts inside Truffle tests. + +## Installation +truffle-assertions can be installed through npm: +```bash +npm install truffle-assertions +``` + +## Usage +To use this package, import it at the top of the Truffle test file, and use the functions that are documented below. +```javascript +const truffleAssert = require('truffle-assertions'); +``` + +## Tutorials +I wrote two tutorials on using this library for checking events and asserting reverts inside smart contract tests: +* [Checking events when testing Solidity smart contracts with Truffle](https://kalis.me/check-events-solidity-smart-contract-test-truffle/) +* [Asserting reverts when testing Solidity smart contracts with Truffle](https://kalis.me/assert-reverts-solidity-smart-contract-test-truffle/) + +I also gave a two talks that explain a few different use cases of the library: +* [TruffleCon 2018: Using events to unit test smart contracts with Truffle](https://youtu.be/0yjlU1vx0HM) ([Slides](/docs/trufflecon-2018-presentation-slides.pdf)) +* [EthCC 2019: Using events to unit test smart contracts](https://youtu.be/GON3qyFdUtE) ([Slides](/docs/ethcc-2019-presentation-slides.pdf)) + +## Exported functions + +### truffleAssert.eventEmitted(result, eventType\[, filter]\[, message]) +The `eventEmitted` assertion checks that an event with type `eventType` has been emitted by the transaction with result `result`. A filter function can be passed along to further specify requirements for the event arguments: + +```javascript +truffleAssert.eventEmitted(result, 'TestEvent', (ev) => { + return ev.param1 === 10 && ev.param2 === ev.param3; +}); +``` + +Alternatively, a filter object can be passed in place of a function. If an object is passed, this object will be matched against the event's arguments. This object does not need to include all the event's arguments; only the included ones will be used in the comparison. + +```javascript +truffleAssert.eventEmitted(result, 'TestEvent', { param1: 10, param2: 20 }); +``` + +When the `filter` parameter is omitted or set to null, the assertion checks just for event type: + +```javascript +truffleAssert.eventEmitted(result, 'TestEvent'); +``` + +Optionally, a custom message can be passed to the assertion, which will be displayed alongside the default one: + +```javascript +truffleAssert.eventEmitted(result, 'TestEvent', (ev) => { + return ev.param1 === 10 && ev.param2 === ev.param3; +}, 'TestEvent should be emitted with correct parameters'); +``` + +The default messages are +```javascript +`Event of type ${eventType} was not emitted` +`Event filter for ${eventType} returned no results` +``` +Depending on the reason for the assertion failure. The default message also includes a list of events that were emitted in the passed transaction. + +--- + +### truffleAssert.eventNotEmitted(result, eventType\[, filter]\[, message]) +The `eventNotEmitted` assertion checks that an event with type `eventType` has not been emitted by the transaction with result `result`. A filter function can be passed along to further specify requirements for the event arguments: + +```javascript +truffleAssert.eventNotEmitted(result, 'TestEvent', (ev) => { + return ev.param1 === 10 && ev.param2 === ev.param3; +}); +``` + +Alternatively, a filter object can be passed in place of a function. If an object is passed, this object will be matched against the event's arguments. This object does not need to include all the event's arguments; only the included ones will be used in the comparison. + +```javascript +truffleAssert.eventNotEmitted(result, 'TestEvent', { param1: 10, param2: 20 }); +``` + +When the `filter` parameter is omitted or set to null, the assertion checks just for event type: + +```javascript +truffleAssert.eventNotEmitted(result, 'TestEvent'); +``` + +Optionally, a custom message can be passed to the assertion, which will be displayed alongside the default one: + +```javascript +truffleAssert.eventNotEmitted(result, 'TestEvent', null, 'TestEvent should not be emitted'); +``` + +The default messages are +```javascript +`Event of type ${eventType} was emitted` +`Event filter for ${eventType} returned results` +``` +Depending on the reason for the assertion failure. The default message also includes a list of events that were emitted in the passed transaction. + +--- + +### truffleAssert.prettyPrintEmittedEvents(result) +Pretty prints the full list of events with their parameters, that were emitted in transaction with result `result` + +```javascript +truffleAssert.prettyPrintEmittedEvents(result); +``` +``` +Events emitted in tx 0x7da28cf2bd52016ee91f10ec711edd8aa2716aac3ed453b0def0af59991d5120: +---------------------------------------------------------------------------------------- +TestEvent(testAddress = 0xe04893f0a1bdb132d66b4e7279492fcfe602f0eb, testInt: 10) +---------------------------------------------------------------------------------------- +``` + +--- + +### truffleAssert.createTransactionResult(contract, transactionHash) +There can be times where we only have access to a transaction hash, and not to a transaction result object, such as with the deployment of a new contract instance using `Contract.new();`. In these cases we still want to be able to assert that certain events are or aren't emitted. + +`truffle-assertions` offers the possibility to create a transaction result object from a contract instance and a transaction hash, which can then be used in the other functions that the library offers. + +**Note:** This function assumes that web3 is injected into the tests, which truffle does automatically. If you're not using truffle, you should import web3 manually at the top of your test file. + +```javascript +let contractInstance = await Contract.new(); +let result = await truffleAssert.createTransactionResult(contractInstance, contractInstance.transactionHash); + +truffleAssert.eventEmitted(result, 'TestEvent'); +``` + +--- + +### truffleAssert.passes(asyncFn\[, message]) +Asserts that the passed async contract function does not fail. + +```javascript +await truffleAssert.passes( + contractInstance.methodThatShouldPass() +); +``` + +Optionally, a custom message can be passed to the assertion, which will be displayed alongside the default one: + +```javascript +await truffleAssert.passes( + contractInstance.methodThatShouldPass(), + 'This method should not run out of gas' +); +``` + +The default message is +```javascript +`Failed with ${error}` +``` + +--- + +### truffleAssert.fails(asyncFn\[, errorType]\[, reason]\[, message]) +Asserts that the passed async contract function fails with a certain ErrorType and reason. + +The different error types are defined as follows: +```javascript +ErrorType = { + REVERT: "revert", + INVALID_OPCODE: "invalid opcode", + OUT_OF_GAS: "out of gas", + INVALID_JUMP: "invalid JUMP" +} +``` + +```javascript +await truffleAssert.fails( + contractInstance.methodThatShouldFail(), + truffleAssert.ErrorType.OUT_OF_GAS +); +``` + +A reason can be passed to the assertion, which functions as an extra filter on the revert reason (note that this is only relevant in the case of revert, not for the other ErrorTypes). This functionality requires at least Truffle v0.5. + +```javascript +await truffleAssert.fails( + contractInstance.methodThatShouldFail(), + truffleAssert.ErrorType.REVERT, + "only owner" +); +``` + +If the errorType parameter is omitted or set to null, the function just checks for failure, regardless of cause. + +```javascript +await truffleAssert.fails(contractInstance.methodThatShouldFail()); +``` + +Optionally, a custom message can be passed to the assertion, which will be displayed alongside the default one: + +```javascript +await truffleAssert.fails( + contractInstance.methodThatShouldFail(), + truffleAssert.ErrorType.OUT_OF_GAS, + null, + 'This method should run out of gas' +); +``` + +The default messages are +```javascript +'Did not fail' +`Expected to fail with ${errorType}, but failed with: ${error}` +``` + +--- + +### truffleAssert.reverts(asyncFn\[, reason]\[, message]) +This is an alias for `truffleAssert.fails(asyncFn, truffleAssert.ErrorType.REVERT[, reason][, message])`. + +```javascript +await truffleAssert.reverts( + contractInstance.methodThatShouldRevert(), + "only owner" +); +``` + +## Related projects + +* [truffle-events](https://github.com/zulhfreelancer/truffle-events) — 3rd party add-on to this project with 'deep events' support. You can test emitted events in other contracts, provided they are in the same transaction i.e. event A (contract A) and event B (contract B) are produced in the same transaction. + +## Donations +If you use this library inside your own projects and you would like to support its development, you can donate Ξ to `0x6775f0Ee4E63983501DBE7b0385bF84DBd36D69B`. diff --git a/node_modules/truffle-assertions/index.js b/node_modules/truffle-assertions/index.js new file mode 100644 index 0000000..76fc003 --- /dev/null +++ b/node_modules/truffle-assertions/index.js @@ -0,0 +1,213 @@ +const AssertionError = require('assertion-error'); +const isEqual = require('lodash.isequal'); + +/* global web3 */ + +class InvalidTxResultError extends Error {} + +const validateResult = (result) => { + if (!result.logs) { + throw new InvalidTxResultError( + 'First argument is not a transaction result. Did you accidentally pass a contract instance or transaction receipt?\n' + + 'If that is the case, check out truffleAssert.createTransactionResult in the documentation.', + ); + } +}; + +/* Creates a new assertion message, containing the passedAssertionMessage and + * the defaultAssertion message when passedAssertionMessage exists, otherwise + * just the default. + */ +const createAssertionMessage = (passedMessage, defaultMessage) => { + let assertionMessage = defaultMessage; + if (passedMessage) { + assertionMessage = `${passedMessage} : ${defaultMessage}`; + } + return assertionMessage; +}; + +const assertEventListNotEmpty = (list, passedMessage, defaultMessage) => { + const assertionMessage = createAssertionMessage(passedMessage, defaultMessage); + if (!Array.isArray(list) || list.length === 0) { + throw new AssertionError(assertionMessage); + } +}; + +const assertEventListEmpty = (list, passedMessage, defaultMessage) => { + const assertionMessage = createAssertionMessage(passedMessage, defaultMessage); + if (Array.isArray(list) && list.length !== 0) { + throw new AssertionError(assertionMessage); + } +}; + +/* Returns event string in the form of EventType(arg1, arg2, ...) */ +const getPrettyEventString = (eventType, args) => { + let argString = ''; + Object.entries(args).forEach(([key, value]) => { + argString += `, ${key}: ${value}`; + }); + argString = argString.replace(', ', ''); + return `${eventType}(${argString})`; +}; + +/* Returns a list of all emitted events in a transaction, + * using the format of getPrettyEventString + */ +const getPrettyEmittedEventsString = (result, indentationSize) => { + const indentation = ' '.repeat(indentationSize); + if (result.logs.length === 0) { + return `${indentation}No events emitted in tx ${result.tx}\n`; + } + let string = `${indentation}Events emitted in tx ${result.tx}:\n`; + string += `${indentation}----------------------------------------------------------------------------------------\n`; + result.logs.forEach((emittedEvent) => { + string += `${indentation}${getPrettyEventString(emittedEvent.event, emittedEvent.args)}\n`; + }); + string += `${indentation}----------------------------------------------------------------------------------------\n`; + return string; +}; + +const assertEventEmittedFromTxResult = (result, eventType, filter, message) => { + validateResult(result); + + /* Filter correct event types */ + const events = result.logs.filter(entry => entry.event === eventType); + + // TODO: Move the getPrettyEmittedEventsString to the assertion functions + assertEventListNotEmpty(events, message, `Event of type ${eventType} was not emitted\n${getPrettyEmittedEventsString(result)}`); + + /* Return if no filter function was provided */ + if (filter === undefined || filter === null) { + return; + } + + /* Filter correct arguments */ + let eventArgs = events.map(entry => entry.args); + + eventArgs = eventArgs.filter(filter); + assertEventListNotEmpty(eventArgs, message, `Event filter for ${eventType} returned no results\n${getPrettyEmittedEventsString(result)}`); +}; + +const assertEventNotEmittedFromTxResult = (result, eventType, filter, message) => { + validateResult(result); + + /* Filter correct event types */ + const events = result.logs.filter(entry => entry.event === eventType); + + /* Only check filtered events if there is no provided filter function */ + if (filter === undefined || filter === null) { + assertEventListEmpty(events, message, `Event of type ${eventType} was emitted\n${getPrettyEmittedEventsString(result)}`); + return; + } + + /* Filter correct arguments */ + let eventArgs = events.map(entry => entry.args); + eventArgs = eventArgs.filter(filter); + assertEventListEmpty(eventArgs, message, `Event filter for ${eventType} returned results\n${getPrettyEmittedEventsString(result)}`); +}; + +const createTransactionResult = async (contract, transactionHash) => { + /* Web3 1.x uses contract.getPastEvents, Web3 0.x uses contract.allEvents() */ + /* TODO: truffle-assertions 1.0 will only support Web3 1.x / Truffle v5 */ + if (contract.getPastEvents) { + const transactionReceipt = await web3.eth.getTransactionReceipt(transactionHash); + const { blockNumber } = transactionReceipt; + const eventList = await contract.getPastEvents('allEvents', { fromBlock: blockNumber, toBlock: blockNumber }); + return { + tx: transactionHash, + receipt: transactionReceipt, + logs: eventList.filter(ev => ev.transactionHash === transactionHash), + }; + } + + return new Promise((resolve, reject) => { + const transactionReceipt = web3.eth.getTransactionReceipt(transactionHash); + const { blockNumber } = transactionReceipt; + contract.allEvents({ fromBlock: blockNumber, toBlock: blockNumber }).get((error, events) => { + if (error) reject(error); + resolve({ + tx: transactionHash, + receipt: transactionReceipt, + logs: events.filter(ev => ev.transactionHash === transactionHash), + }); + }); + }); +}; + +const passes = async (asyncFn, message) => { + try { + await asyncFn; + } catch (error) { + const assertionMessage = createAssertionMessage(message, `Failed with ${error}`); + throw new AssertionError(assertionMessage); + } +}; + +const fails = async (asyncFn, errorType, reason, message) => { + try { + await asyncFn; + } catch (error) { + if (errorType && !error.message.includes(errorType)) { + const assertionMessage = createAssertionMessage(message, `Expected to fail with ${errorType}, but failed with: ${error}`); + throw new AssertionError(assertionMessage); + } else if (reason && !error.message.includes(reason)) { + const assertionMessage = createAssertionMessage(message, `Expected to fail with ${reason}, but failed with: ${error}`); + throw new AssertionError(assertionMessage); + } + // Error was handled by errorType or reason + return; + } + const assertionMessage = createAssertionMessage(message, 'Did not fail'); + throw new AssertionError(assertionMessage); +}; + +const ErrorType = { + REVERT: 'revert', + INVALID_OPCODE: 'invalid opcode', + OUT_OF_GAS: 'out of gas', + INVALID_JUMP: 'invalid JUMP', +}; + +const takeSameKeys = (filterOrObject, obj) => Object.keys(filterOrObject) + .reduce((accumulator, key) => { + if (obj.hasOwnProperty(key)) { + accumulator[key] = obj[key]; + } + return accumulator; + }, {}); + +const toFilterFunction = (filterOrObject) => { + if (filterOrObject !== null && typeof filterOrObject === 'object') { + return (obj) => { + const objectToCompare = takeSameKeys(filterOrObject, obj); + return isEqual(filterOrObject, objectToCompare); + }; + } + return filterOrObject; +}; + +module.exports = { + eventEmitted: (result, eventType, filterOrObject, message) => { + assertEventEmittedFromTxResult(result, eventType, toFilterFunction(filterOrObject), message); + }, + eventNotEmitted: (result, eventType, filterOrObject, message) => { + assertEventNotEmittedFromTxResult(result, eventType, toFilterFunction(filterOrObject), message); + }, + prettyPrintEmittedEvents: (result, indentationSize) => { + console.log(getPrettyEmittedEventsString(result, indentationSize)); + }, + createTransactionResult: (contract, transactionHash) => ( + createTransactionResult(contract, transactionHash) + ), + passes: async (asyncFn, message) => ( + passes(asyncFn, message) + ), + fails: async (asyncFn, errorType, reason, message) => ( + fails(asyncFn, errorType, reason, message) + ), + reverts: async (asyncFn, reason, message) => ( + fails(asyncFn, ErrorType.REVERT, reason, message) + ), + ErrorType, + InvalidTxResultError, +}; diff --git a/node_modules/truffle-assertions/package.json b/node_modules/truffle-assertions/package.json new file mode 100644 index 0000000..babca5b --- /dev/null +++ b/node_modules/truffle-assertions/package.json @@ -0,0 +1,81 @@ +{ + "_from": "truffle-assertions", + "_id": "truffle-assertions@0.9.1", + "_inBundle": false, + "_integrity": "sha512-MtcyXMTzRfg8WfE3TfrbVJm9HWMTPFksWg0K/8ZhajaxzFyPJ56/9AzNjQCROQluI0X1vs6XDsegwMlT1UFUNw==", + "_location": "/truffle-assertions", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "truffle-assertions", + "name": "truffle-assertions", + "escapedName": "truffle-assertions", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/truffle-assertions/-/truffle-assertions-0.9.1.tgz", + "_shasum": "74379a208f1175d6de9f33fba9a8cbb3aec27aa5", + "_spec": "truffle-assertions", + "_where": "/Users/suchetaaa/Desktop/Anonymous-e-voting", + "author": { + "name": "Rosco Kalis" + }, + "bugs": { + "url": "https://github.com/rkalis/truffle-assertions/issues" + }, + "bundleDependencies": false, + "dependencies": { + "assertion-error": "^1.1.0", + "lodash.isequal": "^4.5.0" + }, + "deprecated": false, + "description": "Additional assertions and utilities for testing Ethereum smart contracts in Truffle unit tests", + "devDependencies": { + "chai": "^4.2.0", + "chai-as-promised": "^7.1.1", + "codecov": "^3.1.0", + "coveralls": "^3.0.2", + "eslint": "^5.6.1", + "eslint-config-airbnb-base": "^13.1.0", + "eslint-plugin-import": "^2.14.0", + "mocha": "^5.2.0", + "nyc": "^13.3.0", + "sinon": "^7.1.1" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/rkalis/truffle-assertions", + "keywords": [ + "truffle", + "assert", + "assertions", + "test", + "events", + "ethereum", + "solidity" + ], + "license": "MIT", + "main": "index.js", + "name": "truffle-assertions", + "nyc": { + "temp-directory": "./node_modules/.nyc_output" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/rkalis/truffle-assertions.git" + }, + "scripts": { + "coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", + "lint": "eslint index.js test/*.js", + "lint-fix": "eslint --fix index.js test/*.js", + "test": "nyc mocha" + }, + "version": "0.9.1" +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..4cc1fae --- /dev/null +++ b/package-lock.json @@ -0,0 +1,27 @@ +{ + "name": "anonymous-e-voting", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==" + }, + "lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=" + }, + "truffle-assertions": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/truffle-assertions/-/truffle-assertions-0.9.1.tgz", + "integrity": "sha512-MtcyXMTzRfg8WfE3TfrbVJm9HWMTPFksWg0K/8ZhajaxzFyPJ56/9AzNjQCROQluI0X1vs6XDsegwMlT1UFUNw==", + "requires": { + "assertion-error": "^1.1.0", + "lodash.isequal": "^4.5.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..c2d230e --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "anonymous-e-voting", + "version": "1.0.0", + "description": "Anonymous EVoting", + "main": "truffle-config.js", + "directories": { + "test": "test" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/dexter-morgan/Anonymous-e-voting.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/dexter-morgan/Anonymous-e-voting/issues" + }, + "homepage": "https://github.com/dexter-morgan/Anonymous-e-voting#readme", + "dependencies": { + "truffle-assertions": "^0.9.1" + } +} diff --git a/ring.js b/ring.js new file mode 100644 index 0000000..a3ba156 --- /dev/null +++ b/ring.js @@ -0,0 +1,102 @@ +import * as BigInteger from 'jsproover-mixbytes/prover/bigInteger/bigInteger'; +import { ECCurve } from 'jsproover-mixbytes/prover/curve/curve'; + +const secureRandom = require("secure-random"); +const BN = require("bn.js"); +const ethereumjs_util = require("ethereumjs-util"); + +export let getRingSignature = (message, ringdata) => { + const bnCurve = new ECCurve('bn256') + const order = bnCurve.order + const signatureGenerator = bnCurve.generator + + const N_signer = ringdata.privkeyindex + let pk = new BigInteger.BNCLASS(ringdata.privkey.substr(2), 16, 'be') + pk = pk.umod(order) + + // [FIXME] - remove trash with substr + // let message = "0x14462573adecc6b213bfd0290aea56d908c2b491d3a26b1e35febceb9153c784"; + let hashp = bnCurve.hashInto(message.substr(2)) + + // Calculate Tau + let hashSP = hashp.mul(pk) + // await l(hashSP.serialize(true)); + + let hash_acc = ethereumjs_util.sha256(Buffer.concat([hashp.serialize(true).slice(0, 32), hashSP.serialize(true)])) + + let csum = new BigInteger.BNCLASS(0, 16, 'be') + let gen = bnCurve.generator + + let ctlist = [] + let a = bnCurve.zero + let b + let ri + + for (let j = 0; j < ringdata.pubkeys.length; j++) { + if (j != N_signer) { + let data = secureRandom(32, {type: 'Buffer'}) + let cj = new BN(data, 16, 'be') + data = secureRandom(32, {type: 'Buffer'}) + let tj = new BN(data, 16, 'be') + + // ParameterPointAdd returns the addition of c scaled by cj and tj as a curve poinT + let p1 = gen.mul(tj) + let pubk = bnCurve.pointFromCoordinates(ringdata.pubkeys[j].x.substr(2), ringdata.pubkeys[j].y.substr(2)) + let p2 = pubk.mul(cj) + a = p1.add(p2) + + // HashPointAdd returns the addition of hashSP scaled by cj and c scaled by tj + let p3 = hashp.mul(tj) + let p4 = hashSP.mul(cj) + b = p3.add(p4) + + ctlist.push(cj) + ctlist.push(tj) + + csum = csum.add(cj) + } + + if (j == N_signer) { + let zero = new BigInteger.BNCLASS(0, 16, 'be') + ctlist.push(zero) + ctlist.push(zero) + + // [TEMP] [FIXME] GENERATE RANDOM ri!! + let data = secureRandom(32, {type: 'Buffer'}) + let ri = new BN(data, 16, 'be') + a = gen.mul(ri) + b = hashp.mul(ri) + } + + hash_acc = ethereumjs_util.sha256(Buffer.concat([hash_acc, a.serialize(true), b.serialize(true)])) + } + + // [TODO] remove unneeded "umods" + let hashb = new BN(hash_acc, 16, 'be') + hashb = hashb.umod(order) + + csum = csum.umod(order) + + let c = new BN(hashb, 16, 'be') + c = c.sub(csum).umod(order) + + let cx = new BN(c, 16, 'be') + cx = cx.mul(pk) + cx = cx.umod(order) + + let ti = new BN(ri, 16, 'be') + ti = ti.sub(cx) + ti = ti.umod(order) + + ctlist[2 * N_signer] = c + ctlist[2 * N_signer + 1] = ti + + let x = '0x' + hashSP.serialize(true).slice(0, 32).toString('hex') + let y = '0x' + hashSP.serialize(true).slice(32, 64).toString('hex') + + let ctlist_hex = [] + for (let i = 0; i < ctlist.length; i++) { + ctlist_hex[i] = '0x' + ctlist[i].toString('hex') + } + return {'tau': {'x': x, 'y': y}, 'ctlist': ctlist_hex} +} \ No newline at end of file diff --git a/ring_gen.py b/ring_gen.py new file mode 100644 index 0000000..04df51e --- /dev/null +++ b/ring_gen.py @@ -0,0 +1,16 @@ +from linkable_ring_signature import ring_signature, verify_ring_signature + +from ecdsa.util import randrange +from ecdsa.curves import SECP256k1 + +number_participants = 10 + +x = [ randrange(SECP256k1.order) for i in range(number_participants)] +y = list(map(lambda xi: SECP256k1.generator * xi, x)) + +message = "Every move we made was a kiss" + +i = 2 +signature = ring_signature(x[i], i, message, y) + +assert(verify_ring_signature(message, y, *signature)) \ No newline at end of file diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..e934dd0 --- /dev/null +++ b/test/test.js @@ -0,0 +1,101 @@ +var EVoting = artifacts.require("EVoting"); +const truffleAssert = require('truffle-assertions'); + +var contractInstance; +var voteCount; + +// function postData(input) { +// .ajax({ +// type: "POST", +// url: "/linkable_ring_signature.py", +// data: { param: input }, +// success: callbackFunc +// }); +// } + +// function callbackFunc(response) { +// // do something with the response +// console.log(response); +// } + +// postData('data to process'); + + +contract("EVoting", async function(accounts){ + before(async () => { + contractInstance = await EVoting.deployed(); + }) + describe("success states", async () => { + + it("should add vote for proposal 1", async () => { + var message = 1; + var c0 = 10252198629870239947652931930426534351477048182077741320309900091507895345343; + var keyImage = ['0x278fb27d06bbb2adfd876e2e3184f3c65eb55c23c58e3f4e645647a8c51fcba6', '0x757dab84c2595312ba3b5004689ae64db50b3a6dd6ad1b680ffab4c43e32c983']; + var s = ['0xc99bf913ea2e110e408a733c66aadd32e62b59b8b275ec113401c11d2018a50b', '0x604c1ab1fe152108d32b8d3832d309a8a607e0b8e0429680e6055ed3b768610f', '0x90bf93d34419b1db6a8afbb4cd301990971fc633231c58d28333027ddf5f372e', '0x3c1bd1f69b60d6fc819b6aa5597aa85ff67927e4a2407ee8d52bffebf39cbd76', '0x16ddb43c2be6bcbf3b19ccc23d1b90300c7961fd1065bfdd8f271aa2359bf1d1', '0x798b6fa9156a5d2e405cda87419969192ba56899b7a90d3fe5584932877e589d', '0xf75006b2d5b3848a3db415143cabf979b87bd5789d45f9a2d1fea582622f2d65', '0x249d6a4bb93a52e819f46d3e837f6fd44cb5e3db9f0c933c45356f95a99d344d', '0xad65a56f8467deae2caaf14a0a7adda1b9755b28592d51f446b6c5046c996c9d', '0xae65a98c4839d50f19a22beff10e7482cf1b60542e2eecb6569de5d834f2063b'] +//[91190462932018558120629083241542643882159240682631753133824258713543117415691, 43556498084990321200298779495020214958715306770012155504027362095974956163343, 65471538237796562356647522983903970955116437941109653583553064824841546184494, 27187924899241601813938300368410115736026759436980227265221164420866202451318, 10342599806710454170092993656588321621362115307647025141354441995485175345617, 54976217072910222647394510131265749703801200768375285142934500048096842373277, 111862667597103023608691989942749866360616396225029842347089631718377140464997, 16561391164783323157851578678699591637230113048214181815971479906139005334605, 78429716153092954578776283758974907361899268960233727621916242695584147401885, 78882057384162385213282393644452869203143831500285861875904976068020289013307]; + var pub_keys = [['0xa9ed5780be853a5682cc61389142df496809b747e423e472f1a61a47c9bfe182', '0x4572d073b7955b7c847949c20ed2000450c8f52ad9b83a3ce24dd409cbc01d21'], ['0x54dc4bde844f233ad9b5fb43e71e8bcfd4c21d175d3b670991c30faba893dc39', '0xda8513dacf59a9384c47c1e9e934cb118e5a3ef4c58f7891ed068d8a4a14c0a'], ['0xf213f5a27836ab995d5d5183f0d771efc9383b3d0cf574f93b77eb4000de6856', '0xc361d91274ebf0a258f3baf6ce87f3c32d6a9ba4808c856ba105e89063ab19c9'], ['0x892090c9177551b29be614e60d8d4a54a805f3f850a5e13d5d44719873691add', '0x26be2f213b9b0cb84b13fdfa9d28b042f60ded4150c82d9806d192887d2303fd'], ['0x8cdee0841aaa3dbf14530817a3e2e7c209c28e58894f884846f3c656b1369099', '0xb4ec71964b78059552b51eb4578b3a5d02edccdb43eab21f1d3ade827659c3e7'], ['0xd0e6aaf83cb6f7570a8b0d28ad0f33f08d0c5b5bcf02ceb4e60444ad9ebbc042', '0xa612fdff207927dea42b83a60eccefcd08db09f69861d09aa93c44b426e827bc'], ['0x9f57f0f71ec5ab1dc86bba409164816d8312db8f7ad15870666be1f3f57b9d9b', '0xc2934331a462c24b0d706ecdb774eff221bbf570dcef39e7f98da2e7c4c1d916'], ['0x9937ead84c1bed46defcd039152635f32ea92c728fd7e4f242d749148fe9c65e', '0xa890ea307c37f1db4d21a1b19584eac4c82bd9f7ec87fd7e42570d3b739395a2'], ['0x2e90e70604590f72fa855a80336779aef09dc09fd4accad48a1bf5ba58de4599', '0xc5a6c0640e92c37033b64d2e0d2dde60567b90921dbdae2efb0f20ec6a4360fc'], ['0x1909b3749b0799f3dadb9b0daff18b49a5a163fe026981c37f64f448226b601c', '0x69ca46a41007cd4cdc5e84dc42971b97dc8cf653e1a6b670c5733f038ea93b54']]//[[76860218087793983084535703376981386467447611172084071853258931251531655143810,31412445800597707204000296306981535369487689728022294203473644188534598278433],[38383509265263568403091993992632738089196255623116815243548433385026133154873,6177458042690818063654998812321100640246417077410401798821997202074455067658],[109494974759407544115980221650269989415835863198723097195991870480545591748694,88373887815570028484318636992066972615473624433958557212898599653752288516553],[62024398634874066443962845630678733310841268459352721513836874076957014825693,17523914466505763903401497950553046259382636897003925910700830930167415374845],[63717588402740889593319833542751400718873158538928593038126726953424863531161,81834072601552631999151743416373775064561835219024365947336813467257575949287],[94488627319558170444192963521553866738182271320922938361822272954834163056706,75117489132020203438334222530089728350198927250708518444467009567047301998524],[72073121700845816532409909568957092975560328036852544806670390063697244167579,88008882899030566411419232439265353825316367124231879120604152247564011428118],[69302663261811420267463647311565591458354544084275858903094017435028909835870,76244600855121168108544883604098564729610790293645164381848998871531984754082],[21062411477782016300649284598637628528529199124745416083435916321565775381913,89400255616484687868490880757687246913068397762041460105517838105693640679676],[11324961394441086302516068549805884234494603864143349084821232258857030082588,47850239753691939370379379177679604685639311272023121432695464273305267682132]]; + + receipt = await contractInstance.setCommon(accounts[0], {from:accounts[0]}); + console.log("receipt for setting common address : \n", receipt); + voteCount = await contractInstance.vote.call((message), '0x16aa89ee28eb2cc154d4353c5d8a4e18126c23814a0df840a1564982c226a0bf', keyImage, s, pub_keys, {from: accounts[0], gas:800000000}); + //var tx = contractInstance.addNewItem(name, price, {from: itemSeller}); + // console.log(itemID.toNumber()) + //var res = await contractInstance.getItem.call(itemID.toNumber()) + + assert.equal(voteCount == 1); + // assert.equal(price, res["1"].toNumber(), "Price wasn't added properly"); + // assert.equal(itemSeller, res["2"], "Seller wasn't added properly"); + // assert.equal(res["3"].toNumber(), 0, "Status wasn't added properly"); + + + }); + }) +}) + + // it("should add product 2", async () => { + // var name = "Prod2"; + // var price = 100; + // var itemSeller = accounts[0]; + + + // itemID = await contractInstance.addNewItem.call(name, price, {from: itemSeller}); + // var tx = contractInstance.addNewItem(name, price, {from: itemSeller}); + // // console.log(itemID.toNumber()) + // var res = await contractInstance.getItem.call(itemID.toNumber()) + + // assert.equal(name, res["0"], "Name wasn't added properly"); + // assert.equal(price, res["1"].toNumber(), "Price wasn't added properly"); + // assert.equal(itemSeller, res["2"], "Seller wasn't added properly"); + // assert.equal(res["3"].toNumber(), 0, "Status wasn't added properly"); + + + // }); + + // it("should remove product 1", async () => { + // itemID = 0; + // var tx = await contractInstance.removeItem(itemID); + // var removedId = tx.receipt.logs[0].args["0"].toNumber() + // assert.equal(removedId, itemID, "Incorrect item removed") + // var res = await contractInstance.getItem.call(itemID) + // assert.equal(res["3"].toNumber(), 2, "Item hasn't been removed correctly"); + // // console.log(res); + // }); + + // it("should buy product 2", async () => { + // itemID = 1; + // var tx = await contractInstance.buyItem(itemID, {from: accounts[1], value: 100}); + // var boughtId = tx.receipt.logs[0].args["0"].toNumber() + // assert.equal(boughtId, itemID, "Incorrect item bought") + // var res = await contractInstance.getItem.call(itemID) + // assert.equal(res["3"].toNumber(), 1, "Item hasn't been bought correctly"); + // }); + // }) + + // describe("failure states", async () => { + // it("should not remove product 2", async () => { + // itemID = 1; + // await truffleAssert.reverts(contractInstance.removeItem(itemID), "This item has already been purchased or removed"); + // }); + // }) + +//}); \ No newline at end of file diff --git a/truffle-config.js b/truffle-config.js new file mode 100644 index 0000000..806bf88 --- /dev/null +++ b/truffle-config.js @@ -0,0 +1,99 @@ +/** + * Use this file to configure your truffle project. It's seeded with some + * common settings for different networks and features like migrations, + * compilation and testing. Uncomment the ones you need or modify + * them to suit your project as necessary. + * + * More information about configuration can be found at: + * + * truffleframework.com/docs/advanced/configuration + * + * To deploy via Infura you'll need a wallet provider (like truffle-hdwallet-provider) + * to sign your transactions before they're sent to a remote public node. Infura accounts + * are available for free at: infura.io/register. + * + * You'll also need a mnemonic - the twelve word phrase the wallet uses to generate + * public/private key pairs. If you're publishing your code to GitHub make sure you load this + * phrase from a file you've .gitignored so it doesn't accidentally become public. + * + */ + +// const HDWalletProvider = require('truffle-hdwallet-provider'); +// const infuraKey = "fj4jll3k....."; +// +// const fs = require('fs'); +// const mnemonic = fs.readFileSync(".secret").toString().trim(); + +module.exports = { + /** + * Networks define how you connect to your ethereum client and let you set the + * defaults web3 uses to send transactions. If you don't specify one truffle + * will spin up a development blockchain for you on port 9545 when you + * run `develop` or `test`. You can ask a truffle command to use a specific + * network from the command line, e.g + * + * $ truffle test --network + */ + + networks: { + // Useful for testing. The `development` name is special - truffle uses it by default + // if it's defined here and no other network is specified at the command line. + // You should run a client (like ganache-cli, geth or parity) in a separate terminal + // tab if you use this network and you must also set the `host`, `port` and `network_id` + // options below to some value. + // + development: { + host: "127.0.0.1", // Localhost (default: none) + port: 8545, // Standard Ethereum port (default: none) + network_id: "*", // Any network (default: none) + } + + // Another network with more advanced options... + // advanced: { + // port: 8777, // Custom port + // network_id: 1342, // Custom network + // gas: 8500000, // Gas sent with each transaction (default: ~6700000) + // gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei) + // from:
, // Account to send txs from (default: accounts[0]) + // websockets: true // Enable EventEmitter interface for web3 (default: false) + // }, + + // Useful for deploying to a public network. + // NB: It's important to wrap the provider as a function. + // ropsten: { + // provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`), + // network_id: 3, // Ropsten's id + // gas: 5500000, // Ropsten has a lower block limit than mainnet + // confirmations: 2, // # of confs to wait between deployments. (default: 0) + // timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50) + // skipDryRun: true // Skip dry run before migrations? (default: false for public nets ) + // }, + + // Useful for private networks + // private: { + // provider: () => new HDWalletProvider(mnemonic, `https://network.io`), + // network_id: 2111, // This network is yours, in the cloud. + // production: true // Treats this network as if it was a public net. (default: false) + // } + }, + + // Set default mocha options here, use special reporters etc. + mocha: { + // timeout: 100000 + }, + + // Configure your compilers + compilers: { + solc: { + // version: "0.5.1", // Fetch exact version from solc-bin (default: truffle's version) + // docker: true, // Use "0.5.1" you've installed locally with docker (default: false) + // settings: { // See the solidity docs for advice about optimization and evmVersion + // optimizer: { + // enabled: false, + // runs: 200 + // }, + // evmVersion: "byzantium" + // } + } + } +}