Skip to content

feat: add table bytes to interface #473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
9 changes: 7 additions & 2 deletions src/crossChain/BLSTableCalculator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.27;

import {IBLSTableCalculator} from "../interfaces/IBLSTableCalculator.sol";

import {IOperatorTableCalculator} from "../interfaces/IOperatorTableCalculator.sol";
import {IStakeRegistry} from "../interfaces/IStakeRegistry.sol";
import {IBLSApkRegistry} from "../interfaces/IBLSApkRegistry.sol";
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";
Expand All @@ -18,9 +18,14 @@ abstract contract BLSTableCalculator is IBLSTableCalculator {
constructor(IBLSApkRegistry _blsApkRegistry) {
blsApkRegistry = _blsApkRegistry;
}

/// @inheritdoc IOperatorTableCalculator
function calculateOperatorTableBytes(OperatorSet calldata operatorSet) external view returns (bytes memory operatorTableBytes) {
return abi.encode(calculateOperatorTable(operatorSet));
}

/// @inheritdoc IBLSTableCalculator
function calculateOperatorTable(OperatorSet calldata operatorSet) external view returns (BN254OperatorSetInfo memory operatorSetInfo) {
function calculateOperatorTable(OperatorSet calldata operatorSet) public view returns (BN254OperatorSetInfo memory operatorSetInfo) {
validateOperatorSet(operatorSet);

// Get the weights for all operators in the operatorSet
Expand Down
4 changes: 3 additions & 1 deletion src/interfaces/IBLSTableCalculator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ pragma solidity ^0.8.27;
import {BN254} from "../libraries/BN254.sol";
import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";
import {IStrategy} from "eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol";
import {IOperatorTableCalculator} from "./IOperatorTableCalculator.sol";
import {IOperatorWeightCalculator} from "./IOperatorWeightCalculator.sol";

interface IBLSTableCalculatorErrors {
/// @notice Thrown when the operatorSet does not exist in EigenLayer core.
error InvalidOperatorSet();
Expand Down Expand Up @@ -33,7 +35,7 @@ interface IBLSTableCalculatorTypes {
interface IBLSTableCalculatorEvents is IBLSTableCalculatorTypes {
}

interface IBLSTableCalculator is IOperatorWeightCalculator, IBLSTableCalculatorErrors, IBLSTableCalculatorEvents {
interface IBLSTableCalculator is IOperatorTableCalculator, IOperatorWeightCalculator, IBLSTableCalculatorErrors, IBLSTableCalculatorEvents {
/**
* @notice calculates the operatorInfos for a given operatorSet
* @param operatorSet the operatorSet to calculate the operator table for
Expand Down
14 changes: 14 additions & 0 deletions src/interfaces/IOperatorTableCalculator.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol";

interface IOperatorTableCalculator {
/**
* @notice calculates the operatorTableBytes for a given operatorSet
* @param operatorSet the operatorSet to calculate the operatorTableBytes for
* @return operatorTableBytes The operatorTable bytes
*/
function calculateOperatorTableBytes(OperatorSet calldata operatorSet)
external view returns(bytes memory operatorTableBytes);
}
Loading