Skip to content
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
debug/
target/


# Local test directories
eigenlayer-bls-local-pr/
eigenlayer-bls-local-test/
4 changes: 3 additions & 1 deletion contracts/script/IncredibleSquaringDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ contract IncredibleSquaringDeployer is Script {

proxyAdmin = UpgradeableProxyLib.deployProxyAdmin();
require(address(incredibleSquaringStrategy) != address(0));
address lstStrategyAddress = vm.envAddress("LST_STRATEGY_ADDRESS");
require(lstStrategyAddress != address(0), "LST_STRATEGY_ADDRESS env var not set or invalid");
incrediblSquaringDeployment = IncredibleSquaringDeploymentLib.deployContracts(
proxyAdmin, configData, 0x7D704507b76571a51d9caE8AdDAbBFd0ba0e63d3, isConfig, deployer
proxyAdmin, configData, lstStrategyAddress, isConfig, deployer
);
console.log("instantSlasher", incrediblSquaringDeployment.slasher);

Expand Down
30 changes: 14 additions & 16 deletions contracts/script/RegisterOperator.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {Test, console} from "forge-std/Test.sol";
import {StdCheats} from "forge-std/StdCheats.sol";
import {Script} from "forge-std/Script.sol";
import {
ISignatureUtilsMixin, ISignatureUtilsMixinTypes
ISignatureUtilsMixin,
ISignatureUtilsMixinTypes
} from "@eigenlayer/contracts/interfaces/ISignatureUtilsMixin.sol";
import {IBLSApkRegistryTypes} from "@eigenlayer-middleware/src/interfaces/IBLSApkRegistry.sol";
import {BN254} from "@eigenlayer-middleware/src/libraries/BN254.sol";
Expand Down Expand Up @@ -69,7 +70,7 @@ contract RegisterOperator is Script {
string memory root = vm.projectRoot();
string memory path = string.concat(root, "/docker/eigenlayer/config.json");
string memory json = vm.readFile(path);

// Read the operator socket address from config using the operator ID
return vm.parseJsonString(json, string.concat("$.operators.", operatorId, ".socketAddress"));
}
Expand Down Expand Up @@ -111,8 +112,8 @@ contract RegisterOperator is Script {
}

function registerOperator(
IRegistryCoordinator registryCoordinator,
address avs,
IRegistryCoordinator registryCoordinator,
address avs,
Operator memory operator,
string memory operatorId
) internal {
Expand All @@ -124,12 +125,10 @@ contract RegisterOperator is Script {
BN254.G1Point memory sig = BN254.scalar_mul(h, operator.blsPrivateKey);

IBLSApkRegistryTypes.PubkeyRegistrationParams memory params = IBLSApkRegistryTypes.PubkeyRegistrationParams({
pubkeyG1: operator.pk1,
pubkeyG2: operator.pk2,
pubkeyRegistrationSignature: sig
pubkeyG1: operator.pk1, pubkeyG2: operator.pk2, pubkeyRegistrationSignature: sig
});
ISlashingRegistryCoordinatorTypes.RegistrationType registrationType =
ISlashingRegistryCoordinatorTypes.RegistrationType.NORMAL;
ISlashingRegistryCoordinatorTypes.RegistrationType.NORMAL;
bytes memory encodedParams = abi.encode(registrationType, socket, params);
uint32[] memory operatorSetIds = new uint32[](1);
operatorSetIds[0] = 0;
Expand All @@ -138,25 +137,24 @@ contract RegisterOperator is Script {
IAllocationManagerTypes.RegisterParams({avs: avs, operatorSetIds: operatorSetIds, data: encodedParams});

IStrategy[] memory strategies = new IStrategy[](1);
strategies[0] = IStrategy(LST_STRATEGY_ADDRESS_HOLESKY);
address lstStrategyAddress = vm.envAddress("LST_STRATEGY_ADDRESS");
require(lstStrategyAddress != address(0), "LST_STRATEGY_ADDRESS env var not set or invalid");
strategies[0] = IStrategy(lstStrategyAddress);
uint64[] memory newMagnitudes = new uint64[](1);
// Ref: https://github.com/Layr-Labs/eigenlayer-contracts/blob/734f7361884d24fe51961b342e93dde1290961d0/src/contracts/libraries/SlashingLib.sol#L12
// 1e18 is 100%
newMagnitudes[0] = 1e18;

IAllocationManagerTypes.AllocateParams[] memory allocationMods = new IAllocationManagerTypes.AllocateParams[](1);
allocationMods[0] = IAllocationManagerTypes.AllocateParams({
operatorSet: OperatorSet({avs: avs, id: 0}),
strategies: strategies,
newMagnitudes: newMagnitudes
operatorSet: OperatorSet({avs: avs, id: 0}), strategies: strategies, newMagnitudes: newMagnitudes
});
IAllocationManager(registryCoordinator.allocationManager()).modifyAllocations(operator.operator, allocationMods);

vm.roll(block.number + 1); // Workaround for testnet, txs can't be in the same block

IAllocationManager(registryCoordinator.allocationManager()).registerForOperatorSets(
operator.operator, registerParams
);
IAllocationManager(registryCoordinator.allocationManager())
.registerForOperatorSets(operator.operator, registerParams);
}

function _newOperatorRegistrationSignature(Operator memory operator, address avs, bytes32 salt, uint256 expiry)
Expand All @@ -171,4 +169,4 @@ contract RegisterOperator is Script {
bytes memory signature = abi.encodePacked(r, s, v);
return ISignatureUtilsMixinTypes.SignatureWithSaltAndExpiry({signature: signature, salt: salt, expiry: expiry});
}
}
}
29 changes: 15 additions & 14 deletions contracts/script/SetupMiddleware.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ contract SetupMiddleware is Script {

QuorumConfig memory config = readQuorumConfig();

address operatorSetStrategy = 0x7D704507b76571a51d9caE8AdDAbBFd0ba0e63d3;
address operatorSetStrategy = vm.envAddress("LST_STRATEGY_ADDRESS");
require(operatorSetStrategy != address(0), "LST_STRATEGY_ADDRESS env var not set or invalid");
string memory metadataURI = config.metadataURI;

IAllocationManager(coreData.allocationManager).updateAVSMetadataURI(
deploymentData.incredibleSquaringServiceManager, metadataURI
);
IAllocationManager(coreData.allocationManager)
.updateAVSMetadataURI(deploymentData.incredibleSquaringServiceManager, metadataURI);
IStrategy[] memory strategies = new IStrategy[](1);
strategies[0] = IStrategy(operatorSetStrategy);

Expand All @@ -77,16 +77,17 @@ contract SetupMiddleware is Script {
strategyParamsArray[i] = IStakeRegistryTypes.StrategyParams({strategy: strategies[i], multiplier: 1 ether});
}

ISlashingRegistryCoordinator(deploymentData.slashingRegistryCoordinator).createSlashableStakeQuorum(
ISlashingRegistryCoordinatorTypes.OperatorSetParam({
maxOperatorCount: config.maxOperatorCount,
kickBIPsOfOperatorStake: config.kickBIPsOfOperatorStake,
kickBIPsOfTotalStake: config.kickBIPsOfTotalStake
}),
config.minimumStake,
strategyParamsArray,
0
);
ISlashingRegistryCoordinator(deploymentData.slashingRegistryCoordinator)
.createSlashableStakeQuorum(
ISlashingRegistryCoordinatorTypes.OperatorSetParam({
maxOperatorCount: config.maxOperatorCount,
kickBIPsOfOperatorStake: config.kickBIPsOfOperatorStake,
kickBIPsOfTotalStake: config.kickBIPsOfTotalStake
}),
config.minimumStake,
strategyParamsArray,
0
);

vm.stopBroadcast();
}
Expand Down
Loading