Skip to content

Commit 0d23360

Browse files
authored
feat: add table bytes to interface (#473)
adds a method that returns the abi encoded operator table bytes to be compatible with generation protocol
1 parent 46dc0df commit 0d23360

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

src/crossChain/BLSTableCalculator.sol

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.27;
33

44
import {IBLSTableCalculator} from "../interfaces/IBLSTableCalculator.sol";
5-
5+
import {IOperatorTableCalculator} from "../interfaces/IOperatorTableCalculator.sol";
66
import {IStakeRegistry} from "../interfaces/IStakeRegistry.sol";
77
import {IBLSApkRegistry} from "../interfaces/IBLSApkRegistry.sol";
88
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";
@@ -18,9 +18,14 @@ abstract contract BLSTableCalculator is IBLSTableCalculator {
1818
constructor(IBLSApkRegistry _blsApkRegistry) {
1919
blsApkRegistry = _blsApkRegistry;
2020
}
21+
22+
/// @inheritdoc IOperatorTableCalculator
23+
function calculateOperatorTableBytes(OperatorSet calldata operatorSet) external view returns (bytes memory operatorTableBytes) {
24+
return abi.encode(calculateOperatorTable(operatorSet));
25+
}
2126

2227
/// @inheritdoc IBLSTableCalculator
23-
function calculateOperatorTable(OperatorSet calldata operatorSet) external view returns (BN254OperatorSetInfo memory operatorSetInfo) {
28+
function calculateOperatorTable(OperatorSet calldata operatorSet) public view returns (BN254OperatorSetInfo memory operatorSetInfo) {
2429
validateOperatorSet(operatorSet);
2530

2631
// Get the weights for all operators in the operatorSet

src/interfaces/IBLSTableCalculator.sol

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ pragma solidity ^0.8.27;
44
import {BN254} from "../libraries/BN254.sol";
55
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";
66
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
7+
import {IOperatorTableCalculator} from "./IOperatorTableCalculator.sol";
78
import {IOperatorWeightCalculator} from "./IOperatorWeightCalculator.sol";
9+
810
interface IBLSTableCalculatorErrors {
911
/// @notice Thrown when the operatorSet does not exist in EigenLayer core.
1012
error InvalidOperatorSet();
@@ -33,7 +35,7 @@ interface IBLSTableCalculatorTypes {
3335
interface IBLSTableCalculatorEvents is IBLSTableCalculatorTypes {
3436
}
3537

36-
interface IBLSTableCalculator is IOperatorWeightCalculator, IBLSTableCalculatorErrors, IBLSTableCalculatorEvents {
38+
interface IBLSTableCalculator is IOperatorTableCalculator, IOperatorWeightCalculator, IBLSTableCalculatorErrors, IBLSTableCalculatorEvents {
3739
/**
3840
* @notice calculates the operatorInfos for a given operatorSet
3941
* @param operatorSet the operatorSet to calculate the operator table for
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.20;
3+
4+
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";
5+
6+
interface IOperatorTableCalculator {
7+
/**
8+
* @notice calculates the operatorTableBytes for a given operatorSet
9+
* @param operatorSet the operatorSet to calculate the operatorTableBytes for
10+
* @return operatorTableBytes The operatorTable bytes
11+
*/
12+
function calculateOperatorTableBytes(OperatorSet calldata operatorSet)
13+
external view returns(bytes memory operatorTableBytes);
14+
}

0 commit comments

Comments
 (0)