Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
26 changes: 26 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,17 @@ contract ExistingDeploymentParser is Script, Logger {
EigenStrategy public eigenStrategy;
EigenStrategy public eigenStrategyImpl;

/// @dev Multichain
IKeyRegistrar public keyRegistrar;
IKeyRegistrar public keyRegistrarImplementation;
IBN254CertificateVerifier public bn254CertificateVerifier;
IBN254CertificateVerifier public bn254CertificateVerifierImplementation;
IECDSACertificateVerifier public ecdsaCertificateVerifier;
IECDSACertificateVerifier public ecdsaCertificateVerifierImplementation;
BN254TableCalculator public bn254TableCalculator;
IOperatorTableUpdater public operatorTableUpdater;
IOperatorTableUpdater public operatorTableUpdaterImplementation;

/// -----------------------------------------------------------------------
/// Storage
/// -----------------------------------------------------------------------
Expand Down Expand Up @@ -295,6 +313,14 @@ contract ExistingDeploymentParser is Script, Logger {
bEIGENImpl = IBackingEigen(json.readAddress(".addresses.token.bEIGENImpl"));
eigenStrategy = EigenStrategy(json.readAddress(".addresses.token.eigenStrategy"));
eigenStrategyImpl = EigenStrategy(json.readAddress(".addresses.token.eigenStrategyImpl"));

// multichain
keyRegistrar = IKeyRegistrar(json.readAddress(".addresses.multichain.keyRegistrar"));
bn254CertificateVerifier =
IBN254CertificateVerifier(json.readAddress(".addresses.multichain.bn254CertificateVerifier"));
ecdsaCertificateVerifier =
IECDSACertificateVerifier(json.readAddress(".addresses.multichain.ecdsaCertificateVerifier"));
operatorTableUpdater = IOperatorTableUpdater(json.readAddress(".addresses.multichain.operatorTableUpdater"));
}

function _parseDeployedEigenPods(
Expand Down
12 changes: 12 additions & 0 deletions src/contracts/interfaces/IKeyRegistrar.sol
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,16 @@ interface IKeyRegistrar is IKeyRegistrarErrors, IKeyRegistrarEvents, ISemVerMixi
* @return keyHash The key hash
*/
function getKeyHash(OperatorSet memory operatorSet, address operator) external view returns (bytes32);

/**
* @notice Gets the BN254 key registration EIP-712 typehash
* @return The BN254 key registration typehash
*/
function BN254_KEY_REGISTRATION_TYPEHASH() external view returns (bytes32);

/**
* @notice Gets the ECDSA key registration EIP-712 typehash
* @return The ECDSA key registration typehash
*/
function ECDSA_KEY_REGISTRATION_TYPEHASH() external view returns (bytes32);
}
5 changes: 3 additions & 2 deletions src/contracts/multichain/BN254TableCalculator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ contract BN254TableCalculator is IBN254TableCalculator {
/// @notice AllocationManager contract for managing operator allocations
IAllocationManager public immutable allocationManager;
/// @notice The default lookahead blocks for the slashable stake lookup
uint256 public constant LOOKAHEAD_BLOCKS = 100_800;
uint256 public immutable LOOKAHEAD_BLOCKS;

constructor(IKeyRegistrar _keyRegistrar, IAllocationManager _allocationManager) {
constructor(IKeyRegistrar _keyRegistrar, IAllocationManager _allocationManager, uint256 _LOOKAHEAD_BLOCKS) {
keyRegistrar = _keyRegistrar;
allocationManager = _allocationManager;
LOOKAHEAD_BLOCKS = _LOOKAHEAD_BLOCKS;
}

/// @inheritdoc IBN254TableCalculator
Expand Down
24 changes: 24 additions & 0 deletions src/test/integration/IntegrationBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,30 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter {
++numAVSs;
}

function _newRandomAVS_WithBN254() internal returns (AVS avs, OperatorSet[] memory operatorSets) {
string memory avsName = string.concat("avs", numAVSs.toString());
avs = _genRandAVS(avsName);
avs.updateAVSMetadataURI("https://example.com");
operatorSets = avs.createOperatorSets(_randomStrategies());

for (uint i = 0; i < operatorSets.length; i++) {
avs.configureOperatorSet(operatorSets[i], IKeyRegistrarTypes.CurveType.BN254);
}
++numAVSs;
}

function _newRandomAVS_WithECDSA() internal returns (AVS avs, OperatorSet[] memory operatorSets) {
string memory avsName = string.concat("avs", numAVSs.toString());
avs = _genRandAVS(avsName);
avs.updateAVSMetadataURI("https://example.com");
operatorSets = avs.createOperatorSets(_randomStrategies());

for (uint i = 0; i < operatorSets.length; i++) {
avs.configureOperatorSet(operatorSets[i], IKeyRegistrarTypes.CurveType.ECDSA);
}
++numAVSs;
}

/// @dev Send a random amount of ETH (up to 10 gwei) to the destination via `call`,
/// triggering its fallback function. Sends a gwei-divisible amount as well as a
/// non-gwei-divisible amount.
Expand Down
28 changes: 28 additions & 0 deletions src/test/integration/IntegrationDeployer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ abstract contract IntegrationDeployer is ExistingDeploymentParser {
DELEGATION_MANAGER_MIN_WITHDRAWAL_DELAY_BLOCKS = 50;
DEALLOCATION_DELAY = 50;
ALLOCATION_CONFIGURATION_DELAY = 75;
BN254_TABLE_CALCULATOR_LOOKAHEAD_BLOCKS = 50;

REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS = 86_400;
REWARDS_COORDINATOR_MAX_REWARDS_DURATION = 6_048_000;
Expand Down Expand Up @@ -318,6 +319,15 @@ abstract contract IntegrationDeployer is ExistingDeploymentParser {
SlashEscrowFactory(address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), "")));
eigenPodBeacon = new UpgradeableBeacon(address(emptyContract));
strategyBeacon = new UpgradeableBeacon(address(emptyContract));

// multichain
keyRegistrar = KeyRegistrar(address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), "")));
bn254CertificateVerifier =
BN254CertificateVerifier(address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), "")));
// TODO: add ecdsaCertificateVerifier
// ecdsaCertificateVerifier = IECDSACertificateVerifier(address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), "")));
operatorTableUpdater =
OperatorTableUpdater(address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), "")));
}

/// Deploy an implementation contract for each contract in the system
Expand Down Expand Up @@ -364,6 +374,14 @@ abstract contract IntegrationDeployer is ExistingDeploymentParser {

// Pre-longtail StrategyBaseTVLLimits implementation
// TODO - need to update ExistingDeploymentParser

// multichain
keyRegistrarImplementation = new KeyRegistrar(permissionController, allocationManager, "9.9.9");
bn254CertificateVerifierImplementation = new BN254CertificateVerifier(address(operatorTableUpdater));
bn254TableCalculator = new BN254TableCalculator(keyRegistrar, allocationManager, BN254_TABLE_CALCULATOR_LOOKAHEAD_BLOCKS);
// TODO: add ecdsaCertificateVerifier
// ecdsaCertificateVerifierImplementation = new ECDSACertificateVerifier(keyRegistrar, allocationManager, "9.9.9");
operatorTableUpdaterImplementation = new OperatorTableUpdater(bn254CertificateVerifier, ecdsaCertificateVerifier, "9.9.9");
}

function _upgradeProxies() public noTracing {
Expand Down Expand Up @@ -423,6 +441,16 @@ abstract contract IntegrationDeployer is ExistingDeploymentParser {
ITransparentUpgradeableProxy(payable(address(deployedStrategyArray[i]))), address(baseStrategyImplementation)
);
}

// multichain
// TODO: add ecdsaCertificateVerifier
eigenLayerProxyAdmin.upgrade(ITransparentUpgradeableProxy(payable(address(keyRegistrar))), address(keyRegistrarImplementation));
eigenLayerProxyAdmin.upgrade(
ITransparentUpgradeableProxy(payable(address(bn254CertificateVerifier))), address(bn254CertificateVerifierImplementation)
);
eigenLayerProxyAdmin.upgrade(
ITransparentUpgradeableProxy(payable(address(operatorTableUpdater))), address(operatorTableUpdaterImplementation)
);
}

function _initializeProxies() public noTracing {
Expand Down
Loading
Loading