-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ca2a60
commit d08096f
Showing
7 changed files
with
143 additions
and
247 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.23; | ||
|
||
import {BLS} from "./hubble-contracts/libs/BLS.sol"; | ||
|
||
library BLSOpen { | ||
function verifySingle(uint256[2] memory signature, uint256[4] memory pubkey, uint256[2] memory message) | ||
external | ||
view | ||
returns (bool) | ||
{ | ||
uint256[4][] memory pubkeys = new uint256[4][](1); | ||
uint256[2][] memory messages = new uint256[2][](1); | ||
pubkeys[0] = pubkey; | ||
messages[0] = message; | ||
|
||
(bool verified, bool callSuccess) = BLS.verifyMultiple(signature, pubkeys, messages); | ||
return callSuccess && verified; | ||
|
||
// // NB: (result, success) opposite of `call` convention (success, result). | ||
// (bool verified, bool callSuccess) = BLS.verifySingle( | ||
// signature, | ||
// pubkey, | ||
// message | ||
// ); | ||
// return callSuccess && verified; | ||
} | ||
|
||
function verifyMultiple(uint256[2] memory signature, uint256[4][] memory pubkeys, uint256[2][] memory messages) | ||
external | ||
view | ||
returns (bool) | ||
{ | ||
(bool verified, bool callSuccess) = BLS.verifyMultiple(signature, pubkeys, messages); | ||
return callSuccess && verified; | ||
} | ||
|
||
function hashToPoint(bytes32 domain, bytes memory message) external view returns (uint256[2] memory) { | ||
return BLS.hashToPoint(domain, message); | ||
} | ||
|
||
function isZeroBLSKey(uint256[4] memory blsKey) public pure returns (bool) { | ||
bool isZero = true; | ||
for (uint256 i = 0; isZero && i < 4; i++) { | ||
isZero = (blsKey[i] == 0); | ||
} | ||
return isZero; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.