{
    "Function": "slitherConstructorConstantVariables",
    "File": "src/contracts/middleware/BLSPublicKeyCompendium.sol",
    "Parent Contracts": [
        "src/contracts/interfaces/IBLSPublicKeyCompendium.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "contract BLSPublicKeyCompendium is IBLSPublicKeyCompendium {\n    //Hash of the zero public key: BN254.hashG1Point(G1Point(0,0))\n    bytes32 internal constant ZERO_PK_HASH = hex\"ad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5\";\n\n    /// @notice mapping from operator address to pubkey hash\n    mapping(address => bytes32) public operatorToPubkeyHash;\n    /// @notice mapping from pubkey hash to operator address\n    mapping(bytes32 => address) public pubkeyHashToOperator;\n\n    // EVENTS\n    /// @notice Emitted when `operator` registers with the public key `pk`.\n    event NewPubkeyRegistration(address operator, BN254.G1Point pubkeyG1, BN254.G2Point pubkeyG2);\n\n    /**\n     * @notice Called by an operator to register themselves as the owner of a BLS public key and reveal their G1 and G2 public key.\n     * @param s is the field element of the operator's Schnorr signature\n     * @param rPoint is the group element of the operator's Schnorr signature\n     * @param pubkeyG1 is the the G1 pubkey of the operator\n     * @param pubkeyG2 is the G2 with the same private key as the pubkeyG1\n     */\n    function registerBLSPublicKey(uint256 s, BN254.G1Point memory rPoint, BN254.G1Point memory pubkeyG1, BN254.G2Point memory pubkeyG2) external {\n        // calculate -g1\n        BN254.G1Point memory negGeneratorG1 = BN254.negate(BN254.G1Point({X: 1, Y: 2}));\n        // verify a Schnorr signature (s, R) of pubkeyG1\n        // calculate s*-g1 + (R + H(msg.sender, P, R)*P) = 0\n        // which is the Schnorr signature verification equation\n        BN254.G1Point memory shouldBeZero = \n            BN254.plus(\n                BN254.scalar_mul(negGeneratorG1, s),\n                BN254.plus(\n                    rPoint,\n                    BN254.scalar_mul(\n                        pubkeyG1,\n                        uint256(keccak256(abi.encodePacked(msg.sender, pubkeyG1.X, pubkeyG1.Y, rPoint.X, rPoint.Y))) % BN254.FR_MODULUS\n                    )\n                )\n            );\n\n        require(shouldBeZero.X == 0 && shouldBeZero.Y == 0, \"BLSPublicKeyCompendium.registerBLSPublicKey: incorrect schnorr singature\");\n\n        // verify that the G2 pubkey has the same discrete log as the G1 pubkey\n        // e(P, [1]_2) = e([-1]_1, P')\n        require(BN254.pairing(\n            pubkeyG1,\n            BN254.generatorG2(),\n            negGeneratorG1,\n            pubkeyG2\n        ), \"BLSPublicKeyCompendium.registerBLSPublicKey: G1 and G2 private key do not match\");\n\n        // getting pubkey hash\n        bytes32 pubkeyHash = BN254.hashG1Point(pubkeyG1);\n\n        require(pubkeyHash != ZERO_PK_HASH, \"BLSPublicKeyCompendium.registerBLSPublicKey: operator attempting to register the zero public key\");\n\n        require(\n            operatorToPubkeyHash[msg.sender] == bytes32(0),\n            \"BLSPublicKeyCompendium.registerBLSPublicKey: operator already registered pubkey\"\n        );\n        require(\n            pubkeyHashToOperator[pubkeyHash] == address(0),\n            \"BLSPublicKeyCompendium.registerBLSPublicKey: public key already registered\"\n        );\n\n        // store updates\n        operatorToPubkeyHash[msg.sender] = pubkeyHash;\n        pubkeyHashToOperator[pubkeyHash] = msg.sender;\n\n        emit NewPubkeyRegistration(msg.sender, pubkeyG1, pubkeyG2);\n    }\n}"
}