Skip to content

Commit

Permalink
refactor: interface structure
Browse files Browse the repository at this point in the history
  • Loading branch information
0xClandestine committed Jan 23, 2025
1 parent 792b4fa commit 5fd87d1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
38 changes: 25 additions & 13 deletions src/interfaces/IBLSSignatureChecker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,7 @@ interface IBLSSignatureCheckerErrors {
error InvalidBLSSignature();
}

/**
* @title Used for checking BLS aggregate signatures from the operators of a EigenLayer AVS with the RegistryCoordinator/BLSApkRegistry/StakeRegistry architechture.
* @author Layr Labs, Inc.
* @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
* @notice This is the contract for checking the validity of aggregate operator signatures.
*/
interface IBLSSignatureChecker is IBLSSignatureCheckerErrors {
// DATA STRUCTURES

interface IBLSSignatureCheckerTypes {
struct NonSignerStakesAndSignature {
uint32[] nonSignerQuorumBitmapIndices; // is the indices of all nonsigner quorum bitmaps
BN254.G1Point[] nonSignerPubkeys; // is the G1 pubkeys of all nonsigners
Expand All @@ -60,18 +52,31 @@ interface IBLSSignatureChecker is IBLSSignatureCheckerErrors {
// total amount staked by all operators in each quorum
uint96[] totalStakeForQuorum;
}
}

// EVENTS

interface IBLSSignatureCheckerEvents is IBLSSignatureCheckerTypes {
/// @notice Emitted when `staleStakesForbiddenUpdate` is set
event StaleStakesForbiddenUpdate(bool value);
}

// CONSTANTS & IMMUTABLES
interface IBLSSignatureChecker is IBLSSignatureCheckerErrors, IBLSSignatureCheckerEvents {
/// STATE

function registryCoordinator() external view returns (IRegistryCoordinator);

function stakeRegistry() external view returns (IStakeRegistry);

function blsApkRegistry() external view returns (IBLSApkRegistry);

function delegation() external view returns (IDelegationManager);

function staleStakesForbidden() external view returns (bool);

// ACTIONS

function setStaleStakesForbidden(bool value) external;

/// VIEW

/**
* @notice This function is called by disperser when it has aggregated all the signatures of the operators
Expand All @@ -95,4 +100,11 @@ interface IBLSSignatureChecker is IBLSSignatureCheckerErrors {
uint32 referenceBlockNumber,
NonSignerStakesAndSignature memory nonSignerStakesAndSignature
) external view returns (QuorumStakeTotals memory, bytes32);
}

function trySignatureAndApkVerification(
bytes32 msgHash,
BN254.G1Point memory apk,
BN254.G2Point memory apkG2,
BN254.G1Point memory sigma
) external view returns (bool pairingSuccessful, bool siganatureIsValid);
}
6 changes: 3 additions & 3 deletions test/unit/BLSSignatureCheckerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.27;

import "../../src/BLSSignatureChecker.sol";
import "../utils/BLSMockAVSDeployer.sol";
import {IBLSSignatureCheckerErrors} from "../../src/interfaces/IBLSSignatureChecker.sol";
import {IBLSSignatureCheckerErrors, IBLSSignatureCheckerTypes} from "../../src/interfaces/IBLSSignatureChecker.sol";
import {IBLSApkRegistryErrors} from "../../src/interfaces/IBLSApkRegistry.sol";
import {QuorumBitmapHistoryLib} from "../../src/libraries/QuorumBitmapHistoryLib.sol";
import {IStakeRegistryErrors} from "../../src/interfaces/IStakeRegistry.sol";
Expand Down Expand Up @@ -201,8 +201,8 @@ contract BLSSignatureCheckerUnitTests is BLSMockAVSDeployer {
1, numNonSigners, quorumBitmap
);

IBLSSignatureChecker.NonSignerStakesAndSignature memory incorrectLengthInputs =
IBLSSignatureChecker.NonSignerStakesAndSignature({
IBLSSignatureCheckerTypes.NonSignerStakesAndSignature memory incorrectLengthInputs =
IBLSSignatureCheckerTypes.NonSignerStakesAndSignature({
nonSignerQuorumBitmapIndices: nonSignerStakesAndSignature.nonSignerQuorumBitmapIndices,
nonSignerPubkeys: nonSignerStakesAndSignature.nonSignerPubkeys,
quorumApks: nonSignerStakesAndSignature.quorumApks,
Expand Down

0 comments on commit 5fd87d1

Please sign in to comment.