Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/unaudited/BLSSigCheckOperatorStateRetriever.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ import {BitmapUtils} from "../libraries/BitmapUtils.sol";
import {BN254} from "../libraries/BN254.sol";
import {BN256G2} from "./BN256G2.sol";
import {OperatorStateRetriever} from "../OperatorStateRetriever.sol";
import {ECUtils} from "./ECUtils.sol";
import {BLSSigCheckUtils, Arrays} from "./BLSSigCheckUtils.sol";

/**
* @title BLSSigCheckOperatorStateRetriever with view functions that allow to retrieve the state of an AVSs registry system.
* @dev This contract inherits from OperatorStateRetriever and adds the getNonSignerStakesAndSignature function.
* @author Bread coop
*/
contract BLSSigCheckOperatorStateRetriever is OperatorStateRetriever {
using ECUtils for BN254.G1Point;
using BLSSigCheckUtils for BN254.G1Point;
using BN254 for BN254.G1Point;
using BitmapUtils for uint256;
using Arrays for bytes32[];

/// @dev Thrown when the signature is not on the curve.
error InvalidSigma();
Expand Down Expand Up @@ -150,9 +151,13 @@ contract BLSSigCheckOperatorStateRetriever is OperatorStateRetriever {

// Trim the nonSignerOperatorIds array to the actual count
bytes32[] memory trimmedNonSignerOperatorIds = new bytes32[](nonSignerOperatorsCount);
BN254.G1Point[] memory nonSignerPubkeys = new BN254.G1Point[](nonSignerOperatorsCount);
for (uint256 i = 0; i < nonSignerOperatorsCount; i++) {
trimmedNonSignerOperatorIds[i] = nonSignerOperatorIds[i];
}
trimmedNonSignerOperatorIds = Arrays.sort(trimmedNonSignerOperatorIds);

BN254.G1Point[] memory nonSignerPubkeys = new BN254.G1Point[](nonSignerOperatorsCount);
for (uint256 i = 0; i < nonSignerOperatorsCount; i++) {
address nonSignerOperator =
registryCoordinator.getOperatorFromId(trimmedNonSignerOperatorIds[i]);
(nonSignerPubkeys[i],) = m.blsApkRegistry.getRegisteredPubkey(nonSignerOperator);
Expand Down
Loading
Loading