diff --git a/precompiles/dasigners/IDASigners.abi b/precompiles/dasigners/IDASigners.abi index 6215c2c5..0bb6d20f 100644 --- a/precompiles/dasigners/IDASigners.abi +++ b/precompiles/dasigners/IDASigners.abi @@ -111,6 +111,16 @@ "internalType": "struct BN254.G1Point", "name": "aggPkG1", "type": "tuple" + }, + { + "internalType": "uint256", + "name": "total", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "hit", + "type": "uint256" } ], "stateMutability": "view", diff --git a/precompiles/dasigners/IDASigners.sol b/precompiles/dasigners/IDASigners.sol deleted file mode 100644 index 889ae39a..00000000 --- a/precompiles/dasigners/IDASigners.sol +++ /dev/null @@ -1,387 +0,0 @@ -// Sources flattened with hardhat v2.22.2 https://hardhat.org - -// SPDX-License-Identifier: LGPL-3.0-only AND MIT - -// File contracts/libraries/BN254.sol - -// Original license: SPDX_License_Identifier: MIT -// several functions are taken or adapted from https://github.com/HarryR/solcrypto/blob/master/contracts/altbn128.sol (MIT license): -// Copyright 2017 Christian Reitwiessner -// 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. - -// The remainder of the code in this library is written by LayrLabs Inc. and is also under an MIT license - -pragma solidity ^0.8.12; - -/** - * @title Library for operations on the BN254 elliptic curve. - * @author Layr Labs, Inc. - * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service - * @notice Contains BN254 parameters, common operations (addition, scalar mul, pairing), and BLS signature functionality. - */ -library BN254 { - // modulus for the underlying field F_p of the elliptic curve - uint internal constant FP_MODULUS = 21888242871839275222246405745257275088696311157297823662689037894645226208583; - // modulus for the underlying field F_r of the elliptic curve - uint internal constant FR_MODULUS = 21888242871839275222246405745257275088548364400416034343698204186575808495617; - - struct G1Point { - uint X; - uint Y; - } - - // Encoding of field elements is: X[1] * i + X[0] - struct G2Point { - uint[2] X; - uint[2] Y; - } - - function generatorG1() internal pure returns (G1Point memory) { - return G1Point(1, 2); - } - - // generator of group G2 - /// @dev Generator point in F_q2 is of the form: (x0 + ix1, y0 + iy1). - uint internal constant G2x1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; - uint internal constant G2x0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; - uint internal constant G2y1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531; - uint internal constant G2y0 = 8495653923123431417604973247489272438418190587263600148770280649306958101930; - - /// @notice returns the G2 generator - /// @dev mind the ordering of the 1s and 0s! - /// this is because of the (unknown to us) convention used in the bn254 pairing precompile contract - /// "Elements a * i + b of F_p^2 are encoded as two elements of F_p, (a, b)." - /// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-197.md#encoding - function generatorG2() internal pure returns (G2Point memory) { - return G2Point([G2x1, G2x0], [G2y1, G2y0]); - } - - // negation of the generator of group G2 - /// @dev Generator point in F_q2 is of the form: (x0 + ix1, y0 + iy1). - uint internal constant nG2x1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; - uint internal constant nG2x0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; - uint internal constant nG2y1 = 17805874995975841540914202342111839520379459829704422454583296818431106115052; - uint internal constant nG2y0 = 13392588948715843804641432497768002650278120570034223513918757245338268106653; - - function negGeneratorG2() internal pure returns (G2Point memory) { - return G2Point([nG2x1, nG2x0], [nG2y1, nG2y0]); - } - - bytes32 internal constant powersOfTauMerkleRoot = - 0x22c998e49752bbb1918ba87d6d59dd0e83620a311ba91dd4b2cc84990b31b56f; - - /** - * @param p Some point in G1. - * @return The negation of `p`, i.e. p.plus(p.negate()) should be zero. - */ - function negate(G1Point memory p) internal pure returns (G1Point memory) { - // The prime q in the base field F_q for G1 - if (p.X == 0 && p.Y == 0) { - return G1Point(0, 0); - } else { - return G1Point(p.X, FP_MODULUS - (p.Y % FP_MODULUS)); - } - } - - /** - * @return r the sum of two points of G1 - */ - function plus(G1Point memory p1, G1Point memory p2) internal view returns (G1Point memory r) { - uint[4] memory input; - input[0] = p1.X; - input[1] = p1.Y; - input[2] = p2.X; - input[3] = p2.Y; - bool success; - - // solium-disable-next-line security/no-inline-assembly - assembly { - success := staticcall(sub(gas(), 2000), 6, input, 0x80, r, 0x40) - // Use "invalid" to make gas estimation work - switch success - case 0 { - invalid() - } - } - - require(success, "ec-add-failed"); - } - - /** - * @notice an optimized ecMul implementation that takes O(log_2(s)) ecAdds - * @param p the point to multiply - * @param s the scalar to multiply by - * @dev this function is only safe to use if the scalar is 9 bits or less - */ - function scalar_mul_tiny(BN254.G1Point memory p, uint16 s) internal view returns (BN254.G1Point memory) { - require(s < 2 ** 9, "scalar-too-large"); - - // if s is 1 return p - if (s == 1) { - return p; - } - - // the accumulated product to return - BN254.G1Point memory acc = BN254.G1Point(0, 0); - // the 2^n*p to add to the accumulated product in each iteration - BN254.G1Point memory p2n = p; - // value of most significant bit - uint16 m = 1; - // index of most significant bit - uint8 i = 0; - - //loop until we reach the most significant bit - while (s >= m) { - unchecked { - // if the current bit is 1, add the 2^n*p to the accumulated product - if ((s >> i) & 1 == 1) { - acc = plus(acc, p2n); - } - // double the 2^n*p for the next iteration - p2n = plus(p2n, p2n); - - // increment the index and double the value of the most significant bit - m <<= 1; - ++i; - } - } - - // return the accumulated product - return acc; - } - - /** - * @return r the product of a point on G1 and a scalar, i.e. - * p == p.scalar_mul(1) and p.plus(p) == p.scalar_mul(2) for all - * points p. - */ - function scalar_mul(G1Point memory p, uint s) internal view returns (G1Point memory r) { - uint[3] memory input; - input[0] = p.X; - input[1] = p.Y; - input[2] = s; - bool success; - // solium-disable-next-line security/no-inline-assembly - assembly { - success := staticcall(sub(gas(), 2000), 7, input, 0x60, r, 0x40) - // Use "invalid" to make gas estimation work - switch success - case 0 { - invalid() - } - } - require(success, "ec-mul-failed"); - } - - /** - * @return The result of computing the pairing check - * e(p1[0], p2[0]) * .... * e(p1[n], p2[n]) == 1 - * For example, - * pairing([P1(), P1().negate()], [P2(), P2()]) should return true. - */ - function pairing( - G1Point memory a1, - G2Point memory a2, - G1Point memory b1, - G2Point memory b2 - ) internal view returns (bool) { - G1Point[2] memory p1 = [a1, b1]; - G2Point[2] memory p2 = [a2, b2]; - - uint[12] memory input; - - for (uint i = 0; i < 2; i++) { - uint j = i * 6; - input[j + 0] = p1[i].X; - input[j + 1] = p1[i].Y; - input[j + 2] = p2[i].X[0]; - input[j + 3] = p2[i].X[1]; - input[j + 4] = p2[i].Y[0]; - input[j + 5] = p2[i].Y[1]; - } - - uint[1] memory out; - bool success; - - // solium-disable-next-line security/no-inline-assembly - assembly { - success := staticcall(sub(gas(), 2000), 8, input, mul(12, 0x20), out, 0x20) - // Use "invalid" to make gas estimation work - switch success - case 0 { - invalid() - } - } - - require(success, "pairing-opcode-failed"); - - return out[0] != 0; - } - - /** - * @notice This function is functionally the same as pairing(), however it specifies a gas limit - * the user can set, as a precompile may use the entire gas budget if it reverts. - */ - function safePairing( - G1Point memory a1, - G2Point memory a2, - G1Point memory b1, - G2Point memory b2, - uint pairingGas - ) internal view returns (bool, bool) { - G1Point[2] memory p1 = [a1, b1]; - G2Point[2] memory p2 = [a2, b2]; - - uint[12] memory input; - - for (uint i = 0; i < 2; i++) { - uint j = i * 6; - input[j + 0] = p1[i].X; - input[j + 1] = p1[i].Y; - input[j + 2] = p2[i].X[0]; - input[j + 3] = p2[i].X[1]; - input[j + 4] = p2[i].Y[0]; - input[j + 5] = p2[i].Y[1]; - } - - uint[1] memory out; - bool success; - - // solium-disable-next-line security/no-inline-assembly - assembly { - success := staticcall(pairingGas, 8, input, mul(12, 0x20), out, 0x20) - } - - //Out is the output of the pairing precompile, either 0 or 1 based on whether the two pairings are equal. - //Success is true if the precompile actually goes through (aka all inputs are valid) - - return (success, out[0] != 0); - } - - /// @return hashedG1 the keccak256 hash of the G1 Point - /// @dev used for BLS signatures - function hashG1Point(BN254.G1Point memory pk) internal pure returns (bytes32 hashedG1) { - assembly { - mstore(0, mload(pk)) - mstore(0x20, mload(add(0x20, pk))) - hashedG1 := keccak256(0, 0x40) - } - } - - /// @return the keccak256 hash of the G2 Point - /// @dev used for BLS signatures - function hashG2Point(BN254.G2Point memory pk) internal pure returns (bytes32) { - return keccak256(abi.encodePacked(pk.X[0], pk.X[1], pk.Y[0], pk.Y[1])); - } - - /** - * @notice adapted from https://github.com/HarryR/solcrypto/blob/master/contracts/altbn128.sol - */ - function hashToG1(bytes32 _x) internal view returns (G1Point memory) { - uint beta = 0; - uint y = 0; - - uint x = uint(_x) % FP_MODULUS; - - while (true) { - (beta, y) = findYFromX(x); - - // y^2 == beta - if (beta == mulmod(y, y, FP_MODULUS)) { - return G1Point(x, y); - } - - x = addmod(x, 1, FP_MODULUS); - } - return G1Point(0, 0); - } - - /** - * Given X, find Y - * - * where y = sqrt(x^3 + b) - * - * Returns: (x^3 + b), y - */ - function findYFromX(uint x) internal view returns (uint, uint) { - // beta = (x^3 + b) % p - uint beta = addmod(mulmod(mulmod(x, x, FP_MODULUS), x, FP_MODULUS), 3, FP_MODULUS); - - // y^2 = x^3 + b - // this acts like: y = sqrt(beta) = beta^((p+1) / 4) - uint y = expMod(beta, 0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52, FP_MODULUS); - - return (beta, y); - } - - function expMod(uint _base, uint _exponent, uint _modulus) internal view returns (uint retval) { - bool success; - uint[1] memory output; - uint[6] memory input; - input[0] = 0x20; // baseLen = new(big.Int).SetBytes(getData(input, 0, 32)) - input[1] = 0x20; // expLen = new(big.Int).SetBytes(getData(input, 32, 32)) - input[2] = 0x20; // modLen = new(big.Int).SetBytes(getData(input, 64, 32)) - input[3] = _base; - input[4] = _exponent; - input[5] = _modulus; - assembly { - success := staticcall(sub(gas(), 2000), 5, input, 0xc0, output, 0x20) - // Use "invalid" to make gas estimation work - switch success - case 0 { - invalid() - } - } - require(success, "BN254.expMod: call failure"); - return output[0]; - } -} - - -// File contracts/interface/IDASigners.sol - -// Original license: SPDX_License_Identifier: LGPL-3.0-only - -pragma solidity >=0.8.0 <0.9.0; - -interface IDASigners { - /*=== struct ===*/ - struct SignerDetail { - string socket; - BN254.G1Point pkG1; - BN254.G2Point pkG2; - } - - /*=== event ===*/ - event NewSigner(address indexed signer, BN254.G1Point pkG1, BN254.G2Point pkG2); - event SocketUpdated(address indexed signer, string socket); - - /*=== function ===*/ - function epochNumber() external view returns (uint); - - function getSigners(uint epoch) external view returns (address[] memory accounts, SignerDetail[] memory details); - - function registerSigner(SignerDetail memory _signer, BN254.G1Point memory _signature) external; - - function checkSignatures( - BN254.G1Point memory _hash, - uint epoch, - bytes memory signerBitmap, - BN254.G2Point memory _aggPkG2, - BN254.G1Point memory _signature - ) external view returns (bool); -} \ No newline at end of file diff --git a/precompiles/dasigners/contract.go b/precompiles/dasigners/contract.go index b558627b..8966d62f 100644 --- a/precompiles/dasigners/contract.go +++ b/precompiles/dasigners/contract.go @@ -30,7 +30,7 @@ var ( // DASignersMetaData contains all meta data concerning the DASigners contract. var DASignersMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"indexed\":false,\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"name\":\"NewSigner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"SocketUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"epochNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signersBitmap\",\"type\":\"bytes\"}],\"name\":\"getAggPkG1\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"aggPkG1\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getSigner\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"}],\"name\":\"getSigners\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail[]\",\"name\":\"details\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerNextEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"_signer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"updateSocket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"indexed\":false,\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"name\":\"NewSigner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"SocketUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"epochNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"signersBitmap\",\"type\":\"bytes\"}],\"name\":\"getAggPkG1\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"aggPkG1\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"total\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"hit\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getSigner\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"}],\"name\":\"getSigners\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail[]\",\"name\":\"details\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerNextEpoch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"signer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"pkG1\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[2]\",\"name\":\"X\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[2]\",\"name\":\"Y\",\"type\":\"uint256[2]\"}],\"internalType\":\"structBN254.G2Point\",\"name\":\"pkG2\",\"type\":\"tuple\"}],\"internalType\":\"structIDASigners.SignerDetail\",\"name\":\"_signer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"X\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"Y\",\"type\":\"uint256\"}],\"internalType\":\"structBN254.G1Point\",\"name\":\"_signature\",\"type\":\"tuple\"}],\"name\":\"registerSigner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"socket\",\"type\":\"string\"}],\"name\":\"updateSocket\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // DASignersABI is the input ABI used to generate the binding from. @@ -212,32 +212,51 @@ func (_DASigners *DASignersCallerSession) EpochNumber() (*big.Int, error) { // GetAggPkG1 is a free data retrieval call binding the contract method 0x86fafce5. // -// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1) -func (_DASigners *DASignersCaller) GetAggPkG1(opts *bind.CallOpts, epoch *big.Int, signersBitmap []byte) (BN254G1Point, error) { +// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1, uint256 total, uint256 hit) +func (_DASigners *DASignersCaller) GetAggPkG1(opts *bind.CallOpts, epoch *big.Int, signersBitmap []byte) (struct { + AggPkG1 BN254G1Point + Total *big.Int + Hit *big.Int +}, error) { var out []interface{} err := _DASigners.contract.Call(opts, &out, "getAggPkG1", epoch, signersBitmap) + outstruct := new(struct { + AggPkG1 BN254G1Point + Total *big.Int + Hit *big.Int + }) if err != nil { - return *new(BN254G1Point), err + return *outstruct, err } - out0 := *abi.ConvertType(out[0], new(BN254G1Point)).(*BN254G1Point) + outstruct.AggPkG1 = *abi.ConvertType(out[0], new(BN254G1Point)).(*BN254G1Point) + outstruct.Total = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + outstruct.Hit = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - return out0, err + return *outstruct, err } // GetAggPkG1 is a free data retrieval call binding the contract method 0x86fafce5. // -// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1) -func (_DASigners *DASignersSession) GetAggPkG1(epoch *big.Int, signersBitmap []byte) (BN254G1Point, error) { +// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1, uint256 total, uint256 hit) +func (_DASigners *DASignersSession) GetAggPkG1(epoch *big.Int, signersBitmap []byte) (struct { + AggPkG1 BN254G1Point + Total *big.Int + Hit *big.Int +}, error) { return _DASigners.Contract.GetAggPkG1(&_DASigners.CallOpts, epoch, signersBitmap) } // GetAggPkG1 is a free data retrieval call binding the contract method 0x86fafce5. // -// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1) -func (_DASigners *DASignersCallerSession) GetAggPkG1(epoch *big.Int, signersBitmap []byte) (BN254G1Point, error) { +// Solidity: function getAggPkG1(uint256 epoch, bytes signersBitmap) view returns((uint256,uint256) aggPkG1, uint256 total, uint256 hit) +func (_DASigners *DASignersCallerSession) GetAggPkG1(epoch *big.Int, signersBitmap []byte) (struct { + AggPkG1 BN254G1Point + Total *big.Int + Hit *big.Int +}, error) { return _DASigners.Contract.GetAggPkG1(&_DASigners.CallOpts, epoch, signersBitmap) } diff --git a/precompiles/dasigners/query.go b/precompiles/dasigners/query.go index 8753d97d..2a63aeff 100644 --- a/precompiles/dasigners/query.go +++ b/precompiles/dasigners/query.go @@ -53,5 +53,5 @@ func (d *DASignersPrecompile) GetAggPkG1(ctx sdk.Context, _ *vm.EVM, method *abi if err != nil { return nil, err } - return method.Outputs.Pack(NewBN254G1Point(response.AggregatePubkeyG1)) + return method.Outputs.Pack(NewBN254G1Point(response.AggregatePubkeyG1), big.NewInt(int64(response.Total)), big.NewInt(int64(response.Hit))) } diff --git a/proto/zgc/dasigners/v1/query.proto b/proto/zgc/dasigners/v1/query.proto index 336ac30e..b8811d26 100644 --- a/proto/zgc/dasigners/v1/query.proto +++ b/proto/zgc/dasigners/v1/query.proto @@ -14,16 +14,16 @@ option (gogoproto.goproto_getters_all) = false; // Query defines the gRPC querier service for the dasigners module service Query { rpc EpochNumber(QueryEpochNumberRequest) returns (QueryEpochNumberResponse) { - option (google.api.http).get = "/0gchain/dasigners/v1/epoch-number"; + option (google.api.http).get = "/0g/dasigners/v1/epoch-number"; } rpc EpochSignerSet(QueryEpochSignerSetRequest) returns (QueryEpochSignerSetResponse) { - option (google.api.http).get = "/0gchain/dasigners/v1/epoch-signer-set"; + option (google.api.http).get = "/0g/dasigners/v1/epoch-signer-set"; } rpc AggregatePubkeyG1(QueryAggregatePubkeyG1Request) returns (QueryAggregatePubkeyG1Response) { - option (google.api.http).get = "/0gchain/dasigners/v1/aggregate-pubkey-g1"; + option (google.api.http).get = "/0g/dasigners/v1/aggregate-pubkey-g1"; } rpc Signer(QuerySignerRequest) returns (QuerySignerResponse) { - option (google.api.http).get = "/0gchain/dasigners/v1/signer"; + option (google.api.http).get = "/0g/dasigners/v1/signer"; } } @@ -56,4 +56,6 @@ message QueryAggregatePubkeyG1Request { message QueryAggregatePubkeyG1Response { bytes aggregate_pubkey_g1 = 1; + uint64 total = 2; + uint64 hit = 3; } diff --git a/x/dasigners/v1/keeper/grpc_query.go b/x/dasigners/v1/keeper/grpc_query.go index cb0d1dbf..4dc1c749 100644 --- a/x/dasigners/v1/keeper/grpc_query.go +++ b/x/dasigners/v1/keeper/grpc_query.go @@ -40,11 +40,11 @@ func (k Keeper) EpochNumber( func (k Keeper) EpochSignerSet(c context.Context, request *types.QueryEpochSignerSetRequest) (*types.QueryEpochSignerSetResponse, error) { ctx := sdk.UnwrapSDKContext(c) - epochSignerSet := make([]*types.Signer, 0) signers, found := k.GetEpochSignerSet(ctx, request.EpochNumber) if !found { - return &types.QueryEpochSignerSetResponse{Signers: epochSignerSet}, types.ErrEpochSignerSetNotFound + return nil, types.ErrEpochSignerSetNotFound } + epochSignerSet := make([]*types.Signer, len(signers.Signers)) for _, account := range signers.Signers { signer, found, err := k.GetSigner(ctx, account) if err != nil { @@ -68,6 +68,7 @@ func (k Keeper) AggregatePubkeyG1(c context.Context, request *types.QueryAggrega return nil, types.ErrSignerLengthNotMatch } aggPubkeyG1 := new(bn254.G1Affine) + hit := 0 for i, account := range signers.Signers { b := request.SignersBitmap[i/8] & (1 << (i % 8)) if b == 0 { @@ -80,9 +81,12 @@ func (k Keeper) AggregatePubkeyG1(c context.Context, request *types.QueryAggrega if !found { return nil, types.ErrSignerNotFound } + hit += 1 aggPubkeyG1.Add(aggPubkeyG1, bn254util.DeserializeG1(signer.PubkeyG1)) } return &types.QueryAggregatePubkeyG1Response{ AggregatePubkeyG1: bn254util.SerializeG1(aggPubkeyG1), + Total: uint64(len(signers.Signers)), + Hit: uint64(hit), }, nil } diff --git a/x/dasigners/v1/types/genesis.go b/x/dasigners/v1/types/genesis.go index b3a4c651..b6e5df85 100644 --- a/x/dasigners/v1/types/genesis.go +++ b/x/dasigners/v1/types/genesis.go @@ -18,7 +18,7 @@ func DefaultGenesisState() *GenesisState { QuorumSize: 1024, TokensPerVote: "100", MaxVotes: 100, - EpochBlocks: 1000, + EpochBlocks: 10, }, 0, make([]*Signer, 0), make([]*EpochSignerSet, 0)) } diff --git a/x/dasigners/v1/types/query.pb.go b/x/dasigners/v1/types/query.pb.go index 18418579..fac6e645 100644 --- a/x/dasigners/v1/types/query.pb.go +++ b/x/dasigners/v1/types/query.pb.go @@ -293,6 +293,8 @@ var xxx_messageInfo_QueryAggregatePubkeyG1Request proto.InternalMessageInfo type QueryAggregatePubkeyG1Response struct { AggregatePubkeyG1 []byte `protobuf:"bytes,1,opt,name=aggregate_pubkey_g1,json=aggregatePubkeyG1,proto3" json:"aggregate_pubkey_g1,omitempty"` + Total uint64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + Hit uint64 `protobuf:"varint,3,opt,name=hit,proto3" json:"hit,omitempty"` } func (m *QueryAggregatePubkeyG1Response) Reset() { *m = QueryAggregatePubkeyG1Response{} } @@ -342,43 +344,45 @@ func init() { func init() { proto.RegisterFile("zgc/dasigners/v1/query.proto", fileDescriptor_991a610b84b5964c) } var fileDescriptor_991a610b84b5964c = []byte{ - // 575 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4f, 0x6f, 0xd3, 0x30, - 0x14, 0x6f, 0xc6, 0xe8, 0x84, 0x5b, 0x10, 0xf3, 0x90, 0x48, 0x43, 0x09, 0x25, 0x2a, 0xa8, 0x1b, - 0x24, 0x6e, 0xca, 0x19, 0x21, 0x26, 0xa1, 0x9d, 0x40, 0x5b, 0x77, 0xe3, 0x52, 0x39, 0xc1, 0xb8, - 0x11, 0x4b, 0x9c, 0xd5, 0xce, 0x44, 0xc7, 0x8d, 0x4f, 0x30, 0x89, 0x33, 0x1f, 0x80, 0x6f, 0xb2, - 0xe3, 0x24, 0x2e, 0x1c, 0xa1, 0xe5, 0x83, 0xa0, 0xda, 0x6e, 0x4b, 0xfa, 0x6f, 0xbd, 0xd9, 0xef, - 0xfd, 0xde, 0xef, 0xf7, 0x7b, 0x7e, 0x4f, 0x06, 0xd5, 0x73, 0x1a, 0xa2, 0x0f, 0x98, 0x47, 0x34, - 0x21, 0x3d, 0x8e, 0xce, 0x7c, 0x74, 0x9a, 0x91, 0x5e, 0xdf, 0x4b, 0x7b, 0x4c, 0x30, 0x78, 0xf7, - 0x9c, 0x86, 0xde, 0x24, 0xeb, 0x9d, 0xf9, 0x56, 0x25, 0x64, 0x3c, 0x66, 0xbc, 0x23, 0xf3, 0x48, - 0x5d, 0x14, 0xd8, 0xba, 0x47, 0x19, 0x65, 0x2a, 0x3e, 0x3a, 0xe9, 0x68, 0x95, 0x32, 0x46, 0x4f, - 0x08, 0xc2, 0x69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, 0x5c, 0x0e, - 0x6c, 0xe3, 0x6a, 0x60, 0x1b, 0xbf, 0x07, 0xb6, 0x71, 0x31, 0xb4, 0x0b, 0x57, 0x43, 0xbb, 0xf0, - 0x6b, 0x68, 0x17, 0xde, 0x23, 0x1a, 0x89, 0x6e, 0x16, 0x78, 0x21, 0x8b, 0x51, 0x93, 0x9e, 0xe0, - 0x80, 0xa3, 0x26, 0x75, 0x15, 0xdb, 0xe7, 0x3c, 0x9f, 0xe8, 0xa7, 0x84, 0x07, 0x45, 0xf9, 0xbd, - 0xbd, 0xf8, 0x17, 0x00, 0x00, 0xff, 0xff, 0x83, 0xb0, 0xab, 0x12, 0xbd, 0x05, 0x00, 0x00, + // 600 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4f, 0x6f, 0xd3, 0x4e, + 0x10, 0x8d, 0xfb, 0x57, 0xbf, 0x6d, 0x7e, 0xa8, 0xdd, 0x56, 0xaa, 0x63, 0x5a, 0x27, 0x35, 0x29, + 0x6a, 0x51, 0xed, 0x4d, 0xc2, 0x19, 0x21, 0x2a, 0xa1, 0x9e, 0x40, 0xd4, 0xbd, 0x71, 0x89, 0xd6, + 0x66, 0xd9, 0x58, 0xc4, 0x5e, 0x37, 0x5e, 0x47, 0x4d, 0x8f, 0x5c, 0xb9, 0x20, 0x71, 0xe1, 0x03, + 0xf0, 0x61, 0x7a, 0xa3, 0x12, 0x17, 0x8e, 0x90, 0xf0, 0x41, 0x50, 0x76, 0x37, 0x09, 0x8e, 0x71, + 0xc9, 0x6d, 0xf7, 0xcd, 0x9b, 0x79, 0x6f, 0x76, 0x46, 0x0b, 0xf6, 0xae, 0xa9, 0x8f, 0xde, 0xe0, + 0x24, 0xa0, 0x11, 0xe9, 0x25, 0xa8, 0xdf, 0x44, 0x97, 0x29, 0xe9, 0x0d, 0x9c, 0xb8, 0xc7, 0x38, + 0x83, 0x9b, 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3c, + 0x46, 0x63, 0xf1, 0x04, 0xe5, 0xf1, 0x44, 0x78, 0x7c, 0x08, 0xeb, 0x39, 0x8f, 0xd3, 0xf9, 0xdb, + 0x72, 0x35, 0x6c, 0xda, 0x84, 0x7d, 0xb0, 0x26, 0xdb, 0x84, 0xf5, 0x02, 0xa5, 0xcc, 0xf7, 0x61, + 0x1c, 0xfe, 0x83, 0xa5, 0x4c, 0x54, 0x85, 0x89, 0x0a, 0xdc, 0xcd, 0x99, 0x90, 0xc7, 0xd3, 0x17, + 0x37, 0x3f, 0xcd, 0xd2, 0xcd, 0xd0, 0xd4, 0x6e, 0x87, 0xa6, 0xf6, 0x63, 0x68, 0x6a, 0x1f, 0x47, + 0x66, 0xe9, 0x76, 0x64, 0x96, 0xbe, 0x8f, 0xcc, 0xd2, 0x6b, 0x44, 0x03, 0xde, 0x49, 0x3d, 0xc7, + 0x67, 0x21, 0x6a, 0xd0, 0x2e, 0xf6, 0x12, 0xd4, 0xa0, 0xb6, 0xdf, 0xc1, 0x41, 0x84, 0xae, 0xb2, + 0xf5, 0xf8, 0x20, 0x26, 0x89, 0xb7, 0x26, 0xbe, 0xbc, 0xc7, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, + 0x9b, 0xb2, 0x92, 0x94, 0xd1, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -805,6 +809,16 @@ func (m *QueryAggregatePubkeyG1Response) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if m.Hit != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Hit)) + i-- + dAtA[i] = 0x18 + } + if m.Total != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Total)) + i-- + dAtA[i] = 0x10 + } if len(m.AggregatePubkeyG1) > 0 { i -= len(m.AggregatePubkeyG1) copy(dAtA[i:], m.AggregatePubkeyG1) @@ -926,6 +940,12 @@ func (m *QueryAggregatePubkeyG1Response) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + if m.Total != 0 { + n += 1 + sovQuery(uint64(m.Total)) + } + if m.Hit != 0 { + n += 1 + sovQuery(uint64(m.Hit)) + } return n } @@ -1541,6 +1561,44 @@ func (m *QueryAggregatePubkeyG1Response) Unmarshal(dAtA []byte) error { m.AggregatePubkeyG1 = []byte{} } iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) + } + m.Total = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Total |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Hit", wireType) + } + m.Hit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Hit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/dasigners/v1/types/query.pb.gw.go b/x/dasigners/v1/types/query.pb.gw.go index e905a08f..362db812 100644 --- a/x/dasigners/v1/types/query.pb.gw.go +++ b/x/dasigners/v1/types/query.pb.gw.go @@ -382,13 +382,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_EpochNumber_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0gchain", "dasigners", "v1", "epoch-number"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_EpochNumber_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "epoch-number"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_EpochSignerSet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0gchain", "dasigners", "v1", "epoch-signer-set"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_EpochSignerSet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "epoch-signer-set"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_AggregatePubkeyG1_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0gchain", "dasigners", "v1", "aggregate-pubkey-g1"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_AggregatePubkeyG1_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "aggregate-pubkey-g1"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Signer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0gchain", "dasigners", "v1", "signer"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Signer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"0g", "dasigners", "v1", "signer"}, "", runtime.AssumeColonVerbOpt(false))) ) var (