Skip to content
12 changes: 12 additions & 0 deletions script/utils/ExistingDeploymentParser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ import "../../src/contracts/pods/EigenPod.sol";
import "../../src/contracts/pods/EigenPodManager.sol";

import "../../src/contracts/permissions/PauserRegistry.sol";
import "../../src/contracts/permissions/KeyRegistrar.sol";
import "../../src/contracts/multichain/BN254CertificateVerifier.sol";
import "../../src/contracts/multichain/BN254TableCalculator.sol";
import "../../src/contracts/multichain/OperatorTableUpdater.sol";

import "../../src/test/mocks/EmptyContract.sol";

Expand Down Expand Up @@ -94,6 +98,9 @@ contract ExistingDeploymentParser is Script, Logger {
uint256 STRATEGY_MAX_PER_DEPOSIT;
uint256 STRATEGY_MAX_TOTAL_DEPOSITS;

/// @dev BN254TableCalculator
uint256 BN254_TABLE_CALCULATOR_LOOKAHEAD_BLOCKS;

/// -----------------------------------------------------------------------
/// EigenLayer Contracts
/// -----------------------------------------------------------------------
Expand Down Expand Up @@ -151,6 +158,11 @@ contract ExistingDeploymentParser is Script, Logger {
EigenStrategy public eigenStrategy;
EigenStrategy public eigenStrategyImpl;

/// @dev Multichain
KeyRegistrar public keyRegistrar;
KeyRegistrar public keyRegistrarImplementation;
BN254TableCalculator public bn254TableCalculator;

/// -----------------------------------------------------------------------
/// Storage
/// -----------------------------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions src/contracts/interfaces/IAllocationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,13 @@ interface IAllocationManager is IAllocationManagerErrors, IAllocationManagerEven
address operator
) external view returns (bool isSet, uint32 delay);

/**
* @notice Returns the number of blocks between an operator deallocating magnitude and the magnitude becoming
* unslashable and then being able to be reallocated to another operator set. Note that unlike the allocation delay
* which is configurable by the operator, the DEALLOCATION_DELAY is globally fixed and cannot be changed.
*/
function DEALLOCATION_DELAY() external view returns (uint32 delay);

/**
* @notice Returns a list of all operator sets the operator is registered for
* @param operator The operator address to query.
Expand Down
31 changes: 19 additions & 12 deletions src/contracts/interfaces/IBN254TableCalculator.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

import {BN254} from "../libraries/BN254.sol";
import {OperatorSet} from "../libraries/OperatorSetLib.sol";
import "../libraries/BN254.sol";
import "../libraries/OperatorSetLib.sol";
import "./IOperatorTableCalculator.sol";

interface IBN254TableCalculatorTypes {
/**
Expand Down Expand Up @@ -39,7 +40,22 @@ interface IBN254TableCalculatorTypes {
}
}

interface IBN254TableCalculator is IBN254TableCalculatorTypes {
interface IBN254TableCalculatorEvents {
/// @notice Emitted when the lookahead blocks are set
event LookaheadBlocksSet(uint256 lookaheadBlocks);
}

interface IBN254TableCalculatorErrors {
/// @notice Emitted when the lookahead blocks are too high
error LookaheadBlocksTooHigh();
}

interface IBN254TableCalculator is
IOperatorTableCalculator,
IBN254TableCalculatorTypes,
IBN254TableCalculatorEvents,
IBN254TableCalculatorErrors
{
/**
* @notice calculates the operatorInfos for a given operatorSet
* @param operatorSet the operatorSet to calculate the operator table for
Expand All @@ -50,15 +66,6 @@ interface IBN254TableCalculator is IBN254TableCalculatorTypes {
OperatorSet calldata operatorSet
) external view returns (BN254OperatorSetInfo memory operatorSetInfo);

/**
* @notice calculates the operatorInfos for a given operatorSet
* @param operatorSet the operatorSet to calculate the operator table for
* @return operatorTableBytes the operatorTableBytes for the given operatorSet
*/
function calculateOperatorTableBytes(
OperatorSet calldata operatorSet
) external view returns (bytes memory operatorTableBytes);

/**
* @notice Get the operatorInfos for a given operatorSet
* @param operatorSet the operatorSet to get the operatorInfos for
Expand Down
32 changes: 20 additions & 12 deletions src/contracts/interfaces/IECDSATableCalculator.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

import {OperatorSet} from "../libraries/OperatorSetLib.sol";
import "../libraries/OperatorSetLib.sol";
import "./IOperatorTableCalculator.sol";

interface IECDSATableCalculatorTypes {
/**
* @notice A struct that contains information about a single operator
* @param pubkey The address of the operator
* @param pubkey The address of the signing ECDSA key of the operator and not the operator address itself.
* This is read from the KeyRegistrar contract.
* @param weights The weights of the operator for a single operatorSet
* @dev The `weights` array can be defined as a list of arbitrary groupings. For example,
* it can be [slashable_stake, delegated_stake, strategy_i_stake, ...]
Expand All @@ -17,7 +19,22 @@ interface IECDSATableCalculatorTypes {
}
}

interface IECDSATableCalculator is IECDSATableCalculatorTypes {
interface IECDSATableCalculatorEvents {
/// @notice Emitted when the lookahead blocks are set
event LookaheadBlocksSet(uint256 lookaheadBlocks);
}

interface IECDSATableCalculatorErrors {
/// @notice Emitted when the lookahead blocks are too high
error LookaheadBlocksTooHigh();
}

interface IECDSATableCalculator is
IOperatorTableCalculator,
IECDSATableCalculatorTypes,
IECDSATableCalculatorEvents,
IECDSATableCalculatorErrors
{
/**
* @notice calculates the operatorInfos for a given operatorSet
* @param operatorSet the operatorSet to calculate the operator table for
Expand All @@ -27,13 +44,4 @@ interface IECDSATableCalculator is IECDSATableCalculatorTypes {
function calculateOperatorTable(
OperatorSet calldata operatorSet
) external view returns (ECDSAOperatorInfo[] memory operatorInfos);

/**
* @notice calculates the operatorInfos for a given operatorSet
* @param operatorSet the operatorSet to calculate the operator table for
* @return operatorTableBytes the operatorTableBytes for the given operatorSet
*/
function calculateOperatorTableBytes(
OperatorSet calldata operatorSet
) external view returns (bytes memory operatorTableBytes);
}
28 changes: 25 additions & 3 deletions src/contracts/interfaces/IOperatorTableCalculator.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;
pragma solidity ^0.8.27;

import {OperatorSet} from "../libraries/OperatorSetLib.sol";
import "../libraries/OperatorSetLib.sol";

/// @notice A base operator table calculator that all operator table calculators (ECDSA, BN254) must implement
interface IOperatorTableCalculator {
/**
* @notice Calculates the operatorTableBytes for a given operatorSet
* @notice Calculates the operator table for a given operatorSet
* @param operatorSet the operatorSet to calculate the operator table for
* @return operatorTableBytes the operatorTableBytes for the given operatorSet
*/
function calculateOperatorTableBytes(
OperatorSet calldata operatorSet
) external view returns (bytes memory operatorTableBytes);

/**
* @notice Get the operator weights for a given operatorSet based on the slashable stake.
* @param operatorSet The operatorSet to get the weights for
* @return operators The addresses of the operators in the operatorSet
* @return weights The weights for each operator in the operatorSet, this is a 2D array where the first index is the operator
* and the second index is the type of weight. In this case its of length 1 and returns the slashable stake for the operatorSet.
*/
function getOperatorWeights(
OperatorSet calldata operatorSet
) external view returns (address[] memory operators, uint256[][] memory weights);

/**
* @notice Get the weight for a given operator in a given operatorSet based on the slashable stake.
* @param operatorSet The operatorSet to get the weight for
* @param operator The operator to get the weight for
* @return weight The weight for the operator in the operatorSet
*/
function getOperatorWeight(
OperatorSet calldata operatorSet,
address operator
) external view returns (uint256 weight);
}
2 changes: 1 addition & 1 deletion src/contracts/interfaces/IOperatorTableUpdater.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

import {OperatorSet} from "../libraries/OperatorSetLib.sol";
import "../libraries/OperatorSetLib.sol";

import "./IECDSATableCalculator.sol";
import "./IBN254TableCalculator.sol";
Expand Down
10 changes: 6 additions & 4 deletions src/contracts/multichain/BN254CertificateVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ pragma solidity ^0.8.27;

import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol";

import {BN254} from "../libraries/BN254.sol";
import {OperatorSet} from "../libraries/OperatorSetLib.sol";
import {IBN254TableCalculator, IBN254TableCalculatorTypes} from "../interfaces/IBN254TableCalculator.sol";
import {IBN254CertificateVerifier, IBN254CertificateVerifierTypes} from "../interfaces/IBN254CertificateVerifier.sol";
import {IBaseCertificateVerifier} from "../interfaces/IBaseCertificateVerifier.sol";
import {Merkle} from "../libraries/Merkle.sol";
import {OperatorSet} from "../libraries/OperatorSetLib.sol";

import "../interfaces/IBN254TableCalculator.sol";
import "../interfaces/IBN254CertificateVerifier.sol";
import "../interfaces/IBaseCertificateVerifier.sol";
import "./BN254CertificateVerifierStorage.sol";

/**
Expand Down
Loading
Loading