From d38cc442206200806bb0346a61ef781f83354dad Mon Sep 17 00:00:00 2001 From: "clandestine.eth" <96172957+0xClandestine@users.noreply.github.com> Date: Wed, 8 Oct 2025 16:37:27 -0400 Subject: [PATCH 1/3] foundryup --install v1.4.0 + make fmt --- .../deploy/devnet/deploy_from_scratch.s.sol | 8 +- .../local/deploy_from_scratch.slashing.s.sol | 8 +- .../multichain/create_generator_config.s.sol | 11 +- .../multichain/deploy_generator.s.sol.sol | 18 +- .../update-generator/1-updateGenerator.s.sol | 6 +- script/releases/CrosschainDeployLib.sol | 18 +- script/releases/Env.sol | 15 +- .../1-deploySourceChain.s.sol | 10 +- .../2-deployDestinationChainProxies.s.sol | 9 +- .../3-deployDestinationChainImpls.s.sol | 6 +- ...4-instantiateDestinationChainProxies.s.sol | 10 +- .../2-queueTaskMailboxUpgrade.s.sol | 25 +- .../3-executeTaskMailboxUpgrade.s.sol | 12 +- script/tasks/allocate_operatorSet.s.sol | 4 +- script/tasks/deposit_into_strategy.s.sol | 7 +- script/tasks/register_as_operator.s.sol | 6 +- .../register_operator_to_operatorSet.s.sol | 6 +- script/tasks/withdraw_from_strategy.s.sol | 11 +- script/utils/ExistingDeploymentParser.sol | 12 +- src/contracts/avs/task/TaskMailbox.sol | 61 ++--- src/contracts/avs/task/TaskMailboxStorage.sol | 6 +- src/contracts/core/AVSDirectory.sol | 11 +- src/contracts/core/AllocationManager.sol | 84 +++++-- .../core/AllocationManagerStorage.sol | 3 +- src/contracts/core/DelegationManager.sol | 99 ++++---- src/contracts/core/ReleaseManager.sol | 10 +- src/contracts/core/RewardsCoordinator.sol | 46 +++- src/contracts/core/StrategyManager.sol | 32 ++- src/contracts/core/StrategyManagerStorage.sol | 5 +- src/contracts/interfaces/IAVSDirectory.sol | 13 +- src/contracts/interfaces/IAVSRegistrar.sol | 6 +- src/contracts/interfaces/IAVSTaskHook.sol | 10 +- .../interfaces/IAllocationManager.sol | 62 +++-- .../interfaces/IBN254CertificateVerifier.sol | 1 - src/contracts/interfaces/IBackingEigen.sol | 20 +- .../interfaces/IBaseCertificateVerifier.sol | 1 - .../interfaces/ICrossChainRegistry.sol | 10 +- .../interfaces/IDelegationManager.sol | 25 +- .../interfaces/IECDSACertificateVerifier.sol | 1 - src/contracts/interfaces/IEigen.sol | 10 +- src/contracts/interfaces/IEigenPod.sol | 18 +- src/contracts/interfaces/IEigenPodManager.sol | 6 +- src/contracts/interfaces/IKeyRegistrar.sol | 30 ++- .../interfaces/IOperatorTableCalculator.sol | 1 - .../interfaces/IOperatorTableUpdater.sol | 5 +- .../interfaces/IPermissionController.sol | 52 ++++- src/contracts/interfaces/IReleaseManager.sol | 16 +- .../interfaces/IRewardsCoordinator.sol | 57 ++++- src/contracts/interfaces/IShareManager.sol | 18 +- src/contracts/interfaces/IStrategy.sol | 11 +- src/contracts/interfaces/IStrategyManager.sol | 5 +- src/contracts/interfaces/ITaskMailbox.sol | 24 +- src/contracts/libraries/BN254.sol | 24 +- .../libraries/BN254SignatureVerifier.sol | 26 +-- src/contracts/libraries/BeaconChainProofs.sol | 30 +-- src/contracts/libraries/Merkle.sol | 10 +- src/contracts/libraries/OperatorSetLib.sol | 7 +- src/contracts/libraries/SlashingLib.sol | 38 +++- src/contracts/libraries/Snapshots.sol | 38 +++- src/contracts/mixins/SignatureUtilsMixin.sol | 8 +- .../multichain/BN254CertificateVerifier.sol | 22 +- .../multichain/CrossChainRegistry.sol | 5 +- .../multichain/CrossChainRegistryStorage.sol | 5 +- .../multichain/ECDSACertificateVerifier.sol | 5 +- .../ECDSACertificateVerifierStorage.sol | 3 +- .../multichain/OperatorTableUpdater.sol | 22 +- src/contracts/permissions/KeyRegistrar.sol | 30 ++- src/contracts/permissions/Pausable.sol | 1 - src/contracts/permissions/PauserRegistry.sol | 15 +- .../permissions/PermissionController.sol | 43 +++- src/contracts/pods/EigenPod.sol | 25 +- src/contracts/pods/EigenPodManager.sol | 15 +- src/contracts/pods/EigenPodManagerStorage.sol | 7 +- src/contracts/strategies/EigenStrategy.sol | 16 +- src/contracts/strategies/StrategyBase.sol | 11 +- .../strategies/StrategyBaseTVLLimits.sol | 15 +- src/contracts/strategies/StrategyFactory.sol | 5 +- src/contracts/token/BackingEigen.sol | 36 ++- src/contracts/token/Eigen.sol | 26 ++- src/test/DevnetLifecycle.t.sol | 10 +- src/test/integration/IntegrationBase.t.sol | 52 ++--- src/test/integration/IntegrationChecks.t.sol | 13 +- .../integration/IntegrationDeployer.t.sol | 4 +- .../MultichainIntegrationBase.t.sol | 25 +- .../MultichainIntegrationChecks.t.sol | 5 +- .../mainnet/BeaconChainProofs.sol | 10 +- .../mainnet/IEigenPod.sol | 2 - .../mainnet/IStrategyManager.sol | 6 +- .../integration/mocks/BeaconChainMock.t.sol | 12 +- .../integration/mocks/EIP_7002_Mock.t.sol | 4 +- .../integration/mocks/EIP_7251_Mock.t.sol | 4 +- src/test/integration/mocks/LibProofGen.t.sol | 12 +- .../Deposit_Delegate_Queue_Complete.t.sol | 1 - .../Deposit_Delegate_UpdateBalance.t.sol | 126 +++++------ src/test/integration/users/User.t.sol | 38 ++-- src/test/mocks/AllocationManagerMock.sol | 6 +- .../mocks/BN254CertificateVerifierMock.sol | 3 +- src/test/mocks/DelegationManagerMock.sol | 12 +- src/test/mocks/ERC20Mock.sol | 20 +- src/test/mocks/ETHDepositMock.sol | 3 +- src/test/mocks/EigenPodManagerMock.sol | 9 +- src/test/mocks/MockAVSRegistrar.sol | 2 +- src/test/mocks/MockAVSTaskHook.sol | 32 ++- .../mocks/MockBN254CertificateVerifier.sol | 75 ++++-- .../MockBN254CertificateVerifierFailure.sol | 75 ++++-- .../mocks/MockECDSACertificateVerifier.sol | 70 ++++-- .../MockECDSACertificateVerifierFailure.sol | 70 ++++-- src/test/mocks/MockERC20.sol | 4 +- src/test/mocks/StrategyManagerMock.sol | 8 +- src/test/unit/AVSDirectoryUnit.t.sol | 5 +- src/test/unit/AllocationManagerUnit.t.sol | 140 ++++-------- .../unit/BN254CertificateVerifierUnit.t.sol | 63 ++++-- src/test/unit/DelegationUnit.t.sol | 214 ++++++------------ .../unit/ECDSACertificateVerifierUnit.t.sol | 24 +- src/test/unit/EigenPodManagerUnit.t.sol | 4 +- src/test/unit/EigenPodUnit.t.sol | 58 ++--- src/test/unit/KeyRegistrarUnit.t.sol | 7 +- src/test/unit/OperatorTableUpdaterUnit.t.sol | 5 +- src/test/unit/ReleaseManagerUnit.t.sol | 3 +- src/test/unit/RewardsCoordinatorUnit.t.sol | 28 +-- src/test/unit/StrategyFactoryUnit.t.sol | 4 +- src/test/unit/StrategyManagerUnit.t.sol | 2 +- src/test/unit/TaskMailboxUnit.t.sol | 79 +++---- src/test/utils/BytesLib.sol | 2 +- src/test/utils/EigenPodUser.t.sol | 6 +- src/test/utils/Random.sol | 1 - 126 files changed, 1700 insertions(+), 1107 deletions(-) diff --git a/script/deploy/devnet/deploy_from_scratch.s.sol b/script/deploy/devnet/deploy_from_scratch.s.sol index f196d06e9c..f85f228b02 100644 --- a/script/deploy/devnet/deploy_from_scratch.s.sol +++ b/script/deploy/devnet/deploy_from_scratch.s.sol @@ -507,15 +507,15 @@ contract DeployFromScratch is Script, Test { ); require( eigenLayerProxyAdmin.getProxyImplementation( - ITransparentUpgradeableProxy(payable(address(rewardsCoordinator))) - ) == address(rewardsCoordinatorImplementation), + ITransparentUpgradeableProxy(payable(address(rewardsCoordinator))) + ) == address(rewardsCoordinatorImplementation), "rewardsCoordinator: implementation set incorrectly" ); require( eigenLayerProxyAdmin.getProxyImplementation( - ITransparentUpgradeableProxy(payable(address(allocationManager))) - ) == address(allocationManagerImplementation), + ITransparentUpgradeableProxy(payable(address(allocationManager))) + ) == address(allocationManagerImplementation), "allocationManager: implementation set incorrectly" ); diff --git a/script/deploy/local/deploy_from_scratch.slashing.s.sol b/script/deploy/local/deploy_from_scratch.slashing.s.sol index 49022cdef1..37d4edb402 100644 --- a/script/deploy/local/deploy_from_scratch.slashing.s.sol +++ b/script/deploy/local/deploy_from_scratch.slashing.s.sol @@ -513,15 +513,15 @@ contract DeployFromScratch is Script, Test { ); require( eigenLayerProxyAdmin.getProxyImplementation( - ITransparentUpgradeableProxy(payable(address(rewardsCoordinator))) - ) == address(rewardsCoordinatorImplementation), + ITransparentUpgradeableProxy(payable(address(rewardsCoordinator))) + ) == address(rewardsCoordinatorImplementation), "rewardsCoordinator: implementation set incorrectly" ); require( eigenLayerProxyAdmin.getProxyImplementation( - ITransparentUpgradeableProxy(payable(address(allocationManager))) - ) == address(allocationManagerImplementation), + ITransparentUpgradeableProxy(payable(address(allocationManager))) + ) == address(allocationManagerImplementation), "allocationManager: implementation set incorrectly" ); diff --git a/script/deploy/multichain/create_generator_config.s.sol b/script/deploy/multichain/create_generator_config.s.sol index 82cefc2075..ed8a8a7b71 100644 --- a/script/deploy/multichain/create_generator_config.s.sol +++ b/script/deploy/multichain/create_generator_config.s.sol @@ -16,7 +16,11 @@ contract CreateGeneratorConfig is Script, Test { using Merkle for bytes32[]; using BN254 for BN254.G1Point; - function run(string memory network, uint256 xCoord, uint256 yCoord) public { + function run( + string memory network, + uint256 xCoord, + uint256 yCoord + ) public { // Network must be preprod, testnet-sepolia, or mainnet require( _strEq(network, "preprod") || _strEq(network, "testnet-sepolia") || _strEq(network, "mainnet"), @@ -113,7 +117,10 @@ contract CreateGeneratorConfig is Script, Test { vm.writeToml(finalJson, outputPath); } - function _strEq(string memory a, string memory b) internal pure returns (bool) { + function _strEq( + string memory a, + string memory b + ) internal pure returns (bool) { return keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b)); } diff --git a/script/deploy/multichain/deploy_generator.s.sol.sol b/script/deploy/multichain/deploy_generator.s.sol.sol index efbacddede..ddd79f6017 100644 --- a/script/deploy/multichain/deploy_generator.s.sol.sol +++ b/script/deploy/multichain/deploy_generator.s.sol.sol @@ -19,7 +19,10 @@ contract DeployGenerator is Script, Test { using Merkle for bytes32[]; using BN254 for BN254.G1Point; - function run(string memory network, string memory salt) public { + function run( + string memory network, + string memory salt + ) public { /** * * WALLET CREATION @@ -58,8 +61,7 @@ contract DeployGenerator is Script, Test { operatorInfoLeaves[0] = keccak256( abi.encode( IOperatorTableCalculatorTypes.BN254OperatorInfo({ - pubkey: operator.signingKey.publicKeyG1, - weights: weights + pubkey: operator.signingKey.publicKeyG1, weights: weights }) ) ); @@ -84,7 +86,10 @@ contract DeployGenerator is Script, Test { _writeOperatorData(operator, network); } - function _writeOperatorData(Operator memory operator, string memory network) internal { + function _writeOperatorData( + Operator memory operator, + string memory network + ) internal { string memory operator_object = "operator"; // Serialize regular wallet info @@ -162,7 +167,10 @@ contract DeployGenerator is Script, Test { vm.writeToml(finalJson, outputPath); } - function _strEq(string memory a, string memory b) internal pure returns (bool) { + function _strEq( + string memory a, + string memory b + ) internal pure returns (bool) { return keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b)); } diff --git a/script/operations/update-generator/1-updateGenerator.s.sol b/script/operations/update-generator/1-updateGenerator.s.sol index 2d7fec2213..849f3da1d7 100644 --- a/script/operations/update-generator/1-updateGenerator.s.sol +++ b/script/operations/update-generator/1-updateGenerator.s.sol @@ -84,8 +84,10 @@ contract QueueTransferProxyAdmin is MultisigBuilder { "certificateVerifier.operatorSetOwner invalid" ); // Get the operatorSetInfo - IOperatorTableCalculatorTypes.BN254OperatorSetInfo memory operatorSetInfo = certificateVerifier - .getOperatorSetInfo(generatorParams.generator, operatorTableUpdater.GENERATOR_REFERENCE_TIMESTAMP()); + IOperatorTableCalculatorTypes.BN254OperatorSetInfo memory operatorSetInfo = + certificateVerifier.getOperatorSetInfo( + generatorParams.generator, operatorTableUpdater.GENERATOR_REFERENCE_TIMESTAMP() + ); assertEq( operatorSetInfo.numOperators, generatorParams.generatorInfo.numOperators, diff --git a/script/releases/CrosschainDeployLib.sol b/script/releases/CrosschainDeployLib.sol index 3050571cc8..075ef6a057 100644 --- a/script/releases/CrosschainDeployLib.sol +++ b/script/releases/CrosschainDeployLib.sol @@ -8,7 +8,10 @@ import "src/test/mocks/EmptyContract.sol"; ICreateX constant createx = ICreateX(0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed); interface ICreateX { - function deployCreate2(bytes32 salt, bytes memory initCode) external payable returns (address newContract); + function deployCreate2( + bytes32 salt, + bytes memory initCode + ) external payable returns (address newContract); function computeCreate2Address( bytes32 salt, bytes32 initCodeHash @@ -44,7 +47,7 @@ library CrosschainDeployLib { * ```solidity * bytes11 salt = bytes11(uint88(0xffffffffffffffffffffff)); * address emptyContract = type(EmptyContract).creationCode.deployCrosschain(deployer); - * address proxy = emptyContract.deployCrosschainProxy(deployer, salt); + * address proxy = emptyContract.deployCrosschainProxy(deployer, salt); * ITransparentUpgradeableProxy(address(proxy)).upgradeTo(address(implementation)); * ITransparentUpgradeableProxy(address(proxy)).changeAdmin(address(admin)); * ``` @@ -67,7 +70,11 @@ library CrosschainDeployLib { * type(EmptyContract).creationCode.deployCrosschain(deployer, EMPTY_CONTRACT_SALT) * ``` */ - function _deployCrosschain(address deployer, bytes memory initCode, string memory name) private returns (address) { + function _deployCrosschain( + address deployer, + bytes memory initCode, + string memory name + ) private returns (address) { return createx.deployCreate2(computeProtectedSalt(deployer, name), initCode); } @@ -81,7 +88,10 @@ library CrosschainDeployLib { * @dev The salt is structured as: Deployer EOA (20 bytes) | Cross-chain flag (1 byte) | Entropy (11 bytes) * @dev Example: 0xbebebebebebebebebebebebebebebebebebebebe|ff|1212121212121212121212 */ - function computeProtectedSalt(address deployer, string memory name) internal pure returns (bytes32) { + function computeProtectedSalt( + address deployer, + string memory name + ) internal pure returns (bytes32) { return bytes32( bytes.concat( bytes20(deployer), diff --git a/script/releases/Env.sol b/script/releases/Env.sol index 7a5410c944..f55f70bf97 100644 --- a/script/releases/Env.sol +++ b/script/releases/Env.sol @@ -373,7 +373,10 @@ library Env { } // Returns the proxy instance at index `i` - function strategyBaseTVLLimits(DeployedInstance, uint256 i) internal view returns (StrategyBaseTVLLimits) { + function strategyBaseTVLLimits( + DeployedInstance, + uint256 i + ) internal view returns (StrategyBaseTVLLimits) { return StrategyBaseTVLLimits(_deployedInstance(type(StrategyBaseTVLLimits).name, i)); } @@ -494,7 +497,10 @@ library Env { /** * Helpers */ - function _deployedInstance(string memory name, uint256 idx) private view returns (address) { + function _deployedInstance( + string memory name, + uint256 idx + ) private view returns (address) { return ZEnvHelpers.state().deployedInstance(name, idx); } @@ -585,7 +591,10 @@ library Env { return ProxyAdmin(Env.proxyAdmin()).getProxyAdmin(ITransparentUpgradeableProxy(_proxy)); } - function _strEq(string memory a, string memory b) internal pure returns (bool) { + function _strEq( + string memory a, + string memory b + ) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } } diff --git a/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/1-deploySourceChain.s.sol b/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/1-deploySourceChain.s.sol index 6587331d54..970ced2965 100644 --- a/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/1-deploySourceChain.s.sol +++ b/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/1-deploySourceChain.s.sol @@ -252,11 +252,17 @@ contract DeploySourceChain is EOADeployer { // ReleaseManager and KeyRegistrar don't have initialize functions } - function _assertTrue(bool b, string memory err) private pure { + function _assertTrue( + bool b, + string memory err + ) private pure { assertTrue(b, err); } - function _assertFalse(bool b, string memory err) private pure { + function _assertFalse( + bool b, + string memory err + ) private pure { assertFalse(b, err); } diff --git a/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/2-deployDestinationChainProxies.s.sol b/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/2-deployDestinationChainProxies.s.sol index 5ac183826d..49260f8798 100644 --- a/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/2-deployDestinationChainProxies.s.sol +++ b/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/2-deployDestinationChainProxies.s.sol @@ -177,11 +177,12 @@ contract DeployDestinationChainProxies is MultisigBuilder { } /// @dev Compute the expected proxy address for a given name and empty contract - function _computeExpectedProxyAddress(string memory name, address emptyContract) internal view returns (address) { + function _computeExpectedProxyAddress( + string memory name, + address emptyContract + ) internal view returns (address) { return CrosschainDeployLib.computeCrosschainUpgradeableProxyAddress({ - adminAndDeployer: Env.multichainDeployerMultisig(), - implementation: emptyContract, - name: name + adminAndDeployer: Env.multichainDeployerMultisig(), implementation: emptyContract, name: name }); } diff --git a/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/3-deployDestinationChainImpls.s.sol b/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/3-deployDestinationChainImpls.s.sol index 4dd95dfb57..0019b1225c 100644 --- a/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/3-deployDestinationChainImpls.s.sol +++ b/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/3-deployDestinationChainImpls.s.sol @@ -47,8 +47,7 @@ contract DeployDestinationChainImpls is EOADeployer, DeployDestinationChainProxi name: type(ECDSACertificateVerifier).name, deployedTo: address( new ECDSACertificateVerifier({ - _operatorTableUpdater: Env.proxy.operatorTableUpdater(), - _version: Env.deployVersion() + _operatorTableUpdater: Env.proxy.operatorTableUpdater(), _version: Env.deployVersion() }) ) }); @@ -58,8 +57,7 @@ contract DeployDestinationChainImpls is EOADeployer, DeployDestinationChainProxi name: type(BN254CertificateVerifier).name, deployedTo: address( new BN254CertificateVerifier({ - _operatorTableUpdater: Env.proxy.operatorTableUpdater(), - _version: Env.deployVersion() + _operatorTableUpdater: Env.proxy.operatorTableUpdater(), _version: Env.deployVersion() }) ) }); diff --git a/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/4-instantiateDestinationChainProxies.s.sol b/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/4-instantiateDestinationChainProxies.s.sol index d5113b2653..680f6f04da 100644 --- a/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/4-instantiateDestinationChainProxies.s.sol +++ b/script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/4-instantiateDestinationChainProxies.s.sol @@ -364,11 +364,17 @@ contract InstantiateDestinationChainProxies is DeployDestinationChainImpls { // ECDSACertificateVerifier and BN254CertificateVerifier don't have initialize functions } - function _assertTrue(bool b, string memory err) private pure { + function _assertTrue( + bool b, + string memory err + ) private pure { assertTrue(b, err); } - function _assertFalse(bool b, string memory err) private pure { + function _assertFalse( + bool b, + string memory err + ) private pure { assertFalse(b, err); } diff --git a/script/releases/v1.8.1-hourglass-testnet-replay-fix/2-queueTaskMailboxUpgrade.s.sol b/script/releases/v1.8.1-hourglass-testnet-replay-fix/2-queueTaskMailboxUpgrade.s.sol index 80bba7a02a..15e317db1e 100644 --- a/script/releases/v1.8.1-hourglass-testnet-replay-fix/2-queueTaskMailboxUpgrade.s.sol +++ b/script/releases/v1.8.1-hourglass-testnet-replay-fix/2-queueTaskMailboxUpgrade.s.sol @@ -37,7 +37,11 @@ contract QueueTaskMailboxUpgrade is MultisigBuilder, DeployTaskMailboxImpl { } /// @dev Get the calldata to be sent from the timelock to the executor - function _getCalldataToExecutor() internal returns (bytes memory) { + function _getCalldataToExecutor() + internal + returns (bytes memory) + { + /// forgefmt: disable-next-item MultisigCall[] storage executorCalls = Encode.newMultisigCalls().append({ to: Env.proxyAdmin(), @@ -47,12 +51,13 @@ contract QueueTaskMailboxUpgrade is MultisigBuilder, DeployTaskMailboxImpl { }) }); - return Encode.gnosisSafe.execTransaction({ - from: address(Env.timelockController()), - to: Env.multiSendCallOnly(), - op: Encode.Operation.DelegateCall, - data: Encode.multiSend(executorCalls) - }); + return Encode.gnosisSafe + .execTransaction({ + from: address(Env.timelockController()), + to: Env.multiSendCallOnly(), + op: Encode.Operation.DelegateCall, + data: Encode.multiSend(executorCalls) + }); } function testScript() public virtual override { @@ -66,11 +71,7 @@ contract QueueTaskMailboxUpgrade is MultisigBuilder, DeployTaskMailboxImpl { TimelockController timelock = Env.timelockController(); bytes memory calldata_to_executor = _getCalldataToExecutor(); bytes32 txHash = timelock.hashOperation({ - target: Env.executorMultisig(), - value: 0, - data: calldata_to_executor, - predecessor: 0, - salt: 0 + target: Env.executorMultisig(), value: 0, data: calldata_to_executor, predecessor: 0, salt: 0 }); // Check that the upgrade does not exist in the timelock diff --git a/script/releases/v1.8.1-hourglass-testnet-replay-fix/3-executeTaskMailboxUpgrade.s.sol b/script/releases/v1.8.1-hourglass-testnet-replay-fix/3-executeTaskMailboxUpgrade.s.sol index 92139ba38d..5728971ec3 100644 --- a/script/releases/v1.8.1-hourglass-testnet-replay-fix/3-executeTaskMailboxUpgrade.s.sol +++ b/script/releases/v1.8.1-hourglass-testnet-replay-fix/3-executeTaskMailboxUpgrade.s.sol @@ -24,11 +24,7 @@ contract ExecuteTaskMailboxUpgrade is QueueTaskMailboxUpgrade { TimelockController timelock = Env.timelockController(); timelock.execute({ - target: Env.executorMultisig(), - value: 0, - payload: calldata_to_executor, - predecessor: 0, - salt: 0 + target: Env.executorMultisig(), value: 0, payload: calldata_to_executor, predecessor: 0, salt: 0 }); } @@ -43,11 +39,7 @@ contract ExecuteTaskMailboxUpgrade is QueueTaskMailboxUpgrade { TimelockController timelock = Env.timelockController(); bytes memory calldata_to_executor = _getCalldataToExecutor(); bytes32 txHash = timelock.hashOperation({ - target: Env.executorMultisig(), - value: 0, - data: calldata_to_executor, - predecessor: 0, - salt: 0 + target: Env.executorMultisig(), value: 0, data: calldata_to_executor, predecessor: 0, salt: 0 }); // 2 - Queue. Check that the operation IS ready diff --git a/script/tasks/allocate_operatorSet.s.sol b/script/tasks/allocate_operatorSet.s.sol index f6e41aa3cb..37f1363442 100644 --- a/script/tasks/allocate_operatorSet.s.sol +++ b/script/tasks/allocate_operatorSet.s.sol @@ -48,9 +48,7 @@ contract AllocateOperatorSet is Script, Test { // Define a single MagnitudeAllocation and wrap it in an array IAllocationManagerTypes.AllocateParams[] memory allocations = new IAllocationManagerTypes.AllocateParams[](1); allocations[0] = IAllocationManagerTypes.AllocateParams({ - operatorSet: sets[0], - strategies: strategies, - newMagnitudes: magnitudes + operatorSet: sets[0], strategies: strategies, newMagnitudes: magnitudes }); // Perform allocation diff --git a/script/tasks/deposit_into_strategy.s.sol b/script/tasks/deposit_into_strategy.s.sol index c8256ffeeb..737d756383 100644 --- a/script/tasks/deposit_into_strategy.s.sol +++ b/script/tasks/deposit_into_strategy.s.sol @@ -25,7 +25,12 @@ import "forge-std/Test.sol"; contract DepositIntoStrategy is Script, Test { Vm cheats = Vm(VM_ADDRESS); - function run(string memory configFile, address strategy, address token, uint256 amount) public { + function run( + string memory configFile, + address strategy, + address token, + uint256 amount + ) public { // Load config string memory deployConfigPath = string(bytes(string.concat("script/output/", configFile))); string memory config_data = vm.readFile(deployConfigPath); diff --git a/script/tasks/register_as_operator.s.sol b/script/tasks/register_as_operator.s.sol index a27c390f0d..3a30732b85 100644 --- a/script/tasks/register_as_operator.s.sol +++ b/script/tasks/register_as_operator.s.sol @@ -19,7 +19,11 @@ import "forge-std/Test.sol"; contract RegisterAsOperator is Script, Test { Vm cheats = Vm(VM_ADDRESS); - function run(string memory configFile, address operator, string memory metadataURI) public { + function run( + string memory configFile, + address operator, + string memory metadataURI + ) public { // Load config string memory deployConfigPath = string(bytes(string.concat("script/output/", configFile))); string memory config_data = vm.readFile(deployConfigPath); diff --git a/script/tasks/register_operator_to_operatorSet.s.sol b/script/tasks/register_operator_to_operatorSet.s.sol index 01e12d2895..429b2500cf 100644 --- a/script/tasks/register_operator_to_operatorSet.s.sol +++ b/script/tasks/register_operator_to_operatorSet.s.sol @@ -17,7 +17,11 @@ contract AVSRegistrar is IAVSRegistrar { uint32[] calldata operatorSetIds, bytes calldata data ) external {} - function deregisterOperator(address operator, address avsIdentifier, uint32[] calldata operatorSetIds) external {} + function deregisterOperator( + address operator, + address avsIdentifier, + uint32[] calldata operatorSetIds + ) external {} function supportsAVS( address /*avs*/ diff --git a/script/tasks/withdraw_from_strategy.s.sol b/script/tasks/withdraw_from_strategy.s.sol index 09b3dc1a14..edfd9dc28e 100644 --- a/script/tasks/withdraw_from_strategy.s.sol +++ b/script/tasks/withdraw_from_strategy.s.sol @@ -14,7 +14,12 @@ import "forge-std/Test.sol"; contract WithdrawFromStrategy is Script, Test { Vm cheats = Vm(VM_ADDRESS); - function run(string memory configFile, address strategy, address token, uint256 amount) public { + function run( + string memory configFile, + address strategy, + address token, + uint256 amount + ) public { // Load config string memory deployConfigPath = string(bytes(string.concat("script/output/", configFile))); string memory config_data = vm.readFile(deployConfigPath); @@ -47,9 +52,7 @@ contract WithdrawFromStrategy is Script, Test { IDelegationManagerTypes.QueuedWithdrawalParams[] memory queueWithdrawals = new IDelegationManagerTypes.QueuedWithdrawalParams[](1); queueWithdrawals[0] = IDelegationManagerTypes.QueuedWithdrawalParams({ - strategies: strategies, - depositShares: shares, - __deprecated_withdrawer: address(0) + strategies: strategies, depositShares: shares, __deprecated_withdrawer: address(0) }); // Withdrawal roots will be returned when we queue diff --git a/script/utils/ExistingDeploymentParser.sol b/script/utils/ExistingDeploymentParser.sol index cd04ddadf2..5f30070580 100644 --- a/script/utils/ExistingDeploymentParser.sol +++ b/script/utils/ExistingDeploymentParser.sol @@ -314,9 +314,7 @@ contract ExistingDeploymentParser is Script, Logger { inActivePods = json.readAddressArray(".eigenPods.inActivePods"); allEigenPods = json.readAddressArray(".eigenPods.allEigenPods"); return DeployedEigenPods({ - multiValidatorPods: multiValidatorPods, - singleValidatorPods: singleValidatorPods, - inActivePods: inActivePods + multiValidatorPods: multiValidatorPods, singleValidatorPods: singleValidatorPods, inActivePods: inActivePods }); } @@ -466,12 +464,16 @@ contract ExistingDeploymentParser is Script, Logger { "delegationManager: implementation set incorrectly" ); assertEq( - eigenLayerProxyAdmin.getProxyImplementation(ITransparentUpgradeableProxy(payable(address(strategyManager)))), + eigenLayerProxyAdmin.getProxyImplementation( + ITransparentUpgradeableProxy(payable(address(strategyManager))) + ), address(strategyManagerImplementation), "strategyManager: implementation set incorrectly" ); assertEq( - eigenLayerProxyAdmin.getProxyImplementation(ITransparentUpgradeableProxy(payable(address(eigenPodManager)))), + eigenLayerProxyAdmin.getProxyImplementation( + ITransparentUpgradeableProxy(payable(address(eigenPodManager))) + ), address(eigenPodManagerImplementation), "eigenPodManager: implementation set incorrectly" ); diff --git a/src/contracts/avs/task/TaskMailbox.sol b/src/contracts/avs/task/TaskMailbox.sol index f6cc96fd38..f75245056b 100644 --- a/src/contracts/avs/task/TaskMailbox.sol +++ b/src/contracts/avs/task/TaskMailbox.sol @@ -10,10 +10,12 @@ import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol"; import {IAVSTaskHook} from "../../interfaces/IAVSTaskHook.sol"; import { - IBN254CertificateVerifier, IBN254CertificateVerifierTypes + IBN254CertificateVerifier, + IBN254CertificateVerifierTypes } from "../../interfaces/IBN254CertificateVerifier.sol"; import { - IECDSACertificateVerifier, IECDSACertificateVerifierTypes + IECDSACertificateVerifier, + IECDSACertificateVerifierTypes } from "../../interfaces/IECDSACertificateVerifier.sol"; import {IBaseCertificateVerifier} from "../../interfaces/IBaseCertificateVerifier.sol"; import {IKeyRegistrarTypes} from "../../interfaces/IKeyRegistrar.sol"; @@ -27,13 +29,7 @@ import {TaskMailboxStorage} from "./TaskMailboxStorage.sol"; * @author Layr Labs, Inc. * @notice Contract for managing the lifecycle of tasks that are executed by operator sets of task-based AVSs. */ -contract TaskMailbox is - Initializable, - OwnableUpgradeable, - ReentrancyGuardUpgradeable, - TaskMailboxStorage, - SemVerMixin -{ +contract TaskMailbox is Initializable, OwnableUpgradeable, ReentrancyGuardUpgradeable, TaskMailboxStorage, SemVerMixin { using SafeERC20 for IERC20; using SafeCast for *; @@ -59,7 +55,11 @@ contract TaskMailbox is * @param _feeSplit The initial fee split in basis points * @param _feeSplitCollector The initial fee split collector address */ - function initialize(address _owner, uint16 _feeSplit, address _feeSplitCollector) external initializer { + function initialize( + address _owner, + uint16 _feeSplit, + address _feeSplitCollector + ) external initializer { __Ownable_init(); __ReentrancyGuard_init(); _transferOwnership(_owner); @@ -99,7 +99,10 @@ contract TaskMailbox is } /// @inheritdoc ITaskMailbox - function registerExecutorOperatorSet(OperatorSet memory operatorSet, bool isRegistered) external { + function registerExecutorOperatorSet( + OperatorSet memory operatorSet, + bool isRegistered + ) external { ExecutorOperatorSetTaskConfig memory taskConfig = _executorOperatorSetTaskConfigs[operatorSet.key()]; // Validate that task config has been set before registration can be toggled. @@ -190,16 +193,19 @@ contract TaskMailbox is } /// @inheritdoc ITaskMailbox - function submitResult(bytes32 taskHash, bytes memory executorCert, bytes memory result) external nonReentrant { + function submitResult( + bytes32 taskHash, + bytes memory executorCert, + bytes memory result + ) external nonReentrant { Task storage task = _tasks[taskHash]; TaskStatus status = _getTaskStatus(task); require(status == TaskStatus.CREATED, InvalidTaskStatus(TaskStatus.CREATED, status)); require(block.timestamp > task.creationTime, TimestampAtCreation()); // Pre-task result submission checks: AVS can validate the caller, task result, params and certificate. - task.executorOperatorSetTaskConfig.taskHook.validatePreTaskResultSubmission( - msg.sender, taskHash, executorCert, result - ); + task.executorOperatorSetTaskConfig.taskHook + .validatePreTaskResultSubmission(msg.sender, taskHash, executorCert, result); // Verify certificate based on consensus configuration OperatorSet memory executorOperatorSet = OperatorSet(task.avs, task.executorOperatorSetId); @@ -229,9 +235,8 @@ contract TaskMailbox is // Transfer remaining fee to AVS fee collector uint96 avsAmount = task.avsFee - feeSplitAmount; if (avsAmount > 0) { - task.executorOperatorSetTaskConfig.feeToken.safeTransfer( - task.executorOperatorSetTaskConfig.feeCollector, avsAmount - ); + task.executorOperatorSetTaskConfig.feeToken + .safeTransfer(task.executorOperatorSetTaskConfig.feeCollector, avsAmount); } } @@ -329,7 +334,10 @@ contract TaskMailbox is * @param operatorSet The operator set to register * @param isRegistered Whether the operator set is registered */ - function _registerExecutorOperatorSet(OperatorSet memory operatorSet, bool isRegistered) internal { + function _registerExecutorOperatorSet( + OperatorSet memory operatorSet, + bool isRegistered + ) internal { isExecutorOperatorSetRegistered[operatorSet.key()] = isRegistered; emit ExecutorOperatorSetRegistered(msg.sender, operatorSet.avs, operatorSet.id, isRegistered); } @@ -495,9 +503,8 @@ contract TaskMailbox is // Validate the certificate _validateBN254Certificate(bn254Cert, operatorTableReferenceTimestamp, messageHash); - isThresholdMet = IBN254CertificateVerifier(BN254_CERTIFICATE_VERIFIER).verifyCertificateProportion( - executorOperatorSet, bn254Cert, totalStakeProportionThresholds - ); + isThresholdMet = IBN254CertificateVerifier(BN254_CERTIFICATE_VERIFIER) + .verifyCertificateProportion(executorOperatorSet, bn254Cert, totalStakeProportionThresholds); } else if (curveType == IKeyRegistrarTypes.CurveType.ECDSA) { // ECDSA Certificate verification IECDSACertificateVerifierTypes.ECDSACertificate memory ecdsaCert = @@ -506,9 +513,8 @@ contract TaskMailbox is // Validate the certificate _validateECDSACertificate(ecdsaCert, operatorTableReferenceTimestamp, messageHash); - (isThresholdMet,) = IECDSACertificateVerifier(ECDSA_CERTIFICATE_VERIFIER).verifyCertificateProportion( - executorOperatorSet, ecdsaCert, totalStakeProportionThresholds - ); + (isThresholdMet,) = IECDSACertificateVerifier(ECDSA_CERTIFICATE_VERIFIER) + .verifyCertificateProportion(executorOperatorSet, ecdsaCert, totalStakeProportionThresholds); } else { revert InvalidCurveType(); } @@ -588,7 +594,10 @@ contract TaskMailbox is } /// @inheritdoc ITaskMailbox - function getMessageHash(bytes32 taskHash, bytes memory result) public pure returns (bytes32) { + function getMessageHash( + bytes32 taskHash, + bytes memory result + ) public pure returns (bytes32) { return keccak256(abi.encode(taskHash, result)); } } diff --git a/src/contracts/avs/task/TaskMailboxStorage.sol b/src/contracts/avs/task/TaskMailboxStorage.sol index d99e735c87..e4a020fa92 100644 --- a/src/contracts/avs/task/TaskMailboxStorage.sol +++ b/src/contracts/avs/task/TaskMailboxStorage.sol @@ -46,7 +46,11 @@ abstract contract TaskMailboxStorage is ITaskMailbox { * @param _ecdsaCertificateVerifier Address of the ECDSA certificate verifier * @param _maxTaskSLA Maximum task SLA in seconds */ - constructor(address _bn254CertificateVerifier, address _ecdsaCertificateVerifier, uint96 _maxTaskSLA) { + constructor( + address _bn254CertificateVerifier, + address _ecdsaCertificateVerifier, + uint96 _maxTaskSLA + ) { BN254_CERTIFICATE_VERIFIER = _bn254CertificateVerifier; ECDSA_CERTIFICATE_VERIFIER = _ecdsaCertificateVerifier; MAX_TASK_SLA = _maxTaskSLA; diff --git a/src/contracts/core/AVSDirectory.sol b/src/contracts/core/AVSDirectory.sol index 6f76e421e3..54be88a92c 100644 --- a/src/contracts/core/AVSDirectory.sol +++ b/src/contracts/core/AVSDirectory.sol @@ -22,7 +22,6 @@ contract AVSDirectory is * INITIALIZING FUNCTIONS * */ - /** * @dev Initializes the immutable addresses of the strategy manager, delegationManager, * and eigenpodManager contracts @@ -36,7 +35,10 @@ contract AVSDirectory is } /// @inheritdoc IAVSDirectory - function initialize(address initialOwner, uint256 initialPausedStatus) external initializer { + function initialize( + address initialOwner, + uint256 initialPausedStatus + ) external initializer { _setPausedStatus(initialPausedStatus); _transferOwnership(initialOwner); } @@ -89,10 +91,7 @@ contract AVSDirectory is _checkIsValidSignatureNow({ signer: operator, signableDigest: calculateOperatorAVSRegistrationDigestHash({ - operator: operator, - avs: msg.sender, - salt: operatorSignature.salt, - expiry: operatorSignature.expiry + operator: operator, avs: msg.sender, salt: operatorSignature.salt, expiry: operatorSignature.expiry }), signature: operatorSignature.signature, expiry: operatorSignature.expiry diff --git a/src/contracts/core/AllocationManager.sol b/src/contracts/core/AllocationManager.sol index 44aedf268b..338a8e29da 100644 --- a/src/contracts/core/AllocationManager.sol +++ b/src/contracts/core/AllocationManager.sol @@ -236,7 +236,10 @@ contract AllocationManager is } /// @inheritdoc IAllocationManager - function setAllocationDelay(address operator, uint32 delay) external { + function setAllocationDelay( + address operator, + uint32 delay + ) external { if (msg.sender != address(delegation)) { require(_checkCanCall(operator), InvalidCaller()); require(delegation.isOperator(operator), InvalidOperator()); @@ -245,7 +248,10 @@ contract AllocationManager is } /// @inheritdoc IAllocationManager - function setAVSRegistrar(address avs, IAVSRegistrar registrar) external checkCanCall(avs) { + function setAVSRegistrar( + address avs, + IAVSRegistrar registrar + ) external checkCanCall(avs) { // Check that the registrar is correctly configured to prevent an AVSRegistrar contract // from being used with the wrong AVS require(registrar.supportsAVS(avs), InvalidAVSRegistrar()); @@ -254,13 +260,19 @@ contract AllocationManager is } /// @inheritdoc IAllocationManager - function updateAVSMetadataURI(address avs, string calldata metadataURI) external checkCanCall(avs) { + function updateAVSMetadataURI( + address avs, + string calldata metadataURI + ) external checkCanCall(avs) { if (!_avsRegisteredMetadata[avs]) _avsRegisteredMetadata[avs] = true; emit AVSMetadataURIUpdated(avs, metadataURI); } /// @inheritdoc IAllocationManager - function createOperatorSets(address avs, CreateSetParams[] calldata params) external checkCanCall(avs) { + function createOperatorSets( + address avs, + CreateSetParams[] calldata params + ) external checkCanCall(avs) { require(_avsRegisteredMetadata[avs], NonexistentAVSMetadata()); for (uint256 i = 0; i < params.length; i++) { _createOperatorSet(avs, params[i], DEFAULT_BURN_ADDRESS); @@ -472,7 +484,11 @@ contract AllocationManager is * @param strategy the strategy to update * @param numToClear the number of pending deallocations to clear */ - function _clearDeallocationQueue(address operator, IStrategy strategy, uint16 numToClear) internal { + function _clearDeallocationQueue( + address operator, + IStrategy strategy, + uint16 numToClear + ) internal { uint256 numCleared; uint256 length = deallocationQueue[operator][strategy].length(); @@ -504,7 +520,10 @@ contract AllocationManager is * @param operator The operator to set the delay on behalf of. * @param delay The allocation delay in blocks. */ - function _setAllocationDelay(address operator, uint32 delay) internal { + function _setAllocationDelay( + address operator, + uint32 delay + ) internal { AllocationDelayInfo memory info = _allocationDelayInfo[operator]; // If there is a pending delay that can be applied now, set it @@ -526,7 +545,12 @@ contract AllocationManager is IStrategy strategy, Allocation memory allocation, bool _isOperatorSlashable - ) internal view returns (bool) { + ) + internal + view + returns (bool) + { + /// forgefmt: disable-next-item return // If the operator set does not use this strategy, any allocation from it is not slashable @@ -660,17 +684,27 @@ contract AllocationManager is } } - function _updateMaxMagnitude(address operator, IStrategy strategy, uint64 newMaxMagnitude) internal { + function _updateMaxMagnitude( + address operator, + IStrategy strategy, + uint64 newMaxMagnitude + ) internal { _maxMagnitudeHistory[operator][strategy].push({key: uint32(block.number), value: newMaxMagnitude}); emit MaxMagnitudeUpdated(operator, strategy, newMaxMagnitude); } - function _calcDelta(uint64 currentMagnitude, uint64 newMagnitude) internal pure returns (int128) { + function _calcDelta( + uint64 currentMagnitude, + uint64 newMagnitude + ) internal pure returns (int128) { return int128(uint128(newMagnitude)) - int128(uint128(currentMagnitude)); } /// @dev Use safe casting when downcasting to uint64 - function _addInt128(uint64 a, int128 b) internal pure returns (uint64) { + function _addInt128( + uint64 a, + int128 b + ) internal pure returns (uint64) { return uint256(int256(int128(uint128(a)) + b)).toUint64(); } @@ -781,13 +815,19 @@ contract AllocationManager is } /// @inheritdoc IAllocationManager - function getEncumberedMagnitude(address operator, IStrategy strategy) external view returns (uint64) { + function getEncumberedMagnitude( + address operator, + IStrategy strategy + ) external view returns (uint64) { (uint64 curEncumberedMagnitude,) = _getFreeAndUsedMagnitude(operator, strategy); return curEncumberedMagnitude; } /// @inheritdoc IAllocationManager - function getAllocatableMagnitude(address operator, IStrategy strategy) external view returns (uint64) { + function getAllocatableMagnitude( + address operator, + IStrategy strategy + ) external view returns (uint64) { (, uint64 curAllocatableMagnitude) = _getFreeAndUsedMagnitude(operator, strategy); return curAllocatableMagnitude; } @@ -829,7 +869,10 @@ contract AllocationManager is } /// @inheritdoc IAllocationManager - function getMaxMagnitude(address operator, IStrategy strategy) public view returns (uint64) { + function getMaxMagnitude( + address operator, + IStrategy strategy + ) public view returns (uint64) { return _maxMagnitudeHistory[operator][strategy].latest(); } @@ -848,7 +891,10 @@ contract AllocationManager is } /// @inheritdoc IAllocationManager - function getMaxMagnitudes(address[] memory operators, IStrategy strategy) external view returns (uint64[] memory) { + function getMaxMagnitudes( + address[] memory operators, + IStrategy strategy + ) external view returns (uint64[] memory) { uint64[] memory maxMagnitudes = new uint64[](operators.length); for (uint256 i = 0; i < operators.length; ++i) { @@ -906,7 +952,10 @@ contract AllocationManager is } /// @inheritdoc IAllocationManager - function isMemberOfOperatorSet(address operator, OperatorSet memory operatorSet) public view returns (bool) { + function isMemberOfOperatorSet( + address operator, + OperatorSet memory operatorSet + ) public view returns (bool) { return _operatorSetMembers[operatorSet.key()].contains(operator); } @@ -985,7 +1034,10 @@ contract AllocationManager is } /// @inheritdoc IAllocationManager - function isOperatorSlashable(address operator, OperatorSet memory operatorSet) public view returns (bool) { + function isOperatorSlashable( + address operator, + OperatorSet memory operatorSet + ) public view returns (bool) { RegistrationStatus memory status = registrationStatus[operator][operatorSet.key()]; // slashableUntil returns the last block the operator is slashable in so we check for diff --git a/src/contracts/core/AllocationManagerStorage.sol b/src/contracts/core/AllocationManagerStorage.sol index c87c6f1bb5..17c7917d35 100644 --- a/src/contracts/core/AllocationManagerStorage.sol +++ b/src/contracts/core/AllocationManagerStorage.sol @@ -96,7 +96,8 @@ abstract contract AllocationManagerStorage is IAllocationManager { /// @dev For a strategy, keeps an ordered queue of operator sets that have pending deallocations /// These must be completed in order to free up magnitude for future allocation - mapping(address operator => mapping(IStrategy strategy => DoubleEndedQueue.Bytes32Deque)) internal deallocationQueue; + mapping(address operator => mapping(IStrategy strategy => DoubleEndedQueue.Bytes32Deque)) internal + deallocationQueue; /// @dev Lists the AVSs who has registered metadata and claimed itself as an AVS /// @notice bool is not used and is always true if the avs has registered metadata diff --git a/src/contracts/core/DelegationManager.sol b/src/contracts/core/DelegationManager.sol index 4cf592555a..b72497aedd 100644 --- a/src/contracts/core/DelegationManager.sol +++ b/src/contracts/core/DelegationManager.sol @@ -120,7 +120,10 @@ contract DelegationManager is } /// @inheritdoc IDelegationManager - function updateOperatorMetadataURI(address operator, string calldata metadataURI) external checkCanCall(operator) { + function updateOperatorMetadataURI( + address operator, + string calldata metadataURI + ) external checkCanCall(operator) { require(isOperator(operator), OperatorNotRegistered()); emit OperatorMetadataURIUpdated(operator, metadataURI); } @@ -136,10 +139,7 @@ contract DelegationManager is // If the operator has a `delegationApprover`, check the provided signature _checkApproverSignature({ - staker: msg.sender, - operator: operator, - signature: approverSignatureAndExpiry, - salt: approverSalt + staker: msg.sender, operator: operator, signature: approverSignatureAndExpiry, salt: approverSalt }); // Delegate msg.sender to the operator @@ -267,16 +267,12 @@ contract DelegationManager is uint64 maxMagnitude = allocationManager.getMaxMagnitude(operator, beaconChainETHStrategy); DepositScalingFactor memory dsf = _depositScalingFactor[staker][beaconChainETHStrategy]; uint256 sharesToRemove = dsf.calcWithdrawable({ - depositShares: curDepositShares, - slashingFactor: maxMagnitude.mulWad(beaconChainSlashingFactorDecrease) + depositShares: curDepositShares, slashingFactor: maxMagnitude.mulWad(beaconChainSlashingFactorDecrease) }); // Decrease the operator's shares _decreaseDelegation({ - operator: operator, - staker: staker, - strategy: beaconChainETHStrategy, - sharesToDecrease: sharesToRemove + operator: operator, staker: staker, strategy: beaconChainETHStrategy, sharesToDecrease: sharesToRemove }); } @@ -296,10 +292,7 @@ contract DelegationManager is }); uint256 scaledSharesSlashedFromQueue = _getSlashableSharesInQueue({ - operator: operator, - strategy: strategy, - prevMaxMagnitude: prevMaxMagnitude, - newMaxMagnitude: newMaxMagnitude + operator: operator, strategy: strategy, prevMaxMagnitude: prevMaxMagnitude, newMaxMagnitude: newMaxMagnitude }); // Calculate the total deposit shares to slash (burn or redistribute) - slashed operator shares plus still-slashable @@ -317,9 +310,8 @@ contract DelegationManager is // Emit event for operator shares being slashed emit OperatorSharesSlashed(operator, strategy, totalDepositSharesToSlash); - _getShareManager(strategy).increaseBurnOrRedistributableShares( - operatorSet, slashId, strategy, totalDepositSharesToSlash - ); + _getShareManager(strategy) + .increaseBurnOrRedistributableShares(operatorSet, slashId, strategy, totalDepositSharesToSlash); return totalDepositSharesToSlash; } @@ -335,7 +327,10 @@ contract DelegationManager is * @param operator The account registered as an operator updating their operatorDetails * @param newDelegationApprover The new parameters for the operator */ - function _setDelegationApprover(address operator, address newDelegationApprover) internal { + function _setDelegationApprover( + address operator, + address newDelegationApprover + ) internal { _operatorDetails[operator].delegationApprover = newDelegationApprover; emit DelegationApproverUpdated(operator, newDelegationApprover); } @@ -351,7 +346,10 @@ contract DelegationManager is * Ensures that: * 1) new delegations are not paused (PAUSED_NEW_DELEGATION) */ - function _delegate(address staker, address operator) internal onlyWhenNotPaused(PAUSED_NEW_DELEGATION) { + function _delegate( + address staker, + address operator + ) internal onlyWhenNotPaused(PAUSED_NEW_DELEGATION) { // When a staker is not delegated to an operator, their deposit shares are equal to their // withdrawable shares -- except for the beaconChainETH strategy, which is handled below (IStrategy[] memory strategies, uint256[] memory withdrawableShares) = getDepositedShares(staker); @@ -588,8 +586,7 @@ contract DelegationManager is // Calculate how much slashing to apply, as well as shares to withdraw uint256 sharesToWithdraw = SlashingLib.scaleForCompleteWithdrawal({ - scaledShares: withdrawal.scaledShares[i], - slashingFactor: prevSlashingFactors[i] + scaledShares: withdrawal.scaledShares[i], slashingFactor: prevSlashingFactors[i] }); //Do nothing if 0 shares to withdraw @@ -610,9 +607,7 @@ contract DelegationManager is } else { // Award shares back in StrategyManager/EigenPodManager. (uint256 prevDepositShares, uint256 addedShares) = shareManager.addShares({ - staker: withdrawal.staker, - strategy: withdrawal.strategies[i], - shares: sharesToWithdraw + staker: withdrawal.staker, strategy: withdrawal.strategies[i], shares: sharesToWithdraw }); // Update the staker's deposit scaling factor and delegate shares to their operator @@ -756,9 +751,7 @@ contract DelegationManager is ) internal view returns (uint256[] memory) { uint256[] memory slashingFactors = new uint256[](strategies.length); uint64[] memory maxMagnitudes = allocationManager.getMaxMagnitudesAtBlock({ - operator: operator, - strategies: strategies, - blockNumber: blockNumber + operator: operator, strategies: strategies, blockNumber: blockNumber }); for (uint256 i = 0; i < strategies.length; i++) { @@ -785,28 +778,27 @@ contract DelegationManager is // To get this, we take the current shares in the withdrawal queue and subtract the number of shares // that were in the queue before MIN_WITHDRAWAL_DELAY_BLOCKS. uint256 curQueuedScaledShares = _cumulativeScaledSharesHistory[operator][strategy].latest(); - uint256 prevQueuedScaledShares = _cumulativeScaledSharesHistory[operator][strategy].upperLookup({ - key: uint32(block.number) - MIN_WITHDRAWAL_DELAY_BLOCKS - 1 - }); + uint256 prevQueuedScaledShares = _cumulativeScaledSharesHistory[operator][strategy] + .upperLookup({key: uint32(block.number) - MIN_WITHDRAWAL_DELAY_BLOCKS - 1}); // The difference between these values is the number of scaled shares that entered the withdrawal queue // less than or equal to MIN_WITHDRAWAL_DELAY_BLOCKS ago. These shares are still slashable. uint256 scaledSharesAdded = curQueuedScaledShares - prevQueuedScaledShares; return SlashingLib.scaleForBurning({ - scaledShares: scaledSharesAdded, - prevMaxMagnitude: prevMaxMagnitude, - newMaxMagnitude: newMaxMagnitude + scaledShares: scaledSharesAdded, prevMaxMagnitude: prevMaxMagnitude, newMaxMagnitude: newMaxMagnitude }); } /// @dev Add to the cumulative withdrawn scaled shares from an operator for a given strategy - function _addQueuedSlashableShares(address operator, IStrategy strategy, uint256 scaledShares) internal { + function _addQueuedSlashableShares( + address operator, + IStrategy strategy, + uint256 scaledShares + ) internal { uint256 currCumulativeScaledShares = _cumulativeScaledSharesHistory[operator][strategy].latest(); - _cumulativeScaledSharesHistory[operator][strategy].push({ - key: uint32(block.number), - value: currCumulativeScaledShares + scaledShares - }); + _cumulativeScaledSharesHistory[operator][strategy] + .push({key: uint32(block.number), value: currCumulativeScaledShares + scaledShares}); } /// @dev Get the shares from a queued withdrawal. @@ -830,15 +822,12 @@ contract DelegationManager is blockNumber: slashableUntil }) : _getSlashingFactors({ - staker: withdrawal.staker, - operator: withdrawal.delegatedTo, - strategies: withdrawal.strategies + staker: withdrawal.staker, operator: withdrawal.delegatedTo, strategies: withdrawal.strategies }); for (uint256 j; j < withdrawal.strategies.length; ++j) { shares[j] = SlashingLib.scaleForCompleteWithdrawal({ - scaledShares: withdrawal.scaledShares[j], - slashingFactor: slashingFactors[j] + scaledShares: withdrawal.scaledShares[j], slashingFactor: slashingFactors[j] }); } } @@ -880,7 +869,10 @@ contract DelegationManager is } /// @inheritdoc IDelegationManager - function depositScalingFactor(address staker, IStrategy strategy) external view returns (uint256) { + function depositScalingFactor( + address staker, + IStrategy strategy + ) external view returns (uint256) { return _depositScalingFactor[staker][strategy].scalingFactor(); } @@ -909,15 +901,15 @@ contract DelegationManager is } /// @inheritdoc IDelegationManager - function getSlashableSharesInQueue(address operator, IStrategy strategy) public view returns (uint256) { + function getSlashableSharesInQueue( + address operator, + IStrategy strategy + ) public view returns (uint256) { uint64 maxMagnitude = allocationManager.getMaxMagnitude(operator, strategy); // Return amount of slashable scaled shares remaining return _getSlashableSharesInQueue({ - operator: operator, - strategy: strategy, - prevMaxMagnitude: maxMagnitude, - newMaxMagnitude: 0 + operator: operator, strategy: strategy, prevMaxMagnitude: maxMagnitude, newMaxMagnitude: 0 }); } @@ -1048,7 +1040,12 @@ contract DelegationManager is address approver, bytes32 approverSalt, uint256 expiry - ) public view returns (bytes32) { + ) + public + view + returns (bytes32) + { + /// forgefmt: disable-next-item return _calculateSignableDigest( keccak256( diff --git a/src/contracts/core/ReleaseManager.sol b/src/contracts/core/ReleaseManager.sol index 35fa604f88..b8c1cb4217 100644 --- a/src/contracts/core/ReleaseManager.sol +++ b/src/contracts/core/ReleaseManager.sol @@ -69,7 +69,10 @@ contract ReleaseManager is Initializable, ReleaseManagerStorage, PermissionContr } /// @inheritdoc IReleaseManager - function getRelease(OperatorSet memory operatorSet, uint256 releaseId) external view returns (Release memory) { + function getRelease( + OperatorSet memory operatorSet, + uint256 releaseId + ) external view returns (Release memory) { return _operatorSetReleases[operatorSet.key()][releaseId]; } @@ -96,7 +99,10 @@ contract ReleaseManager is Initializable, ReleaseManagerStorage, PermissionContr } /// @inheritdoc IReleaseManager - function isValidRelease(OperatorSet memory operatorSet, uint256 releaseId) external view returns (bool) { + function isValidRelease( + OperatorSet memory operatorSet, + uint256 releaseId + ) external view returns (bool) { uint256 totalReleases = getTotalReleases(operatorSet); require(totalReleases > 0, NoReleases()); return releaseId == totalReleases - 1; diff --git a/src/contracts/core/RewardsCoordinator.sol b/src/contracts/core/RewardsCoordinator.sol index ac9a8b47fe..1e98b52e1b 100644 --- a/src/contracts/core/RewardsCoordinator.sol +++ b/src/contracts/core/RewardsCoordinator.sol @@ -265,7 +265,10 @@ contract RewardsCoordinator is } /// @inheritdoc IRewardsCoordinator - function setClaimerFor(address earner, address claimer) external checkCanCall(earner) { + function setClaimerFor( + address earner, + address claimer + ) external checkCanCall(earner) { // Require that the earner is an operator or AVS require( delegationManager.isOperator(earner) || allocationManager.getOperatorSetCount(earner) > 0, InvalidEarner() @@ -335,7 +338,10 @@ contract RewardsCoordinator is } /// @inheritdoc IRewardsCoordinator - function setRewardsForAllSubmitter(address _submitter, bool _newValue) external onlyOwner { + function setRewardsForAllSubmitter( + address _submitter, + bool _newValue + ) external onlyOwner { bool prevValue = isRewardsForAllSubmitter[_submitter]; emit RewardsForAllSubmitterSet(_submitter, prevValue, _newValue); isRewardsForAllSubmitter[_submitter] = _newValue; @@ -352,7 +358,10 @@ contract RewardsCoordinator is * @param claim The RewardsMerkleClaims to be processed. * @param recipient The address recipient that receives the ERC20 rewards */ - function _processClaim(RewardsMerkleClaim calldata claim, address recipient) internal { + function _processClaim( + RewardsMerkleClaim calldata claim, + address recipient + ) internal { DistributionRoot memory root = _distributionRoots[claim.rootIndex]; _checkClaim(claim, root); // If claimerFor earner is not set, claimer is by default the earner. Else set to claimerFor @@ -398,7 +407,10 @@ contract RewardsCoordinator is rewardsUpdater = _rewardsUpdater; } - function _setClaimer(address earner, address claimer) internal { + function _setClaimer( + address earner, + address claimer + ) internal { address prevClaimer = claimerFor[earner]; claimerFor[earner] = claimer; emit ClaimerForSet(earner, prevClaimer, claimer); @@ -410,7 +422,11 @@ contract RewardsCoordinator is * @param split The split in basis points. * @param activatedAt The timestamp when the split is activated. */ - function _setOperatorSplit(OperatorSplit storage operatorSplit, uint16 split, uint32 activatedAt) internal { + function _setOperatorSplit( + OperatorSplit storage operatorSplit, + uint16 split, + uint32 activatedAt + ) internal { require(split <= ONE_HUNDRED_IN_BIPS, SplitExceedsMax()); require(block.timestamp > operatorSplit.activatedAt, PreviousSplitPending()); @@ -504,7 +520,10 @@ contract RewardsCoordinator is return totalAmount; } - function _checkClaim(RewardsMerkleClaim calldata claim, DistributionRoot memory root) internal view { + function _checkClaim( + RewardsMerkleClaim calldata claim, + DistributionRoot memory root + ) internal view { require(!root.disabled, RootDisabled()); require(block.timestamp >= root.activatedAt, RootNotActivated()); require(claim.tokenIndices.length == claim.tokenTreeProofs.length, InputArrayLengthMismatch()); @@ -550,10 +569,7 @@ contract RewardsCoordinator is bytes32 tokenLeafHash = calculateTokenLeafHash(tokenLeaf); require( Merkle.verifyInclusionKeccak({ - root: earnerTokenRoot, - index: tokenLeafIndex, - proof: tokenProof, - leaf: tokenLeafHash + root: earnerTokenRoot, index: tokenLeafIndex, proof: tokenProof, leaf: tokenLeafHash }), InvalidClaimProof() ); @@ -643,7 +659,10 @@ contract RewardsCoordinator is } /// @inheritdoc IRewardsCoordinator - function getOperatorAVSSplit(address operator, address avs) external view returns (uint16) { + function getOperatorAVSSplit( + address operator, + address avs + ) external view returns (uint16) { return _getOperatorSplit(_operatorAVSSplitBips[operator][avs]); } @@ -655,7 +674,10 @@ contract RewardsCoordinator is } /// @inheritdoc IRewardsCoordinator - function getOperatorSetSplit(address operator, OperatorSet calldata operatorSet) external view returns (uint16) { + function getOperatorSetSplit( + address operator, + OperatorSet calldata operatorSet + ) external view returns (uint16) { return _getOperatorSplit(_operatorSetSplitBips[operator][operatorSet.key()]); } diff --git a/src/contracts/core/StrategyManager.sol b/src/contracts/core/StrategyManager.sol index 02f6717ea7..4ad2994de9 100644 --- a/src/contracts/core/StrategyManager.sol +++ b/src/contracts/core/StrategyManager.sol @@ -266,7 +266,11 @@ contract StrategyManager is * delegated shares are tracked, increases the stored share amount in `stakerDepositShares[staker][strategy]`, and adds `strategy` * to the `staker`'s list of strategies, if it is not in the list already. */ - function _addShares(address staker, IStrategy strategy, uint256 shares) internal returns (uint256, uint256) { + function _addShares( + address staker, + IStrategy strategy, + uint256 shares + ) internal returns (uint256, uint256) { // sanity checks on inputs require(staker != address(0), StakerAddressZero()); require(shares != 0, SharesAmountZero()); @@ -312,10 +316,7 @@ contract StrategyManager is // Increase shares delegated to operator delegation.increaseDelegatedShares({ - staker: staker, - strategy: strategy, - prevDepositShares: prevDepositShares, - addedShares: addedShares + staker: staker, strategy: strategy, prevDepositShares: prevDepositShares, addedShares: addedShares }); return shares; @@ -362,7 +363,10 @@ contract StrategyManager is * @param staker The user whose array will have an entry removed * @param strategy The Strategy to remove from `stakerStrategyList[staker]` */ - function _removeStrategyFromStakerStrategyList(address staker, IStrategy strategy) internal { + function _removeStrategyFromStakerStrategyList( + address staker, + IStrategy strategy + ) internal { //loop through all of the strategies, find the right one, then replace uint256 stratsLength = stakerStrategyList[staker].length; uint256 j = 0; @@ -401,11 +405,10 @@ contract StrategyManager is uint256 amountOut; if (sharesToRemove != 0) { // Withdraw the shares to the burn address. - amountOut = IStrategy(strategy).withdraw({ - recipient: recipient, - token: IStrategy(strategy).underlyingToken(), - amountShares: sharesToRemove - }); + amountOut = IStrategy(strategy) + .withdraw({ + recipient: recipient, token: IStrategy(strategy).underlyingToken(), amountShares: sharesToRemove + }); // Emit an event to notify the that burnable shares have been decreased. emit BurnOrRedistributableSharesDecreased(operatorSet, slashId, strategy, sharesToRemove); @@ -474,7 +477,12 @@ contract StrategyManager is uint256 amount, uint256 nonce, uint256 expiry - ) public view returns (bytes32) { + ) + public + view + returns (bytes32) + { + /// forgefmt: disable-next-item return _calculateSignableDigest( keccak256( diff --git a/src/contracts/core/StrategyManagerStorage.sol b/src/contracts/core/StrategyManagerStorage.sol index bbedfc2bce..82a0037ee7 100644 --- a/src/contracts/core/StrategyManagerStorage.sol +++ b/src/contracts/core/StrategyManagerStorage.sol @@ -94,7 +94,10 @@ abstract contract StrategyManagerStorage is IStrategyManager { /** * @param _delegation The delegation contract of EigenLayer. */ - constructor(IAllocationManager _allocationManager, IDelegationManager _delegation) { + constructor( + IAllocationManager _allocationManager, + IDelegationManager _delegation + ) { allocationManager = _allocationManager; delegation = _delegation; } diff --git a/src/contracts/interfaces/IAVSDirectory.sol b/src/contracts/interfaces/IAVSDirectory.sol index 643f601e5d..bd981c5ea8 100644 --- a/src/contracts/interfaces/IAVSDirectory.sol +++ b/src/contracts/interfaces/IAVSDirectory.sol @@ -7,7 +7,6 @@ import "./IStrategy.sol"; interface IAVSDirectoryErrors { /// Operator Status - /// @dev Thrown when an operator does not exist in the DelegationManager error OperatorNotRegisteredToEigenLayer(); /// @dev Thrown when an operator is already registered to an AVS. @@ -24,7 +23,6 @@ interface IAVSDirectoryTypes { enum OperatorAVSRegistrationStatus { UNREGISTERED, // Operator not registered to AVS REGISTERED // Operator registered to AVS - } /** @@ -59,11 +57,13 @@ interface IAVSDirectory is IAVSDirectoryEvents, IAVSDirectoryErrors, ISignatureU * EXTERNAL FUNCTIONS * */ - /** * @dev Initializes the addresses of the initial owner and paused status. */ - function initialize(address initialOwner, uint256 initialPausedStatus) external; + function initialize( + address initialOwner, + uint256 initialPausedStatus + ) external; /** * @notice Called by an AVS to emit an `AVSMetadataURIUpdated` event indicating the information has updated. @@ -119,7 +119,10 @@ interface IAVSDirectory is IAVSDirectoryEvents, IAVSDirectoryErrors, ISignatureU * VIEW FUNCTIONS * */ - function operatorSaltIsSpent(address operator, bytes32 salt) external view returns (bool); + function operatorSaltIsSpent( + address operator, + bytes32 salt + ) external view returns (bool); /** * @notice Calculates the digest hash to be signed by an operator to register with an AVS. diff --git a/src/contracts/interfaces/IAVSRegistrar.sol b/src/contracts/interfaces/IAVSRegistrar.sol index b36bbba9d2..8f5146671d 100644 --- a/src/contracts/interfaces/IAVSRegistrar.sol +++ b/src/contracts/interfaces/IAVSRegistrar.sol @@ -24,7 +24,11 @@ interface IAVSRegistrar { * @param avs the AVS the operator is deregistering from. This should be the same as IAVSRegistrar.avs() * @param operatorSetIds the list of operator set ids being deregistered from */ - function deregisterOperator(address operator, address avs, uint32[] calldata operatorSetIds) external; + function deregisterOperator( + address operator, + address avs, + uint32[] calldata operatorSetIds + ) external; /** * @notice Returns true if the AVS is supported by the registrar diff --git a/src/contracts/interfaces/IAVSTaskHook.sol b/src/contracts/interfaces/IAVSTaskHook.sol index cf3e9bb2c7..05b291ce6f 100644 --- a/src/contracts/interfaces/IAVSTaskHook.sol +++ b/src/contracts/interfaces/IAVSTaskHook.sol @@ -16,7 +16,10 @@ interface IAVSTaskHook { * @param taskParams Task parameters * @dev This function should revert if the task should not be created */ - function validatePreTaskCreation(address caller, ITaskMailboxTypes.TaskParams memory taskParams) external view; + function validatePreTaskCreation( + address caller, + ITaskMailboxTypes.TaskParams memory taskParams + ) external view; /** * @notice Handles a task after it is created @@ -48,7 +51,10 @@ interface IAVSTaskHook { * @param taskHash Unique identifier of the task * @dev This function can be used to perform additional validation or update AVS-specific state */ - function handlePostTaskResultSubmission(address caller, bytes32 taskHash) external; + function handlePostTaskResultSubmission( + address caller, + bytes32 taskHash + ) external; /** * @notice Calculates the fee for a task payload against a specific fee market diff --git a/src/contracts/interfaces/IAllocationManager.sol b/src/contracts/interfaces/IAllocationManager.sol index 7bbf82e2d5..cf7eec0659 100644 --- a/src/contracts/interfaces/IAllocationManager.sol +++ b/src/contracts/interfaces/IAllocationManager.sol @@ -9,7 +9,6 @@ import "./ISemVerMixin.sol"; interface IAllocationManagerErrors { /// Input Validation - /// @dev Thrown when `wadToSlash` is zero or greater than 1e18 error InvalidWadToSlash(); /// @dev Thrown when two array parameters have mismatching lengths. @@ -269,7 +268,10 @@ interface IAllocationManager is IAllocationManagerErrors, IAllocationManagerEven * @param params array of magnitude adjustments for one or more operator sets * @dev Updates encumberedMagnitude for the updated strategies */ - function modifyAllocations(address operator, AllocateParams[] calldata params) external; + function modifyAllocations( + address operator, + AllocateParams[] calldata params + ) external; /** * @notice This function takes a list of strategies and for each strategy, removes from the deallocationQueue @@ -295,7 +297,10 @@ interface IAllocationManager is IAllocationManagerErrors, IAllocationManagerEven * registerOperator` method to complete registration. This call MUST succeed in order for * registration to be successful. */ - function registerForOperatorSets(address operator, RegisterParams calldata params) external; + function registerForOperatorSets( + address operator, + RegisterParams calldata params + ) external; /** * @notice Allows an operator or AVS to deregister the operator from one or more of the AVS's operator sets. @@ -316,7 +321,10 @@ interface IAllocationManager is IAllocationManagerErrors, IAllocationManagerEven * @param operator The operator to set the delay on behalf of. * @param delay the allocation delay in blocks */ - function setAllocationDelay(address operator, uint32 delay) external; + function setAllocationDelay( + address operator, + uint32 delay + ) external; /** * @notice Called by an AVS to configure the address that is called when an operator registers @@ -324,7 +332,10 @@ interface IAllocationManager is IAllocationManagerErrors, IAllocationManagerEven * to the AVS's address. * @param registrar the new registrar address */ - function setAVSRegistrar(address avs, IAVSRegistrar registrar) external; + function setAVSRegistrar( + address avs, + IAVSRegistrar registrar + ) external; /** * @notice Called by an AVS to emit an `AVSMetadataURIUpdated` event indicating the information has updated. @@ -333,12 +344,18 @@ interface IAllocationManager is IAllocationManagerErrors, IAllocationManagerEven * * @dev Note that the `metadataURI` is *never stored* and is only emitted in the `AVSMetadataURIUpdated` event. */ - function updateAVSMetadataURI(address avs, string calldata metadataURI) external; + function updateAVSMetadataURI( + address avs, + string calldata metadataURI + ) external; /** * @notice Allows an AVS to create new operator sets, defining strategies that the operator set uses */ - function createOperatorSets(address avs, CreateSetParams[] calldata params) external; + function createOperatorSets( + address avs, + CreateSetParams[] calldata params + ) external; /** * @notice Allows an AVS to create new Redistribution operator sets. @@ -362,7 +379,11 @@ interface IAllocationManager is IAllocationManagerErrors, IAllocationManagerEven * @param operatorSetId the operator set to add strategies to * @param strategies the strategies to add */ - function addStrategiesToOperatorSet(address avs, uint32 operatorSetId, IStrategy[] calldata strategies) external; + function addStrategiesToOperatorSet( + address avs, + uint32 operatorSetId, + IStrategy[] calldata strategies + ) external; /** * @notice Allows an AVS to remove strategies from an operator set @@ -458,7 +479,10 @@ interface IAllocationManager is IAllocationManagerErrors, IAllocationManagerEven * @param strategy the strategy to get allocatable magnitude for * @return currently allocated magnitude */ - function getEncumberedMagnitude(address operator, IStrategy strategy) external view returns (uint64); + function getEncumberedMagnitude( + address operator, + IStrategy strategy + ) external view returns (uint64); /** * @notice For a strategy, get the amount of magnitude not currently allocated to any operator set @@ -466,7 +490,10 @@ interface IAllocationManager is IAllocationManagerErrors, IAllocationManagerEven * @param strategy the strategy to get allocatable magnitude for * @return magnitude available to be allocated to an operator set */ - function getAllocatableMagnitude(address operator, IStrategy strategy) external view returns (uint64); + function getAllocatableMagnitude( + address operator, + IStrategy strategy + ) external view returns (uint64); /** * @notice Returns the maximum magnitude an operator can allocate for the given strategy @@ -476,7 +503,10 @@ interface IAllocationManager is IAllocationManagerErrors, IAllocationManagerEven * @param strategy the strategy to get the max magnitude for * @return the max magnitude for the strategy */ - function getMaxMagnitude(address operator, IStrategy strategy) external view returns (uint64); + function getMaxMagnitude( + address operator, + IStrategy strategy + ) external view returns (uint64); /** * @notice Returns the maximum magnitude an operator can allocate for the given strategies @@ -552,7 +582,10 @@ interface IAllocationManager is IAllocationManagerErrors, IAllocationManagerEven * @param operator The operator to query * @param operatorSet The operator set to query */ - function isMemberOfOperatorSet(address operator, OperatorSet memory operatorSet) external view returns (bool); + function isMemberOfOperatorSet( + address operator, + OperatorSet memory operatorSet + ) external view returns (bool); /** * @notice Returns whether the operator set exists @@ -637,7 +670,10 @@ interface IAllocationManager is IAllocationManagerErrors, IAllocationManagerEven * @param operator the operator to check slashability for * @param operatorSet the operator set to check slashability for */ - function isOperatorSlashable(address operator, OperatorSet memory operatorSet) external view returns (bool); + function isOperatorSlashable( + address operator, + OperatorSet memory operatorSet + ) external view returns (bool); /** * @notice Returns the address where slashed funds will be sent for a given operator set. diff --git a/src/contracts/interfaces/IBN254CertificateVerifier.sol b/src/contracts/interfaces/IBN254CertificateVerifier.sol index 64109483b1..3bf5103afc 100644 --- a/src/contracts/interfaces/IBN254CertificateVerifier.sol +++ b/src/contracts/interfaces/IBN254CertificateVerifier.sol @@ -95,7 +95,6 @@ interface IBN254CertificateVerifier is /// a. An in-flight certificate for a past reference timestamp and an operator table update for a newer reference timestamp. The AVS should decide whether it /// wants to only confirm tasks against the *latest* certificate /// b. An in-flight certificate against a stake table with a majority-stake operator that has been slashed or removed from the operatorSet - /** * @notice updates the operatorSet with the operator table (i.e. stake weights) and its configuration * @param operatorSet the operatorSet to update the operator table for diff --git a/src/contracts/interfaces/IBackingEigen.sol b/src/contracts/interfaces/IBackingEigen.sol index c8e031bd6c..d34d6d6837 100644 --- a/src/contracts/interfaces/IBackingEigen.sol +++ b/src/contracts/interfaces/IBackingEigen.sol @@ -9,14 +9,20 @@ interface IBackingEigen is IERC20 { * @param from the address whose allowedFrom status is being set * @param isAllowedFrom the new allowedFrom status */ - function setAllowedFrom(address from, bool isAllowedFrom) external; + function setAllowedFrom( + address from, + bool isAllowedFrom + ) external; /** * @notice This function allows the owner to set the allowedTo status of an address * @param to the address whose allowedTo status is being set * @param isAllowedTo the new allowedTo status */ - function setAllowedTo(address to, bool isAllowedTo) external; + function setAllowedTo( + address to, + bool isAllowedTo + ) external; /** * @notice Allows the owner to disable transfer restrictions @@ -31,13 +37,19 @@ interface IBackingEigen is IERC20 { ) external; // @notice Allows the contract owner to modify an entry in the `isMinter` mapping. - function setIsMinter(address minterAddress, bool newStatus) external; + function setIsMinter( + address minterAddress, + bool newStatus + ) external; /** * @notice Allows any privileged address to mint `amount` new tokens to the address `to`. * @dev Callable only by an address that has `isMinter` set to true. */ - function mint(address to, uint256 amount) external; + function mint( + address to, + uint256 amount + ) external; /** * @dev Destroys `amount` tokens from the caller. diff --git a/src/contracts/interfaces/IBaseCertificateVerifier.sol b/src/contracts/interfaces/IBaseCertificateVerifier.sol index 23837a3098..fe85cab148 100644 --- a/src/contracts/interfaces/IBaseCertificateVerifier.sol +++ b/src/contracts/interfaces/IBaseCertificateVerifier.sol @@ -79,7 +79,6 @@ interface IBaseCertificateVerifier is /// a. An in-flight certificate for a past reference timestamp and an operator table update for a newer reference timestamp. The AVS should decide whether it /// wants to only confirm tasks against the *latest* certificate /// b. An in-flight certificate against a stake table with a majority-stake operator that has been slashed or removed from the operatorSet - /** * @notice The address of the owner of the operatorSet * @param operatorSet The operatorSet to get the owner of diff --git a/src/contracts/interfaces/ICrossChainRegistry.sol b/src/contracts/interfaces/ICrossChainRegistry.sol index 3650bcda3a..0316c6de06 100644 --- a/src/contracts/interfaces/ICrossChainRegistry.sol +++ b/src/contracts/interfaces/ICrossChainRegistry.sol @@ -195,7 +195,10 @@ interface ICrossChainRegistry is ICrossChainRegistryErrors, ICrossChainRegistryE * @dev Emits the following events: * - OperatorSetConfigSet: When the operator set config is successfully set */ - function setOperatorSetConfig(OperatorSet calldata operatorSet, OperatorSetConfig calldata config) external; + function setOperatorSetConfig( + OperatorSet calldata operatorSet, + OperatorSetConfig calldata config + ) external; /** * @notice Adds chainIDs to the whitelist of chainIDs that are transported to by the multichain protocol @@ -211,7 +214,10 @@ interface ICrossChainRegistry is ICrossChainRegistryErrors, ICrossChainRegistryE * @dev Emits the following events: * - ChainIDAddedToWhitelist: When each chainID is successfully added to the whitelist */ - function addChainIDsToWhitelist(uint256[] calldata chainIDs, address[] calldata operatorTableUpdaters) external; + function addChainIDsToWhitelist( + uint256[] calldata chainIDs, + address[] calldata operatorTableUpdaters + ) external; /** * @notice Removes chainIDs from the whitelist of chainIDs diff --git a/src/contracts/interfaces/IDelegationManager.sol b/src/contracts/interfaces/IDelegationManager.sol index fcbc9a4afd..5bdf455584 100644 --- a/src/contracts/interfaces/IDelegationManager.sol +++ b/src/contracts/interfaces/IDelegationManager.sol @@ -218,7 +218,10 @@ interface IDelegationManager is ISignatureUtilsMixin, IDelegationManagerErrors, * * @dev The caller must have previously registered as an operator in EigenLayer. */ - function modifyOperatorDetails(address operator, address newDelegationApprover) external; + function modifyOperatorDetails( + address operator, + address newDelegationApprover + ) external; /** * @notice Called by an operator to emit an `OperatorMetadataURIUpdated` event indicating the information has updated. @@ -226,7 +229,10 @@ interface IDelegationManager is ISignatureUtilsMixin, IDelegationManagerErrors, * @param metadataURI The URI for metadata associated with an operator * @dev Note that the `metadataURI` is *never stored * and is only emitted in the `OperatorMetadataURIUpdated` event */ - function updateOperatorMetadataURI(address operator, string calldata metadataURI) external; + function updateOperatorMetadataURI( + address operator, + string calldata metadataURI + ) external; /** * @notice Caller delegates their stake to an operator. @@ -396,7 +402,10 @@ interface IDelegationManager is ISignatureUtilsMixin, IDelegationManagerErrors, * @dev Salts are used in the `delegateTo` function. Note that this function only processes the delegationApprover's * signature + the provided salt if the operator being delegated to has specified a nonzero address as their `delegationApprover`. */ - function delegationApproverSaltIsSpent(address _delegationApprover, bytes32 salt) external view returns (bool); + function delegationApproverSaltIsSpent( + address _delegationApprover, + bytes32 salt + ) external view returns (bool); /// @notice Mapping: staker => cumulative number of queued withdrawals they have ever initiated. /// @dev This only increments (doesn't decrement), and is used to help ensure that otherwise identical withdrawals have unique hashes. @@ -453,7 +462,10 @@ interface IDelegationManager is ISignatureUtilsMixin, IDelegationManagerErrors, * @param strategy the strategy to get shares for * @return the amount of shares that are slashable in the withdrawal queue for an operator and a strategy */ - function getSlashableSharesInQueue(address operator, IStrategy strategy) external view returns (uint256); + function getSlashableSharesInQueue( + address operator, + IStrategy strategy + ) external view returns (uint256); /** * @notice Given a staker and a set of strategies, return the shares they can queue for withdrawal and the @@ -477,7 +489,10 @@ interface IDelegationManager is ISignatureUtilsMixin, IDelegationManagerErrors, /** * @notice Returns the scaling factor applied to a staker's deposits for a given strategy */ - function depositScalingFactor(address staker, IStrategy strategy) external view returns (uint256); + function depositScalingFactor( + address staker, + IStrategy strategy + ) external view returns (uint256); /** * @notice Returns the Withdrawal associated with a `withdrawalRoot`. diff --git a/src/contracts/interfaces/IECDSACertificateVerifier.sol b/src/contracts/interfaces/IECDSACertificateVerifier.sol index 799c179815..17247905b7 100644 --- a/src/contracts/interfaces/IECDSACertificateVerifier.sol +++ b/src/contracts/interfaces/IECDSACertificateVerifier.sol @@ -86,7 +86,6 @@ interface IECDSACertificateVerifier is /// a. An in-flight certificate for a past reference timestamp and an operator table update for a newer reference timestamp. The AVS should decide whether it /// wants to only confirm tasks against the *latest* certificate /// b. An in-flight certificate against a stake table with a majority-stake operator that has been slashed or removed from the operatorSet - /** * @notice updates the operatorSet with the operator table (i.e. stake weights) and its configuration * @param operatorSet the operatorSet to update the operator table for diff --git a/src/contracts/interfaces/IEigen.sol b/src/contracts/interfaces/IEigen.sol index 0de79374bf..bb79f488f2 100644 --- a/src/contracts/interfaces/IEigen.sol +++ b/src/contracts/interfaces/IEigen.sol @@ -9,14 +9,20 @@ interface IEigen is IERC20 { * @param from the address whose allowedFrom status is being set * @param isAllowedFrom the new allowedFrom status */ - function setAllowedFrom(address from, bool isAllowedFrom) external; + function setAllowedFrom( + address from, + bool isAllowedFrom + ) external; /** * @notice This function allows the owner to set the allowedTo status of an address * @param to the address whose allowedTo status is being set * @param isAllowedTo the new allowedTo status */ - function setAllowedTo(address to, bool isAllowedTo) external; + function setAllowedTo( + address to, + bool isAllowedTo + ) external; /** * @notice Allows the owner to disable transfer restrictions diff --git a/src/contracts/interfaces/IEigenPod.sol b/src/contracts/interfaces/IEigenPod.sol index c36f1fce98..47085e32ae 100644 --- a/src/contracts/interfaces/IEigenPod.sol +++ b/src/contracts/interfaces/IEigenPod.sol @@ -87,7 +87,6 @@ interface IEigenPodTypes { INACTIVE, // doesnt exist ACTIVE, // staked on ethpos and withdrawal credentials are pointed to the EigenPod WITHDRAWN // withdrawn from the Beacon Chain - } /** @@ -198,14 +197,21 @@ interface IEigenPod is IEigenPodErrors, IEigenPodEvents, ISemVerMixin { /// @notice Called by EigenPodManager when the owner wants to create another ETH validator. /// @dev This function only supports staking to a 0x01 validator. For compounding validators, please interact directly with the deposit contract. - function stake(bytes calldata pubkey, bytes calldata signature, bytes32 depositDataRoot) external payable; + function stake( + bytes calldata pubkey, + bytes calldata signature, + bytes32 depositDataRoot + ) external payable; /** * @notice Transfers `amountWei` from this contract to the `recipient`. Only callable by the EigenPodManager as part * of the DelegationManager's withdrawal flow. * @dev `amountWei` is not required to be a whole Gwei amount. Amounts less than a Gwei multiple may be unrecoverable due to Gwei conversion. */ - function withdrawRestakedBeaconChainETH(address recipient, uint256 amount) external; + function withdrawRestakedBeaconChainETH( + address recipient, + uint256 amount + ) external; /** * @dev Create a checkpoint used to prove this pod's active validator set. Checkpoints are completed @@ -390,7 +396,11 @@ interface IEigenPod is IEigenPodErrors, IEigenPodEvents, ISemVerMixin { ) external payable; /// @notice called by owner of a pod to remove any ERC20s deposited in the pod - function recoverTokens(IERC20[] memory tokenList, uint256[] memory amountsToWithdraw, address recipient) external; + function recoverTokens( + IERC20[] memory tokenList, + uint256[] memory amountsToWithdraw, + address recipient + ) external; /// @notice Allows the owner of a pod to update the proof submitter, a permissioned /// address that can call various EigenPod methods, but cannot trigger asset withdrawals diff --git a/src/contracts/interfaces/IEigenPodManager.sol b/src/contracts/interfaces/IEigenPodManager.sol index b7814e9888..895b1fb68b 100644 --- a/src/contracts/interfaces/IEigenPodManager.sol +++ b/src/contracts/interfaces/IEigenPodManager.sol @@ -111,7 +111,11 @@ interface IEigenPodManager is * @param signature The validator's signature of the deposit data. * @param depositDataRoot The root/hash of the deposit data for the validator's deposit. */ - function stake(bytes calldata pubkey, bytes calldata signature, bytes32 depositDataRoot) external payable; + function stake( + bytes calldata pubkey, + bytes calldata signature, + bytes32 depositDataRoot + ) external payable; /** * @notice Adds any positive share delta to the pod owner's deposit shares, and delegates them to the pod diff --git a/src/contracts/interfaces/IKeyRegistrar.sol b/src/contracts/interfaces/IKeyRegistrar.sol index 79f570cf27..bd70291430 100644 --- a/src/contracts/interfaces/IKeyRegistrar.sol +++ b/src/contracts/interfaces/IKeyRegistrar.sol @@ -105,7 +105,10 @@ interface IKeyRegistrar is IKeyRegistrarErrors, IKeyRegistrarEvents, ISemVerMixi * @dev Emits the following events: * - OperatorSetConfigured: When the operator set is successfully configured with a curve type */ - function configureOperatorSet(OperatorSet memory operatorSet, CurveType curveType) external; + function configureOperatorSet( + OperatorSet memory operatorSet, + CurveType curveType + ) external; /** * @notice Registers a cryptographic key for an operator with a specific operator set @@ -154,7 +157,10 @@ interface IKeyRegistrar is IKeyRegistrarErrors, IKeyRegistrarEvents, ISemVerMixi * @dev Emits the following events: * - KeyDeregistered: When the key is successfully deregistered for the operator and operatorSet */ - function deregisterKey(address operator, OperatorSet memory operatorSet) external; + function deregisterKey( + address operator, + OperatorSet memory operatorSet + ) external; /** * @notice Checks if a key is registered for an operator with a specific operator set @@ -163,7 +169,10 @@ interface IKeyRegistrar is IKeyRegistrarErrors, IKeyRegistrarEvents, ISemVerMixi * @return True if the key is registered, false otherwise * @dev If the operatorSet is not configured, this function will return false */ - function isRegistered(OperatorSet memory operatorSet, address operator) external view returns (bool); + function isRegistered( + OperatorSet memory operatorSet, + address operator + ) external view returns (bool); /** * @notice Gets the curve type for an operator set @@ -200,7 +209,10 @@ interface IKeyRegistrar is IKeyRegistrarErrors, IKeyRegistrarEvents, ISemVerMixi * @dev Returns 0x0 if the operator has not registered a key for the operatorSet. We * recommend calling `isRegistered` first to check if the operator has a key registered */ - function getECDSAKey(OperatorSet memory operatorSet, address operator) external view returns (bytes memory); + function getECDSAKey( + OperatorSet memory operatorSet, + address operator + ) external view returns (bytes memory); /** * @notice Gets the ECDSA public key for an operator with a specific operator set @@ -212,7 +224,10 @@ interface IKeyRegistrar is IKeyRegistrarErrors, IKeyRegistrarEvents, ISemVerMixi * @dev Returns 0x0 if the operator has not registered a key for the operatorSet. We * recommend calling `isRegistered` first to check if the operator has a key registered */ - function getECDSAAddress(OperatorSet memory operatorSet, address operator) external view returns (address); + function getECDSAAddress( + OperatorSet memory operatorSet, + address operator + ) external view returns (address); /** * @notice Checks if a key hash is globally registered @@ -229,7 +244,10 @@ interface IKeyRegistrar is IKeyRegistrarErrors, IKeyRegistrarEvents, ISemVerMixi * @param operator Address of the operator * @return keyHash The key hash */ - function getKeyHash(OperatorSet memory operatorSet, address operator) external view returns (bytes32); + function getKeyHash( + OperatorSet memory operatorSet, + address operator + ) external view returns (bytes32); /** * @notice Gets the operator from signing key diff --git a/src/contracts/interfaces/IOperatorTableCalculator.sol b/src/contracts/interfaces/IOperatorTableCalculator.sol index 39a7d34428..a6e27dd8ae 100644 --- a/src/contracts/interfaces/IOperatorTableCalculator.sol +++ b/src/contracts/interfaces/IOperatorTableCalculator.sol @@ -85,7 +85,6 @@ interface IOperatorTableCalculator { /// @dev To distribute stake-weighted tasks to operators, the AVS should read this contract (via RPC) at the `referenceTimestamp` /// for which the operator table was updated on the destination chains /// @dev The operatorTableCalculator is configured by the AVS in the core `CrossChainRegistry` contract - /** * @notice Calculates the operator table, in bytes, for a given operatorSet * @param operatorSet the operatorSet to calculate the operator table for diff --git a/src/contracts/interfaces/IOperatorTableUpdater.sol b/src/contracts/interfaces/IOperatorTableUpdater.sol index 2aae4e29b5..ada0236f95 100644 --- a/src/contracts/interfaces/IOperatorTableUpdater.sol +++ b/src/contracts/interfaces/IOperatorTableUpdater.sol @@ -161,7 +161,10 @@ interface IOperatorTableUpdater is * @dev Emits the following events: * - GeneratorUpdated: When generator is successfully updated */ - function updateGenerator(OperatorSet calldata generator, BN254OperatorSetInfo calldata generatorInfo) external; + function updateGenerator( + OperatorSet calldata generator, + BN254OperatorSetInfo calldata generatorInfo + ) external; /** * @notice Updates an operator table diff --git a/src/contracts/interfaces/IPermissionController.sol b/src/contracts/interfaces/IPermissionController.sol index b8e2153736..4d1b8c4d80 100644 --- a/src/contracts/interfaces/IPermissionController.sol +++ b/src/contracts/interfaces/IPermissionController.sol @@ -50,7 +50,10 @@ interface IPermissionController is IPermissionControllerErrors, IPermissionContr * @dev The pending admin must accept the role before becoming an active admin. * @dev Multiple admins can be set for a single account. */ - function addPendingAdmin(address account, address admin) external; + function addPendingAdmin( + address account, + address admin + ) external; /** * @notice Removes a pending admin from an account before they have accepted the role. @@ -58,7 +61,10 @@ interface IPermissionController is IPermissionControllerErrors, IPermissionContr * @param admin The pending admin address to remove. * @dev Only an existing admin of the account can remove a pending admin. */ - function removePendingAdmin(address account, address admin) external; + function removePendingAdmin( + address account, + address admin + ) external; /** * @notice Allows a pending admin to accept their admin role for an account. @@ -76,7 +82,10 @@ interface IPermissionController is IPermissionControllerErrors, IPermissionContr * @dev Only an existing admin of the account can remove another admin. * @dev Will revert if removing this admin would leave the account with zero admins. */ - function removeAdmin(address account, address admin) external; + function removeAdmin( + address account, + address admin + ) external; /** * @notice Sets an appointee who can call specific functions on behalf of an account. @@ -86,7 +95,12 @@ interface IPermissionController is IPermissionControllerErrors, IPermissionContr * @param selector The function selector the appointee can call. * @dev Only an admin of the account can set appointees. */ - function setAppointee(address account, address appointee, address target, bytes4 selector) external; + function setAppointee( + address account, + address appointee, + address target, + bytes4 selector + ) external; /** * @notice Removes an appointee's permission to call a specific function. @@ -96,7 +110,12 @@ interface IPermissionController is IPermissionControllerErrors, IPermissionContr * @param selector The function selector to remove permissions for. * @dev Only an admin of the account can remove appointees. */ - function removeAppointee(address account, address appointee, address target, bytes4 selector) external; + function removeAppointee( + address account, + address appointee, + address target, + bytes4 selector + ) external; /** * @notice Checks if a given address is an admin of an account. @@ -105,7 +124,10 @@ interface IPermissionController is IPermissionControllerErrors, IPermissionContr * @dev If the account has no admins, returns true only if the caller is the account itself. * @return Returns true if the caller is an admin, false otherwise. */ - function isAdmin(address account, address caller) external view returns (bool); + function isAdmin( + address account, + address caller + ) external view returns (bool); /** * @notice Checks if an address is currently a pending admin for an account. @@ -113,7 +135,10 @@ interface IPermissionController is IPermissionControllerErrors, IPermissionContr * @param pendingAdmin The address to check. * @return Returns true if the address is a pending admin, false otherwise. */ - function isPendingAdmin(address account, address pendingAdmin) external view returns (bool); + function isPendingAdmin( + address account, + address pendingAdmin + ) external view returns (bool); /** * @notice Retrieves all active admins for an account. @@ -145,7 +170,12 @@ interface IPermissionController is IPermissionControllerErrors, IPermissionContr * This is only possible if a function's selector changes (e.g. if a function's parameters are modified). * @return Returns true if the caller has permission, false otherwise. */ - function canCall(address account, address caller, address target, bytes4 selector) external returns (bool); + function canCall( + address account, + address caller, + address target, + bytes4 selector + ) external returns (bool); /** * @notice Retrieves all permissions granted to an appointee for a given account. @@ -166,5 +196,9 @@ interface IPermissionController is IPermissionControllerErrors, IPermissionContr * @dev Does not include admins in the returned list, even though they have calling permission. * @return An array of appointee addresses. */ - function getAppointees(address account, address target, bytes4 selector) external returns (address[] memory); + function getAppointees( + address account, + address target, + bytes4 selector + ) external returns (address[] memory); } diff --git a/src/contracts/interfaces/IReleaseManager.sol b/src/contracts/interfaces/IReleaseManager.sol index 8cf45c8493..2acfcc0d85 100644 --- a/src/contracts/interfaces/IReleaseManager.sol +++ b/src/contracts/interfaces/IReleaseManager.sol @@ -54,7 +54,6 @@ interface IReleaseManager is IReleaseManagerErrors, IReleaseManagerEvents { * WRITE FUNCTIONS * */ - /// @notice Publishes a new release for an operator set. /// @dev If the upgradeByTime is 0, the release is meant to signal an instant upgrade. /// @param operatorSet The operator set this release is for. @@ -68,7 +67,10 @@ interface IReleaseManager is IReleaseManagerErrors, IReleaseManagerEvents { /// @notice Publishes a metadata URI for an operator set. /// @param operatorSet The operator set this metadata URI is for. /// @param metadataURI The metadata URI that was published. - function publishMetadataURI(OperatorSet calldata operatorSet, string calldata metadataURI) external; + function publishMetadataURI( + OperatorSet calldata operatorSet, + string calldata metadataURI + ) external; /** * @@ -88,7 +90,10 @@ interface IReleaseManager is IReleaseManagerErrors, IReleaseManagerEvents { /// @param operatorSet The operator set to query. /// @param releaseId The id of the release to get. /// @return The release at the specified index. - function getRelease(OperatorSet memory operatorSet, uint256 releaseId) external view returns (Release memory); + function getRelease( + OperatorSet memory operatorSet, + uint256 releaseId + ) external view returns (Release memory); /// @notice Returns the latest release for an operator set. /// @dev If the upgradeByTime is 0, the release is meant to signal an instant upgrade. @@ -111,7 +116,10 @@ interface IReleaseManager is IReleaseManagerErrors, IReleaseManagerEvents { /// @param operatorSet The operator set to query. /// @param releaseId The id of the release to check. /// @return True if the release is the latest release, false otherwise. - function isValidRelease(OperatorSet memory operatorSet, uint256 releaseId) external view returns (bool); + function isValidRelease( + OperatorSet memory operatorSet, + uint256 releaseId + ) external view returns (bool); /// @notice Returns the metadata URI for an operator set. /// @param operatorSet The operator set to query. diff --git a/src/contracts/interfaces/IRewardsCoordinator.sol b/src/contracts/interfaces/IRewardsCoordinator.sol index 1baf624e41..eff087e036 100644 --- a/src/contracts/interfaces/IRewardsCoordinator.sol +++ b/src/contracts/interfaces/IRewardsCoordinator.sol @@ -527,7 +527,10 @@ interface IRewardsCoordinator is IRewardsCoordinatorErrors, IRewardsCoordinatorE * if claimerFor[claim.earner] is address(0) then only the earner can claim, otherwise only * claimerFor[claim.earner] can claim the rewards. */ - function processClaim(RewardsMerkleClaim calldata claim, address recipient) external; + function processClaim( + RewardsMerkleClaim calldata claim, + address recipient + ) external; /** * @notice Batch claim rewards against a given root (read from _distributionRoots[claim.rootIndex]). @@ -542,7 +545,10 @@ interface IRewardsCoordinator is IRewardsCoordinatorErrors, IRewardsCoordinatorE * claimerFor[claim.earner] can claim the rewards. * @dev This function may fail to execute with a large number of claims due to gas limits. Use a smaller array of claims if necessary. */ - function processClaims(RewardsMerkleClaim[] calldata claims, address recipient) external; + function processClaims( + RewardsMerkleClaim[] calldata claims, + address recipient + ) external; /** * @notice Creates a new distribution root. activatedAt is set to block.timestamp + activationDelay @@ -550,7 +556,10 @@ interface IRewardsCoordinator is IRewardsCoordinatorErrors, IRewardsCoordinatorE * @param rewardsCalculationEndTimestamp The timestamp until which rewards have been calculated * @dev Only callable by the rewardsUpdater */ - function submitRoot(bytes32 root, uint32 rewardsCalculationEndTimestamp) external; + function submitRoot( + bytes32 root, + uint32 rewardsCalculationEndTimestamp + ) external; /** * @notice allow the rewardsUpdater to disable/cancel a pending root submission in case of an error @@ -576,7 +585,10 @@ interface IRewardsCoordinator is IRewardsCoordinatorErrors, IRewardsCoordinatorE * @dev Only callable by operators or AVSs. We define an AVS that has created at least one * operatorSet in the `AllocationManager` */ - function setClaimerFor(address earner, address claimer) external; + function setClaimerFor( + address earner, + address claimer + ) external; /** * @notice Sets the delay in timestamp before a posted root can be claimed against @@ -605,7 +617,11 @@ interface IRewardsCoordinator is IRewardsCoordinatorErrors, IRewardsCoordinatorE * @dev Split has to be between 0 and 10000 bips (inclusive) * @dev The split will be activated after the activation delay */ - function setOperatorAVSSplit(address operator, address avs, uint16 split) external; + function setOperatorAVSSplit( + address operator, + address avs, + uint16 split + ) external; /** * @notice Sets the split for a specific operator for Programmatic Incentives. @@ -615,7 +631,10 @@ interface IRewardsCoordinator is IRewardsCoordinatorErrors, IRewardsCoordinatorE * @dev Split has to be between 0 and 10000 bips (inclusive) * @dev The split will be activated after the activation delay */ - function setOperatorPISplit(address operator, uint16 split) external; + function setOperatorPISplit( + address operator, + uint16 split + ) external; /** * @notice Sets the split for a specific operator for a specific operatorSet. @@ -626,7 +645,11 @@ interface IRewardsCoordinator is IRewardsCoordinatorErrors, IRewardsCoordinatorE * @dev Split has to be between 0 and 10000 bips (inclusive) * @dev The split will be activated after the activation delay */ - function setOperatorSetSplit(address operator, OperatorSet calldata operatorSet, uint16 split) external; + function setOperatorSetSplit( + address operator, + OperatorSet calldata operatorSet, + uint16 split + ) external; /** * @notice Sets the permissioned `rewardsUpdater` address which can post new roots @@ -643,7 +666,10 @@ interface IRewardsCoordinator is IRewardsCoordinatorErrors, IRewardsCoordinatorE * @param _submitter The address of the rewardsForAllSubmitter * @param _newValue The new value for isRewardsForAllSubmitter */ - function setRewardsForAllSubmitter(address _submitter, bool _newValue) external; + function setRewardsForAllSubmitter( + address _submitter, + bool _newValue + ) external; /** * @@ -663,13 +689,19 @@ interface IRewardsCoordinator is IRewardsCoordinatorErrors, IRewardsCoordinatorE ) external view returns (address); /// @notice Mapping: claimer => token => total amount claimed - function cumulativeClaimed(address claimer, IERC20 token) external view returns (uint256); + function cumulativeClaimed( + address claimer, + IERC20 token + ) external view returns (uint256); /// @notice the default split for all operators across all avss function defaultOperatorSplitBips() external view returns (uint16); /// @notice the split for a specific `operator` for a specific `avs` - function getOperatorAVSSplit(address operator, address avs) external view returns (uint16); + function getOperatorAVSSplit( + address operator, + address avs + ) external view returns (uint16); /// @notice the split for a specific `operator` for Programmatic Incentives function getOperatorPISplit( @@ -677,7 +709,10 @@ interface IRewardsCoordinator is IRewardsCoordinatorErrors, IRewardsCoordinatorE ) external view returns (uint16); /// @notice Returns the split for a specific `operator` for a given `operatorSet` - function getOperatorSetSplit(address operator, OperatorSet calldata operatorSet) external view returns (uint16); + function getOperatorSetSplit( + address operator, + OperatorSet calldata operatorSet + ) external view returns (uint16); /// @notice return the hash of the earner's leaf function calculateEarnerLeafHash( diff --git a/src/contracts/interfaces/IShareManager.sol b/src/contracts/interfaces/IShareManager.sol index 212ae2c08d..569c03d63a 100644 --- a/src/contracts/interfaces/IShareManager.sol +++ b/src/contracts/interfaces/IShareManager.sol @@ -26,17 +26,29 @@ interface IShareManager { /// @dev strategy must be beaconChainETH when talking to the EigenPodManager /// @return existingDepositShares the shares the staker had before any were added /// @return addedShares the new shares added to the staker's balance - function addShares(address staker, IStrategy strategy, uint256 shares) external returns (uint256, uint256); + function addShares( + address staker, + IStrategy strategy, + uint256 shares + ) external returns (uint256, uint256); /// @notice Used by the DelegationManager to convert deposit shares to tokens and send them to a staker /// @dev strategy must be beaconChainETH when talking to the EigenPodManager /// @dev token is not validated when talking to the EigenPodManager - function withdrawSharesAsTokens(address staker, IStrategy strategy, IERC20 token, uint256 shares) external; + function withdrawSharesAsTokens( + address staker, + IStrategy strategy, + IERC20 token, + uint256 shares + ) external; /// @notice Returns the current shares of `user` in `strategy` /// @dev strategy must be beaconChainETH when talking to the EigenPodManager /// @dev returns 0 if the user has negative shares - function stakerDepositShares(address user, IStrategy strategy) external view returns (uint256 depositShares); + function stakerDepositShares( + address user, + IStrategy strategy + ) external view returns (uint256 depositShares); /** * @notice Increase the amount of burnable/redistributable shares for a given Strategy. This is called by the DelegationManager diff --git a/src/contracts/interfaces/IStrategy.sol b/src/contracts/interfaces/IStrategy.sol index bb60597940..b168ea55e8 100644 --- a/src/contracts/interfaces/IStrategy.sol +++ b/src/contracts/interfaces/IStrategy.sol @@ -57,7 +57,10 @@ interface IStrategy is IStrategyErrors, IStrategyEvents, ISemVerMixin { * `depositIntoStrategy` function, and individual share balances are recorded in the strategyManager as well. * @return newShares is the number of new shares issued at the current exchange ratio. */ - function deposit(IERC20 token, uint256 amount) external returns (uint256); + function deposit( + IERC20 token, + uint256 amount + ) external returns (uint256); /** * @notice Used to withdraw tokens from this Strategy, to the `recipient`'s address @@ -68,7 +71,11 @@ interface IStrategy is IStrategyErrors, IStrategyEvents, ISemVerMixin { * other functions, and individual share balances are recorded in the strategyManager as well. * @return amountOut is the amount of tokens being transferred out. */ - function withdraw(address recipient, IERC20 token, uint256 amountShares) external returns (uint256); + function withdraw( + address recipient, + IERC20 token, + uint256 amountShares + ) external returns (uint256); /** * @notice Used to convert a number of shares to the equivalent amount of underlying tokens for this strategy. diff --git a/src/contracts/interfaces/IStrategyManager.sol b/src/contracts/interfaces/IStrategyManager.sol index 15f0c098f0..a9270fc103 100644 --- a/src/contracts/interfaces/IStrategyManager.sol +++ b/src/contracts/interfaces/IStrategyManager.sol @@ -243,7 +243,10 @@ interface IStrategyManager is IStrategyManagerErrors, IStrategyManagerEvents, IS ) external view returns (uint256); /// @notice Returns the current shares of `user` in `strategy` - function stakerDepositShares(address user, IStrategy strategy) external view returns (uint256 shares); + function stakerDepositShares( + address user, + IStrategy strategy + ) external view returns (uint256 shares); /// @notice Returns the single, central Delegation contract of EigenLayer function delegation() external view returns (IDelegationManager); diff --git a/src/contracts/interfaces/ITaskMailbox.sol b/src/contracts/interfaces/ITaskMailbox.sol index 9afb0710a3..b92011bc29 100644 --- a/src/contracts/interfaces/ITaskMailbox.sol +++ b/src/contracts/interfaces/ITaskMailbox.sol @@ -72,7 +72,6 @@ interface ITaskMailboxTypes { CREATED, // 1 - Task has been created VERIFIED, // 2 - Task has been verified EXPIRED // 3 - Task has expired - } /** @@ -284,14 +283,17 @@ interface ITaskMailbox is ITaskMailboxErrors, ITaskMailboxEvents { * EXTERNAL FUNCTIONS * */ - /** * @notice Initializes the TaskMailbox * @param owner The owner of the contract * @param feeSplit The initial fee split in basis points * @param feeSplitCollector The initial fee split collector address */ - function initialize(address owner, uint16 feeSplit, address feeSplitCollector) external; + function initialize( + address owner, + uint16 feeSplit, + address feeSplitCollector + ) external; /** * @notice Sets the task configuration for an executor operator set @@ -310,7 +312,10 @@ interface ITaskMailbox is ITaskMailboxErrors, ITaskMailboxEvents { * @param isRegistered Whether the operator set is going to be (de)registered * @dev This function can be called to toggle the registration once the task config has been set. */ - function registerExecutorOperatorSet(OperatorSet memory operatorSet, bool isRegistered) external; + function registerExecutorOperatorSet( + OperatorSet memory operatorSet, + bool isRegistered + ) external; /** * @notice Creates a new task @@ -329,7 +334,11 @@ interface ITaskMailbox is ITaskMailboxErrors, ITaskMailboxEvents { * @param executorCert Certificate proving the validity of the result * @param result Task execution result data */ - function submitResult(bytes32 taskHash, bytes memory executorCert, bytes memory result) external; + function submitResult( + bytes32 taskHash, + bytes memory executorCert, + bytes memory result + ) external; /** * @notice Refunds the fee for an expired task @@ -433,7 +442,10 @@ interface ITaskMailbox is ITaskMailboxErrors, ITaskMailboxEvents { * @param result Task execution result data * @return The message hash for the task that needs to be signed by operators */ - function getMessageHash(bytes32 taskHash, bytes memory result) external pure returns (bytes32); + function getMessageHash( + bytes32 taskHash, + bytes memory result + ) external pure returns (bytes32); /** * @notice Gets the current fee split percentage diff --git a/src/contracts/libraries/BN254.sol b/src/contracts/libraries/BN254.sol index 236bbef383..f5d80bae7e 100644 --- a/src/contracts/libraries/BN254.sol +++ b/src/contracts/libraries/BN254.sol @@ -96,7 +96,8 @@ library BN254 { return G2Point([nG2x1, nG2x0], [nG2y1, nG2y0]); } - bytes32 internal constant powersOfTauMerkleRoot = 0x22c998e49752bbb1918ba87d6d59dd0e83620a311ba91dd4b2cc84990b31b56f; + bytes32 internal constant powersOfTauMerkleRoot = + 0x22c998e49752bbb1918ba87d6d59dd0e83620a311ba91dd4b2cc84990b31b56f; /** * @param p Some point in G1. @@ -116,7 +117,10 @@ library BN254 { /** * @return r the sum of two points of G1 */ - function plus(G1Point memory p1, G1Point memory p2) internal view returns (G1Point memory r) { + function plus( + G1Point memory p1, + G1Point memory p2 + ) internal view returns (G1Point memory r) { uint256[4] memory input; input[0] = p1.X; input[1] = p1.Y; @@ -141,7 +145,10 @@ library BN254 { * @param s the scalar to multiply by * @dev this function is only safe to use if the scalar is 9 bits or less */ - function scalar_mul_tiny(BN254.G1Point memory p, uint16 s) internal view returns (BN254.G1Point memory) { + function scalar_mul_tiny( + BN254.G1Point memory p, + uint16 s + ) internal view returns (BN254.G1Point memory) { require(s < 2 ** 9, ScalarTooLarge()); // if s is 1 return p @@ -183,7 +190,10 @@ library BN254 { * p == p.scalar_mul(1) and p.plus(p) == p.scalar_mul(2) for all * points p. */ - function scalar_mul(G1Point memory p, uint256 s) internal view returns (G1Point memory r) { + function scalar_mul( + G1Point memory p, + uint256 s + ) internal view returns (G1Point memory r) { uint256[3] memory input; input[0] = p.X; input[1] = p.Y; @@ -346,7 +356,11 @@ library BN254 { return (beta, y); } - function expMod(uint256 _base, uint256 _exponent, uint256 _modulus) internal view returns (uint256 retval) { + function expMod( + uint256 _base, + uint256 _exponent, + uint256 _modulus + ) internal view returns (uint256 retval) { bool success; uint256[1] memory output; uint256[6] memory input; diff --git a/src/contracts/libraries/BN254SignatureVerifier.sol b/src/contracts/libraries/BN254SignatureVerifier.sol index 6ca512d17d..8939ab4bd4 100644 --- a/src/contracts/libraries/BN254SignatureVerifier.sol +++ b/src/contracts/libraries/BN254SignatureVerifier.sol @@ -64,19 +64,19 @@ library BN254SignatureVerifier { BN254.G1Point memory signature ) internal pure returns (uint256 gamma) { gamma = uint256( - keccak256( - abi.encodePacked( - msgHash, - pubkeyG1.X, - pubkeyG1.Y, - pubkeyG2.X[0], - pubkeyG2.X[1], - pubkeyG2.Y[0], - pubkeyG2.Y[1], - signature.X, - signature.Y + keccak256( + abi.encodePacked( + msgHash, + pubkeyG1.X, + pubkeyG1.Y, + pubkeyG2.X[0], + pubkeyG2.X[1], + pubkeyG2.Y[0], + pubkeyG2.Y[1], + signature.X, + signature.Y + ) ) - ) - ) % BN254.FR_MODULUS; + ) % BN254.FR_MODULUS; } } diff --git a/src/contracts/libraries/BeaconChainProofs.sol b/src/contracts/libraries/BeaconChainProofs.sol index 5d7af5d8ad..d23447202f 100644 --- a/src/contracts/libraries/BeaconChainProofs.sol +++ b/src/contracts/libraries/BeaconChainProofs.sol @@ -112,7 +112,10 @@ library BeaconChainProofs { /// @notice Verify a merkle proof of the beacon state root against a beacon block root /// @param beaconBlockRoot merkle root of the beacon block /// @param proof the beacon state root and merkle proof of its inclusion under `beaconBlockRoot` - function verifyStateRoot(bytes32 beaconBlockRoot, StateRootProof calldata proof) internal view { + function verifyStateRoot( + bytes32 beaconBlockRoot, + StateRootProof calldata proof + ) internal view { require(proof.proof.length == 32 * (BEACON_BLOCK_HEADER_TREE_HEIGHT), InvalidProofLength()); /// This merkle proof verifies the `beaconStateRoot` under the `beaconBlockRoot` @@ -121,10 +124,7 @@ library BeaconChainProofs { /// -- beaconStateRoot require( Merkle.verifyInclusionSha256({ - proof: proof.proof, - root: beaconBlockRoot, - leaf: proof.beaconStateRoot, - index: STATE_ROOT_INDEX + proof: proof.proof, root: beaconBlockRoot, leaf: proof.beaconStateRoot, index: STATE_ROOT_INDEX }), InvalidProof() ); @@ -171,10 +171,7 @@ library BeaconChainProofs { require( Merkle.verifyInclusionSha256({ - proof: validatorFieldsProof, - root: beaconStateRoot, - leaf: validatorRoot, - index: index + proof: validatorFieldsProof, root: beaconStateRoot, leaf: validatorRoot, index: index }), InvalidProof() ); @@ -216,10 +213,7 @@ library BeaconChainProofs { require( Merkle.verifyInclusionSha256({ - proof: proof.proof, - root: beaconBlockRoot, - leaf: proof.balanceContainerRoot, - index: index + proof: proof.proof, root: beaconBlockRoot, leaf: proof.balanceContainerRoot, index: index }), InvalidProof() ); @@ -248,10 +242,7 @@ library BeaconChainProofs { require( Merkle.verifyInclusionSha256({ - proof: proof.proof, - root: balanceContainerRoot, - leaf: proof.balanceRoot, - index: balanceIndex + proof: proof.proof, root: balanceContainerRoot, leaf: proof.balanceRoot, index: balanceIndex }), InvalidProof() ); @@ -269,7 +260,10 @@ library BeaconChainProofs { * @param validatorIndex is the index of the validator being proven for * @return The validator's balance, in Gwei */ - function getBalanceAtIndex(bytes32 balanceRoot, uint40 validatorIndex) internal pure returns (uint64) { + function getBalanceAtIndex( + bytes32 balanceRoot, + uint40 validatorIndex + ) internal pure returns (uint64) { uint256 bitShiftAmount = (validatorIndex % 4) * 64; return Endian.fromLittleEndianUint64(bytes32((uint256(balanceRoot) << bitShiftAmount))); } diff --git a/src/contracts/libraries/Merkle.sol b/src/contracts/libraries/Merkle.sol index f12b53ebdf..f53bc99eaf 100644 --- a/src/contracts/libraries/Merkle.sol +++ b/src/contracts/libraries/Merkle.sol @@ -265,7 +265,10 @@ library Merkle { * @dev Reverts for: * - InvalidIndex: index is outside the max index for the tree. */ - function getProofKeccak(bytes32[] memory leaves, uint256 index) internal pure returns (bytes memory proof) { + function getProofKeccak( + bytes32[] memory leaves, + uint256 index + ) internal pure returns (bytes memory proof) { require(leaves.length > 0, NoLeaves()); // TODO: very inefficient, use ZERO_HASHES // pad to the next power of 2 @@ -306,7 +309,10 @@ library Merkle { * - NotEnoughLeaves: leaves.length is less than 2. * @dev Unlike the Keccak version, this function does not allow a single-leaf proof. */ - function getProofSha256(bytes32[] memory leaves, uint256 index) internal pure returns (bytes memory proof) { + function getProofSha256( + bytes32[] memory leaves, + uint256 index + ) internal pure returns (bytes memory proof) { require(leaves.length > 1, NotEnoughLeaves()); // TODO: very inefficient, use ZERO_HASHES // pad to the next power of 2 diff --git a/src/contracts/libraries/OperatorSetLib.sol b/src/contracts/libraries/OperatorSetLib.sol index 0b1ae4808d..1fbe72f206 100644 --- a/src/contracts/libraries/OperatorSetLib.sol +++ b/src/contracts/libraries/OperatorSetLib.sol @@ -22,7 +22,12 @@ library OperatorSetLib { function decode( bytes32 _key - ) internal pure returns (OperatorSet memory) { + ) + internal + pure + returns (OperatorSet memory) + { + /// forgefmt: disable-next-item return OperatorSet({ avs: address(uint160(uint256(_key) >> 96)), diff --git a/src/contracts/libraries/SlashingLib.sol b/src/contracts/libraries/SlashingLib.sol index 24b512ed87..8f0c2c1e87 100644 --- a/src/contracts/libraries/SlashingLib.sol +++ b/src/contracts/libraries/SlashingLib.sol @@ -15,9 +15,9 @@ uint64 constant WAD = 1e18; * There are 2 types of shares: * 1. deposit shares * - These can be converted to an amount of tokens given a strategy - * - by calling `sharesToUnderlying` on the strategy address (they're already tokens + * - by calling `sharesToUnderlying` on the strategy address (they're already tokens * in the case of EigenPods) - * - These live in the storage of the EigenPodManager and individual StrategyManager strategies + * - These live in the storage of the EigenPodManager and individual StrategyManager strategies * 2. withdrawable shares * - For a staker, this is the amount of shares that they can withdraw * - For an operator, the shares delegated to them are equal to the sum of their stakers' @@ -41,11 +41,17 @@ library SlashingLib { // WAD MATH - function mulWad(uint256 x, uint256 y) internal pure returns (uint256) { + function mulWad( + uint256 x, + uint256 y + ) internal pure returns (uint256) { return x.mulDiv(y, WAD); } - function divWad(uint256 x, uint256 y) internal pure returns (uint256) { + function divWad( + uint256 x, + uint256 y + ) internal pure returns (uint256) { return x.mulDiv(WAD, y); } @@ -54,7 +60,10 @@ library SlashingLib { * situation where an operator is slashed several times and precision has been lost over time, * an incoming slashing request isn't rounded down to 0 and an operator is able to avoid slashing penalties. */ - function mulWadRoundUp(uint256 x, uint256 y) internal pure returns (uint256) { + function mulWadRoundUp( + uint256 x, + uint256 y + ) internal pure returns (uint256) { return x.mulDiv(y, WAD, Math.Rounding.Up); } @@ -73,7 +82,10 @@ library SlashingLib { return depositSharesToWithdraw.mulWad(dsf.scalingFactor()); } - function scaleForCompleteWithdrawal(uint256 scaledShares, uint256 slashingFactor) internal pure returns (uint256) { + function scaleForCompleteWithdrawal( + uint256 scaledShares, + uint256 slashingFactor + ) internal pure returns (uint256) { return scaledShares.mulWad(slashingFactor); } @@ -161,7 +173,12 @@ library SlashingLib { DepositScalingFactor memory dsf, uint256 depositShares, uint256 slashingFactor - ) internal pure returns (uint256) { + ) + internal + pure + returns (uint256) + { + /// forgefmt: disable-next-item return depositShares .mulWad(dsf.scalingFactor()) @@ -172,7 +189,12 @@ library SlashingLib { DepositScalingFactor memory dsf, uint256 withdrawableShares, uint256 slashingFactor - ) internal pure returns (uint256) { + ) + internal + pure + returns (uint256) + { + /// forgefmt: disable-next-item return withdrawableShares .divWad(dsf.scalingFactor()) diff --git a/src/contracts/libraries/Snapshots.sol b/src/contracts/libraries/Snapshots.sol index 839aec0d48..53002ad5c8 100644 --- a/src/contracts/libraries/Snapshots.sol +++ b/src/contracts/libraries/Snapshots.sol @@ -41,7 +41,11 @@ library Snapshots { /** * @dev Pushes a (`key`, `value`) pair into a DefaultWadHistory so that it is stored as the snapshot. */ - function push(DefaultWadHistory storage self, uint32 key, uint64 value) internal { + function push( + DefaultWadHistory storage self, + uint32 key, + uint64 value + ) internal { _insert(self._snapshots, key, value); } @@ -49,7 +53,11 @@ library Snapshots { * @dev Pushes a (`key`, `value`) pair into a DefaultZeroHistory so that it is stored as the snapshot. * `value` is cast to uint224. Responsibility for the safety of this operation falls outside of this library. */ - function push(DefaultZeroHistory storage self, uint32 key, uint256 value) internal { + function push( + DefaultZeroHistory storage self, + uint32 key, + uint256 value + ) internal { _insert(self._snapshots, key, uint224(value)); } @@ -57,7 +65,10 @@ library Snapshots { * @dev Return default value of WAD if there are no snapshots for DefaultWadHistory. * This is used for looking up maxMagnitudes in the AllocationManager. */ - function upperLookup(DefaultWadHistory storage self, uint32 key) internal view returns (uint64) { + function upperLookup( + DefaultWadHistory storage self, + uint32 key + ) internal view returns (uint64) { return uint64(_upperLookup(self._snapshots, key, WAD)); } @@ -65,7 +76,10 @@ library Snapshots { * @dev Return default value of 0 if there are no snapshots for DefaultZeroHistory. * This is used for looking up cumulative scaled shares in the DelegationManager. */ - function upperLookup(DefaultZeroHistory storage self, uint32 key) internal view returns (uint256) { + function upperLookup( + DefaultZeroHistory storage self, + uint32 key + ) internal view returns (uint256) { return _upperLookup(self._snapshots, key, 0); } @@ -109,7 +123,11 @@ library Snapshots { * @dev Pushes a (`key`, `value`) pair into an ordered list of snapshots, either by inserting a new snapshot, * or by updating the last one. */ - function _insert(Snapshot[] storage self, uint32 key, uint224 value) private { + function _insert( + Snapshot[] storage self, + uint32 key, + uint224 value + ) private { uint256 pos = self.length; if (pos > 0) { @@ -144,7 +162,10 @@ library Snapshots { /** * @dev Returns the value in the most recent snapshot, or `defaultValue` if there are no snapshots. */ - function _latest(Snapshot[] storage snapshots, uint224 defaultValue) private view returns (uint224) { + function _latest( + Snapshot[] storage snapshots, + uint224 defaultValue + ) private view returns (uint224) { uint256 pos = snapshots.length; return pos == 0 ? defaultValue : _unsafeAccess(snapshots, pos - 1)._value; } @@ -175,7 +196,10 @@ library Snapshots { /** * @dev Access an element of the array without performing bounds check. The position is assumed to be within bounds. */ - function _unsafeAccess(Snapshot[] storage self, uint256 pos) private pure returns (Snapshot storage result) { + function _unsafeAccess( + Snapshot[] storage self, + uint256 pos + ) private pure returns (Snapshot storage result) { assembly { mstore(0, self.slot) result.slot := add(keccak256(0, 0x20), pos) diff --git a/src/contracts/mixins/SignatureUtilsMixin.sol b/src/contracts/mixins/SignatureUtilsMixin.sol index 1d17ad0877..8785cb83d4 100644 --- a/src/contracts/mixins/SignatureUtilsMixin.sol +++ b/src/contracts/mixins/SignatureUtilsMixin.sol @@ -32,7 +32,13 @@ abstract contract SignatureUtilsMixin is ISignatureUtilsMixin, SemVerMixin { /// EXTERNAL FUNCTIONS /// /// @inheritdoc ISignatureUtilsMixin - function domainSeparator() public view virtual returns (bytes32) { + function domainSeparator() + public + view + virtual + returns (bytes32) + { + // forgefmt: disable-next-item return keccak256( diff --git a/src/contracts/multichain/BN254CertificateVerifier.sol b/src/contracts/multichain/BN254CertificateVerifier.sol index 210f4e8474..010c6ea891 100644 --- a/src/contracts/multichain/BN254CertificateVerifier.sol +++ b/src/contracts/multichain/BN254CertificateVerifier.sol @@ -17,12 +17,7 @@ import "./BN254CertificateVerifierStorage.sol"; * @dev This contract uses BN254 curves for signature verification and * caches operator information for efficient verification */ -contract BN254CertificateVerifier is - Initializable, - BN254CertificateVerifierStorage, - SemVerMixin, - LeafCalculatorMixin -{ +contract BN254CertificateVerifier is Initializable, BN254CertificateVerifierStorage, SemVerMixin, LeafCalculatorMixin { using Merkle for bytes; using BN254 for BN254.G1Point; @@ -179,7 +174,10 @@ contract BN254CertificateVerifier is * @param operatorSetKey The operator set key * @param referenceTimestamp The reference timestamp to validate */ - function _validateCertificateTimestamp(bytes32 operatorSetKey, uint32 referenceTimestamp) internal view { + function _validateCertificateTimestamp( + bytes32 operatorSetKey, + uint32 referenceTimestamp + ) internal view { // Assert that the certificate is not stale uint32 maxStaleness = _maxStalenessPeriods[operatorSetKey]; require(maxStaleness == 0 || block.timestamp <= referenceTimestamp + maxStaleness, CertificateStale()); @@ -270,7 +268,10 @@ contract BN254CertificateVerifier is * @param ctx The verification context * @param cert The certificate containing the signature to verify */ - function _verifySignature(VerificationContext memory ctx, BN254Certificate memory cert) internal view { + function _verifySignature( + VerificationContext memory ctx, + BN254Certificate memory cert + ) internal view { // Calculate signer aggregate public key by subtracting non-signers from total BN254.G1Point memory signerApk = ctx.operatorSetInfo.aggregatePubkey.plus(ctx.nonSignerApk.negate()); @@ -410,7 +411,10 @@ contract BN254CertificateVerifier is } /// @inheritdoc IBN254CertificateVerifier - function calculateCertificateDigest(uint32 referenceTimestamp, bytes32 messageHash) public pure returns (bytes32) { + function calculateCertificateDigest( + uint32 referenceTimestamp, + bytes32 messageHash + ) public pure returns (bytes32) { return keccak256(abi.encode(BN254_CERTIFICATE_TYPEHASH, referenceTimestamp, messageHash)); } } diff --git a/src/contracts/multichain/CrossChainRegistry.sol b/src/contracts/multichain/CrossChainRegistry.sol index fb4e62c91b..6eb43b7dcd 100644 --- a/src/contracts/multichain/CrossChainRegistry.sol +++ b/src/contracts/multichain/CrossChainRegistry.sol @@ -249,7 +249,10 @@ contract CrossChainRegistry is * @param config The operator set config * @dev The 0 staleness period is special case and is allowed, since it allows for certificates to ALWAYS be valid */ - function _setOperatorSetConfig(OperatorSet memory operatorSet, OperatorSetConfig memory config) internal { + function _setOperatorSetConfig( + OperatorSet memory operatorSet, + OperatorSetConfig memory config + ) internal { require( config.maxStalenessPeriod == 0 || config.maxStalenessPeriod >= _tableUpdateCadence, InvalidStalenessPeriod() ); diff --git a/src/contracts/multichain/CrossChainRegistryStorage.sol b/src/contracts/multichain/CrossChainRegistryStorage.sol index c62d172b38..f3de8b9d31 100644 --- a/src/contracts/multichain/CrossChainRegistryStorage.sol +++ b/src/contracts/multichain/CrossChainRegistryStorage.sol @@ -66,7 +66,10 @@ abstract contract CrossChainRegistryStorage is ICrossChainRegistry { // Construction - constructor(IAllocationManager _allocationManager, IKeyRegistrar _keyRegistrar) { + constructor( + IAllocationManager _allocationManager, + IKeyRegistrar _keyRegistrar + ) { allocationManager = _allocationManager; keyRegistrar = _keyRegistrar; } diff --git a/src/contracts/multichain/ECDSACertificateVerifier.sol b/src/contracts/multichain/ECDSACertificateVerifier.sol index a9d718674c..9290771029 100644 --- a/src/contracts/multichain/ECDSACertificateVerifier.sol +++ b/src/contracts/multichain/ECDSACertificateVerifier.sol @@ -372,7 +372,10 @@ contract ECDSACertificateVerifier is Initializable, ECDSACertificateVerifierStor } /// @inheritdoc IECDSACertificateVerifier - function calculateCertificateDigest(uint32 referenceTimestamp, bytes32 messageHash) public view returns (bytes32) { + function calculateCertificateDigest( + uint32 referenceTimestamp, + bytes32 messageHash + ) public view returns (bytes32) { return keccak256(calculateCertificateDigestBytes(referenceTimestamp, messageHash)); } } diff --git a/src/contracts/multichain/ECDSACertificateVerifierStorage.sol b/src/contracts/multichain/ECDSACertificateVerifierStorage.sol index 398c70e782..b884762321 100644 --- a/src/contracts/multichain/ECDSACertificateVerifierStorage.sol +++ b/src/contracts/multichain/ECDSACertificateVerifierStorage.sol @@ -36,7 +36,8 @@ abstract contract ECDSACertificateVerifierStorage is IECDSACertificateVerifier { mapping(bytes32 => uint32) internal _latestReferenceTimestamps; /// @dev Mapping from referenceTimestamp to the number of operators - mapping(bytes32 operatorSetKey => mapping(uint32 referenceTimestamp => uint256 numOperators)) internal _numOperators; + mapping(bytes32 operatorSetKey => mapping(uint32 referenceTimestamp => uint256 numOperators)) internal + _numOperators; /// @dev Mapping from operatorSetKey to referenceTimestamp to operatorInfos mapping(bytes32 operatorSetKey => mapping(uint32 referenceTimestamp => mapping(uint256 => ECDSAOperatorInfo))) diff --git a/src/contracts/multichain/OperatorTableUpdater.sol b/src/contracts/multichain/OperatorTableUpdater.sol index 91a4ccb321..f395d92d4e 100644 --- a/src/contracts/multichain/OperatorTableUpdater.sol +++ b/src/contracts/multichain/OperatorTableUpdater.sol @@ -138,11 +138,8 @@ contract OperatorTableUpdater is // Silently return if the `referenceTimestamp` has already been updated for the `operatorSet` // We do this to avoid race conditions with the offchain transport of the operator table - if ( - IBaseCertificateVerifier(getCertificateVerifier(curveType)).isReferenceTimestampSet( - operatorSet, referenceTimestamp - ) - ) { + if (IBaseCertificateVerifier(getCertificateVerifier(curveType)) + .isReferenceTimestampSet(operatorSet, referenceTimestamp)) { return; } @@ -341,10 +338,7 @@ contract OperatorTableUpdater is // Verify inclusion of the operatorSet and operatorSetLeaf in the merkle tree require( Merkle.verifyInclusionKeccak({ - proof: proof, - root: globalTableRoot, - leaf: operatorSetLeafHash, - index: operatorSetIndex + proof: proof, root: globalTableRoot, leaf: operatorSetLeafHash, index: operatorSetIndex }), InvalidOperatorSetProof() ); @@ -374,7 +368,10 @@ contract OperatorTableUpdater is * @dev The `_latestReferenceTimestamp` is not updated since this root is ONLY used for the `Generator` * @dev The `_referenceBlockNumber` and `_referenceTimestamps` mappings are not updated since they are only used for introspection for official operatorSets */ - function _updateGenerator(OperatorSet calldata generator, BN254OperatorSetInfo calldata generatorInfo) internal { + function _updateGenerator( + OperatorSet calldata generator, + BN254OperatorSetInfo calldata generatorInfo + ) internal { // Set the generator _generator = generator; @@ -410,8 +407,9 @@ contract OperatorTableUpdater is bytes memory operatorTableInfo ) { - (operatorSet, curveType, operatorSetInfo, operatorTableInfo) = - abi.decode(operatorTable, (OperatorSet, CurveType, OperatorSetConfig, bytes)); + (operatorSet, curveType, operatorSetInfo, operatorTableInfo) = abi.decode( + operatorTable, (OperatorSet, CurveType, OperatorSetConfig, bytes) + ); } /** diff --git a/src/contracts/permissions/KeyRegistrar.sol b/src/contracts/permissions/KeyRegistrar.sol index 7830a3063a..6fdace4c11 100644 --- a/src/contracts/permissions/KeyRegistrar.sol +++ b/src/contracts/permissions/KeyRegistrar.sol @@ -88,7 +88,10 @@ contract KeyRegistrar is KeyRegistrarStorage, PermissionControllerMixin, Signatu } /// @inheritdoc IKeyRegistrar - function deregisterKey(address operator, OperatorSet memory operatorSet) external checkCanCall(operator) { + function deregisterKey( + address operator, + OperatorSet memory operatorSet + ) external checkCanCall(operator) { // Operators can only deregister if they are not slashable for this operator set require( !allocationManager.isOperatorSlashable(operator, operatorSet), OperatorStillSlashable(operatorSet, operator) @@ -231,7 +234,10 @@ contract KeyRegistrar is KeyRegistrarStorage, PermissionControllerMixin, Signatu * @param curveType The curve type (ECDSA or BN254) * @return keyHash The key hash */ - function _getKeyHashForKeyData(bytes memory pubkey, CurveType curveType) internal pure returns (bytes32) { + function _getKeyHashForKeyData( + bytes memory pubkey, + CurveType curveType + ) internal pure returns (bytes32) { if (curveType == CurveType.ECDSA) { return keccak256(pubkey); } else if (curveType == CurveType.BN254) { @@ -249,7 +255,10 @@ contract KeyRegistrar is KeyRegistrarStorage, PermissionControllerMixin, Signatu */ /// @inheritdoc IKeyRegistrar - function isRegistered(OperatorSet memory operatorSet, address operator) public view returns (bool) { + function isRegistered( + OperatorSet memory operatorSet, + address operator + ) public view returns (bool) { return _operatorKeyInfo[operatorSet.key()][operator].isRegistered; } @@ -284,7 +293,10 @@ contract KeyRegistrar is KeyRegistrarStorage, PermissionControllerMixin, Signatu } /// @inheritdoc IKeyRegistrar - function getECDSAKey(OperatorSet memory operatorSet, address operator) public view returns (bytes memory) { + function getECDSAKey( + OperatorSet memory operatorSet, + address operator + ) public view returns (bytes memory) { // Validate operator set curve type CurveType curveType = _operatorSetCurveTypes[operatorSet.key()]; require(curveType == CurveType.ECDSA, InvalidCurveType()); @@ -294,7 +306,10 @@ contract KeyRegistrar is KeyRegistrarStorage, PermissionControllerMixin, Signatu } /// @inheritdoc IKeyRegistrar - function getECDSAAddress(OperatorSet memory operatorSet, address operator) external view returns (address) { + function getECDSAAddress( + OperatorSet memory operatorSet, + address operator + ) external view returns (address) { return address(bytes20(getECDSAKey(operatorSet, operator))); } @@ -306,7 +321,10 @@ contract KeyRegistrar is KeyRegistrarStorage, PermissionControllerMixin, Signatu } /// @inheritdoc IKeyRegistrar - function getKeyHash(OperatorSet memory operatorSet, address operator) external view returns (bytes32) { + function getKeyHash( + OperatorSet memory operatorSet, + address operator + ) external view returns (bytes32) { KeyInfo memory keyInfo = _operatorKeyInfo[operatorSet.key()][operator]; CurveType curveType = _operatorSetCurveTypes[operatorSet.key()]; diff --git a/src/contracts/permissions/Pausable.sol b/src/contracts/permissions/Pausable.sol index 1701cd3d64..f696e27690 100644 --- a/src/contracts/permissions/Pausable.sol +++ b/src/contracts/permissions/Pausable.sol @@ -21,7 +21,6 @@ import "../interfaces/IPausable.sol"; */ abstract contract Pausable is IPausable { /// Constants - uint256 internal constant _UNPAUSE_ALL = 0; uint256 internal constant _PAUSE_ALL = type(uint256).max; diff --git a/src/contracts/permissions/PauserRegistry.sol b/src/contracts/permissions/PauserRegistry.sol index cc86944aff..a5ef556830 100644 --- a/src/contracts/permissions/PauserRegistry.sol +++ b/src/contracts/permissions/PauserRegistry.sol @@ -20,7 +20,10 @@ contract PauserRegistry is IPauserRegistry { _; } - constructor(address[] memory _pausers, address _unpauser) { + constructor( + address[] memory _pausers, + address _unpauser + ) { for (uint256 i = 0; i < _pausers.length; i++) { _setIsPauser(_pausers[i], true); } @@ -30,7 +33,10 @@ contract PauserRegistry is IPauserRegistry { /// @notice Sets new pauser - only callable by unpauser, as the unpauser is expected to be kept more secure, e.g. being a multisig with a higher threshold /// @param newPauser Address to be added/removed as pauser /// @param canPause Whether the address should be added or removed as pauser - function setIsPauser(address newPauser, bool canPause) external onlyUnpauser { + function setIsPauser( + address newPauser, + bool canPause + ) external onlyUnpauser { _setIsPauser(newPauser, canPause); } @@ -41,7 +47,10 @@ contract PauserRegistry is IPauserRegistry { _setUnpauser(newUnpauser); } - function _setIsPauser(address pauser, bool canPause) internal { + function _setIsPauser( + address pauser, + bool canPause + ) internal { require(pauser != address(0), InputAddressZero()); isPauser[pauser] = canPause; emit PauserStatusChanged(pauser, canPause); diff --git a/src/contracts/permissions/PermissionController.sol b/src/contracts/permissions/PermissionController.sol index ee367d79d8..99aa441ccd 100644 --- a/src/contracts/permissions/PermissionController.sol +++ b/src/contracts/permissions/PermissionController.sol @@ -33,7 +33,10 @@ contract PermissionController is Initializable, SemVerMixin, PermissionControlle */ /// @inheritdoc IPermissionController - function addPendingAdmin(address account, address admin) external onlyAdmin(account) { + function addPendingAdmin( + address account, + address admin + ) external onlyAdmin(account) { AccountPermissions storage permissions = _permissions[account]; // Revert if the admin is already set @@ -47,7 +50,10 @@ contract PermissionController is Initializable, SemVerMixin, PermissionControlle } /// @inheritdoc IPermissionController - function removePendingAdmin(address account, address admin) external onlyAdmin(account) { + function removePendingAdmin( + address account, + address admin + ) external onlyAdmin(account) { EnumerableSet.AddressSet storage pendingAdmins = _permissions[account].pendingAdmins; // Remove the admin from the account's pending admins @@ -75,7 +81,10 @@ contract PermissionController is Initializable, SemVerMixin, PermissionControlle } /// @inheritdoc IPermissionController - function removeAdmin(address account, address admin) external onlyAdmin(account) { + function removeAdmin( + address account, + address admin + ) external onlyAdmin(account) { EnumerableSet.AddressSet storage admins = _permissions[account].admins; require(admins.length() > 1, CannotHaveZeroAdmins()); @@ -133,7 +142,10 @@ contract PermissionController is Initializable, SemVerMixin, PermissionControlle /// @dev Encodes the target and selector into a single bytes32 values /// @dev Encoded Format: [160 bits target][32 bits selector][64 bits padding], - function _encodeTargetSelector(address target, bytes4 selector) internal pure returns (bytes32) { + function _encodeTargetSelector( + address target, + bytes4 selector + ) internal pure returns (bytes32) { // Reserve 96 bits for the target uint256 shiftedTarget = uint256(uint160(target)) << 96; // Reserve 32 bits for the selector @@ -162,7 +174,10 @@ contract PermissionController is Initializable, SemVerMixin, PermissionControlle */ /// @inheritdoc IPermissionController - function isAdmin(address account, address caller) public view returns (bool) { + function isAdmin( + address account, + address caller + ) public view returns (bool) { if (_permissions[account].admins.length() == 0) { // If the account does not have an admin, the caller must be the account return account == caller; @@ -173,7 +188,10 @@ contract PermissionController is Initializable, SemVerMixin, PermissionControlle } /// @inheritdoc IPermissionController - function isPendingAdmin(address account, address pendingAdmin) external view returns (bool) { + function isPendingAdmin( + address account, + address pendingAdmin + ) external view returns (bool) { return _permissions[account].pendingAdmins.contains(pendingAdmin); } @@ -198,7 +216,12 @@ contract PermissionController is Initializable, SemVerMixin, PermissionControlle } /// @inheritdoc IPermissionController - function canCall(address account, address caller, address target, bytes4 selector) external view returns (bool) { + function canCall( + address account, + address caller, + address target, + bytes4 selector + ) external view returns (bool) { return isAdmin(account, caller) || _permissions[account].appointeePermissions[caller].contains(_encodeTargetSelector(target, selector)); } @@ -223,7 +246,11 @@ contract PermissionController is Initializable, SemVerMixin, PermissionControlle } /// @inheritdoc IPermissionController - function getAppointees(address account, address target, bytes4 selector) external view returns (address[] memory) { + function getAppointees( + address account, + address target, + bytes4 selector + ) external view returns (address[] memory) { bytes32 targetSelector = _encodeTargetSelector(target, selector); return _permissions[account].permissionAppointees[targetSelector].values(); } diff --git a/src/contracts/pods/EigenPod.sol b/src/contracts/pods/EigenPod.sol index 94117ddca1..d315915b88 100644 --- a/src/contracts/pods/EigenPod.sol +++ b/src/contracts/pods/EigenPod.sol @@ -24,13 +24,7 @@ import "./EigenPodStorage.sol"; * @dev Note that all beacon chain balances are stored as gwei within the beacon chain datastructures. We choose * to account balances in terms of gwei in the EigenPod contract and convert to wei when making calls to other contracts */ -contract EigenPod is - Initializable, - ReentrancyGuardUpgradeable, - EigenPodPausingConstants, - EigenPodStorage, - SemVerMixin -{ +contract EigenPod is Initializable, ReentrancyGuardUpgradeable, EigenPodPausingConstants, EigenPodStorage, SemVerMixin { using SafeERC20 for IERC20; using BeaconChainProofs for *; @@ -238,6 +232,7 @@ contract EigenPod is uint256 totalAmountToBeRestakedWei; for (uint256 i = 0; i < validatorIndices.length; i++) { + // forgefmt: disable-next-item totalAmountToBeRestakedWei += _verifyWithdrawalCredentials( beaconTimestamp, @@ -408,7 +403,10 @@ contract EigenPod is } /// @inheritdoc IEigenPod - function withdrawRestakedBeaconChainETH(address recipient, uint256 amountWei) external onlyEigenPodManager { + function withdrawRestakedBeaconChainETH( + address recipient, + uint256 amountWei + ) external onlyEigenPodManager { uint64 amountGwei = uint64(amountWei / GWEI_TO_WEI); amountWei = amountGwei * GWEI_TO_WEI; require(amountGwei <= restakedExecutionLayerGwei, InsufficientWithdrawableBalance()); @@ -666,9 +664,7 @@ contract EigenPod is // Update pod owner's shares emit CheckpointFinalized(lastCheckpointTimestamp, balanceDeltaWei); eigenPodManager.recordBeaconChainETHBalanceUpdate({ - podOwner: podOwner, - prevRestakedBalanceWei: prevRestakedBalanceWei, - balanceDeltaWei: balanceDeltaWei + podOwner: podOwner, prevRestakedBalanceWei: prevRestakedBalanceWei, balanceDeltaWei: balanceDeltaWei }); } @@ -709,9 +705,10 @@ contract EigenPod is /// We check if the proofTimestamp is <= pectraForkTimestamp because a `proofTimestamp` at the `pectraForkTimestamp` /// is considered to be Pre-Pectra given the EIP-4788 oracle returns the parent block. - return proofTimestamp <= forkTimestamp - ? BeaconChainProofs.ProofVersion.DENEB - : BeaconChainProofs.ProofVersion.PECTRA; + return + proofTimestamp <= forkTimestamp + ? BeaconChainProofs.ProofVersion.DENEB + : BeaconChainProofs.ProofVersion.PECTRA; } /** diff --git a/src/contracts/pods/EigenPodManager.sol b/src/contracts/pods/EigenPodManager.sol index 1c5822e921..dd6cfff215 100644 --- a/src/contracts/pods/EigenPodManager.sol +++ b/src/contracts/pods/EigenPodManager.sol @@ -67,7 +67,10 @@ contract EigenPodManager is _disableInitializers(); } - function initialize(address initialOwner, uint256 _initPausedStatus) external initializer { + function initialize( + address initialOwner, + uint256 _initPausedStatus + ) external initializer { _transferOwnership(initialOwner); _setPausedStatus(_initPausedStatus); } @@ -283,7 +286,10 @@ contract EigenPodManager is /// NOTE: if the staker ends with a non-positive balance, this returns (0, 0) /// @return prevDepositShares the shares the staker had before any were added /// @return addedShares the shares added to the staker's balance - function _addShares(address staker, uint256 shares) internal returns (uint256, uint256) { + function _addShares( + address staker, + uint256 shares + ) internal returns (uint256, uint256) { require(staker != address(0), InputAddressZero()); require(int256(shares) >= 0, SharesNegative()); @@ -359,7 +365,10 @@ contract EigenPodManager is /// @notice Returns the current shares of `user` in `strategy` /// @dev strategy must be beaconChainETHStrategy /// @dev returns 0 if the user has negative shares - function stakerDepositShares(address user, IStrategy strategy) public view returns (uint256 depositShares) { + function stakerDepositShares( + address user, + IStrategy strategy + ) public view returns (uint256 depositShares) { require(strategy == beaconChainETHStrategy, InvalidStrategy()); return podOwnerDepositShares[user] < 0 ? 0 : uint256(podOwnerDepositShares[user]); } diff --git a/src/contracts/pods/EigenPodManagerStorage.sol b/src/contracts/pods/EigenPodManagerStorage.sol index edfaeb9726..82157ac531 100644 --- a/src/contracts/pods/EigenPodManagerStorage.sol +++ b/src/contracts/pods/EigenPodManagerStorage.sol @@ -16,7 +16,6 @@ abstract contract EigenPodManagerStorage is IEigenPodManager { * CONSTANTS / IMMUTABLES * */ - /// @notice The ETH2 Deposit Contract IETHPOSDeposit public immutable ethPOS; @@ -97,7 +96,11 @@ abstract contract EigenPodManagerStorage is IEigenPodManager { /// @notice The timestamp of the Pectra proof uint64 public pectraForkTimestamp; - constructor(IETHPOSDeposit _ethPOS, IBeacon _eigenPodBeacon, IDelegationManager _delegationManager) { + constructor( + IETHPOSDeposit _ethPOS, + IBeacon _eigenPodBeacon, + IDelegationManager _delegationManager + ) { ethPOS = _ethPOS; eigenPodBeacon = _eigenPodBeacon; delegationManager = _delegationManager; diff --git a/src/contracts/strategies/EigenStrategy.sol b/src/contracts/strategies/EigenStrategy.sol index 1bde13901d..44cf031853 100644 --- a/src/contracts/strategies/EigenStrategy.sol +++ b/src/contracts/strategies/EigenStrategy.sol @@ -42,7 +42,10 @@ contract EigenStrategy is StrategyBase { string memory _version ) StrategyBase(_strategyManager, _pauserRegistry, _version) {} - function initialize(IEigen _EIGEN, IERC20 _bEIGEN) public virtual initializer { + function initialize( + IEigen _EIGEN, + IERC20 _bEIGEN + ) public virtual initializer { EIGEN = _EIGEN; _initializeStrategyBase(_bEIGEN); } @@ -55,7 +58,10 @@ contract EigenStrategy is StrategyBase { * @param token token to be deposited, can be either EIGEN or bEIGEN. If EIGEN, then is unwrapped into bEIGEN * @param amount deposit amount */ - function _beforeDeposit(IERC20 token, uint256 amount) internal virtual override { + function _beforeDeposit( + IERC20 token, + uint256 amount + ) internal virtual override { require(token == underlyingToken || token == EIGEN, OnlyUnderlyingToken()); if (token == EIGEN) { @@ -88,7 +94,11 @@ contract EigenStrategy is StrategyBase { * @param token token to be withdrawn, can be either EIGEN or bEIGEN. If EIGEN, then bEIGEN is wrapped into EIGEN * @param amountToSend amount of tokens to transfer */ - function _afterWithdrawal(address recipient, IERC20 token, uint256 amountToSend) internal virtual override { + function _afterWithdrawal( + address recipient, + IERC20 token, + uint256 amountToSend + ) internal virtual override { if (token == EIGEN) { // wrap bEIGEN into EIGEN assuming a 1-1 wrapping amount // the strategy will then hold `amountToSend` of EIGEN diff --git a/src/contracts/strategies/StrategyBase.sol b/src/contracts/strategies/StrategyBase.sol index 18824c7bb5..600d82cd09 100644 --- a/src/contracts/strategies/StrategyBase.sol +++ b/src/contracts/strategies/StrategyBase.sol @@ -213,7 +213,11 @@ contract StrategyBase is Initializable, Pausable, IStrategy, SemVerMixin { * @param token The ERC20 being transferred * @param amountToSend The amount of `token` to transfer */ - function _afterWithdrawal(address recipient, IERC20 token, uint256 amountToSend) internal virtual { + function _afterWithdrawal( + address recipient, + IERC20 token, + uint256 amountToSend + ) internal virtual { token.safeTransfer(recipient, amountToSend); } @@ -287,7 +291,10 @@ contract StrategyBase is Initializable, Pausable, IStrategy, SemVerMixin { /// @notice Internal function used to emit the exchange rate of the strategy in wad (18 decimals) /// @dev Tokens that do not have 18 decimals must have offchain services scale the exchange rate down to proper magnitude - function _emitExchangeRate(uint256 virtualTokenBalance, uint256 virtualTotalShares) internal { + function _emitExchangeRate( + uint256 virtualTokenBalance, + uint256 virtualTotalShares + ) internal { // Emit asset over shares ratio. emit ExchangeRateEmitted((1e18 * virtualTokenBalance) / virtualTotalShares); } diff --git a/src/contracts/strategies/StrategyBaseTVLLimits.sol b/src/contracts/strategies/StrategyBaseTVLLimits.sol index 65eca55877..afffaa6021 100644 --- a/src/contracts/strategies/StrategyBaseTVLLimits.sol +++ b/src/contracts/strategies/StrategyBaseTVLLimits.sol @@ -46,7 +46,10 @@ contract StrategyBaseTVLLimits is StrategyBase { * @dev We note that there is a potential race condition between a call to this function that lowers either or both of these limits and call(s) * to `deposit`, that may result in some calls to `deposit` reverting. */ - function setTVLLimits(uint256 newMaxPerDeposit, uint256 newMaxTotalDeposits) external onlyUnpauser { + function setTVLLimits( + uint256 newMaxPerDeposit, + uint256 newMaxTotalDeposits + ) external onlyUnpauser { _setTVLLimits(newMaxPerDeposit, newMaxTotalDeposits); } @@ -56,7 +59,10 @@ contract StrategyBaseTVLLimits is StrategyBase { } /// @notice Internal setter for TVL limits - function _setTVLLimits(uint256 newMaxPerDeposit, uint256 newMaxTotalDeposits) internal { + function _setTVLLimits( + uint256 newMaxPerDeposit, + uint256 newMaxTotalDeposits + ) internal { emit MaxPerDepositUpdated(maxPerDeposit, newMaxPerDeposit); emit MaxTotalDepositsUpdated(maxTotalDeposits, newMaxTotalDeposits); require(newMaxPerDeposit <= newMaxTotalDeposits, MaxPerDepositExceedsMax()); @@ -76,7 +82,10 @@ contract StrategyBaseTVLLimits is StrategyBase { * c) increases in the token balance of this contract through other effects – including token rebasing – may cause similar issues to (a) and (b). * @param amount The amount of `token` being deposited */ - function _beforeDeposit(IERC20 token, uint256 amount) internal virtual override { + function _beforeDeposit( + IERC20 token, + uint256 amount + ) internal virtual override { require(amount <= maxPerDeposit, MaxPerDepositExceedsMax()); require(_tokenBalance() <= maxTotalDeposits, BalanceExceedsMaxTotalDeposits()); diff --git a/src/contracts/strategies/StrategyFactory.sol b/src/contracts/strategies/StrategyFactory.sol index 385bdcd839..21019c3179 100644 --- a/src/contracts/strategies/StrategyFactory.sol +++ b/src/contracts/strategies/StrategyFactory.sol @@ -119,7 +119,10 @@ contract StrategyFactory is StrategyFactoryStorage, OwnableUpgradeable, Pausable strategyManager.removeStrategiesFromDepositWhitelist(strategiesToRemoveFromWhitelist); } - function _setStrategyForToken(IERC20 token, IStrategy strategy) internal { + function _setStrategyForToken( + IERC20 token, + IStrategy strategy + ) internal { deployedStrategies[token] = strategy; emit StrategySetForToken(token, strategy); } diff --git a/src/contracts/token/BackingEigen.sol b/src/contracts/token/BackingEigen.sol index a9fbc9f136..71f21d40f0 100644 --- a/src/contracts/token/BackingEigen.sol +++ b/src/contracts/token/BackingEigen.sol @@ -39,7 +39,10 @@ contract BackingEigen is OwnableUpgradeable, ERC20VotesUpgradeable { } // @notice Allows the contract owner to modify an entry in the `isMinter` mapping. - function setIsMinter(address minterAddress, bool newStatus) external onlyOwner { + function setIsMinter( + address minterAddress, + bool newStatus + ) external onlyOwner { emit IsMinterModified(minterAddress, newStatus); isMinter[minterAddress] = newStatus; } @@ -48,7 +51,10 @@ contract BackingEigen is OwnableUpgradeable, ERC20VotesUpgradeable { * @notice Allows any privileged address to mint `amount` new tokens to the address `to`. * @dev Callable only by an address that has `isMinter` set to true. */ - function mint(address to, uint256 amount) external { + function mint( + address to, + uint256 amount + ) external { require(isMinter[msg.sender], "BackingEigen.mint: caller is not a minter"); _mint(to, amount); } @@ -96,7 +102,10 @@ contract BackingEigen is OwnableUpgradeable, ERC20VotesUpgradeable { * @param from the address whose allowedFrom status is being set * @param isAllowedFrom the new allowedFrom status */ - function setAllowedFrom(address from, bool isAllowedFrom) external onlyOwner { + function setAllowedFrom( + address from, + bool isAllowedFrom + ) external onlyOwner { _setAllowedFrom(from, isAllowedFrom); } @@ -105,7 +114,10 @@ contract BackingEigen is OwnableUpgradeable, ERC20VotesUpgradeable { * @param to the address whose allowedTo status is being set * @param isAllowedTo the new allowedTo status */ - function setAllowedTo(address to, bool isAllowedTo) external onlyOwner { + function setAllowedTo( + address to, + bool isAllowedTo + ) external onlyOwner { _setAllowedTo(to, isAllowedTo); } @@ -142,12 +154,18 @@ contract BackingEigen is OwnableUpgradeable, ERC20VotesUpgradeable { /// INTERNAL FUNCTIONS - function _setAllowedFrom(address from, bool isAllowedFrom) internal { + function _setAllowedFrom( + address from, + bool isAllowedFrom + ) internal { allowedFrom[from] = isAllowedFrom; emit SetAllowedFrom(from, isAllowedFrom); } - function _setAllowedTo(address to, bool isAllowedTo) internal { + function _setAllowedTo( + address to, + bool isAllowedTo + ) internal { allowedTo[to] = isAllowedTo; emit SetAllowedTo(to, isAllowedTo); } @@ -158,7 +176,11 @@ contract BackingEigen is OwnableUpgradeable, ERC20VotesUpgradeable { * @param to the address tokens are being transferred to * @param amount the amount of tokens being transferred */ - function _beforeTokenTransfer(address from, address to, uint256 amount) internal override { + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal override { // if transfer restrictions are enabled if (block.timestamp <= transferRestrictionsDisabledAfter) { // if both from and to are not whitelisted diff --git a/src/contracts/token/Eigen.sol b/src/contracts/token/Eigen.sol index b53b9790b0..0125f142a0 100644 --- a/src/contracts/token/Eigen.sol +++ b/src/contracts/token/Eigen.sol @@ -40,7 +40,10 @@ contract Eigen is OwnableUpgradeable, ERC20VotesUpgradeable, SemVerMixin { /// @notice Emitted when EIGEN tokens are unwrapped into bEIGEN event TokenUnwrapped(address indexed account, uint256 amount); - constructor(IERC20 _bEIGEN, string memory _version) SemVerMixin(_version) { + constructor( + IERC20 _bEIGEN, + string memory _version + ) SemVerMixin(_version) { bEIGEN = _bEIGEN; _disableInitializers(); } @@ -87,7 +90,10 @@ contract Eigen is OwnableUpgradeable, ERC20VotesUpgradeable, SemVerMixin { * @param from the address whose allowedFrom status is being set * @param isAllowedFrom the new allowedFrom status */ - function setAllowedFrom(address from, bool isAllowedFrom) external onlyOwner { + function setAllowedFrom( + address from, + bool isAllowedFrom + ) external onlyOwner { allowedFrom[from] = isAllowedFrom; emit SetAllowedFrom(from, isAllowedFrom); } @@ -97,7 +103,10 @@ contract Eigen is OwnableUpgradeable, ERC20VotesUpgradeable, SemVerMixin { * @param to the address whose allowedTo status is being set * @param isAllowedTo the new allowedTo status */ - function setAllowedTo(address to, bool isAllowedTo) external onlyOwner { + function setAllowedTo( + address to, + bool isAllowedTo + ) external onlyOwner { allowedTo[to] = isAllowedTo; emit SetAllowedTo(to, isAllowedTo); } @@ -151,7 +160,10 @@ contract Eigen is OwnableUpgradeable, ERC20VotesUpgradeable, SemVerMixin { /** * @notice Allows the sender to transfer tokens to multiple addresses in a single transaction */ - function multisend(address[] calldata receivers, uint256[] calldata amounts) public { + function multisend( + address[] calldata receivers, + uint256[] calldata amounts + ) public { require(receivers.length == amounts.length, "Eigen.multisend: receivers and amounts must be the same length"); for (uint256 i = 0; i < receivers.length; i++) { _transfer(msg.sender, receivers[i], amounts[i]); @@ -164,7 +176,11 @@ contract Eigen is OwnableUpgradeable, ERC20VotesUpgradeable, SemVerMixin { * @param to the address tokens are being transferred to * @param amount the amount of tokens being transferred */ - function _beforeTokenTransfer(address from, address to, uint256 amount) internal override { + function _beforeTokenTransfer( + address from, + address to, + uint256 amount + ) internal override { // if transfer restrictions are enabled if (block.timestamp <= transferRestrictionsDisabledAfter) { // if both from and to are not whitelisted diff --git a/src/test/DevnetLifecycle.t.sol b/src/test/DevnetLifecycle.t.sol index e60d847d29..438c4500c3 100644 --- a/src/test/DevnetLifecycle.t.sol +++ b/src/test/DevnetLifecycle.t.sol @@ -171,11 +171,7 @@ contract Devnet_Lifecycle_Test is Test, IAllocationManagerTypes { function _slashOperator() public { // Get slashing params SlashingParams memory slashingParams = SlashingParams({ - operator: operator, - operatorSetId: 1, - strategies: wethStrategy.toArray(), - wadsToSlash: 5e17.toArrayU256(), - description: "test" + operator: operator, operatorSetId: 1, strategies: wethStrategy.toArray(), wadsToSlash: 5e17.toArrayU256(), description: "test" }); // Slash operator @@ -193,9 +189,7 @@ contract Devnet_Lifecycle_Test is Test, IAllocationManagerTypes { (uint[] memory withdrawableShares,) = delegationManager.getWithdrawableShares(staker, strategies); IDelegationManagerTypes.QueuedWithdrawalParams[] memory queuedWithdrawals = new IDelegationManagerTypes.QueuedWithdrawalParams[](1); queuedWithdrawals[0] = IDelegationManagerTypes.QueuedWithdrawalParams({ - strategies: strategies, - depositShares: withdrawableShares, - __deprecated_withdrawer: address(0) + strategies: strategies, depositShares: withdrawableShares, __deprecated_withdrawer: address(0) }); // Generate withdrawal params diff --git a/src/test/integration/IntegrationBase.t.sol b/src/test/integration/IntegrationBase.t.sol index 18454c7e06..b8657108b6 100644 --- a/src/test/integration/IntegrationBase.t.sol +++ b/src/test/integration/IntegrationBase.t.sol @@ -846,9 +846,7 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter { uint expectedSlashed = prevMagnitudes[i].max == 0 ? 0 : SlashingLib.calcSlashedAmount({ - operatorShares: prevSlashableStake[i], - prevMaxMagnitude: prevMagnitudes[i].max, - newMaxMagnitude: curMagnitudes[i].max + operatorShares: prevSlashableStake[i], prevMaxMagnitude: prevMagnitudes[i].max, newMaxMagnitude: curMagnitudes[i].max }); assertEq(curSlashableStake[i], prevSlashableStake[i] - expectedSlashed, err); @@ -960,9 +958,7 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter { uint expectedSlashed = prevMagnitudes[i].max == 0 ? 0 : SlashingLib.calcSlashedAmount({ - operatorShares: prevAllocatedStake[i], - prevMaxMagnitude: prevMagnitudes[i].max, - newMaxMagnitude: curMagnitudes[i].max + operatorShares: prevAllocatedStake[i], prevMaxMagnitude: prevMagnitudes[i].max, newMaxMagnitude: curMagnitudes[i].max }); assertEq(curAllocatedStake[i], prevAllocatedStake[i] - expectedSlashed, err); @@ -1416,9 +1412,7 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter { uint expectedSlashed = prevMagnitudes[i].max == 0 ? 0 : SlashingLib.calcSlashedAmount({ - operatorShares: prevShares[i], - prevMaxMagnitude: prevMagnitudes[i].max, - newMaxMagnitude: curMagnitudes[i].max + operatorShares: prevShares[i], prevMaxMagnitude: prevMagnitudes[i].max, newMaxMagnitude: curMagnitudes[i].max }); assertEq(curShares[i], prevShares[i] - expectedSlashed, err); @@ -1611,9 +1605,8 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter { } else { uint[] memory prevDepositShares = _getPrevStakerDepositShares(staker, strategies); assertEq( - (prevDepositShares[i] + depositSharesAdded[i]).mulWad(_getDepositScalingFactor(staker, strategies[i])).mulWad( - _getSlashingFactor(staker, strategies[i]) - ), + (prevDepositShares[i] + depositSharesAdded[i]).mulWad(_getDepositScalingFactor(staker, strategies[i])) + .mulWad(_getSlashingFactor(staker, strategies[i])), curShares[i], err ); @@ -1919,7 +1912,14 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter { assertEq(prevQueuedWithdrawals + withdrawals.length, curQueuedWithdrawals, err); } - function assert_Snap_Added_QueuedWithdrawal(User staker, Withdrawal memory, /*withdrawal*/ string memory err) internal { + function assert_Snap_Added_QueuedWithdrawal( + User staker, + Withdrawal memory, + /*withdrawal*/ + string memory err + ) + internal + { uint curQueuedWithdrawal = _getCumulativeWithdrawals(staker); // Use timewarp to get previous cumulative withdrawals uint prevQueuedWithdrawal = _getPrevCumulativeWithdrawals(staker); @@ -2093,9 +2093,7 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter { returns (AllocateParams memory params) { return _genAllocation_AllAvailable({ - operator: operator, - operatorSet: operatorSet, - strategies: allocationManager.getStrategiesInOperatorSet(operatorSet) + operator: operator, operatorSet: operatorSet, strategies: allocationManager.getStrategiesInOperatorSet(operatorSet) }); } @@ -2123,9 +2121,7 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter { returns (AllocateParams memory params) { return _genAllocation_HalfAvailable({ - operator: operator, - operatorSet: operatorSet, - strategies: allocationManager.getStrategiesInOperatorSet(operatorSet) + operator: operator, operatorSet: operatorSet, strategies: allocationManager.getStrategiesInOperatorSet(operatorSet) }); } @@ -2176,9 +2172,7 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter { returns (AllocateParams memory params) { return _genDeallocation_HalfRemaining({ - operator: operator, - operatorSet: operatorSet, - strategies: allocationManager.getStrategiesInOperatorSet(operatorSet) + operator: operator, operatorSet: operatorSet, strategies: allocationManager.getStrategiesInOperatorSet(operatorSet) }); } @@ -2692,10 +2686,7 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter { returns (uint[] memory) { return allocationManager.getMinimumSlashableStake({ - operatorSet: operatorSet, - operators: address(operator).toArray(), - strategies: strategies, - futureBlock: uint32(block.number) + operatorSet: operatorSet, operators: address(operator).toArray(), strategies: strategies, futureBlock: uint32(block.number) })[0]; } @@ -2705,10 +2696,7 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter { returns (uint[] memory) { return allocationManager.getMinimumSlashableStake({ - operatorSet: operatorSet, - operators: address(operator).toArray(), - strategies: strategies, - futureBlock: uint32(block.number) + operatorSet: operatorSet, operators: address(operator).toArray(), strategies: strategies, futureBlock: uint32(block.number) })[0]; } @@ -2726,9 +2714,7 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter { returns (uint[] memory) { return allocationManager.getAllocatedStake({ - operatorSet: operatorSet, - operators: address(operator).toArray(), - strategies: strategies + operatorSet: operatorSet, operators: address(operator).toArray(), strategies: strategies })[0]; } diff --git a/src/test/integration/IntegrationChecks.t.sol b/src/test/integration/IntegrationChecks.t.sol index c9ed0b08b1..448e1de406 100644 --- a/src/test/integration/IntegrationChecks.t.sol +++ b/src/test/integration/IntegrationChecks.t.sol @@ -685,9 +685,7 @@ contract IntegrationCheckUtils is IntegrationBase { /// @dev Check invariants for registerForOperatorSets given a set of strategies /// for which NO allocation exists (currentMag/pendingDiff are 0) /// @param unallocated For the given operatorSet, a list of strategies for which NO allocation exists - function check_Registration_State_NoAllocation(User operator, OperatorSet memory operatorSet, IStrategy[] memory unallocated) - internal - { + function check_Registration_State_NoAllocation(User operator, OperatorSet memory operatorSet, IStrategy[] memory unallocated) internal { check_Base_Registration_State(operator, operatorSet); /// The operator is NOT allocated, ensure their slashable stake and magnitudes are unchanged @@ -1060,9 +1058,12 @@ contract IntegrationCheckUtils is IntegrationBase { * ALM - SLASHING * */ - function check_Base_Slashing_State(User operator, AllocateParams memory allocateParams, SlashingParams memory slashParams, uint slashId) - internal - { + function check_Base_Slashing_State( + User operator, + AllocateParams memory allocateParams, + SlashingParams memory slashParams, + uint slashId + ) internal { OperatorSet memory operatorSet = allocateParams.operatorSet; check_MaxMag_Invariants(operator); diff --git a/src/test/integration/IntegrationDeployer.t.sol b/src/test/integration/IntegrationDeployer.t.sol index 5c978a93c4..573a9825fd 100644 --- a/src/test/integration/IntegrationDeployer.t.sol +++ b/src/test/integration/IntegrationDeployer.t.sol @@ -441,9 +441,7 @@ abstract contract IntegrationDeployer is ExistingDeploymentParser { delegationManager.initialize({initialPausedStatus: 0}); strategyManager.initialize({ - initialOwner: executorMultisig, - initialStrategyWhitelister: address(strategyFactory), - initialPausedStatus: 0 + initialOwner: executorMultisig, initialStrategyWhitelister: address(strategyFactory), initialPausedStatus: 0 }); eigenPodManager.initialize({initialOwner: executorMultisig, _initPausedStatus: 0}); diff --git a/src/test/integration/MultichainIntegrationBase.t.sol b/src/test/integration/MultichainIntegrationBase.t.sol index 7562bc4814..ddb6da6e63 100644 --- a/src/test/integration/MultichainIntegrationBase.t.sol +++ b/src/test/integration/MultichainIntegrationBase.t.sol @@ -150,13 +150,10 @@ abstract contract MultichainIntegrationBase is IntegrationBase { uint[] memory totalWeights = new uint[](1); totalWeights[0] = operatorWeights[0]; - IOperatorTableCalculatorTypes.BN254OperatorSetInfo memory initialOperatorSetInfo = IOperatorTableCalculatorTypes - .BN254OperatorSetInfo({ - operatorInfoTreeRoot: operatorInfoTreeRoot, - numOperators: 1, - aggregatePubkey: aggregatePubkey, - totalWeights: totalWeights - }); + IOperatorTableCalculatorTypes.BN254OperatorSetInfo memory initialOperatorSetInfo = + IOperatorTableCalculatorTypes.BN254OperatorSetInfo({ + operatorInfoTreeRoot: operatorInfoTreeRoot, numOperators: 1, aggregatePubkey: aggregatePubkey, totalWeights: totalWeights + }); ICrossChainRegistryTypes.OperatorSetConfig memory initialOperatorSetConfig = ICrossChainRegistryTypes.OperatorSetConfig({owner: address(0xDEADBEEF), maxStalenessPeriod: 0}); @@ -244,8 +241,9 @@ abstract contract MultichainIntegrationBase is IntegrationBase { // Configure the operator set for BN254 curve type (only once) try keyRegistrar.configureOperatorSet(operatorSet, IKeyRegistrarTypes.CurveType.BN254) { - // Configuration successful - } catch { + // Configuration successful + } + catch { // Already configured, which is fine } @@ -288,8 +286,9 @@ abstract contract MultichainIntegrationBase is IntegrationBase { // Configure the operator set for ECDSA curve type (only once) try keyRegistrar.configureOperatorSet(operatorSet, IKeyRegistrarTypes.CurveType.ECDSA) { - // Configuration successful - } catch { + // Configuration successful + } + catch { // Already configured, which is fine } @@ -506,9 +505,7 @@ abstract contract MultichainIntegrationBase is IntegrationBase { } cert = IECDSACertificateVerifierTypes.ECDSACertificate({ - referenceTimestamp: referenceTimestamp, - messageHash: messageHash, - sig: signatures + referenceTimestamp: referenceTimestamp, messageHash: messageHash, sig: signatures }); } diff --git a/src/test/integration/MultichainIntegrationChecks.t.sol b/src/test/integration/MultichainIntegrationChecks.t.sol index 32989da545..05ee097000 100644 --- a/src/test/integration/MultichainIntegrationChecks.t.sol +++ b/src/test/integration/MultichainIntegrationChecks.t.sol @@ -387,10 +387,7 @@ contract MultichainIntegrationCheckUtils is MultichainIntegrationBase { } } - function check_SignedStakes_ExactValues(uint[] memory signedStakes, uint[] memory expectedValues, string memory context) - internal - pure - { + function check_SignedStakes_ExactValues(uint[] memory signedStakes, uint[] memory expectedValues, string memory context) internal pure { require(signedStakes.length == expectedValues.length, "SignedStakes and expected values length mismatch"); for (uint i = 0; i < signedStakes.length; i++) { diff --git a/src/test/integration/deprecatedInterfaces/mainnet/BeaconChainProofs.sol b/src/test/integration/deprecatedInterfaces/mainnet/BeaconChainProofs.sol index d909147cc1..107e54914a 100644 --- a/src/test/integration/deprecatedInterfaces/mainnet/BeaconChainProofs.sol +++ b/src/test/integration/deprecatedInterfaces/mainnet/BeaconChainProofs.sol @@ -146,10 +146,12 @@ library BeaconChainProofs_DeprecatedM1 { * @param proof is the data used in proving the validator's fields * @param validatorFields the claimed fields of the validator */ - function verifyValidatorFields(uint40 validatorIndex, bytes32 beaconStateRoot, bytes calldata proof, bytes32[] calldata validatorFields) - internal - view - { + function verifyValidatorFields( + uint40 validatorIndex, + bytes32 beaconStateRoot, + bytes calldata proof, + bytes32[] calldata validatorFields + ) internal view { require( validatorFields.length == 2 ** VALIDATOR_FIELD_TREE_HEIGHT, "BeaconChainProofs.verifyValidatorFields: Validator fields has incorrect length" diff --git a/src/test/integration/deprecatedInterfaces/mainnet/IEigenPod.sol b/src/test/integration/deprecatedInterfaces/mainnet/IEigenPod.sol index de591074ba..bee0ac88ec 100644 --- a/src/test/integration/deprecatedInterfaces/mainnet/IEigenPod.sol +++ b/src/test/integration/deprecatedInterfaces/mainnet/IEigenPod.sol @@ -20,7 +20,6 @@ interface IEigenPod_DeprecatedM2 { INACTIVE, // doesnt exist ACTIVE, // staked on ethpos and withdrawal credentials are pointed to the EigenPod WITHDRAWN // withdrawn from the Beacon Chain - } struct ValidatorInfo { @@ -264,7 +263,6 @@ interface IEigenPod_DeprecatedM1 { ACTIVE, // staked on ethpos and withdrawal credentials are pointed to the EigenPod OVERCOMMITTED, // proven to be overcommitted to EigenLayer WITHDRAWN // withdrawn from the Beacon Chain - } // this struct keeps track of PartialWithdrawalClaims diff --git a/src/test/integration/deprecatedInterfaces/mainnet/IStrategyManager.sol b/src/test/integration/deprecatedInterfaces/mainnet/IStrategyManager.sol index fd21de490b..4c3b90e645 100644 --- a/src/test/integration/deprecatedInterfaces/mainnet/IStrategyManager.sol +++ b/src/test/integration/deprecatedInterfaces/mainnet/IStrategyManager.sol @@ -84,8 +84,10 @@ interface IStrategyManager_DeprecatedM2 { * @param strategiesToWhitelist Strategies that will be added to the `strategyIsWhitelistedForDeposit` mapping (if they aren't in it already) * @param thirdPartyTransfersForbiddenValues bool values to set `thirdPartyTransfersForbidden` to for each strategy */ - function addStrategiesToDepositWhitelist(IStrategy[] calldata strategiesToWhitelist, bool[] calldata thirdPartyTransfersForbiddenValues) - external; + function addStrategiesToDepositWhitelist( + IStrategy[] calldata strategiesToWhitelist, + bool[] calldata thirdPartyTransfersForbiddenValues + ) external; /** * @notice Owner-only function that removes the provided Strategies from the 'whitelist' of strategies that stakers can deposit into diff --git a/src/test/integration/mocks/BeaconChainMock.t.sol b/src/test/integration/mocks/BeaconChainMock.t.sol index 6b8872cfda..50238cd7d5 100644 --- a/src/test/integration/mocks/BeaconChainMock.t.sol +++ b/src/test/integration/mocks/BeaconChainMock.t.sol @@ -59,7 +59,6 @@ contract BeaconChainMock is Logger { Minor, // `MINOR_SLASH_AMOUNT_GWEI` Half, // Half of the validator's balance Full // The validator's entire balance - } // Rewards given to each validator during epoch processing @@ -784,8 +783,7 @@ contract BeaconChainMock is Logger { StateProofs storage p = proofs[timestamp]; CheckpointProofs memory checkpointProofs = CheckpointProofs({ - balanceContainerProof: p.balanceContainerProof, - balanceProofs: new BeaconChainProofs.BalanceProof[](_validators.length) + balanceContainerProof: p.balanceContainerProof, balanceProofs: new BeaconChainProofs.BalanceProof[](_validators.length) }); // Get proofs for each validator @@ -795,9 +793,7 @@ contract BeaconChainMock is Logger { BalanceRootProof memory proof = p.balanceRootProofs[balanceRootIndex]; checkpointProofs.balanceProofs[i] = BeaconChainProofs.BalanceProof({ - pubkeyHash: validators[validatorIndex].pubkeyHash, - balanceRoot: proof.balanceRoot, - proof: proof.proof + pubkeyHash: validators[validatorIndex].pubkeyHash, balanceRoot: proof.balanceRoot, proof: proof.proof }); } @@ -816,7 +812,9 @@ contract BeaconChainMock is Logger { return StaleBalanceProofs({ beaconTimestamp: curTimestamp, stateRootProof: p.stateRootProof, - validatorProof: BeaconChainProofs.ValidatorProof({validatorFields: vfProof.validatorFields, proof: vfProof.validatorFieldsProof}) + validatorProof: BeaconChainProofs.ValidatorProof({ + validatorFields: vfProof.validatorFields, proof: vfProof.validatorFieldsProof + }) }); } diff --git a/src/test/integration/mocks/EIP_7002_Mock.t.sol b/src/test/integration/mocks/EIP_7002_Mock.t.sol index 07ef93bd8b..bd62715c88 100644 --- a/src/test/integration/mocks/EIP_7002_Mock.t.sol +++ b/src/test/integration/mocks/EIP_7002_Mock.t.sol @@ -123,9 +123,7 @@ contract EIP_7002_Mock { require(excessRequests != EXCESS_INHIBITOR, "EIP_7002_Mock: excess inhibitor reached"); return _fakeExponential({ - factor: MIN_WITHDRAWAL_REQUEST_FEE, - numerator: excessRequests, - denominator: WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION + factor: MIN_WITHDRAWAL_REQUEST_FEE, numerator: excessRequests, denominator: WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION }); } diff --git a/src/test/integration/mocks/EIP_7251_Mock.t.sol b/src/test/integration/mocks/EIP_7251_Mock.t.sol index 995516f4b7..a67537d4e7 100644 --- a/src/test/integration/mocks/EIP_7251_Mock.t.sol +++ b/src/test/integration/mocks/EIP_7251_Mock.t.sol @@ -119,9 +119,7 @@ contract EIP_7251_Mock { require(excessRequests != EXCESS_INHIBITOR, "EIP_7251_Mock: excess inhibitor reached"); return _fakeExponential({ - factor: MIN_CONSOLIDATION_REQUEST_FEE, - numerator: excessRequests, - denominator: CONSOLIDATION_REQUEST_FEE_UPDATE_FRACTION + factor: MIN_CONSOLIDATION_REQUEST_FEE, numerator: excessRequests, denominator: CONSOLIDATION_REQUEST_FEE_UPDATE_FRACTION }); } diff --git a/src/test/integration/mocks/LibProofGen.t.sol b/src/test/integration/mocks/LibProofGen.t.sol index ffaa7648c5..34e9a07759 100644 --- a/src/test/integration/mocks/LibProofGen.t.sol +++ b/src/test/integration/mocks/LibProofGen.t.sol @@ -147,16 +147,12 @@ library LibProofGen { bytes32 balanceContainerRoot = trees.balancesTree.build({leaves: balanceLeaves, height: BeaconChainProofs.BALANCE_TREE_HEIGHT + 1}); // Build merkle tree for BeaconState - bytes32 beaconStateRoot = trees.stateTree.build({ - leaves: _getBeaconStateLeaves(validatorsRoot, balanceContainerRoot), - height: config().BEACON_STATE_TREE_HEIGHT - }); + bytes32 beaconStateRoot = trees.stateTree + .build({leaves: _getBeaconStateLeaves(validatorsRoot, balanceContainerRoot), height: config().BEACON_STATE_TREE_HEIGHT}); // Build merkle tree for BeaconBlock - beaconBlockRoot = trees.blockTree.build({ - leaves: _getBeaconBlockLeaves(beaconStateRoot), - height: BeaconChainProofs.BEACON_BLOCK_HEADER_TREE_HEIGHT - }); + beaconBlockRoot = trees.blockTree + .build({leaves: _getBeaconBlockLeaves(beaconStateRoot), height: BeaconChainProofs.BEACON_BLOCK_HEADER_TREE_HEIGHT}); // Pre-generate proofs for EigenPod methods p.genStateRootProof(beaconStateRoot); diff --git a/src/test/integration/tests/Deposit_Delegate_Queue_Complete.t.sol b/src/test/integration/tests/Deposit_Delegate_Queue_Complete.t.sol index 7af3ac45bc..bf7cb3d526 100644 --- a/src/test/integration/tests/Deposit_Delegate_Queue_Complete.t.sol +++ b/src/test/integration/tests/Deposit_Delegate_Queue_Complete.t.sol @@ -10,7 +10,6 @@ contract Integration_Deposit_Delegate_Queue_Complete is IntegrationCheckUtils { * FULL WITHDRAWALS * */ - // TODO: fix test /// Generates a random staker and operator. The staker: /// 1. deposits all assets into strategies diff --git a/src/test/integration/tests/Deposit_Delegate_UpdateBalance.t.sol b/src/test/integration/tests/Deposit_Delegate_UpdateBalance.t.sol index 07caad29df..81a1ac1852 100644 --- a/src/test/integration/tests/Deposit_Delegate_UpdateBalance.t.sol +++ b/src/test/integration/tests/Deposit_Delegate_UpdateBalance.t.sol @@ -5,72 +5,62 @@ import "src/test/integration/IntegrationChecks.t.sol"; import "src/test/integration/users/User.t.sol"; contract Integration_Deposit_Delegate_UpdateBalance is IntegrationCheckUtils { -// TODO: fix for slashing -/// Generates a random stake and operator. The staker: -/// 1. deposits all assets into strategies -/// 2. delegates to an operator -/// 3. queues a withdrawal for a ALL shares -/// 4. updates their balance randomly -/// 5. completes the queued withdrawal as tokens -// function testFuzz_deposit_delegate_updateBalance_completeAsTokens(uint24 _random) public { -// _configRand({ -// _randomSeed: _random, -// _assetTypes: HOLDS_ETH, // HOLDS_LST | HOLDS_ETH | HOLDS_ALL, -// _userTypes: DEFAULT //| ALT_METHODS -// }); + // TODO: fix for slashing + /// Generates a random stake and operator. The staker: + /// 1. deposits all assets into strategies + /// 2. delegates to an operator + /// 3. queues a withdrawal for a ALL shares + /// 4. updates their balance randomly + /// 5. completes the queued withdrawal as tokens + // function testFuzz_deposit_delegate_updateBalance_completeAsTokens(uint24 _random) public { + // _configRand({ + // _randomSeed: _random, + // _assetTypes: HOLDS_ETH, // HOLDS_LST | HOLDS_ETH | HOLDS_ALL, + // _userTypes: DEFAULT //| ALT_METHODS + // }); + // /// 0. Create an operator and staker with some underlying assets + // ( + // User staker, + // IStrategy[] memory strategies, + // uint[] memory tokenBalances + // ) = _newRandomStaker(); + // (User operator, ,) = _newRandomOperator(); + // // Upgrade contracts if forkType is not local + // _upgradeEigenLayerContracts(); + // uint[] memory shares = _calculateExpectedShares(strategies, tokenBalances); + // assert_HasNoDelegatableShares(staker, "staker should not have delegatable shares before depositing"); + // assertFalse(delegationManager.isDelegated(address(staker)), "staker should not be delegated"); + // /// 1. Deposit into strategies + // staker.depositIntoEigenlayer(strategies, tokenBalances); + // check_Deposit_State(staker, strategies, shares); + // /// 2. Delegate to an operator + // staker.delegateTo(operator); + // check_Delegation_State(staker, operator, strategies, shares); + // /// 3. Queue withdrawals for ALL shares + // Withdrawal[] memory withdrawals = staker.queueWithdrawals(strategies, shares); + // bytes32[] memory withdrawalRoots = _getWithdrawalHashes(withdrawals); + // check_QueuedWithdrawal_State(staker, operator, strategies, shares, withdrawals, withdrawalRoots); + // // Generate a random balance update: + // // - For LSTs, the tokenDelta is positive tokens minted to the staker + // // - For ETH, the tokenDelta is a positive or negative change in beacon chain balance + // ( + // int[] memory tokenDeltas, + // int[] memory stakerShareDeltas, + // int[] memory operatorShareDeltas + // ) = _randBalanceUpdate(staker, strategies); + // // 4. Update LST balance by depositing, and beacon balance by submitting a proof + // staker.updateBalances(strategies, tokenDeltas); + // assert_Snap_Delta_StakerShares(staker, strategies, stakerShareDeltas, "staker should have applied deltas correctly"); + // assert_Snap_Delta_OperatorShares(operator, strategies, operatorShareDeltas, "operator should have applied deltas correctly"); + // console.log("withdrawble: ", staker.pod().withdrawableRestakedExecutionLayerGwei()); + // // Fast forward to when we can complete the withdrawal + // _rollBlocksForCompleteWithdrawals(withdrawals); + // // 5. Complete queued withdrawals as tokens + // staker.completeWithdrawalsAsTokens(withdrawals); + // assertEq(address(operator), delegationManager.delegatedTo(address(staker)), "staker should still be delegated to operator"); + // assert_NoWithdrawalsPending(withdrawalRoots, "all withdrawals should be removed from pending"); + // assert_Snap_Unchanged_TokenBalances(operator, "operator token balances should not have changed"); + // assert_Snap_Unchanged_OperatorShares(operator, "operator shares should not have changed"); + // } -// /// 0. Create an operator and staker with some underlying assets -// ( -// User staker, -// IStrategy[] memory strategies, -// uint[] memory tokenBalances -// ) = _newRandomStaker(); -// (User operator, ,) = _newRandomOperator(); -// // Upgrade contracts if forkType is not local -// _upgradeEigenLayerContracts(); - -// uint[] memory shares = _calculateExpectedShares(strategies, tokenBalances); - -// assert_HasNoDelegatableShares(staker, "staker should not have delegatable shares before depositing"); -// assertFalse(delegationManager.isDelegated(address(staker)), "staker should not be delegated"); - -// /// 1. Deposit into strategies -// staker.depositIntoEigenlayer(strategies, tokenBalances); -// check_Deposit_State(staker, strategies, shares); - -// /// 2. Delegate to an operator -// staker.delegateTo(operator); -// check_Delegation_State(staker, operator, strategies, shares); - -// /// 3. Queue withdrawals for ALL shares -// Withdrawal[] memory withdrawals = staker.queueWithdrawals(strategies, shares); -// bytes32[] memory withdrawalRoots = _getWithdrawalHashes(withdrawals); -// check_QueuedWithdrawal_State(staker, operator, strategies, shares, withdrawals, withdrawalRoots); - -// // Generate a random balance update: -// // - For LSTs, the tokenDelta is positive tokens minted to the staker -// // - For ETH, the tokenDelta is a positive or negative change in beacon chain balance -// ( -// int[] memory tokenDeltas, -// int[] memory stakerShareDeltas, -// int[] memory operatorShareDeltas -// ) = _randBalanceUpdate(staker, strategies); - -// // 4. Update LST balance by depositing, and beacon balance by submitting a proof -// staker.updateBalances(strategies, tokenDeltas); -// assert_Snap_Delta_StakerShares(staker, strategies, stakerShareDeltas, "staker should have applied deltas correctly"); -// assert_Snap_Delta_OperatorShares(operator, strategies, operatorShareDeltas, "operator should have applied deltas correctly"); - -// console.log("withdrawble: ", staker.pod().withdrawableRestakedExecutionLayerGwei()); - -// // Fast forward to when we can complete the withdrawal -// _rollBlocksForCompleteWithdrawals(withdrawals); - -// // 5. Complete queued withdrawals as tokens -// staker.completeWithdrawalsAsTokens(withdrawals); -// assertEq(address(operator), delegationManager.delegatedTo(address(staker)), "staker should still be delegated to operator"); -// assert_NoWithdrawalsPending(withdrawalRoots, "all withdrawals should be removed from pending"); -// assert_Snap_Unchanged_TokenBalances(operator, "operator token balances should not have changed"); -// assert_Snap_Unchanged_OperatorShares(operator, "operator shares should not have changed"); -// } -} + } diff --git a/src/test/integration/users/User.t.sol b/src/test/integration/users/User.t.sol index 579c39fe72..cf692e98a7 100644 --- a/src/test/integration/users/User.t.sol +++ b/src/test/integration/users/User.t.sol @@ -133,9 +133,10 @@ contract User is Logger, TypeImporter { ); _tryPrankAppointee_AllocationManager(IAllocationManager.registerForOperatorSets.selector); - allocationManager().registerForOperatorSets( - address(this), RegisterParams({avs: operatorSet.avs, operatorSetIds: operatorSet.id.toArrayU32(), data: ""}) - ); + allocationManager() + .registerForOperatorSets( + address(this), RegisterParams({avs: operatorSet.avs, operatorSetIds: operatorSet.id.toArrayU32(), data: ""}) + ); print.gasUsed(); } @@ -146,9 +147,10 @@ contract User is Logger, TypeImporter { ); _tryPrankAppointee_AllocationManager(IAllocationManager.deregisterFromOperatorSets.selector); - allocationManager().deregisterFromOperatorSets( - DeregisterParams({operator: address(this), avs: operatorSet.avs, operatorSetIds: operatorSet.id.toArrayU32()}) - ); + allocationManager() + .deregisterFromOperatorSets( + DeregisterParams({operator: address(this), avs: operatorSet.avs, operatorSetIds: operatorSet.id.toArrayU32()}) + ); print.gasUsed(); } @@ -323,12 +325,7 @@ contract User is Logger, TypeImporter { return (withdrawals); } - function completeWithdrawalsAsTokens(Withdrawal[] memory withdrawals) - public - virtual - createSnapshot - returns (IERC20[][] memory tokens) - { + function completeWithdrawalsAsTokens(Withdrawal[] memory withdrawals) public virtual createSnapshot returns (IERC20[][] memory tokens) { print.method("completeWithdrawalsAsTokens"); tokens = new IERC20[][](withdrawals.length); for (uint i = 0; i < withdrawals.length; i++) { @@ -341,12 +338,7 @@ contract User is Logger, TypeImporter { return _completeQueuedWithdrawal(withdrawal, true); } - function completeWithdrawalsAsShares(Withdrawal[] memory withdrawals) - public - virtual - createSnapshot - returns (IERC20[][] memory tokens) - { + function completeWithdrawalsAsShares(Withdrawal[] memory withdrawals) public virtual createSnapshot returns (IERC20[][] memory tokens) { print.method("completeWithdrawalsAsShares"); tokens = new IERC20[][](withdrawals.length); for (uint i = 0; i < withdrawals.length; i++) { @@ -555,10 +547,9 @@ contract User is Logger, TypeImporter { StaleBalanceProofs memory proof = beaconChain.getStaleBalanceProofs(validatorIndex); try pod.verifyStaleBalance({ - beaconTimestamp: proof.beaconTimestamp, - stateRootProof: proof.stateRootProof, - proof: proof.validatorProof - }) {} catch (bytes memory err) { + beaconTimestamp: proof.beaconTimestamp, stateRootProof: proof.stateRootProof, proof: proof.validatorProof + }) {} + catch (bytes memory err) { _revert(err); } } @@ -826,7 +817,8 @@ contract User is Logger, TypeImporter { validatorIndices: _validators, validatorFieldsProofs: proofs.validatorFieldsProofs, validatorFields: proofs.validatorFields - }) {} catch (bytes memory err) { + }) {} + catch (bytes memory err) { _revert(err); } cheats.resumeTracing(); diff --git a/src/test/mocks/AllocationManagerMock.sol b/src/test/mocks/AllocationManagerMock.sol index 5425bb4ed0..b0cfe66aa2 100644 --- a/src/test/mocks/AllocationManagerMock.sol +++ b/src/test/mocks/AllocationManagerMock.sol @@ -141,7 +141,11 @@ contract AllocationManagerMock is Test { OperatorSet memory operatorSet, address[] memory operators, IStrategy[] memory strategies /*uint32 futureBlock*/ - ) external pure returns (uint[][] memory) { + ) + external + pure + returns (uint[][] memory) + { uint[][] memory minimumSlashableStake = new uint[][](operators.length); for (uint i = 0; i < operators.length; ++i) { diff --git a/src/test/mocks/BN254CertificateVerifierMock.sol b/src/test/mocks/BN254CertificateVerifierMock.sol index a1decc2dc3..f7d8b11bc4 100644 --- a/src/test/mocks/BN254CertificateVerifierMock.sol +++ b/src/test/mocks/BN254CertificateVerifierMock.sol @@ -16,7 +16,8 @@ contract BN254CertificateVerifierMock is Test, IBN254CertificateVerifierTypes, I mapping(bytes32 certificateHash => bool isValid) internal _isValidCertificate; - mapping(bytes32 operatorSetKey => mapping(uint32 referenceTimestamp => BN254OperatorSetInfo operatorSetInfo)) internal _operatorSetInfos; + mapping(bytes32 operatorSetKey => mapping(uint32 referenceTimestamp => BN254OperatorSetInfo operatorSetInfo)) internal + _operatorSetInfos; mapping(bytes32 operatorSetKey => address owner) internal _operatorSetOwners; mapping(bytes32 operatorSetKey => uint32 maxStalenessPeriod) internal _maxStalenessPeriods; mapping(bytes32 operatorSetKey => uint32 latestReferenceTimestamp) internal _latestReferenceTimestamp; diff --git a/src/test/mocks/DelegationManagerMock.sol b/src/test/mocks/DelegationManagerMock.sol index b07775d894..777bbbedff 100644 --- a/src/test/mocks/DelegationManagerMock.sol +++ b/src/test/mocks/DelegationManagerMock.sol @@ -37,9 +37,7 @@ contract DelegationManagerMock is Test { uint64 newMaxMagnitude ) external returns (uint totalDepositSharesToBurn) { uint amountSlashed = SlashingLib.calcSlashedAmount({ - operatorShares: operatorShares[operator][strategy], - prevMaxMagnitude: prevMaxMagnitude, - newMaxMagnitude: newMaxMagnitude + operatorShares: operatorShares[operator][strategy], prevMaxMagnitude: prevMaxMagnitude, newMaxMagnitude: newMaxMagnitude }); operatorShares[operator][strategy] -= amountSlashed; @@ -63,7 +61,9 @@ contract DelegationManagerMock is Test { address operator, ISignatureUtilsMixinTypes.SignatureWithExpiry memory, /*approverSignatureAndExpiry*/ bytes32 /*approverSalt*/ - ) external { + ) + external + { delegatedTo[msg.sender] = operator; } @@ -85,9 +85,7 @@ contract DelegationManagerMock is Test { function operatorDetails(address operator) external pure returns (IDelegationManagerTypes.OperatorDetails memory) { IDelegationManagerTypes.OperatorDetails memory returnValue = IDelegationManagerTypes.OperatorDetails({ - __deprecated_earningsReceiver: operator, - delegationApprover: operator, - __deprecated_stakerOptOutWindowBlocks: 0 + __deprecated_earningsReceiver: operator, delegationApprover: operator, __deprecated_stakerOptOutWindowBlocks: 0 }); return returnValue; } diff --git a/src/test/mocks/ERC20Mock.sol b/src/test/mocks/ERC20Mock.sol index 01ead61ba3..fd091d7c5b 100644 --- a/src/test/mocks/ERC20Mock.sol +++ b/src/test/mocks/ERC20Mock.sol @@ -89,7 +89,14 @@ contract ERC20Mock is Context, IERC20 { return _allowances[owner][spender]; } - function mint(address, /*to*/ uint amount) public virtual { + function mint( + address, + /*to*/ + uint amount + ) + public + virtual + { address owner = _msgSender(); _mint(owner, amount); } @@ -104,7 +111,16 @@ contract ERC20Mock is Context, IERC20 { * * - `spender` cannot be the zero address. */ - function approve(address, /*spender*/ uint /*amount*/ ) public virtual override returns (bool) { + function approve( + address, + /*spender*/ + uint /*amount*/ + ) + public + virtual + override + returns (bool) + { return true; } diff --git a/src/test/mocks/ETHDepositMock.sol b/src/test/mocks/ETHDepositMock.sol index f568d0ca28..6bf6fb6359 100644 --- a/src/test/mocks/ETHDepositMock.sol +++ b/src/test/mocks/ETHDepositMock.sol @@ -6,8 +6,7 @@ import "../../contracts/interfaces/IETHPOSDeposit.sol"; contract ETHPOSDepositMock is IETHPOSDeposit { function deposit(bytes calldata pubkey, bytes calldata withdrawal_credentials, bytes calldata signature, bytes32 deposit_data_root) external - payable - {} + payable {} function get_deposit_root() external pure returns (bytes32) { bytes32 root; diff --git a/src/test/mocks/EigenPodManagerMock.sol b/src/test/mocks/EigenPodManagerMock.sol index 7c829f3f47..e72eef384d 100644 --- a/src/test/mocks/EigenPodManagerMock.sol +++ b/src/test/mocks/EigenPodManagerMock.sol @@ -49,7 +49,10 @@ contract EigenPodManagerMock is Test, Pausable { address podOwner, IStrategy, // strategy uint shares - ) external returns (uint) { + ) + external + returns (uint) + { int updatedShares = podOwnerDepositShares[podOwner] - int(shares); podOwnerDepositShares[podOwner] = updatedShares; return uint(updatedShares); @@ -70,7 +73,9 @@ contract EigenPodManagerMock is Test, Pausable { * token */ uint shares - ) external { + ) + external + { podOwnerSharesWithdrawn[podOwner] += shares; } diff --git a/src/test/mocks/MockAVSRegistrar.sol b/src/test/mocks/MockAVSRegistrar.sol index 49cb52f672..00aeea784c 100644 --- a/src/test/mocks/MockAVSRegistrar.sol +++ b/src/test/mocks/MockAVSRegistrar.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.27; contract MockAVSRegistrar { - function supportsAVS(address /*avs*/ ) external pure returns (bool) { + function supportsAVS(address /*avs*/) external pure returns (bool) { return true; } diff --git a/src/test/mocks/MockAVSTaskHook.sol b/src/test/mocks/MockAVSTaskHook.sol index 551b2af61d..518d5c3f6a 100644 --- a/src/test/mocks/MockAVSTaskHook.sol +++ b/src/test/mocks/MockAVSTaskHook.sol @@ -11,26 +11,44 @@ contract MockAVSTaskHook is IAVSTaskHook { defaultFee = _fee; } - function validatePreTaskCreation(address, /*caller*/ ITaskMailboxTypes.TaskParams memory /*taskParams*/ ) external view { + function validatePreTaskCreation( + address, + /*caller*/ + ITaskMailboxTypes.TaskParams memory /*taskParams*/ + ) + external + view { //TODO: Implement } - function handlePostTaskCreation(bytes32 /*taskHash*/ ) external { + function handlePostTaskCreation(bytes32 /*taskHash*/) external { //TODO: Implement } - function validatePreTaskResultSubmission(address, /*caller*/ bytes32, /*taskHash*/ bytes memory, /*cert*/ bytes memory /*result*/ ) + function validatePreTaskResultSubmission( + address, + /*caller*/ + bytes32, + /*taskHash*/ + bytes memory, + /*cert*/ + bytes memory /*result*/ + ) external - view - { + view { //TODO: Implement } - function handlePostTaskResultSubmission(address, /*caller*/ bytes32 /*taskHash*/ ) external { + function handlePostTaskResultSubmission( + address, + /*caller*/ + bytes32 /*taskHash*/ + ) + external { //TODO: Implement } - function calculateTaskFee(ITaskMailboxTypes.TaskParams memory /*taskParams*/ ) external view returns (uint96) { + function calculateTaskFee(ITaskMailboxTypes.TaskParams memory /*taskParams*/) external view returns (uint96) { return defaultFee; } } diff --git a/src/test/mocks/MockBN254CertificateVerifier.sol b/src/test/mocks/MockBN254CertificateVerifier.sol index ae4ea50ffc..f9c52b2911 100644 --- a/src/test/mocks/MockBN254CertificateVerifier.sol +++ b/src/test/mocks/MockBN254CertificateVerifier.sol @@ -33,7 +33,11 @@ contract MockBN254CertificateVerifier is IBN254CertificateVerifier { OperatorSetConfig calldata /*operatorSetConfig*/ ) external pure {} - function verifyCertificate(OperatorSet memory, /*operatorSet*/ BN254Certificate memory /*cert*/ ) + function verifyCertificate( + OperatorSet memory, + /*operatorSet*/ + BN254Certificate memory /*cert*/ + ) external pure returns (uint[] memory signedStakes) @@ -45,7 +49,11 @@ contract MockBN254CertificateVerifier is IBN254CertificateVerifier { OperatorSet memory, /*operatorSet*/ BN254Certificate memory, /*cert*/ uint16[] memory /*totalStakeProportionThresholds*/ - ) external pure returns (bool) { + ) + external + pure + returns (bool) + { return true; } @@ -53,16 +61,20 @@ contract MockBN254CertificateVerifier is IBN254CertificateVerifier { OperatorSet memory, /*operatorSet*/ BN254Certificate memory, /*cert*/ uint[] memory /*totalStakeNominalThresholds*/ - ) external pure returns (bool) { + ) + external + pure + returns (bool) + { return true; } // Implement IBaseCertificateVerifier required functions - function operatorTableUpdater(OperatorSet memory /*operatorSet*/ ) external pure returns (address) { + function operatorTableUpdater(OperatorSet memory /*operatorSet*/) external pure returns (address) { return address(0); } - function getLatestReferenceTimestamp(OperatorSet memory /*operatorSet*/ ) external pure returns (uint32) { + function getLatestReferenceTimestamp(OperatorSet memory /*operatorSet*/) external pure returns (uint32) { return 0; } @@ -72,11 +84,11 @@ contract MockBN254CertificateVerifier is IBN254CertificateVerifier { return owner != address(0) ? owner : operatorSet.avs; } - function latestReferenceTimestamp(OperatorSet memory /*operatorSet*/ ) external view returns (uint32) { + function latestReferenceTimestamp(OperatorSet memory /*operatorSet*/) external view returns (uint32) { return _latestReferenceTimestamp; } - function maxOperatorTableStaleness(OperatorSet memory /*operatorSet*/ ) external view returns (uint32) { + function maxOperatorTableStaleness(OperatorSet memory /*operatorSet*/) external view returns (uint32) { return _maxOperatorTableStaleness; } @@ -85,11 +97,21 @@ contract MockBN254CertificateVerifier is IBN254CertificateVerifier { BN254.G1Point memory, /*aggPubkey*/ BN254.G2Point memory, /*apkG2*/ BN254.G1Point memory /*signature*/ - ) external pure returns (bool pairingSuccessful, bool signatureValid) { + ) + external + pure + returns (bool pairingSuccessful, bool signatureValid) + { return (true, true); } - function getNonsignerOperatorInfo(OperatorSet memory, /*operatorSet*/ uint32, /*referenceTimestamp*/ uint /*operatorIndex*/ ) + function getNonsignerOperatorInfo( + OperatorSet memory, + /*operatorSet*/ + uint32, + /*referenceTimestamp*/ + uint /*operatorIndex*/ + ) external pure returns (IOperatorTableCalculatorTypes.BN254OperatorInfo memory) @@ -98,7 +120,13 @@ contract MockBN254CertificateVerifier is IBN254CertificateVerifier { return IOperatorTableCalculatorTypes.BN254OperatorInfo({pubkey: BN254.G1Point(0, 0), weights: weights}); } - function isNonsignerCached(OperatorSet memory, /*operatorSet*/ uint32, /*referenceTimestamp*/ uint /*operatorIndex*/ ) + function isNonsignerCached( + OperatorSet memory, + /*operatorSet*/ + uint32, + /*referenceTimestamp*/ + uint /*operatorIndex*/ + ) external pure returns (bool) @@ -106,17 +134,18 @@ contract MockBN254CertificateVerifier is IBN254CertificateVerifier { return false; } - function getOperatorSetInfo(OperatorSet memory, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) + function getOperatorSetInfo( + OperatorSet memory, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) external pure returns (IOperatorTableCalculatorTypes.BN254OperatorSetInfo memory) { uint[] memory totalWeights = new uint[](0); return IOperatorTableCalculatorTypes.BN254OperatorSetInfo({ - operatorInfoTreeRoot: bytes32(0), - numOperators: 0, - aggregatePubkey: BN254.G1Point(0, 0), - totalWeights: totalWeights + operatorInfoTreeRoot: bytes32(0), numOperators: 0, aggregatePubkey: BN254.G1Point(0, 0), totalWeights: totalWeights }); } @@ -124,7 +153,11 @@ contract MockBN254CertificateVerifier is IBN254CertificateVerifier { return true; } - function getTotalStakeWeights(OperatorSet memory, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) + function getTotalStakeWeights( + OperatorSet memory, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) external pure returns (uint[] memory) @@ -132,7 +165,15 @@ contract MockBN254CertificateVerifier is IBN254CertificateVerifier { return new uint[](0); } - function getOperatorCount(OperatorSet memory, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) external pure returns (uint) { + function getOperatorCount( + OperatorSet memory, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) + external + pure + returns (uint) + { return 0; } diff --git a/src/test/mocks/MockBN254CertificateVerifierFailure.sol b/src/test/mocks/MockBN254CertificateVerifierFailure.sol index 294341078e..d087232b07 100644 --- a/src/test/mocks/MockBN254CertificateVerifierFailure.sol +++ b/src/test/mocks/MockBN254CertificateVerifierFailure.sol @@ -26,7 +26,11 @@ contract MockBN254CertificateVerifierFailure is IBN254CertificateVerifier { OperatorSetConfig calldata /*operatorSetConfig*/ ) external pure {} - function verifyCertificate(OperatorSet memory, /*operatorSet*/ BN254Certificate memory /*cert*/ ) + function verifyCertificate( + OperatorSet memory, + /*operatorSet*/ + BN254Certificate memory /*cert*/ + ) external pure returns (uint[] memory signedStakes) @@ -38,7 +42,11 @@ contract MockBN254CertificateVerifierFailure is IBN254CertificateVerifier { OperatorSet memory, /*operatorSet*/ BN254Certificate memory, /*cert*/ uint16[] memory /*totalStakeProportionThresholds*/ - ) external pure returns (bool) { + ) + external + pure + returns (bool) + { return false; // Always fail } @@ -46,16 +54,20 @@ contract MockBN254CertificateVerifierFailure is IBN254CertificateVerifier { OperatorSet memory, /*operatorSet*/ BN254Certificate memory, /*cert*/ uint[] memory /*totalStakeNominalThresholds*/ - ) external pure returns (bool) { + ) + external + pure + returns (bool) + { return false; // Always fail } // Implement IBaseCertificateVerifier required functions - function operatorTableUpdater(OperatorSet memory /*operatorSet*/ ) external pure returns (address) { + function operatorTableUpdater(OperatorSet memory /*operatorSet*/) external pure returns (address) { return address(0); } - function getLatestReferenceTimestamp(OperatorSet memory /*operatorSet*/ ) external pure returns (uint32) { + function getLatestReferenceTimestamp(OperatorSet memory /*operatorSet*/) external pure returns (uint32) { return 0; } @@ -65,11 +77,11 @@ contract MockBN254CertificateVerifierFailure is IBN254CertificateVerifier { return owner != address(0) ? owner : operatorSet.avs; } - function latestReferenceTimestamp(OperatorSet memory /*operatorSet*/ ) external pure returns (uint32) { + function latestReferenceTimestamp(OperatorSet memory /*operatorSet*/) external pure returns (uint32) { return 0; } - function maxOperatorTableStaleness(OperatorSet memory /*operatorSet*/ ) external pure returns (uint32) { + function maxOperatorTableStaleness(OperatorSet memory /*operatorSet*/) external pure returns (uint32) { return 86_400; } @@ -78,11 +90,21 @@ contract MockBN254CertificateVerifierFailure is IBN254CertificateVerifier { BN254.G1Point memory, /*aggPubkey*/ BN254.G2Point memory, /*apkG2*/ BN254.G1Point memory /*signature*/ - ) external pure returns (bool pairingSuccessful, bool signatureValid) { + ) + external + pure + returns (bool pairingSuccessful, bool signatureValid) + { return (true, false); // Pairing succeeds but signature is invalid } - function getNonsignerOperatorInfo(OperatorSet memory, /*operatorSet*/ uint32, /*referenceTimestamp*/ uint /*operatorIndex*/ ) + function getNonsignerOperatorInfo( + OperatorSet memory, + /*operatorSet*/ + uint32, + /*referenceTimestamp*/ + uint /*operatorIndex*/ + ) external pure returns (IOperatorTableCalculatorTypes.BN254OperatorInfo memory) @@ -91,7 +113,13 @@ contract MockBN254CertificateVerifierFailure is IBN254CertificateVerifier { return IOperatorTableCalculatorTypes.BN254OperatorInfo({pubkey: BN254.G1Point(0, 0), weights: weights}); } - function isNonsignerCached(OperatorSet memory, /*operatorSet*/ uint32, /*referenceTimestamp*/ uint /*operatorIndex*/ ) + function isNonsignerCached( + OperatorSet memory, + /*operatorSet*/ + uint32, + /*referenceTimestamp*/ + uint /*operatorIndex*/ + ) external pure returns (bool) @@ -99,17 +127,18 @@ contract MockBN254CertificateVerifierFailure is IBN254CertificateVerifier { return false; } - function getOperatorSetInfo(OperatorSet memory, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) + function getOperatorSetInfo( + OperatorSet memory, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) external pure returns (IOperatorTableCalculatorTypes.BN254OperatorSetInfo memory) { uint[] memory totalWeights = new uint[](0); return IOperatorTableCalculatorTypes.BN254OperatorSetInfo({ - operatorInfoTreeRoot: bytes32(0), - numOperators: 0, - aggregatePubkey: BN254.G1Point(0, 0), - totalWeights: totalWeights + operatorInfoTreeRoot: bytes32(0), numOperators: 0, aggregatePubkey: BN254.G1Point(0, 0), totalWeights: totalWeights }); } @@ -117,7 +146,11 @@ contract MockBN254CertificateVerifierFailure is IBN254CertificateVerifier { return true; } - function getTotalStakeWeights(OperatorSet memory, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) + function getTotalStakeWeights( + OperatorSet memory, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) external pure returns (uint[] memory) @@ -125,7 +158,15 @@ contract MockBN254CertificateVerifierFailure is IBN254CertificateVerifier { return new uint[](0); } - function getOperatorCount(OperatorSet memory, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) external pure returns (uint) { + function getOperatorCount( + OperatorSet memory, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) + external + pure + returns (uint) + { return 0; } diff --git a/src/test/mocks/MockECDSACertificateVerifier.sol b/src/test/mocks/MockECDSACertificateVerifier.sol index 68fc4367f5..2507b50984 100644 --- a/src/test/mocks/MockECDSACertificateVerifier.sol +++ b/src/test/mocks/MockECDSACertificateVerifier.sol @@ -29,9 +29,15 @@ contract MockECDSACertificateVerifier is IECDSACertificateVerifier { uint32, /*referenceTimestamp*/ ECDSAOperatorInfo[] calldata, /*operatorInfos*/ OperatorSetConfig calldata /*operatorSetConfig*/ - ) external pure {} + ) + external + pure {} - function verifyCertificate(OperatorSet calldata, /*operatorSet*/ ECDSACertificate memory /*cert*/ ) + function verifyCertificate( + OperatorSet calldata, + /*operatorSet*/ + ECDSACertificate memory /*cert*/ + ) external pure returns (uint[] memory signedStakes, address[] memory signers) @@ -43,7 +49,11 @@ contract MockECDSACertificateVerifier is IECDSACertificateVerifier { OperatorSet calldata, /*operatorSet*/ ECDSACertificate memory, /*cert*/ uint16[] memory /*totalStakeProportionThresholds*/ - ) external pure returns (bool, address[] memory signers) { + ) + external + pure + returns (bool, address[] memory signers) + { return (true, new address[](0)); } @@ -51,16 +61,20 @@ contract MockECDSACertificateVerifier is IECDSACertificateVerifier { OperatorSet calldata, /*operatorSet*/ ECDSACertificate memory, /*cert*/ uint[] memory /*totalStakeNominalThresholds*/ - ) external pure returns (bool, address[] memory signers) { + ) + external + pure + returns (bool, address[] memory signers) + { return (true, new address[](0)); } // Implement IBaseCertificateVerifier required functions - function operatorTableUpdater(OperatorSet memory /*operatorSet*/ ) external pure returns (address) { + function operatorTableUpdater(OperatorSet memory /*operatorSet*/) external pure returns (address) { return address(0); } - function getLatestReferenceTimestamp(OperatorSet memory /*operatorSet*/ ) external pure returns (uint32) { + function getLatestReferenceTimestamp(OperatorSet memory /*operatorSet*/) external pure returns (uint32) { return 0; } @@ -70,15 +84,19 @@ contract MockECDSACertificateVerifier is IECDSACertificateVerifier { return owner != address(0) ? owner : operatorSet.avs; } - function latestReferenceTimestamp(OperatorSet memory /*operatorSet*/ ) external view returns (uint32) { + function latestReferenceTimestamp(OperatorSet memory /*operatorSet*/) external view returns (uint32) { return _latestReferenceTimestamp; } - function maxOperatorTableStaleness(OperatorSet memory /*operatorSet*/ ) external view returns (uint32) { + function maxOperatorTableStaleness(OperatorSet memory /*operatorSet*/) external view returns (uint32) { return _maxOperatorTableStaleness; } - function getCachedSignerList(OperatorSet calldata, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) + function getCachedSignerList( + OperatorSet calldata, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) external pure returns (address[] memory) @@ -86,7 +104,11 @@ contract MockECDSACertificateVerifier is IECDSACertificateVerifier { return new address[](0); } - function getOperatorInfos(OperatorSet calldata, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) + function getOperatorInfos( + OperatorSet calldata, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) external pure returns (ECDSAOperatorInfo[] memory) @@ -94,7 +116,13 @@ contract MockECDSACertificateVerifier is IECDSACertificateVerifier { return new ECDSAOperatorInfo[](0); } - function getOperatorInfo(OperatorSet calldata, /*operatorSet*/ uint32, /*referenceTimestamp*/ uint /*operatorIndex*/ ) + function getOperatorInfo( + OperatorSet calldata, + /*operatorSet*/ + uint32, + /*referenceTimestamp*/ + uint /*operatorIndex*/ + ) external pure returns (ECDSAOperatorInfo memory) @@ -103,11 +131,27 @@ contract MockECDSACertificateVerifier is IECDSACertificateVerifier { return ECDSAOperatorInfo({pubkey: address(0), weights: weights}); } - function getOperatorCount(OperatorSet memory, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) external pure returns (uint) { + function getOperatorCount( + OperatorSet memory, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) + external + pure + returns (uint) + { return 0; } - function getTotalStakes(OperatorSet calldata, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) external pure returns (uint[] memory) { + function getTotalStakes( + OperatorSet calldata, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) + external + pure + returns (uint[] memory) + { return new uint[](0); } diff --git a/src/test/mocks/MockECDSACertificateVerifierFailure.sol b/src/test/mocks/MockECDSACertificateVerifierFailure.sol index d943bc83d1..eba757a61e 100644 --- a/src/test/mocks/MockECDSACertificateVerifierFailure.sol +++ b/src/test/mocks/MockECDSACertificateVerifierFailure.sol @@ -17,9 +17,15 @@ contract MockECDSACertificateVerifierFailure is IECDSACertificateVerifier { uint32, /*referenceTimestamp*/ ECDSAOperatorInfo[] calldata, /*operatorInfos*/ OperatorSetConfig calldata /*operatorSetConfig*/ - ) external pure {} + ) + external + pure {} - function verifyCertificate(OperatorSet calldata, /*operatorSet*/ ECDSACertificate memory /*cert*/ ) + function verifyCertificate( + OperatorSet calldata, + /*operatorSet*/ + ECDSACertificate memory /*cert*/ + ) external pure returns (uint[] memory signedStakes, address[] memory signers) @@ -31,7 +37,11 @@ contract MockECDSACertificateVerifierFailure is IECDSACertificateVerifier { OperatorSet calldata, /*operatorSet*/ ECDSACertificate memory, /*cert*/ uint16[] memory /*totalStakeProportionThresholds*/ - ) external pure returns (bool, address[] memory signers) { + ) + external + pure + returns (bool, address[] memory signers) + { return (false, new address[](0)); // Always fail } @@ -39,16 +49,20 @@ contract MockECDSACertificateVerifierFailure is IECDSACertificateVerifier { OperatorSet calldata, /*operatorSet*/ ECDSACertificate memory, /*cert*/ uint[] memory /*totalStakeNominalThresholds*/ - ) external pure returns (bool, address[] memory signers) { + ) + external + pure + returns (bool, address[] memory signers) + { return (false, new address[](0)); // Always fail } // Implement IBaseCertificateVerifier required functions - function operatorTableUpdater(OperatorSet memory /*operatorSet*/ ) external pure returns (address) { + function operatorTableUpdater(OperatorSet memory /*operatorSet*/) external pure returns (address) { return address(0); } - function getLatestReferenceTimestamp(OperatorSet memory /*operatorSet*/ ) external pure returns (uint32) { + function getLatestReferenceTimestamp(OperatorSet memory /*operatorSet*/) external pure returns (uint32) { return 0; } @@ -58,15 +72,19 @@ contract MockECDSACertificateVerifierFailure is IECDSACertificateVerifier { return owner != address(0) ? owner : operatorSet.avs; } - function latestReferenceTimestamp(OperatorSet memory /*operatorSet*/ ) external pure returns (uint32) { + function latestReferenceTimestamp(OperatorSet memory /*operatorSet*/) external pure returns (uint32) { return 0; } - function maxOperatorTableStaleness(OperatorSet memory /*operatorSet*/ ) external pure returns (uint32) { + function maxOperatorTableStaleness(OperatorSet memory /*operatorSet*/) external pure returns (uint32) { return 86_400; } - function getCachedSignerList(OperatorSet calldata, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) + function getCachedSignerList( + OperatorSet calldata, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) external pure returns (address[] memory) @@ -74,7 +92,11 @@ contract MockECDSACertificateVerifierFailure is IECDSACertificateVerifier { return new address[](0); } - function getOperatorInfos(OperatorSet calldata, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) + function getOperatorInfos( + OperatorSet calldata, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) external pure returns (ECDSAOperatorInfo[] memory) @@ -82,7 +104,13 @@ contract MockECDSACertificateVerifierFailure is IECDSACertificateVerifier { return new ECDSAOperatorInfo[](0); } - function getOperatorInfo(OperatorSet calldata, /*operatorSet*/ uint32, /*referenceTimestamp*/ uint /*operatorIndex*/ ) + function getOperatorInfo( + OperatorSet calldata, + /*operatorSet*/ + uint32, + /*referenceTimestamp*/ + uint /*operatorIndex*/ + ) external pure returns (ECDSAOperatorInfo memory) @@ -91,11 +119,27 @@ contract MockECDSACertificateVerifierFailure is IECDSACertificateVerifier { return ECDSAOperatorInfo({pubkey: address(0), weights: weights}); } - function getOperatorCount(OperatorSet memory, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) external pure returns (uint) { + function getOperatorCount( + OperatorSet memory, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) + external + pure + returns (uint) + { return 0; } - function getTotalStakes(OperatorSet calldata, /*operatorSet*/ uint32 /*referenceTimestamp*/ ) external pure returns (uint[] memory) { + function getTotalStakes( + OperatorSet calldata, + /*operatorSet*/ + uint32 /*referenceTimestamp*/ + ) + external + pure + returns (uint[] memory) + { return new uint[](0); } diff --git a/src/test/mocks/MockERC20.sol b/src/test/mocks/MockERC20.sol index 01d43c5a14..c3555cc7d7 100644 --- a/src/test/mocks/MockERC20.sol +++ b/src/test/mocks/MockERC20.sol @@ -224,8 +224,8 @@ contract MockERC20 { } function _pureChainId() private pure returns (uint chainId) { - function() internal view returns (uint256) fnIn = _viewChainId; - function() internal pure returns (uint256) pureChainId; + function() internal view returns (uint) fnIn = _viewChainId; + function() internal pure returns (uint) pureChainId; assembly { pureChainId := fnIn } diff --git a/src/test/mocks/StrategyManagerMock.sol b/src/test/mocks/StrategyManagerMock.sol index 8545762be9..c5472e919d 100644 --- a/src/test/mocks/StrategyManagerMock.sol +++ b/src/test/mocks/StrategyManagerMock.sol @@ -65,7 +65,7 @@ contract StrategyManagerMock is Test { uint public stakerStrategyListLengthReturnValue; /// @notice Simple getter function that returns `stakerStrategyList[staker].length`. - function stakerStrategyListLength(address /*staker*/ ) external view returns (uint) { + function stakerStrategyListLength(address /*staker*/) external view returns (uint) { return stakerStrategyListLengthReturnValue; } @@ -90,14 +90,16 @@ contract StrategyManagerMock is Test { return updatedShares; } - function removeStrategiesFromDepositWhitelist(IStrategy[] calldata /*strategiesToRemoveFromWhitelist*/ ) external pure {} + function removeStrategiesFromDepositWhitelist(IStrategy[] calldata /*strategiesToRemoveFromWhitelist*/) external pure {} function withdrawSharesAsTokens( address staker, IStrategy strategy, address, // token uint shares - ) external { + ) + external + { strategySharesWithdrawn[staker][strategy] += shares; } diff --git a/src/test/unit/AVSDirectoryUnit.t.sol b/src/test/unit/AVSDirectoryUnit.t.sol index 1636a5898a..e7a1260edb 100644 --- a/src/test/unit/AVSDirectoryUnit.t.sol +++ b/src/test/unit/AVSDirectoryUnit.t.sol @@ -23,10 +23,7 @@ contract AVSDirectoryUnitTests is EigenLayerUnitTestSetup, IAVSDirectoryEvents, defaultOperatorPk = cheats.randomUint(1, MAX_PRIVATE_KEY); defaultOperator = cheats.addr(defaultOperatorPk); defaultOperatorSignature = _newOperatorRegistrationSignature({ - operatorPk: defaultOperatorPk, - avs: defaultAVS, - salt: bytes32(cheats.randomUint()), - expiry: type(uint).max + operatorPk: defaultOperatorPk, avs: defaultAVS, salt: bytes32(cheats.randomUint()), expiry: type(uint).max }); delegationManagerMock.setIsOperator(defaultOperator, true); diff --git a/src/test/unit/AllocationManagerUnit.t.sol b/src/test/unit/AllocationManagerUnit.t.sol index 173668045d..8da28761de 100644 --- a/src/test/unit/AllocationManagerUnit.t.sol +++ b/src/test/unit/AllocationManagerUnit.t.sol @@ -311,10 +311,7 @@ contract AllocationManagerUnitTests is EigenLayerUnitTestSetup, IAllocationManag uint futureBlock ) internal view { uint[][] memory slashableStake = allocationManager.getMinimumSlashableStake({ - operatorSet: operatorSet, - operators: operator.toArray(), - strategies: strategies, - futureBlock: uint32(futureBlock) + operatorSet: operatorSet, operators: operator.toArray(), strategies: strategies, futureBlock: uint32(futureBlock) }); for (uint i = 0; i < strategies.length; i++) { @@ -465,10 +462,7 @@ contract AllocationManagerUnitTests is EigenLayerUnitTestSetup, IAllocationManag /// @dev Create allocate params for random magnitudes to the same default strategy across multiple operator sets /// NOTE: this variant allocates ALL magnitude (1 WAD) - function _randAllocateParams_SingleMockStrategy_AllocAll(OperatorSet[] memory operatorSets) - internal - returns (AllocateParams[] memory) - { + function _randAllocateParams_SingleMockStrategy_AllocAll(OperatorSet[] memory operatorSets) internal returns (AllocateParams[] memory) { // Give each set a minimum of 1 magnitude uint64[] memory magnitudes = new uint64[](operatorSets.length); uint64 usedMagnitude; @@ -543,7 +537,6 @@ contract AllocationManagerUnitTests_Initialization_Setters is AllocationManagerU /// ----------------------------------------------------------------------- /// initialize() /// ----------------------------------------------------------------------- - /// @dev Asserts the following: /// 1. The fn can only be called once, during deployment. /// 2. The fn initializes the contract state correctly (owner, pauserRegistry, and initialPausedStatus). @@ -833,9 +826,7 @@ contract AllocationManagerUnitTests_SlashOperator is AllocationManagerUnitTests strategy: strategyMock, expectedAllocation: Allocation({currentMagnitude: expectedCurrentMag, pendingDiff: 0, effectBlock: 0}), expectedMagnitudes: Magnitudes({ - encumbered: expectedEncumberedMag, - max: expectedMaxMag, - allocatable: expectedMaxMag - expectedEncumberedMag + encumbered: expectedEncumberedMag, max: expectedMaxMag, allocatable: expectedMaxMag - expectedEncumberedMag }) }); @@ -1083,10 +1074,7 @@ contract AllocationManagerUnitTests_SlashOperator is AllocationManagerUnitTests // Check slashable amount after final slash _checkSlashableStake({ - operatorSet: defaultOperatorSet, - operator: defaultOperator, - strategies: defaultStrategies, - expectedSlashableStake: 0 + operatorSet: defaultOperatorSet, operator: defaultOperator, strategies: defaultStrategies, expectedSlashableStake: 0 }); } @@ -1126,7 +1114,8 @@ contract AllocationManagerUnitTests_SlashOperator is AllocationManagerUnitTests uint magnitudeAllocated = allocateParams[0].newMagnitudes[0]; uint magnitudeDeallocated = magnitudeAllocated - deallocateParams[0].newMagnitudes[0]; - uint magnitudeSlashed = (magnitudeAllocated * slashingParams.wadsToSlash[0] / WAD) + uint magnitudeSlashed = + (magnitudeAllocated * slashingParams.wadsToSlash[0] / WAD) + _calculateSlippage(uint64(magnitudeAllocated), slashingParams.wadsToSlash[0]); uint expectedCurrentMagnitude = magnitudeAllocated - magnitudeSlashed; int128 expectedPendingDiff = @@ -1167,9 +1156,7 @@ contract AllocationManagerUnitTests_SlashOperator is AllocationManagerUnitTests operatorSet: allocateParams[0].operatorSet, strategy: allocateParams[0].strategies[0], expectedAllocation: Allocation({ - currentMagnitude: uint64(expectedCurrentMagnitude), - pendingDiff: expectedPendingDiff, - effectBlock: deallocationEffectBlock + currentMagnitude: uint64(expectedCurrentMagnitude), pendingDiff: expectedPendingDiff, effectBlock: deallocationEffectBlock }), expectedMagnitudes: Magnitudes({encumbered: expectedCurrentMagnitude, max: uint64(WAD - magnitudeSlashed), allocatable: 0}) }); @@ -1359,9 +1346,7 @@ contract AllocationManagerUnitTests_SlashOperator is AllocationManagerUnitTests strategy: strategyMock, expectedAllocation: Allocation({currentMagnitude: magnitudeAfterSlash, pendingDiff: 0, effectBlock: 0}), expectedMagnitudes: Magnitudes({ - encumbered: expectedEncumberedMagnitude, - max: maxMagnitudeAfterSlash, - allocatable: allocatableMagnitudeAfterSlash + encumbered: expectedEncumberedMagnitude, max: maxMagnitudeAfterSlash, allocatable: allocatableMagnitudeAfterSlash }) }); } @@ -1424,9 +1409,7 @@ contract AllocationManagerUnitTests_SlashOperator is AllocationManagerUnitTests strategy: strategyMock, expectedAllocation: Allocation({currentMagnitude: expectedCurrentMag, pendingDiff: 0, effectBlock: 0}), expectedMagnitudes: Magnitudes({ - encumbered: expectedEncumberedMag, - max: expectedMaxMag, - allocatable: expectedMaxMag - expectedEncumberedMag + encumbered: expectedEncumberedMag, max: expectedMaxMag, allocatable: expectedMaxMag - expectedEncumberedMag }) }); @@ -1437,9 +1420,7 @@ contract AllocationManagerUnitTests_SlashOperator is AllocationManagerUnitTests strategy: strategyMock, expectedAllocation: Allocation({currentMagnitude: magnitudeToAllocate, pendingDiff: 0, effectBlock: 0}), expectedMagnitudes: Magnitudes({ - encumbered: expectedEncumberedMag, - max: expectedMaxMag, - allocatable: expectedMaxMag - expectedEncumberedMag + encumbered: expectedEncumberedMag, max: expectedMaxMag, allocatable: expectedMaxMag - expectedEncumberedMag }) }); @@ -1624,9 +1605,7 @@ contract AllocationManagerUnitTests_SlashOperator is AllocationManagerUnitTests strategy: strategy, expectedAllocation: Allocation({currentMagnitude: expectedCurrentMag, pendingDiff: 0, effectBlock: 0}), expectedMagnitudes: Magnitudes({ - encumbered: expectedEncumberedMag, - max: expectedMaxMag, - allocatable: expectedMaxMag - expectedEncumberedMag + encumbered: expectedEncumberedMag, max: expectedMaxMag, allocatable: expectedMaxMag - expectedEncumberedMag }) }); @@ -1643,9 +1622,7 @@ contract AllocationManagerUnitTests_SlashOperator is AllocationManagerUnitTests operatorSet: operatorSet, strategy: strategy, expectedAllocation: Allocation({ - currentMagnitude: expectedCurrentMag, - pendingDiff: pendingDiff, - effectBlock: _defaultAllocEffectBlock() + currentMagnitude: expectedCurrentMag, pendingDiff: pendingDiff, effectBlock: _defaultAllocEffectBlock() }), expectedMagnitudes: Magnitudes({encumbered: expectedMaxMag, max: expectedMaxMag, allocatable: 0}) }); @@ -1828,10 +1805,10 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe function test_revert_invalidOperatorSet() public { AllocateParams[] memory allocateParams = AllocateParams({ - operatorSet: OperatorSet(random().Address(), 0), - strategies: defaultStrategies, - newMagnitudes: uint64(0.5 ether).toArrayU64() - }).toArray(); + operatorSet: OperatorSet(random().Address(), 0), + strategies: defaultStrategies, + newMagnitudes: uint64(0.5 ether).toArrayU64() + }).toArray(); cheats.expectRevert(InvalidOperatorSet.selector); cheats.prank(defaultOperator); @@ -2213,7 +2190,9 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe operator: defaultOperator, operatorSet: defaultOperatorSet, strategy: strategyMock, - expectedAllocation: Allocation({currentMagnitude: half, pendingDiff: int64(1), effectBlock: uint32(block.number + secondDelay)}), + expectedAllocation: Allocation({ + currentMagnitude: half, pendingDiff: int64(1), effectBlock: uint32(block.number + secondDelay) + }), expectedMagnitudes: Magnitudes({encumbered: half + 1, max: WAD, allocatable: WAD - (half + 1)}) }); } @@ -2338,14 +2317,10 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe operatorSet: operatorSets[i], strategy: strategyMock, expectedAllocation: Allocation({ - currentMagnitude: 0, - pendingDiff: int128(uint128(allocateParams[i].newMagnitudes[0])), - effectBlock: effectBlock + currentMagnitude: 0, pendingDiff: int128(uint128(allocateParams[i].newMagnitudes[0])), effectBlock: effectBlock }), expectedMagnitudes: Magnitudes({ - encumbered: _encumberedMagnitudes[strategyMock], - max: WAD, - allocatable: WAD - _encumberedMagnitudes[strategyMock] + encumbered: _encumberedMagnitudes[strategyMock], max: WAD, allocatable: WAD - _encumberedMagnitudes[strategyMock] }) }); @@ -2364,9 +2339,7 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe strategy: strategyMock, expectedAllocation: Allocation({currentMagnitude: allocateParams[i].newMagnitudes[0], pendingDiff: 0, effectBlock: 0}), expectedMagnitudes: Magnitudes({ - encumbered: _encumberedMagnitudes[strategyMock], - max: WAD, - allocatable: WAD - _encumberedMagnitudes[strategyMock] + encumbered: _encumberedMagnitudes[strategyMock], max: WAD, allocatable: WAD - _encumberedMagnitudes[strategyMock] }) }); } @@ -2429,9 +2402,7 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe operatorSet: defaultOperatorSet, strategy: strategyMock, expectedAllocation: Allocation({ - currentMagnitude: firstAlloc, - pendingDiff: int64(secondAlloc - firstAlloc), - effectBlock: _defaultAllocEffectBlock() + currentMagnitude: firstAlloc, pendingDiff: int64(secondAlloc - firstAlloc), effectBlock: _defaultAllocEffectBlock() }), expectedMagnitudes: Magnitudes({encumbered: secondAlloc, max: WAD, allocatable: WAD - secondAlloc}) }); @@ -2526,9 +2497,7 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe operatorSet: defaultOperatorSet, strategy: strategyMock, expectedAllocation: Allocation({ - currentMagnitude: firstMod, - pendingDiff: -int128(uint128(firstMod - secondMod)), - effectBlock: effectBlock + currentMagnitude: firstMod, pendingDiff: -int128(uint128(firstMod - secondMod)), effectBlock: effectBlock }), expectedMagnitudes: Magnitudes({encumbered: firstMod, max: WAD, allocatable: WAD - firstMod}) }); @@ -2627,14 +2596,10 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe operatorSet: defaultOperatorSet, strategy: strategyMock, expectedAllocation: Allocation({ - currentMagnitude: allocateParams[0].newMagnitudes[0], - pendingDiff: expectedDiff, - effectBlock: deallocEffectBlock + currentMagnitude: allocateParams[0].newMagnitudes[0], pendingDiff: expectedDiff, effectBlock: deallocEffectBlock }), expectedMagnitudes: Magnitudes({ - encumbered: allocateParams[0].newMagnitudes[0], - max: WAD, - allocatable: WAD - allocateParams[0].newMagnitudes[0] + encumbered: allocateParams[0].newMagnitudes[0], max: WAD, allocatable: WAD - allocateParams[0].newMagnitudes[0] }) }); @@ -2648,9 +2613,7 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe strategy: strategyMock, expectedAllocation: Allocation({currentMagnitude: deallocateParams[0].newMagnitudes[0], pendingDiff: 0, effectBlock: 0}), expectedMagnitudes: Magnitudes({ - encumbered: deallocateParams[0].newMagnitudes[0], - max: WAD, - allocatable: WAD - deallocateParams[0].newMagnitudes[0] + encumbered: deallocateParams[0].newMagnitudes[0], max: WAD, allocatable: WAD - deallocateParams[0].newMagnitudes[0] }) }); } @@ -2721,9 +2684,7 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe operatorSet: operatorSetB, strategy: strategyMock, expectedAllocation: Allocation({ - currentMagnitude: 0, - pendingDiff: int128(uint128(firstMod)), - effectBlock: _defaultAllocEffectBlock() + currentMagnitude: 0, pendingDiff: int128(uint128(firstMod)), effectBlock: _defaultAllocEffectBlock() }), expectedMagnitudes: Magnitudes({encumbered: firstMod, max: WAD, allocatable: WAD - firstMod}) }); @@ -2827,7 +2788,9 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe operator: defaultOperator, operatorSet: finalOpSet, strategy: strategyMock, - expectedAllocation: Allocation({currentMagnitude: 0, pendingDiff: int128(uint128(WAD)), effectBlock: _defaultAllocEffectBlock()}), + expectedAllocation: Allocation({ + currentMagnitude: 0, pendingDiff: int128(uint128(WAD)), effectBlock: _defaultAllocEffectBlock() + }), expectedMagnitudes: Magnitudes({encumbered: WAD, max: WAD, allocatable: 0}) }); } @@ -2928,9 +2891,7 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe effectBlock: _defaultAllocEffectBlock() }), expectedMagnitudes: Magnitudes({ - encumbered: allocateParams[i].newMagnitudes[j], - max: WAD, - allocatable: WAD - allocateParams[i].newMagnitudes[j] + encumbered: allocateParams[i].newMagnitudes[j], max: WAD, allocatable: WAD - allocateParams[i].newMagnitudes[j] }) }); } @@ -2948,9 +2909,7 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe strategy: allocateParams[i].strategies[j], expectedAllocation: Allocation({currentMagnitude: allocateParams[i].newMagnitudes[j], pendingDiff: 0, effectBlock: 0}), expectedMagnitudes: Magnitudes({ - encumbered: allocateParams[i].newMagnitudes[j], - max: WAD, - allocatable: WAD - allocateParams[i].newMagnitudes[j] + encumbered: allocateParams[i].newMagnitudes[j], max: WAD, allocatable: WAD - allocateParams[i].newMagnitudes[j] }) }); } @@ -2986,9 +2945,7 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe effectBlock: uint32(block.number + DEALLOCATION_DELAY + 1) }), expectedMagnitudes: Magnitudes({ - encumbered: allocateParams[i].newMagnitudes[j], - max: WAD, - allocatable: WAD - allocateParams[i].newMagnitudes[j] + encumbered: allocateParams[i].newMagnitudes[j], max: WAD, allocatable: WAD - allocateParams[i].newMagnitudes[j] }) }); } @@ -3002,11 +2959,11 @@ contract AllocationManagerUnitTests_ModifyAllocations is AllocationManagerUnitTe operator: defaultOperator, operatorSet: deallocateParams[i].operatorSet, strategy: allocateParams[i].strategies[j], - expectedAllocation: Allocation({currentMagnitude: deallocateParams[i].newMagnitudes[j], pendingDiff: 0, effectBlock: 0}), + expectedAllocation: Allocation({ + currentMagnitude: deallocateParams[i].newMagnitudes[j], pendingDiff: 0, effectBlock: 0 + }), expectedMagnitudes: Magnitudes({ - encumbered: deallocateParams[i].newMagnitudes[j], - max: WAD, - allocatable: WAD - deallocateParams[i].newMagnitudes[j] + encumbered: deallocateParams[i].newMagnitudes[j], max: WAD, allocatable: WAD - deallocateParams[i].newMagnitudes[j] }) }); } @@ -3068,9 +3025,7 @@ contract AllocationManagerUnitTests_ClearDeallocationQueue is AllocationManagerU strategy: strategyMock, expectedAllocation: Allocation({currentMagnitude: allocateParams[0].newMagnitudes[0], pendingDiff: 0, effectBlock: 0}), expectedMagnitudes: Magnitudes({ - encumbered: allocateParams[0].newMagnitudes[0], - max: WAD, - allocatable: WAD - allocateParams[0].newMagnitudes[0] + encumbered: allocateParams[0].newMagnitudes[0], max: WAD, allocatable: WAD - allocateParams[0].newMagnitudes[0] }) }); } @@ -3119,9 +3074,7 @@ contract AllocationManagerUnitTests_ClearDeallocationQueue is AllocationManagerU effectBlock: uint32(block.number + DEALLOCATION_DELAY + 1) }), expectedMagnitudes: Magnitudes({ - encumbered: allocateParams[0].newMagnitudes[0], - max: WAD, - allocatable: WAD - allocateParams[0].newMagnitudes[0] + encumbered: allocateParams[0].newMagnitudes[0], max: WAD, allocatable: WAD - allocateParams[0].newMagnitudes[0] }) }); @@ -3130,9 +3083,7 @@ contract AllocationManagerUnitTests_ClearDeallocationQueue is AllocationManagerU // Clear queue _checkClearDeallocationQueueEvents({ - operator: defaultOperator, - strategy: strategyMock, - encumberedMagnitude: deallocateParams[0].newMagnitudes[0] + operator: defaultOperator, strategy: strategyMock, encumberedMagnitude: deallocateParams[0].newMagnitudes[0] }); allocationManager.clearDeallocationQueue(defaultOperator, defaultStrategies, _maxNumToClear()); @@ -3143,9 +3094,7 @@ contract AllocationManagerUnitTests_ClearDeallocationQueue is AllocationManagerU strategy: strategyMock, expectedAllocation: Allocation({currentMagnitude: deallocateParams[0].newMagnitudes[0], pendingDiff: 0, effectBlock: 0}), expectedMagnitudes: Magnitudes({ - encumbered: deallocateParams[0].newMagnitudes[0], - max: WAD, - allocatable: WAD - deallocateParams[0].newMagnitudes[0] + encumbered: deallocateParams[0].newMagnitudes[0], max: WAD, allocatable: WAD - deallocateParams[0].newMagnitudes[0] }) }); } @@ -3263,7 +3212,6 @@ contract AllocationManagerUnitTests_SetAllocationDelay is AllocationManagerUnitT /// ----------------------------------------------------------------------- /// setAllocationDelay() + getAllocationDelay() /// ----------------------------------------------------------------------- - address operatorToSet = address(0x1); function setUp() public override { @@ -3984,9 +3932,7 @@ contract AllocationManagerUnitTests_getStrategyAllocations is AllocationManagerU strategy: createSetParams[0].strategies[0], expectedAllocation: Allocation({currentMagnitude: allocateParams[0].newMagnitudes[0], pendingDiff: 0, effectBlock: 0}), expectedMagnitudes: Magnitudes({ - encumbered: allocateParams[0].newMagnitudes[0], - max: WAD, - allocatable: WAD - allocateParams[0].newMagnitudes[0] + encumbered: allocateParams[0].newMagnitudes[0], max: WAD, allocatable: WAD - allocateParams[0].newMagnitudes[0] }) }); } diff --git a/src/test/unit/BN254CertificateVerifierUnit.t.sol b/src/test/unit/BN254CertificateVerifierUnit.t.sol index 09d8c24b4d..d74397506d 100644 --- a/src/test/unit/BN254CertificateVerifierUnit.t.sol +++ b/src/test/unit/BN254CertificateVerifierUnit.t.sol @@ -602,8 +602,13 @@ contract BN254CertificateVerifierUnitTests_verifyCertificate is BN254Certificate // Create operators uint numSigners = r.Uint256(1, numOperators - 1); uint nonSigners = numOperators - numSigners; - (BN254OperatorInfo[] memory operators,, uint32 referenceTimestamp, uint32[] memory nonSignerIndices, BN254.G1Point memory signature) - = _updateOperatorTable(r, numSigners, nonSigners); + ( + BN254OperatorInfo[] memory operators, + , + uint32 referenceTimestamp, + uint32[] memory nonSignerIndices, + BN254.G1Point memory signature + ) = _updateOperatorTable(r, numSigners, nonSigners); BN254Certificate memory cert = _createCertificate(referenceTimestamp, defaultMsgHash, nonSignerIndices, operators); @@ -688,8 +693,13 @@ contract BN254CertificateVerifierUnitTests_verifyCertificate is BN254Certificate contract BN254CertificateVerifierUnitTests_verifyCertificateProportion is BN254CertificateVerifierUnitTests { function testFuzz_revert_arrayLengthMismatch(Randomness r) public rand(r) { // Update operator table - (BN254OperatorInfo[] memory operators,, uint32 referenceTimestamp, uint32[] memory nonSignerIndices, BN254.G1Point memory signature) - = _updateOperatorTable(r, numOperators, 0); // 0 nonsigners + ( + BN254OperatorInfo[] memory operators, + , + uint32 referenceTimestamp, + uint32[] memory nonSignerIndices, + BN254.G1Point memory signature + ) = _updateOperatorTable(r, numOperators, 0); // 0 nonsigners BN254Certificate memory cert = _createCertificate(referenceTimestamp, defaultMsgHash, nonSignerIndices, operators); @@ -704,8 +714,13 @@ contract BN254CertificateVerifierUnitTests_verifyCertificateProportion is BN254C // Update operator table uint numSigners = r.Uint256(1, numOperators - 1); uint numNonsigners = numOperators - numSigners; - (BN254OperatorInfo[] memory operators,, uint32 referenceTimestamp, uint32[] memory nonSignerIndices, BN254.G1Point memory signature) - = _updateOperatorTable(r, numSigners, numNonsigners); + ( + BN254OperatorInfo[] memory operators, + , + uint32 referenceTimestamp, + uint32[] memory nonSignerIndices, + BN254.G1Point memory signature + ) = _updateOperatorTable(r, numSigners, numNonsigners); BN254Certificate memory cert = _createCertificate(referenceTimestamp, defaultMsgHash, nonSignerIndices, operators); @@ -802,8 +817,13 @@ contract BN254CertificateVerifierUnitTests_verifyCertificateNominal is BN254Cert // Update operator table uint numSigners = r.Uint256(1, numOperators - 1); uint numNonsigners = numOperators - numSigners; - (BN254OperatorInfo[] memory operators,, uint32 referenceTimestamp, uint32[] memory nonSignerIndices, BN254.G1Point memory signature) - = _updateOperatorTable(r, numSigners, numNonsigners); + ( + BN254OperatorInfo[] memory operators, + , + uint32 referenceTimestamp, + uint32[] memory nonSignerIndices, + BN254.G1Point memory signature + ) = _updateOperatorTable(r, numSigners, numNonsigners); BN254Certificate memory cert = _createCertificate(referenceTimestamp, defaultMsgHash, nonSignerIndices, operators); @@ -818,8 +838,13 @@ contract BN254CertificateVerifierUnitTests_verifyCertificateNominal is BN254Cert // Update operator table uint numSigners = r.Uint256(1, numOperators); uint numNonsigners = numOperators - numSigners; - (BN254OperatorInfo[] memory operators,, uint32 referenceTimestamp, uint32[] memory nonSignerIndices, BN254.G1Point memory signature) - = _updateOperatorTable(r, numSigners, numNonsigners); + ( + BN254OperatorInfo[] memory operators, + , + uint32 referenceTimestamp, + uint32[] memory nonSignerIndices, + BN254.G1Point memory signature + ) = _updateOperatorTable(r, numSigners, numNonsigners); BN254Certificate memory cert = _createCertificate(referenceTimestamp, defaultMsgHash, nonSignerIndices, operators); @@ -839,8 +864,13 @@ contract BN254CertificateVerifierUnitTests_verifyCertificateNominal is BN254Cert // Update operator table uint numSigners = r.Uint256(1, numOperators - 1); // Ensure at least one non-signer uint numNonsigners = numOperators - numSigners; - (BN254OperatorInfo[] memory operators,, uint32 referenceTimestamp, uint32[] memory nonSignerIndices, BN254.G1Point memory signature) - = _updateOperatorTable(r, numSigners, numNonsigners); + ( + BN254OperatorInfo[] memory operators, + , + uint32 referenceTimestamp, + uint32[] memory nonSignerIndices, + BN254.G1Point memory signature + ) = _updateOperatorTable(r, numSigners, numNonsigners); BN254Certificate memory cert = _createCertificate(referenceTimestamp, defaultMsgHash, nonSignerIndices, operators); @@ -861,8 +891,13 @@ contract BN254CertificateVerifierUnitTests_verifyCertificateNominal is BN254Cert // Update operator table uint numSigners = r.Uint256(1, numOperators); uint numNonsigners = numOperators - numSigners; - (BN254OperatorInfo[] memory operators,, uint32 referenceTimestamp, uint32[] memory nonSignerIndices, BN254.G1Point memory signature) - = _updateOperatorTable(r, numSigners, numNonsigners); + ( + BN254OperatorInfo[] memory operators, + , + uint32 referenceTimestamp, + uint32[] memory nonSignerIndices, + BN254.G1Point memory signature + ) = _updateOperatorTable(r, numSigners, numNonsigners); BN254Certificate memory cert = _createCertificate(referenceTimestamp, defaultMsgHash, nonSignerIndices, operators); diff --git a/src/test/unit/DelegationUnit.t.sol b/src/test/unit/DelegationUnit.t.sol index ae8ebecac5..49a93196e2 100644 --- a/src/test/unit/DelegationUnit.t.sol +++ b/src/test/unit/DelegationUnit.t.sol @@ -321,9 +321,7 @@ contract DelegationManagerUnitTests is EigenLayerUnitTestSetup, IDelegationManag QueuedWithdrawalParams[] memory queuedWithdrawalParams = new QueuedWithdrawalParams[](1); { queuedWithdrawalParams[0] = QueuedWithdrawalParams({ - strategies: strategies, - depositShares: depositWithdrawalAmounts, - __deprecated_withdrawer: address(0) + strategies: strategies, depositShares: depositWithdrawalAmounts, __deprecated_withdrawer: address(0) }); } @@ -721,9 +719,7 @@ contract DelegationManagerUnitTests is EigenLayerUnitTestSetup, IDelegationManag for (uint i = 0; i < params.withdrawals.length; i++) { _completeQueuedWithdrawal_expectEmit( CompleteQueuedWithdrawalEmitStruct({ - withdrawal: params.withdrawals[i], - tokens: params.tokens[i], - receiveAsTokens: params.receiveAsTokens[i] + withdrawal: params.withdrawals[i], tokens: params.tokens[i], receiveAsTokens: params.receiveAsTokens[i] }) ); } @@ -1009,8 +1005,9 @@ contract DelegationManagerUnitTests is EigenLayerUnitTestSetup, IDelegationManag uint64 prevMaxMagnitude, uint64 newMaxMagnitude ) internal view returns (uint sharesToDecrement, uint operatorSharesAfterSlash) { - (sharesToDecrement, operatorSharesAfterSlash) = - _calcSlashedAmount({operatorShares: operatorSharesBefore, prevMaxMagnitude: prevMaxMagnitude, newMaxMagnitude: newMaxMagnitude}); + (sharesToDecrement, operatorSharesAfterSlash) = _calcSlashedAmount({ + operatorShares: operatorSharesBefore, prevMaxMagnitude: prevMaxMagnitude, newMaxMagnitude: newMaxMagnitude + }); assertEq( operatorSharesAfterSlash, @@ -1235,18 +1232,14 @@ contract DelegationManagerUnitTests_RegisterModifyOperator is DelegationManagerU // register operator1 with expected emits _registerOperator_expectEmit( RegisterAsOperatorEmitStruct({ - operator: operator1, - delegationApprover: delegationApprover1, - metadataURI: emptyStringForMetadataURI + operator: operator1, delegationApprover: delegationApprover1, metadataURI: emptyStringForMetadataURI }) ); _registerOperator(operator1, delegationApprover1, emptyStringForMetadataURI); // register operator2 with expected emits _registerOperator_expectEmit( RegisterAsOperatorEmitStruct({ - operator: operator2, - delegationApprover: delegationApprover2, - metadataURI: emptyStringForMetadataURI + operator: operator2, delegationApprover: delegationApprover2, metadataURI: emptyStringForMetadataURI }) ); _registerOperator(operator2, delegationApprover2, emptyStringForMetadataURI); @@ -1290,7 +1283,9 @@ contract DelegationManagerUnitTests_RegisterModifyOperator is DelegationManagerU // register operator, their own staker depositShares should increase their operatorShares _registerOperator_expectEmit( - RegisterAsOperatorEmitStruct({operator: defaultOperator, delegationApprover: address(0), metadataURI: emptyStringForMetadataURI}) + RegisterAsOperatorEmitStruct({ + operator: defaultOperator, delegationApprover: address(0), metadataURI: emptyStringForMetadataURI + }) ); _registerOperatorWithBaseDetails(defaultOperator); uint operatorSharesAfter = delegationManager.operatorShares(defaultOperator, strategyMock); @@ -1314,9 +1309,7 @@ contract DelegationManagerUnitTests_RegisterModifyOperator is DelegationManagerU function testFuzz_modifyOperatorParameters(address delegationApprover1, address delegationApprover2) public { _registerOperator_expectEmit( RegisterAsOperatorEmitStruct({ - operator: defaultOperator, - delegationApprover: delegationApprover1, - metadataURI: emptyStringForMetadataURI + operator: defaultOperator, delegationApprover: delegationApprover1, metadataURI: emptyStringForMetadataURI }) ); _registerOperator(defaultOperator, delegationApprover1, emptyStringForMetadataURI); @@ -1482,11 +1475,7 @@ contract DelegationManagerUnitTests_delegateTo is DelegationManagerUnitTests { cheats.prank(staker); _delegateTo_expectEmit_singleStrat( DelegateToSingleStratEmitStruct({ - staker: staker, - operator: defaultOperator, - strategy: strategyMock, - depositShares: shares, - depositScalingFactor: WAD + staker: staker, operator: defaultOperator, strategy: strategyMock, depositShares: shares, depositScalingFactor: WAD }) ); delegationManager.delegateTo(defaultOperator, approverSignatureAndExpiry, salt); @@ -2247,11 +2236,7 @@ contract DelegationManagerUnitTests_delegateTo is DelegationManagerUnitTests { cheats.startPrank(staker); _delegateTo_expectEmit_singleStrat( DelegateToSingleStratEmitStruct({ - staker: staker, - operator: defaultOperator, - strategy: strategyMock, - depositShares: shares, - depositScalingFactor: WAD + staker: staker, operator: defaultOperator, strategy: strategyMock, depositShares: shares, depositScalingFactor: WAD }) ); delegationManager.delegateTo(defaultOperator, approverSignatureAndExpiry, salt); @@ -3105,22 +3090,20 @@ contract DelegationManagerUnitTests_decreaseDelegatedShares is DelegationManager uint depositScalingFactor = uint(WAD); // expected operatorShares decreased for event uint operatorSharesToDecrease = _calcWithdrawableShares({ - depositShares: uint(beaconShares), - depositScalingFactor: depositScalingFactor, - slashingFactor: beaconChainSlashingFactorDecrease + depositShares: uint(beaconShares), depositScalingFactor: depositScalingFactor, slashingFactor: beaconChainSlashingFactorDecrease }); // expected events _decreaseDelegatedShares_expectEmit( - DecreaseDelegatedSharesEmitStruct({staker: defaultStaker, operator: defaultOperator, sharesToDecrease: operatorSharesToDecrease}) + DecreaseDelegatedSharesEmitStruct({ + staker: defaultStaker, operator: defaultOperator, sharesToDecrease: operatorSharesToDecrease + }) ); cheats.prank(address(eigenPodManagerMock)); delegationManager.decreaseDelegatedShares(defaultStaker, uint(beaconShares), beaconChainSlashingFactorDecrease); // 3. Assert correct values uint expectedWithdrawableShares = _calcWithdrawableShares({ - depositShares: uint(beaconShares), - depositScalingFactor: depositScalingFactor, - slashingFactor: newBeaconSlashingFactor + depositShares: uint(beaconShares), depositScalingFactor: depositScalingFactor, slashingFactor: newBeaconSlashingFactor }); _assertSharesAfterBeaconSlash({ staker: defaultStaker, @@ -3189,7 +3172,9 @@ contract DelegationManagerUnitTests_decreaseDelegatedShares is DelegationManager }); // expected events _decreaseDelegatedShares_expectEmit( - DecreaseDelegatedSharesEmitStruct({staker: defaultStaker, operator: defaultOperator, sharesToDecrease: operatorSharesToDecrease}) + DecreaseDelegatedSharesEmitStruct({ + staker: defaultStaker, operator: defaultOperator, sharesToDecrease: operatorSharesToDecrease + }) ); cheats.prank(address(eigenPodManagerMock)); delegationManager.decreaseDelegatedShares(defaultStaker, uint(beaconShares), beaconChainSlashingFactorDecrease); @@ -3263,7 +3248,9 @@ contract DelegationManagerUnitTests_decreaseDelegatedShares is DelegationManager }); // expected events _decreaseDelegatedShares_expectEmit( - DecreaseDelegatedSharesEmitStruct({staker: defaultStaker, operator: defaultOperator, sharesToDecrease: operatorSharesToDecrease}) + DecreaseDelegatedSharesEmitStruct({ + staker: defaultStaker, operator: defaultOperator, sharesToDecrease: operatorSharesToDecrease + }) ); cheats.prank(address(eigenPodManagerMock)); delegationManager.decreaseDelegatedShares(defaultStaker, uint(beaconShares), prevBeaconSlashingFactor); @@ -3839,9 +3826,7 @@ contract DelegationManagerUnitTests_undelegate is DelegationManagerUnitTests { uint totalOperatorSharesDecreased = 0; for (uint i = 0; i < stakers.length; ++i) { (, Withdrawal memory withdrawal, bytes32 withdrawalRoot) = _setUpQueueWithdrawalsSingleStrat({ - staker: stakers[i], - strategy: strategyMock, - depositSharesToWithdraw: stakerDepositShares[stakers[i]] + staker: stakers[i], strategy: strategyMock, depositSharesToWithdraw: stakerDepositShares[stakers[i]] }); uint operatorSharesDecreased = _calcWithdrawableShares( stakerDepositShares[stakers[i]], delegationManager.depositScalingFactor(stakers[i], strategyMock), newMaxMagnitude @@ -4141,11 +4126,7 @@ contract DelegationManagerUnitTests_redelegate is DelegationManagerUnitTests { ); _delegateTo_expectEmit_singleStrat( DelegateToSingleStratEmitStruct({ - staker: defaultStaker, - operator: newOperator, - strategy: strategyMock, - depositShares: 0, - depositScalingFactor: WAD + staker: defaultStaker, operator: newOperator, strategy: strategyMock, depositShares: 0, depositScalingFactor: WAD }) ); cheats.prank(defaultStaker); @@ -4206,9 +4187,7 @@ contract DelegationManagerUnitTests_redelegate is DelegationManagerUnitTests { (, Withdrawal memory strategyWithdrawal,) = _setUpQueueWithdrawalsSingleStrat({staker: staker, strategy: strategyMock, depositSharesToWithdraw: strategyShares}); (, Withdrawal memory beaconWithdrawal,) = _setUpQueueWithdrawalsSingleStrat({ - staker: staker, - strategy: IStrategy(address(beaconChainETHStrategy)), - depositSharesToWithdraw: uint(beaconShares) + staker: staker, strategy: IStrategy(address(beaconChainETHStrategy)), depositSharesToWithdraw: uint(beaconShares) }); beaconWithdrawal.nonce = 1; // Ensure nonce is greater for second withdrawal cheats.prank(staker); @@ -4481,8 +4460,9 @@ contract DelegationManagerUnitTests_queueWithdrawals is DelegationManagerUnitTes uint nonceBefore = delegationManager.cumulativeWithdrawalsQueued(defaultStaker); { - (QueuedWithdrawalParams[] memory queuedWithdrawalParams, Withdrawal memory withdrawal, bytes32 withdrawalRoot) = - _setUpQueueWithdrawalsSingleStrat({staker: defaultStaker, strategy: strategyMock, depositSharesToWithdraw: withdrawalAmount}); + (QueuedWithdrawalParams[] memory queuedWithdrawalParams, Withdrawal memory withdrawal, bytes32 withdrawalRoot) = _setUpQueueWithdrawalsSingleStrat({ + staker: defaultStaker, strategy: strategyMock, depositSharesToWithdraw: withdrawalAmount + }); // queueWithdrawals _queueWithdrawals_expectEmit( @@ -4538,8 +4518,7 @@ contract DelegationManagerUnitTests_queueWithdrawals is DelegationManagerUnitTes depositAmount: depositAmount }); - (QueuedWithdrawalParams[] memory queuedWithdrawalParams, Withdrawal memory withdrawal, bytes32 withdrawalRoot) = - _setUpQueueWithdrawalsSingleStrat({ + (QueuedWithdrawalParams[] memory queuedWithdrawalParams, Withdrawal memory withdrawal, bytes32 withdrawalRoot) = _setUpQueueWithdrawalsSingleStrat({ staker: defaultStaker, strategy: strategyMock, depositSharesToWithdraw: 0 // expected 0 since slashed 100% @@ -4756,8 +4735,12 @@ contract DelegationManagerUnitTests_queueWithdrawals is DelegationManagerUnitTes IStrategy[] memory strategies = r.StrategyArray(r.Uint32(1, 32)); bool depositBeaconChainShares = r.Boolean(); if (depositBeaconChainShares) strategies[strategies.length - 1] = beaconChainETHStrategy; - (uint[] memory depositAmounts, uint[] memory withdrawalAmounts, uint64[] memory prevMaxMagnitudes, uint64[] memory newMaxMagnitudes) - = _fuzzDepositWithdrawalAmounts({r: r, numStrategies: uint32(strategies.length)}); + ( + uint[] memory depositAmounts, + uint[] memory withdrawalAmounts, + uint64[] memory prevMaxMagnitudes, + uint64[] memory newMaxMagnitudes + ) = _fuzzDepositWithdrawalAmounts({r: r, numStrategies: uint32(strategies.length)}); _registerOperatorWithBaseDetails(defaultOperator); allocationManagerMock.setMaxMagnitudes(defaultOperator, strategies, prevMaxMagnitudes); _depositIntoStrategies(defaultStaker, strategies, depositAmounts); @@ -4944,15 +4927,8 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage cheats.prank(pauser); delegationManager.pause(2 ** PAUSED_EXIT_WITHDRAWAL_QUEUE); _registerOperatorWithBaseDetails(defaultOperator); - ( - Withdrawal memory withdrawal, - IERC20[] memory tokens, - /* bytes32 withdrawalRoot */ - ) = _setUpCompleteQueuedWithdrawalSingleStrat({ - staker: defaultStaker, - depositAmount: 100, - withdrawalAmount: 100, - isBeaconChainStrategy: false + (Withdrawal memory withdrawal, IERC20[] memory tokens,/* bytes32 withdrawalRoot */) = _setUpCompleteQueuedWithdrawalSingleStrat({ + staker: defaultStaker, depositAmount: 100, withdrawalAmount: 100, isBeaconChainStrategy: false }); _delegateToOperatorWhoAcceptsAllStakers(defaultStaker, defaultOperator); @@ -4976,15 +4952,8 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage function test_Revert_WhenInputArrayLengthMismatch() public { _registerOperatorWithBaseDetails(defaultOperator); - ( - Withdrawal memory withdrawal, - IERC20[] memory tokens, - /* bytes32 withdrawalRoot */ - ) = _setUpCompleteQueuedWithdrawalSingleStrat({ - staker: defaultStaker, - depositAmount: 100, - withdrawalAmount: 100, - isBeaconChainStrategy: false + (Withdrawal memory withdrawal, IERC20[] memory tokens,/* bytes32 withdrawalRoot */) = _setUpCompleteQueuedWithdrawalSingleStrat({ + staker: defaultStaker, depositAmount: 100, withdrawalAmount: 100, isBeaconChainStrategy: false }); _delegateToOperatorWhoAcceptsAllStakers(defaultStaker, defaultOperator); @@ -5008,10 +4977,7 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage _registerOperatorWithBaseDetails(defaultOperator); (Withdrawal memory withdrawal, IERC20[] memory tokens,) = _setUpCompleteQueuedWithdrawalSingleStrat({ - staker: defaultStaker, - depositAmount: 100, - withdrawalAmount: 100, - isBeaconChainStrategy: false + staker: defaultStaker, depositAmount: 100, withdrawalAmount: 100, isBeaconChainStrategy: false }); _delegateToOperatorWhoAcceptsAllStakers(defaultStaker, defaultOperator); @@ -5023,10 +4989,7 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage function test_Revert_WhenInvalidWithdrawalRoot() public { _registerOperatorWithBaseDetails(defaultOperator); (Withdrawal memory withdrawal, IERC20[] memory tokens, bytes32 withdrawalRoot) = _setUpCompleteQueuedWithdrawalSingleStrat({ - staker: defaultStaker, - depositAmount: 100, - withdrawalAmount: 100, - isBeaconChainStrategy: false + staker: defaultStaker, depositAmount: 100, withdrawalAmount: 100, isBeaconChainStrategy: false }); _delegateToOperatorWhoAcceptsAllStakers(defaultStaker, defaultOperator); @@ -5052,15 +5015,8 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage (uint[] memory depositAmounts, uint[] memory withdrawalAmounts,,) = _fuzzDepositWithdrawalAmounts(r, numStrategies); _registerOperatorWithBaseDetails(defaultOperator); - ( - Withdrawal memory withdrawal, - IERC20[] memory tokens, - /* bytes32 withdrawalRoot */ - ) = _setUpCompleteQueuedWithdrawal({ - staker: defaultStaker, - depositAmounts: depositAmounts, - withdrawalAmounts: withdrawalAmounts, - depositBeaconChainShares: false + (Withdrawal memory withdrawal, IERC20[] memory tokens,/* bytes32 withdrawalRoot */) = _setUpCompleteQueuedWithdrawal({ + staker: defaultStaker, depositAmounts: depositAmounts, withdrawalAmounts: withdrawalAmounts, depositBeaconChainShares: false }); // prank as withdrawer address @@ -5181,10 +5137,7 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage _registerOperatorWithBaseDetails(defaultOperator); (Withdrawal memory withdrawal, IERC20[] memory tokens, bytes32 withdrawalRoot) = _setUpCompleteQueuedWithdrawalSingleStrat({ - staker: defaultStaker, - depositAmount: depositAmount, - withdrawalAmount: withdrawalAmount, - isBeaconChainStrategy: false + staker: defaultStaker, depositAmount: depositAmount, withdrawalAmount: withdrawalAmount, isBeaconChainStrategy: false }); _delegateToOperatorWhoAcceptsAllStakers(defaultStaker, defaultOperator); uint operatorSharesBefore = delegationManager.operatorShares(defaultOperator, withdrawal.strategies[0]); @@ -5261,9 +5214,7 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage { uint operatorSharesAfterQueue = delegationManager.operatorShares(defaultOperator, strategyMock); (uint sharesToDecrement,) = _calcSlashedAmount({ - operatorShares: operatorSharesAfterQueue, - prevMaxMagnitude: prevMaxMagnitude, - newMaxMagnitude: newMaxMagnitude + operatorShares: operatorSharesAfterQueue, prevMaxMagnitude: prevMaxMagnitude, newMaxMagnitude: newMaxMagnitude }); _setOperatorMagnitude(defaultOperator, strategyMock, newMaxMagnitude); cheats.prank(address(allocationManagerMock)); @@ -5331,19 +5282,14 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage _delegateToOperatorWhoAcceptsAllStakers(defaultStaker, defaultOperator); // Queue withdrawal - (QueuedWithdrawalParams[] memory queuedWithdrawalParams, Withdrawal memory withdrawal, bytes32 withdrawalRoot) = - _setUpQueueWithdrawalsSingleStrat({ - staker: defaultStaker, - strategy: beaconChainETHStrategy, - depositSharesToWithdraw: withdrawalAmount + (QueuedWithdrawalParams[] memory queuedWithdrawalParams, Withdrawal memory withdrawal, bytes32 withdrawalRoot) = _setUpQueueWithdrawalsSingleStrat({ + staker: defaultStaker, strategy: beaconChainETHStrategy, depositSharesToWithdraw: withdrawalAmount }); uint64 prevBeaconSlashingFactor; uint64 newBeaconSlashingFactor; { uint sharesToDecrement = _calcWithdrawableShares({ - depositShares: withdrawalAmount, - depositScalingFactor: uint(WAD), - slashingFactor: uint(initialBCSF) + depositShares: withdrawalAmount, depositScalingFactor: uint(WAD), slashingFactor: uint(initialBCSF) }); uint operatorSharesBeforeQueue = delegationManager.operatorShares(defaultOperator, beaconChainETHStrategy); cheats.prank(defaultStaker); @@ -5364,9 +5310,7 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage _decreaseBeaconChainShares({staker: defaultStaker, beaconShares: int(currentPodShares), sharesDecrease: sharesDecrease}); uint expectedWithdrawableShares = _calcWithdrawableShares({ - depositShares: uint(currentPodShares), - depositScalingFactor: uint(WAD), - slashingFactor: uint(newBeaconSlashingFactor) + depositShares: uint(currentPodShares), depositScalingFactor: uint(WAD), slashingFactor: uint(newBeaconSlashingFactor) }); _assertSharesAfterBeaconSlash(defaultStaker, withdrawableSharesBefore[0], expectedWithdrawableShares, prevBeaconSlashingFactor); } @@ -5424,11 +5368,8 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage uint operatorSharesBeforeQueue = delegationManager.operatorShares(defaultOperator, beaconChainETHStrategy); // Queue withdrawal - (QueuedWithdrawalParams[] memory queuedWithdrawalParams, Withdrawal memory withdrawal, bytes32 withdrawalRoot) = - _setUpQueueWithdrawalsSingleStrat({ - staker: defaultStaker, - strategy: beaconChainETHStrategy, - depositSharesToWithdraw: withdrawalAmount + (QueuedWithdrawalParams[] memory queuedWithdrawalParams, Withdrawal memory withdrawal, bytes32 withdrawalRoot) = _setUpQueueWithdrawalsSingleStrat({ + staker: defaultStaker, strategy: beaconChainETHStrategy, depositSharesToWithdraw: withdrawalAmount }); uint64 newBeaconSlashingFactor; @@ -5512,10 +5453,7 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage _registerOperatorWithBaseDetails(defaultOperator); (Withdrawal memory withdrawal, IERC20[] memory tokens, bytes32 withdrawalRoot) = _setUpCompleteQueuedWithdrawalSingleStrat({ - staker: staker, - depositAmount: depositAmount, - withdrawalAmount: withdrawalAmount, - isBeaconChainStrategy: false + staker: staker, depositAmount: depositAmount, withdrawalAmount: withdrawalAmount, isBeaconChainStrategy: false }); _delegateToOperatorWhoAcceptsAllStakers(staker, defaultOperator); uint operatorSharesBefore = delegationManager.operatorShares(defaultOperator, withdrawal.strategies[0]); @@ -5734,9 +5672,7 @@ contract DelegationManagerUnitTests_slashingShares is DelegationManagerUnitTests uint withdrawalAmount = depositAmount / 6; for (uint i = 0; i < 5; i++) { (QueuedWithdrawalParams[] memory queuedWithdrawalParams,,) = _setUpQueueWithdrawalsSingleStrat({ - staker: defaultStaker, - strategy: strategyMock, - depositSharesToWithdraw: withdrawalAmount + staker: defaultStaker, strategy: strategyMock, depositSharesToWithdraw: withdrawalAmount }); cheats.prank(defaultStaker); delegationManager.queueWithdrawals(queuedWithdrawalParams); @@ -5755,12 +5691,7 @@ contract DelegationManagerUnitTests_slashingShares is DelegationManagerUnitTests _setOperatorMagnitude(defaultOperator, strategyMock, 0); cheats.prank(address(allocationManagerMock)); cheats.expectEmit(true, true, true, true, address(delegationManager)); - emit OperatorSharesDecreased( - defaultOperator, - address(0), - strategyMock, - depositAmount / 6 // 1 withdrawal not queued so decreased - ); + emit OperatorSharesDecreased(defaultOperator, address(0), strategyMock, depositAmount / 6); // 1 withdrawal not queued so decreased delegationManager.slashOperatorShares(defaultOperator, defaultOperatorSet, defaultSlashId, strategyMock, WAD, uint64(0)); // Assert slashable shares @@ -5899,10 +5830,7 @@ contract DelegationManagerUnitTests_slashingShares is DelegationManagerUnitTests // Burn shares _slashOperatorShares_expectEmit( SlashOperatorSharesEmitStruct({ - operator: operator, - strategy: strategyMock, - sharesToDecrease: sharesToBurn, - sharesToBurn: sharesToBurn + operator: operator, strategy: strategyMock, sharesToDecrease: sharesToBurn, sharesToBurn: sharesToBurn }) ); @@ -6204,9 +6132,7 @@ contract DelegationManagerUnitTests_slashingShares is DelegationManagerUnitTests // 3. Queue withdrawal for staker and slash operator for 50% { (QueuedWithdrawalParams[] memory queuedWithdrawalParams,,) = _setUpQueueWithdrawalsSingleStrat({ - staker: staker, - strategy: strategyMock, - depositSharesToWithdraw: depositSharesToWithdraw1 + staker: staker, strategy: strategyMock, depositSharesToWithdraw: depositSharesToWithdraw1 }); // 3.1 queue a withdrawal for the staker @@ -6222,10 +6148,7 @@ contract DelegationManagerUnitTests_slashingShares is DelegationManagerUnitTests _setOperatorMagnitude(operator, strategyMock, newMagnitude); _slashOperatorShares_expectEmit( SlashOperatorSharesEmitStruct({ - operator: operator, - strategy: strategyMock, - sharesToDecrease: sharesToDecrease, - sharesToBurn: sharesToBurn + operator: operator, strategy: strategyMock, sharesToDecrease: sharesToDecrease, sharesToBurn: sharesToBurn }) ); @@ -6261,9 +6184,7 @@ contract DelegationManagerUnitTests_slashingShares is DelegationManagerUnitTests newMagnitude = 25e16; { (QueuedWithdrawalParams[] memory queuedWithdrawalParams,,) = _setUpQueueWithdrawalsSingleStrat({ - staker: staker, - strategy: strategyMock, - depositSharesToWithdraw: depositSharesToWithdraw2 + staker: staker, strategy: strategyMock, depositSharesToWithdraw: depositSharesToWithdraw2 }); // 4.1 queue a withdrawal for the staker @@ -6279,10 +6200,7 @@ contract DelegationManagerUnitTests_slashingShares is DelegationManagerUnitTests _setOperatorMagnitude(operator, strategyMock, newMagnitude); _slashOperatorShares_expectEmit( SlashOperatorSharesEmitStruct({ - operator: operator, - strategy: strategyMock, - sharesToDecrease: sharesToDecrease, - sharesToBurn: sharesToBurn + operator: operator, strategy: strategyMock, sharesToDecrease: sharesToDecrease, sharesToBurn: sharesToBurn }) ); @@ -7549,14 +7467,16 @@ contract DelegationManagerUnitTests_getQueuedWithdrawals is DelegationManagerUni assertApproxEqAbs(afterSlash, newStakerShares, 1, "bad operator shares after slash"); // Queue withdrawals. - (QueuedWithdrawalParams[] memory queuedWithdrawalParams0, Withdrawal memory withdrawal0, bytes32 withdrawalRoot0) = - _setUpQueueWithdrawalsSingleStrat({staker: defaultStaker, strategy: strategyMock, depositSharesToWithdraw: totalDepositShares / 2}); + (QueuedWithdrawalParams[] memory queuedWithdrawalParams0, Withdrawal memory withdrawal0, bytes32 withdrawalRoot0) = _setUpQueueWithdrawalsSingleStrat({ + staker: defaultStaker, strategy: strategyMock, depositSharesToWithdraw: totalDepositShares / 2 + }); cheats.prank(defaultStaker); delegationManager.queueWithdrawals(queuedWithdrawalParams0); - (QueuedWithdrawalParams[] memory queuedWithdrawalParams1, Withdrawal memory withdrawal1, bytes32 withdrawalRoot1) = - _setUpQueueWithdrawalsSingleStrat({staker: defaultStaker, strategy: strategyMock, depositSharesToWithdraw: totalDepositShares / 2}); + (QueuedWithdrawalParams[] memory queuedWithdrawalParams1, Withdrawal memory withdrawal1, bytes32 withdrawalRoot1) = _setUpQueueWithdrawalsSingleStrat({ + staker: defaultStaker, strategy: strategyMock, depositSharesToWithdraw: totalDepositShares / 2 + }); cheats.prank(defaultStaker); delegationManager.queueWithdrawals(queuedWithdrawalParams1); diff --git a/src/test/unit/ECDSACertificateVerifierUnit.t.sol b/src/test/unit/ECDSACertificateVerifierUnit.t.sol index 51debb5b46..b14fe17aff 100644 --- a/src/test/unit/ECDSACertificateVerifierUnit.t.sol +++ b/src/test/unit/ECDSACertificateVerifierUnit.t.sol @@ -192,9 +192,7 @@ contract ECDSACertificateVerifierUnitTests is } cert = IECDSACertificateVerifierTypes.ECDSACertificate({ - referenceTimestamp: referenceTimestamp, - messageHash: messageHash, - sig: signatures + referenceTimestamp: referenceTimestamp, messageHash: messageHash, sig: signatures }); } @@ -425,9 +423,7 @@ contract ECDSACertificateVerifierUnitTests_verifyCertificate is ECDSACertificate bytes memory invalidLengthSig = new bytes(64); // Should be 65 bytes for ECDSA IECDSACertificateVerifierTypes.ECDSACertificate memory cert = IECDSACertificateVerifierTypes.ECDSACertificate({ - referenceTimestamp: referenceTimestamp, - messageHash: defaultMsgHash, - sig: invalidLengthSig + referenceTimestamp: referenceTimestamp, messageHash: defaultMsgHash, sig: invalidLengthSig }); vm.expectRevert(IECDSACertificateVerifierErrors.InvalidSignatureLength.selector); @@ -682,9 +678,7 @@ contract ECDSACertificateVerifierUnitTests_verifyCertificate is ECDSACertificate bytes memory signature = abi.encodePacked(r, s, v); IECDSACertificateVerifierTypes.ECDSACertificate memory cert = IECDSACertificateVerifierTypes.ECDSACertificate({ - referenceTimestamp: referenceTimestamp, - messageHash: defaultMsgHash, - sig: signature + referenceTimestamp: referenceTimestamp, messageHash: defaultMsgHash, sig: signature }); // Should revert because the signer is not an operator @@ -745,9 +739,7 @@ contract ECDSACertificateVerifierUnitTests_verifyCertificate is ECDSACertificate bytes memory signatures = bytes.concat(abi.encodePacked(r0, s0, v0), abi.encodePacked(r1, s1, v1)); IECDSACertificateVerifierTypes.ECDSACertificate memory cert = IECDSACertificateVerifierTypes.ECDSACertificate({ - referenceTimestamp: referenceTimestamp, - messageHash: defaultMsgHash, - sig: signatures + referenceTimestamp: referenceTimestamp, messageHash: defaultMsgHash, sig: signatures }); // Should revert because signatures are not ordered by address @@ -780,9 +772,7 @@ contract ECDSACertificateVerifierUnitTests_verifyCertificate is ECDSACertificate invalidSignature[64] = bytes1(v); IECDSACertificateVerifierTypes.ECDSACertificate memory cert = IECDSACertificateVerifierTypes.ECDSACertificate({ - referenceTimestamp: referenceTimestamp, - messageHash: defaultMsgHash, - sig: invalidSignature + referenceTimestamp: referenceTimestamp, messageHash: defaultMsgHash, sig: invalidSignature }); // Should revert because signature recovery returns an error @@ -816,9 +806,7 @@ contract ECDSACertificateVerifierUnitTests_verifyCertificate is ECDSACertificate zeroRecoverySignature[64] = bytes1(v); IECDSACertificateVerifierTypes.ECDSACertificate memory cert = IECDSACertificateVerifierTypes.ECDSACertificate({ - referenceTimestamp: referenceTimestamp, - messageHash: defaultMsgHash, - sig: zeroRecoverySignature + referenceTimestamp: referenceTimestamp, messageHash: defaultMsgHash, sig: zeroRecoverySignature }); // Should revert because recovered address is zero - now throws VerificationFailed diff --git a/src/test/unit/EigenPodManagerUnit.t.sol b/src/test/unit/EigenPodManagerUnit.t.sol index 1e9e475146..d3ba5193cb 100644 --- a/src/test/unit/EigenPodManagerUnit.t.sol +++ b/src/test/unit/EigenPodManagerUnit.t.sol @@ -49,7 +49,7 @@ contract EigenPodManagerUnitTests is EigenLayerUnitTestSetup, IEigenPodManagerEv new TransparentUpgradeableProxy( address(eigenPodManagerImplementation), address(eigenLayerProxyAdmin), - abi.encodeWithSelector(EigenPodManager.initialize.selector, initialOwner, 0 /*initialPausedStatus*/ ) + abi.encodeWithSelector(EigenPodManager.initialize.selector, initialOwner, 0 /*initialPausedStatus*/) ) ) ); @@ -119,7 +119,7 @@ contract EigenPodManagerUnitTests_Initialization_Setters is EigenPodManagerUnitT function test_initialize_revert_alreadyInitialized() public { cheats.expectRevert("Initializable: contract is already initialized"); - eigenPodManager.initialize(initialOwner, 0 /*initialPausedStatus*/ ); + eigenPodManager.initialize(initialOwner, 0 /*initialPausedStatus*/); } } diff --git a/src/test/unit/EigenPodUnit.t.sol b/src/test/unit/EigenPodUnit.t.sol index 2654fefcd4..c73a50ea0b 100644 --- a/src/test/unit/EigenPodUnit.t.sol +++ b/src/test/unit/EigenPodUnit.t.sol @@ -66,14 +66,12 @@ contract EigenPodUnitTests is EigenLayerUnitTestSetup, EigenPodPausingConstants, // Deploy Proxy same way as EigenPodManager does eigenPod = EigenPod( - payable( - Create2.deploy( + payable(Create2.deploy( 0, bytes32(uint(uint160(address(this)))), // set the beacon address to the eigenPodBeacon abi.encodePacked(beaconProxyBytecode, abi.encode(eigenPodBeacon, "")) - ) - ) + )) ); // Store the eigenPodBeacon address in the eigenPod beacon proxy @@ -370,7 +368,6 @@ contract EigenPodUnitTests_EPMFunctions is EigenPodUnitTests { * stake() tests * */ - // Beacon chain staking constnats bytes public constant pubkey = hex"88347ed1c492eedc97fc8c506a35d44d81f27a0c7a1c661b35913cfd15256c0cccbd34a83341f505c7de2983292f2cab"; bytes public signature; @@ -609,7 +606,6 @@ contract EigenPodUnitTests_verifyWithdrawalCredentials is EigenPodUnitTests, Pro * verifyWithdrawalCredentials() tests * */ - /// @notice revert when verify wc is not called by pod owner function testFuzz_revert_callerIsNotPodOwnerOrProofSubmitter(address invalidCaller) public { (EigenPodUser staker,) = _newEigenPodStaker({rand: 0}); @@ -981,7 +977,6 @@ contract EigenPodUnitTests_startCheckpoint is EigenPodUnitTests { * startCheckpoint() tests * */ - /// @notice revert when startCheckpoint is not called by pod owner function testFuzz_revert_callerIsNotPodOwnerOrProofSubmitter(uint rand, address invalidCaller) public { (EigenPodUser staker,) = _newEigenPodStaker({rand: rand}); @@ -1091,7 +1086,6 @@ contract EigenPodUnitTests_verifyCheckpointProofs is EigenPodUnitTests { * verifyCheckpointProofs() tests * */ - /// @notice test verifyCheckpointProofs reverts when paused function testFuzz_revert_verifyCheckpointProofsPaused(uint rand) public { (EigenPodUser staker,) = _newEigenPodStaker({rand: rand}); @@ -1392,9 +1386,7 @@ contract EigenPodUnitTests_verifyStaleBalance is EigenPodUnitTests { eigenPodManagerMock.pause(2 ** PAUSED_VERIFY_STALE_BALANCE); cheats.expectRevert(IEigenPodErrors.CurrentlyPaused.selector); pod.verifyStaleBalance({ - beaconTimestamp: proofs.beaconTimestamp, - stateRootProof: proofs.stateRootProof, - proof: proofs.validatorProof + beaconTimestamp: proofs.beaconTimestamp, stateRootProof: proofs.stateRootProof, proof: proofs.validatorProof }); } @@ -1409,9 +1401,7 @@ contract EigenPodUnitTests_verifyStaleBalance is EigenPodUnitTests { eigenPodManagerMock.pause(2 ** PAUSED_START_CHECKPOINT); cheats.expectRevert(IEigenPodErrors.CurrentlyPaused.selector); pod.verifyStaleBalance({ - beaconTimestamp: proofs.beaconTimestamp, - stateRootProof: proofs.stateRootProof, - proof: proofs.validatorProof + beaconTimestamp: proofs.beaconTimestamp, stateRootProof: proofs.stateRootProof, proof: proofs.validatorProof }); } @@ -1433,9 +1423,7 @@ contract EigenPodUnitTests_verifyStaleBalance is EigenPodUnitTests { StaleBalanceProofs memory proofs = beaconChain.getStaleBalanceProofs(validator); cheats.expectRevert(IEigenPodErrors.BeaconTimestampTooFarInPast.selector); pod.verifyStaleBalance({ - beaconTimestamp: lastCheckpointTimestamp, - stateRootProof: proofs.stateRootProof, - proof: proofs.validatorProof + beaconTimestamp: lastCheckpointTimestamp, stateRootProof: proofs.stateRootProof, proof: proofs.validatorProof }); } @@ -1471,9 +1459,7 @@ contract EigenPodUnitTests_verifyStaleBalance is EigenPodUnitTests { cheats.expectRevert(IEigenPodErrors.ValidatorNotActiveInPod.selector); pod.verifyStaleBalance({ - beaconTimestamp: proofs.beaconTimestamp, - stateRootProof: proofs.stateRootProof, - proof: proofs.validatorProof + beaconTimestamp: proofs.beaconTimestamp, stateRootProof: proofs.stateRootProof, proof: proofs.validatorProof }); } @@ -1493,9 +1479,7 @@ contract EigenPodUnitTests_verifyStaleBalance is EigenPodUnitTests { cheats.expectRevert(IEigenPodErrors.ValidatorNotSlashedOnBeaconChain.selector); pod.verifyStaleBalance({ - beaconTimestamp: proofs.beaconTimestamp, - stateRootProof: proofs.stateRootProof, - proof: proofs.validatorProof + beaconTimestamp: proofs.beaconTimestamp, stateRootProof: proofs.stateRootProof, proof: proofs.validatorProof }); } @@ -1518,9 +1502,7 @@ contract EigenPodUnitTests_verifyStaleBalance is EigenPodUnitTests { cheats.expectRevert(IEigenPodErrors.ForkTimestampZero.selector); pod.verifyStaleBalance({ - beaconTimestamp: proofs.beaconTimestamp, - stateRootProof: proofs.stateRootProof, - proof: proofs.validatorProof + beaconTimestamp: proofs.beaconTimestamp, stateRootProof: proofs.stateRootProof, proof: proofs.validatorProof }); } @@ -1545,9 +1527,7 @@ contract EigenPodUnitTests_verifyStaleBalance is EigenPodUnitTests { cheats.expectRevert(BeaconChainProofs.InvalidProofLength.selector); pod.verifyStaleBalance({ - beaconTimestamp: proofs.beaconTimestamp, - stateRootProof: invalidStateRootProof, - proof: proofs.validatorProof + beaconTimestamp: proofs.beaconTimestamp, stateRootProof: invalidStateRootProof, proof: proofs.validatorProof }); } @@ -1573,9 +1553,7 @@ contract EigenPodUnitTests_verifyStaleBalance is EigenPodUnitTests { cheats.expectRevert(BeaconChainProofs.InvalidProof.selector); pod.verifyStaleBalance({ - beaconTimestamp: proofs.beaconTimestamp, - stateRootProof: proofs.stateRootProof, - proof: proofs.validatorProof + beaconTimestamp: proofs.beaconTimestamp, stateRootProof: proofs.stateRootProof, proof: proofs.validatorProof }); } @@ -1600,9 +1578,7 @@ contract EigenPodUnitTests_verifyStaleBalance is EigenPodUnitTests { BeaconChainProofs.ValidatorProof({validatorFields: proofs.validatorProof.validatorFields, proof: invalidProof}); cheats.expectRevert(BeaconChainProofs.InvalidProofLength.selector); pod.verifyStaleBalance({ - beaconTimestamp: proofs.beaconTimestamp, - stateRootProof: proofs.stateRootProof, - proof: invalidValidatorProof + beaconTimestamp: proofs.beaconTimestamp, stateRootProof: proofs.stateRootProof, proof: invalidValidatorProof }); // Change the validator fields to have an invalid length @@ -1614,9 +1590,7 @@ contract EigenPodUnitTests_verifyStaleBalance is EigenPodUnitTests { cheats.expectRevert(BeaconChainProofs.InvalidValidatorFieldsLength.selector); pod.verifyStaleBalance({ - beaconTimestamp: proofs.beaconTimestamp, - stateRootProof: proofs.stateRootProof, - proof: proofs.validatorProof + beaconTimestamp: proofs.beaconTimestamp, stateRootProof: proofs.stateRootProof, proof: proofs.validatorProof }); } @@ -1640,9 +1614,7 @@ contract EigenPodUnitTests_verifyStaleBalance is EigenPodUnitTests { cheats.expectRevert(BeaconChainProofs.InvalidProof.selector); pod.verifyStaleBalance({ - beaconTimestamp: proofs.beaconTimestamp, - stateRootProof: proofs.stateRootProof, - proof: proofs.validatorProof + beaconTimestamp: proofs.beaconTimestamp, stateRootProof: proofs.stateRootProof, proof: proofs.validatorProof }); } @@ -1662,9 +1634,7 @@ contract EigenPodUnitTests_verifyStaleBalance is EigenPodUnitTests { cheats.expectEmit(true, true, true, true, address(staker.pod())); emit CheckpointCreated(uint64(block.timestamp), EIP_4788_ORACLE.timestampToBlockRoot(block.timestamp), validators.length); pod.verifyStaleBalance({ - beaconTimestamp: proofs.beaconTimestamp, - stateRootProof: proofs.stateRootProof, - proof: proofs.validatorProof + beaconTimestamp: proofs.beaconTimestamp, stateRootProof: proofs.stateRootProof, proof: proofs.validatorProof }); check_StartCheckpoint_State(staker); } diff --git a/src/test/unit/KeyRegistrarUnit.t.sol b/src/test/unit/KeyRegistrarUnit.t.sol index ab6cb6bdb7..fd5a167e2a 100644 --- a/src/test/unit/KeyRegistrarUnit.t.sol +++ b/src/test/unit/KeyRegistrarUnit.t.sol @@ -14,12 +14,7 @@ import "src/test/utils/EigenLayerMultichainUnitTestSetup.sol"; import "src/contracts/libraries/OperatorSetLib.sol"; import "src/contracts/interfaces/ISignatureUtilsMixin.sol"; -contract KeyRegistrarUnitTests is - EigenLayerMultichainUnitTestSetup, - IKeyRegistrarErrors, - IKeyRegistrarEvents, - ISignatureUtilsMixinErrors -{ +contract KeyRegistrarUnitTests is EigenLayerMultichainUnitTestSetup, IKeyRegistrarErrors, IKeyRegistrarEvents, ISignatureUtilsMixinErrors { using BN254 for BN254.G1Point; // Test accounts diff --git a/src/test/unit/OperatorTableUpdaterUnit.t.sol b/src/test/unit/OperatorTableUpdaterUnit.t.sol index bfd94964a1..413cd90829 100644 --- a/src/test/unit/OperatorTableUpdaterUnit.t.sol +++ b/src/test/unit/OperatorTableUpdaterUnit.t.sol @@ -35,10 +35,7 @@ contract OperatorTableUpdaterUnitTests is // Setup a mock Bn254OperatorSetInfo for the initial table update on initialization initialOperatorSetInfo = BN254OperatorSetInfo({ - operatorInfoTreeRoot: bytes32(0), - numOperators: 1, - aggregatePubkey: BN254.G1Point({X: 1, Y: 2}), - totalWeights: new uint[](1) + operatorInfoTreeRoot: bytes32(0), numOperators: 1, aggregatePubkey: BN254.G1Point({X: 1, Y: 2}), totalWeights: new uint[](1) }); operatorTableUpdater = diff --git a/src/test/unit/ReleaseManagerUnit.t.sol b/src/test/unit/ReleaseManagerUnit.t.sol index 6d2bc6ab96..1f6850769b 100644 --- a/src/test/unit/ReleaseManagerUnit.t.sol +++ b/src/test/unit/ReleaseManagerUnit.t.sol @@ -73,8 +73,7 @@ contract ReleaseManagerUnitTests is EigenLayerUnitTestSetup, IReleaseManagerErro Artifact[] memory artifacts = new Artifact[](numArtifacts); for (uint i = 0; i < numArtifacts; i++) { artifacts[i] = Artifact({ - digest: keccak256(abi.encodePacked("artifact", i)), - registry: string(abi.encodePacked("https://example.com/artifact", i)) + digest: keccak256(abi.encodePacked("artifact", i)), registry: string(abi.encodePacked("https://example.com/artifact", i)) }); } return _createRelease(artifacts, upgradeByTime); diff --git a/src/test/unit/RewardsCoordinatorUnit.t.sol b/src/test/unit/RewardsCoordinatorUnit.t.sol index 9f98ff320e..e8b89ab0ab 100644 --- a/src/test/unit/RewardsCoordinatorUnit.t.sol +++ b/src/test/unit/RewardsCoordinatorUnit.t.sol @@ -489,10 +489,7 @@ contract RewardsCoordinatorUnitTests_setOperatorAVSSplit is RewardsCoordinatorUn } // Testing that the split has been initialized for the first time. - function testFuzz_setOperatorAVSSplitFirstTime(address operator, address avs, uint16 split) - public - filterFuzzedAddressInputs(operator) - { + function testFuzz_setOperatorAVSSplitFirstTime(address operator, address avs, uint16 split) public filterFuzzedAddressInputs(operator) { cheats.assume(operator != address(0)); split = uint16(bound(split, 0, ONE_HUNDRED_IN_BIPS)); uint32 activatedAt = uint32(block.timestamp) + activationDelay; @@ -1533,9 +1530,7 @@ contract RewardsCoordinatorUnitTests_createRewardsForAllSubmission is RewardsCoo * - rewards submission hash being set in storage * - token balances before and after of createRewardsForAllSubmission submitter and rewardsCoordinator */ - function testFuzz_createRewardsForAllSubmission_MultipleSubmissions(FuzzAVSRewardsSubmission memory param, uint numSubmissions) - public - { + function testFuzz_createRewardsForAllSubmission_MultipleSubmissions(FuzzAVSRewardsSubmission memory param, uint numSubmissions) public { numSubmissions = bound(numSubmissions, 2, 10); cheats.prank(rewardsCoordinator.owner()); @@ -1762,9 +1757,7 @@ contract RewardsCoordinatorUnitTests_createRewardsForAllEarners is RewardsCoordi * - rewards submission hash being set in storage * - token balances before and after of createRewardsForAllSubmission submitter and rewardsCoordinator */ - function testFuzz_createRewardsForAllSubmission_MultipleSubmissions(FuzzAVSRewardsSubmission memory param, uint numSubmissions) - public - { + function testFuzz_createRewardsForAllSubmission_MultipleSubmissions(FuzzAVSRewardsSubmission memory param, uint numSubmissions) public { numSubmissions = bound(numSubmissions, 2, 10); cheats.prank(rewardsCoordinator.owner()); @@ -2054,10 +2047,7 @@ contract RewardsCoordinatorUnitTests_createOperatorDirectedAVSRewardsSubmission } // Revert when duplicate operators - function testFuzz_Revert_WhenDuplicateOperators(address avs, uint startTimestamp, uint duration) - public - filterFuzzedAddressInputs(avs) - { + function testFuzz_Revert_WhenDuplicateOperators(address avs, uint startTimestamp, uint duration) public filterFuzzedAddressInputs(avs) { cheats.assume(avs != address(0)); cheats.prank(rewardsCoordinator.owner()); @@ -2933,10 +2923,7 @@ contract RewardsCoordinatorUnitTests_createOperatorDirectedOperatorSetRewardsSub } // Revert when duplicate operators - function testFuzz_Revert_WhenDuplicateOperators(address avs, uint startTimestamp, uint duration) - public - filterFuzzedAddressInputs(avs) - { + function testFuzz_Revert_WhenDuplicateOperators(address avs, uint startTimestamp, uint duration) public filterFuzzedAddressInputs(avs) { cheats.assume(avs != address(0)); operatorSet = OperatorSet(avs, 1); @@ -4188,9 +4175,8 @@ contract RewardsCoordinatorUnitTests_processClaim is RewardsCoordinatorUnitTests assertTrue(rewardsCoordinator.checkClaim(claim), "RewardsCoordinator.checkClaim: claim not valid"); // Set cumulativeClaimed to be max uint256, should revert when attempting to claim - stdstore.target(address(rewardsCoordinator)).sig("cumulativeClaimed(address,address)").with_key(claim.earnerLeaf.earner).with_key( - address(claim.tokenLeaves[0].token) - ).checked_write(type(uint).max); + stdstore.target(address(rewardsCoordinator)).sig("cumulativeClaimed(address,address)").with_key(claim.earnerLeaf.earner) + .with_key(address(claim.tokenLeaves[0].token)).checked_write(type(uint).max); cheats.startPrank(claimer); cheats.expectRevert(EarningsNotGreaterThanClaimed.selector); rewardsCoordinator.processClaim(claim, claimer); diff --git a/src/test/unit/StrategyFactoryUnit.t.sol b/src/test/unit/StrategyFactoryUnit.t.sol index 65f47e783d..c6a0470d10 100644 --- a/src/test/unit/StrategyFactoryUnit.t.sol +++ b/src/test/unit/StrategyFactoryUnit.t.sol @@ -92,7 +92,9 @@ contract StrategyFactoryUnitTests is EigenLayerUnitTestSetup { function test_initialize_revert_reinitialization() public { cheats.expectRevert("Initializable: contract is already initialized"); - strategyFactory.initialize({_initialOwner: initialOwner, _initialPausedStatus: initialPausedStatus, _strategyBeacon: strategyBeacon}); + strategyFactory.initialize({ + _initialOwner: initialOwner, _initialPausedStatus: initialPausedStatus, _strategyBeacon: strategyBeacon + }); } function test_deployNewStrategy() public { diff --git a/src/test/unit/StrategyManagerUnit.t.sol b/src/test/unit/StrategyManagerUnit.t.sol index d86ea93a85..f5ebce2274 100644 --- a/src/test/unit/StrategyManagerUnit.t.sol +++ b/src/test/unit/StrategyManagerUnit.t.sol @@ -50,7 +50,7 @@ contract StrategyManagerUnitTests is EigenLayerUnitTestSetup, IStrategyManagerEv new TransparentUpgradeableProxy( address(strategyManagerImplementation), address(eigenLayerProxyAdmin), - abi.encodeWithSelector(StrategyManager.initialize.selector, initialOwner, initialOwner, 0 /*initialPausedStatus*/ ) + abi.encodeWithSelector(StrategyManager.initialize.selector, initialOwner, initialOwner, 0 /*initialPausedStatus*/) ) ) ); diff --git a/src/test/unit/TaskMailboxUnit.t.sol b/src/test/unit/TaskMailboxUnit.t.sol index 8017a45e12..e683ba8dc3 100644 --- a/src/test/unit/TaskMailboxUnit.t.sol +++ b/src/test/unit/TaskMailboxUnit.t.sol @@ -84,9 +84,7 @@ contract TaskMailboxUnitTests is Test, ITaskMailboxTypes, ITaskMailboxErrors, IT function _createValidTaskParams() internal view returns (TaskParams memory) { return TaskParams({ - refundCollector: refundCollector, - executorOperatorSet: OperatorSet(avs, executorOperatorSetId), - payload: bytes("test payload") + refundCollector: refundCollector, executorOperatorSet: OperatorSet(avs, executorOperatorSetId), payload: bytes("test payload") }); } @@ -317,7 +315,9 @@ contract TaskMailboxUnitTests_setExecutorOperatorSetTaskConfig is TaskMailboxUni feeToken: IERC20(fuzzFeeToken), curveType: IKeyRegistrarTypes.CurveType.BN254, feeCollector: fuzzFeeCollector, - consensus: Consensus({consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, value: abi.encode(fuzzStakeProportionThreshold)}), + consensus: Consensus({ + consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, value: abi.encode(fuzzStakeProportionThreshold) + }), taskMetadata: fuzzTaskMetadata }); @@ -456,10 +456,11 @@ contract TaskMailboxUnitTests_setExecutorOperatorSetTaskConfig is TaskMailboxUni function test_ConsensusZeroThreshold() public { OperatorSet memory operatorSet = OperatorSet(avs, executorOperatorSetId); ExecutorOperatorSetTaskConfig memory config = _createValidExecutorOperatorSetTaskConfig(); - config.consensus = Consensus({ - consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, - value: abi.encode(uint16(0)) // Zero threshold is valid - }); + config.consensus = + Consensus({ + consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, + value: abi.encode(uint16(0)) // Zero threshold is valid + }); vm.prank(avs); taskMailbox.setExecutorOperatorSetTaskConfig(operatorSet, config); @@ -473,10 +474,11 @@ contract TaskMailboxUnitTests_setExecutorOperatorSetTaskConfig is TaskMailboxUni function test_ConsensusMaxThreshold() public { OperatorSet memory operatorSet = OperatorSet(avs, executorOperatorSetId); ExecutorOperatorSetTaskConfig memory config = _createValidExecutorOperatorSetTaskConfig(); - config.consensus = Consensus({ - consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, - value: abi.encode(uint16(10_000)) // Maximum 100% - }); + config.consensus = + Consensus({ + consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, + value: abi.encode(uint16(10_000)) // Maximum 100% + }); vm.prank(avs); taskMailbox.setExecutorOperatorSetTaskConfig(operatorSet, config); @@ -508,10 +510,11 @@ contract TaskMailboxUnitTests_setExecutorOperatorSetTaskConfig is TaskMailboxUni function test_Revert_ConsensusTypeNone_InvalidWithNonEmptyValue() public { OperatorSet memory operatorSet = OperatorSet(avs, executorOperatorSetId); ExecutorOperatorSetTaskConfig memory config = _createValidExecutorOperatorSetTaskConfig(); - config.consensus = Consensus({ - consensusType: ConsensusType.NONE, - value: abi.encode(uint16(5000)) // Non-empty value for NONE type - }); + config.consensus = + Consensus({ + consensusType: ConsensusType.NONE, + value: abi.encode(uint16(5000)) // Non-empty value for NONE type + }); // Should revert with non-empty value for ConsensusType.NONE vm.prank(avs); @@ -666,9 +669,7 @@ contract TaskMailboxUnitTests_createTask is TaskMailboxUnitTests { mockTaskHook.setDefaultFee(fuzzAvsFee); TaskParams memory taskParams = TaskParams({ - refundCollector: fuzzRefundCollector, - executorOperatorSet: OperatorSet(avs, executorOperatorSetId), - payload: fuzzPayload + refundCollector: fuzzRefundCollector, executorOperatorSet: OperatorSet(avs, executorOperatorSetId), payload: fuzzPayload }); // First task will have count 0 @@ -1494,10 +1495,11 @@ contract TaskMailboxUnitTests_submitResult is TaskMailboxUnitTests { // Setup executor operator set with zero stake threshold OperatorSet memory operatorSet = OperatorSet(avs, executorOperatorSetId); ExecutorOperatorSetTaskConfig memory config = _createValidExecutorOperatorSetTaskConfig(); - config.consensus = Consensus({ - consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, - value: abi.encode(uint16(0)) // Zero threshold - }); + config.consensus = + Consensus({ + consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, + value: abi.encode(uint16(0)) // Zero threshold + }); vm.prank(avs); taskMailbox.setExecutorOperatorSetTaskConfig(operatorSet, config); @@ -1531,10 +1533,11 @@ contract TaskMailboxUnitTests_submitResult is TaskMailboxUnitTests { // Setup executor operator set with max stake threshold OperatorSet memory operatorSet = OperatorSet(avs, executorOperatorSetId); ExecutorOperatorSetTaskConfig memory config = _createValidExecutorOperatorSetTaskConfig(); - config.consensus = Consensus({ - consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, - value: abi.encode(uint16(10_000)) // 100% threshold - }); + config.consensus = + Consensus({ + consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, + value: abi.encode(uint16(10_000)) // 100% threshold + }); vm.prank(avs); taskMailbox.setExecutorOperatorSetTaskConfig(operatorSet, config); @@ -1753,10 +1756,11 @@ contract TaskMailboxUnitTests_submitResult is TaskMailboxUnitTests { // Setup executor operator set with zero stake threshold OperatorSet memory operatorSet = OperatorSet(avs, executorOperatorSetId); ExecutorOperatorSetTaskConfig memory config = _createValidExecutorOperatorSetTaskConfig(); - config.consensus = Consensus({ - consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, - value: abi.encode(uint16(0)) // Zero threshold - }); + config.consensus = + Consensus({ + consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, + value: abi.encode(uint16(0)) // Zero threshold + }); vm.prank(avs); taskMailbox.setExecutorOperatorSetTaskConfig(operatorSet, config); @@ -1794,10 +1798,11 @@ contract TaskMailboxUnitTests_submitResult is TaskMailboxUnitTests { OperatorSet memory operatorSet = OperatorSet(avs, executorOperatorSetId); ExecutorOperatorSetTaskConfig memory config = _createValidExecutorOperatorSetTaskConfig(); config.curveType = IKeyRegistrarTypes.CurveType.ECDSA; - config.consensus = Consensus({ - consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, - value: abi.encode(uint16(0)) // Zero threshold - }); + config.consensus = + Consensus({ + consensusType: ConsensusType.STAKE_PROPORTION_THRESHOLD, + value: abi.encode(uint16(0)) // Zero threshold + }); vm.prank(avs); taskMailbox.setExecutorOperatorSetTaskConfig(operatorSet, config); @@ -2676,9 +2681,7 @@ contract TaskMailboxUnitTests_submitResult is TaskMailboxUnitTests { bytes memory result = bytes("test result"); IECDSACertificateVerifierTypes.ECDSACertificate memory cert = IECDSACertificateVerifierTypes.ECDSACertificate({ - referenceTimestamp: _getTaskReferenceTimestamp(newTaskHash), - messageHash: keccak256("wrong result"), - sig: bytes("signature") + referenceTimestamp: _getTaskReferenceTimestamp(newTaskHash), messageHash: keccak256("wrong result"), sig: bytes("signature") }); vm.prank(aggregator); diff --git a/src/test/utils/BytesLib.sol b/src/test/utils/BytesLib.sol index 2f5f93680c..1bfa7c3fc1 100644 --- a/src/test/utils/BytesLib.sol +++ b/src/test/utils/BytesLib.sol @@ -384,7 +384,7 @@ library BytesLib { let end := add(mc, length) for { let cc := add(_postBytes, 0x20) } // while(uint256(mc < end) + cb == 2) // the next line is the loop condition: - eq(add(lt(mc, end), cb), 2) { + eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { diff --git a/src/test/utils/EigenPodUser.t.sol b/src/test/utils/EigenPodUser.t.sol index 42c8993be4..9f77d1091f 100644 --- a/src/test/utils/EigenPodUser.t.sol +++ b/src/test/utils/EigenPodUser.t.sol @@ -40,14 +40,12 @@ contract EigenPodUser is Logger, TypeImporter { beaconChain = deployer.beaconChain(); eigenPodBeacon = deployer.eigenPodBeacon(); pod = EigenPod( - payable( - Create2.deploy( + payable(Create2.deploy( 0, bytes32(uint(uint160(address(this)))), // set the beacon address to the eigenPodBeacon abi.encodePacked(beaconProxyBytecode, abi.encode(eigenPodBeacon, "")) - ) - ) + )) ); pod.initialize(address(this)); diff --git a/src/test/utils/Random.sol b/src/test/utils/Random.sol index 27131b3a54..f52f3177b1 100644 --- a/src/test/utils/Random.sol +++ b/src/test/utils/Random.sol @@ -13,7 +13,6 @@ library Random { /// ----------------------------------------------------------------------- /// Constants /// ----------------------------------------------------------------------- - /// @dev Equivalent to: `uint256(keccak256("RANDOMNESS.SEED"))`. uint constant SEED = 0x93bfe7cafd9427243dc4fe8c6e706851eb6696ba8e48960dd74ecc96544938ce; From 4875e9294625ac4fec06e1fb20aab2643b0ac909 Mon Sep 17 00:00:00 2001 From: "clandestine.eth" <96172957+0xClandestine@users.noreply.github.com> Date: Wed, 8 Oct 2025 16:39:21 -0400 Subject: [PATCH 2/3] bump foundry-toolchain -> 1.5.0 --- .github/workflows/certora-prover.yml | 4 ++-- .github/workflows/foundry-post-merge.yml | 2 +- .github/workflows/foundry.yml | 8 ++++---- .github/workflows/validate-deployment-scripts.yml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/certora-prover.yml b/.github/workflows/certora-prover.yml index 696a94b1cd..460766e56e 100644 --- a/.github/workflows/certora-prover.yml +++ b/.github/workflows/certora-prover.yml @@ -51,7 +51,7 @@ jobs: # Install the Foundry toolchain - name: Install Foundry - uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de + uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: version: stable @@ -111,7 +111,7 @@ jobs: # Install the Foundry toolchain. - name: Install Foundry - uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de + uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: version: stable diff --git a/.github/workflows/foundry-post-merge.yml b/.github/workflows/foundry-post-merge.yml index 0fd29ae096..5b0cecc69b 100644 --- a/.github/workflows/foundry-post-merge.yml +++ b/.github/workflows/foundry-post-merge.yml @@ -58,7 +58,7 @@ jobs: # Install the Foundry toolchain. - name: "Install Foundry" - uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de + uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: version: stable diff --git a/.github/workflows/foundry.yml b/.github/workflows/foundry.yml index 657c89364a..25c7a3c9ca 100644 --- a/.github/workflows/foundry.yml +++ b/.github/workflows/foundry.yml @@ -56,7 +56,7 @@ jobs: # Install the Foundry toolchain. - name: Install Foundry - uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de + uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: version: stable @@ -121,7 +121,7 @@ jobs: # Install the Foundry toolchain. - name: "Install Foundry" - uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de + uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: version: stable @@ -168,7 +168,7 @@ jobs: # Install the Foundry toolchain. - name: "Install Foundry" - uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de + uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: version: stable @@ -254,7 +254,7 @@ jobs: # Install the Foundry toolchain. - name: "Install Foundry" - uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de + uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: version: stable diff --git a/.github/workflows/validate-deployment-scripts.yml b/.github/workflows/validate-deployment-scripts.yml index 625c6ee2ae..6cf91e6c54 100644 --- a/.github/workflows/validate-deployment-scripts.yml +++ b/.github/workflows/validate-deployment-scripts.yml @@ -46,7 +46,7 @@ jobs: # Install the Foundry toolchain. - name: Install Foundry - uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de + uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: version: stable From d14074f158a3862108c960919787099aa5f872d6 Mon Sep 17 00:00:00 2001 From: "clandestine.eth" <96172957+0xClandestine@users.noreply.github.com> Date: Wed, 8 Oct 2025 16:45:00 -0400 Subject: [PATCH 3/3] bump ci foundry version -> 1.4.0 --- .github/workflows/certora-prover.yml | 4 ++-- .github/workflows/certora.yml | 2 +- .github/workflows/foundry-post-merge.yml | 2 +- .github/workflows/foundry.yml | 8 ++++---- .github/workflows/validate-deployment-scripts.yml | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/certora-prover.yml b/.github/workflows/certora-prover.yml index 460766e56e..bcce0a2342 100644 --- a/.github/workflows/certora-prover.yml +++ b/.github/workflows/certora-prover.yml @@ -53,7 +53,7 @@ jobs: - name: Install Foundry uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: - version: stable + version: v1.4.0 # Install dependencies using Forge - name: Install forge dependencies @@ -113,7 +113,7 @@ jobs: - name: Install Foundry uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: - version: stable + version: v1.4.0 # Install dependencies using Forge - name: Install forge dependencies diff --git a/.github/workflows/certora.yml b/.github/workflows/certora.yml index f784e824d1..73aa13511a 100644 --- a/.github/workflows/certora.yml +++ b/.github/workflows/certora.yml @@ -28,7 +28,7 @@ # - name: Install Foundry # uses: foundry-rs/foundry-toolchain@v1 # with: -# version: stable +# version: v1.4.0 # - name: Install forge dependencies # run: forge install diff --git a/.github/workflows/foundry-post-merge.yml b/.github/workflows/foundry-post-merge.yml index 5b0cecc69b..fd5c1a3500 100644 --- a/.github/workflows/foundry-post-merge.yml +++ b/.github/workflows/foundry-post-merge.yml @@ -60,7 +60,7 @@ jobs: - name: "Install Foundry" uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: - version: stable + version: v1.4.0 # Build the project and display contract sizes. - name: "Forge Build" diff --git a/.github/workflows/foundry.yml b/.github/workflows/foundry.yml index 25c7a3c9ca..861ad53b48 100644 --- a/.github/workflows/foundry.yml +++ b/.github/workflows/foundry.yml @@ -58,7 +58,7 @@ jobs: - name: Install Foundry uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: - version: stable + version: v1.4.0 # Run Forge's formatting checker to ensure consistent code style. - name: "Forge Fmt" @@ -123,7 +123,7 @@ jobs: - name: "Install Foundry" uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: - version: stable + version: v1.4.0 # Run storage diff check to detect storage layout incompatibilities. - name: "Mainnet Storage Diff" @@ -170,7 +170,7 @@ jobs: - name: "Install Foundry" uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: - version: stable + version: v1.4.0 # Install LCOV for coverage report generation. - name: Install LCOV (Prebuilt) @@ -256,7 +256,7 @@ jobs: - name: "Install Foundry" uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: - version: stable + version: v1.4.0 - name: Build contracts on PR branch run: | diff --git a/.github/workflows/validate-deployment-scripts.yml b/.github/workflows/validate-deployment-scripts.yml index 6cf91e6c54..dbf0283f4d 100644 --- a/.github/workflows/validate-deployment-scripts.yml +++ b/.github/workflows/validate-deployment-scripts.yml @@ -48,7 +48,7 @@ jobs: - name: Install Foundry uses: foundry-rs/foundry-toolchain@50d5a8956f2e319df19e6b57539d7e2acb9f8c1e with: - version: stable + version: v1.4.0 # Run Forge's formatting checker to ensure consistent code style. - name: "Forge Fmt"