From 34a934a49128ebe296f80a655987be86bee490c9 Mon Sep 17 00:00:00 2001 From: steven Date: Thu, 17 Oct 2024 11:30:46 -0400 Subject: [PATCH 1/2] feat(ci): format check --- .github/workflows/contracts-tests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/contracts-tests.yml b/.github/workflows/contracts-tests.yml index 1bbf76dc..717d2924 100644 --- a/.github/workflows/contracts-tests.yml +++ b/.github/workflows/contracts-tests.yml @@ -25,3 +25,8 @@ jobs: - name: Run tests run: forge test -vvv working-directory: ./contracts + + + - name: Enforce Formatting + run: forge fmt --check + working-directory: ./contracts From e47b1ad2b51de167ea19f59abc7fe9fe19dc82c5 Mon Sep 17 00:00:00 2001 From: steven Date: Thu, 17 Oct 2024 11:31:02 -0400 Subject: [PATCH 2/2] chore(style): forge fmt --- contracts/foundry.toml | 13 +- .../script/IncredibleSquaringDeployer.s.sol | 125 +++++++++++++----- contracts/script/utils/Utils.sol | 29 ++-- contracts/src/ERC20Mock.sol | 20 ++- .../src/IIncredibleSquaringTaskManager.sol | 7 +- .../src/IncredibleSquaringServiceManager.sol | 8 +- .../src/IncredibleSquaringTaskManager.sol | 73 ++++++---- .../test/CredibleSquaringTaskManager.t.sol | 9 +- 8 files changed, 203 insertions(+), 81 deletions(-) diff --git a/contracts/foundry.toml b/contracts/foundry.toml index 28f209a3..eec24e51 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -2,7 +2,7 @@ src = "src" out = "out" libs = ["lib"] -fs_permissions = [{ access = "read-write", path = "./"}] +fs_permissions = [{ access = "read-write", path = "./" }] remappings = [ "@eigenlayer/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/", @@ -12,7 +12,7 @@ remappings = [ "@openzeppelin/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/lib/openzeppelin-contracts/", "@openzeppelin-upgrades/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable/", "forge-std/=lib/forge-std/src/", - "ds-test/=lib/forge-std/lib/ds-test/src/" + "ds-test/=lib/forge-std/lib/ds-test/src/", ] gas_reports = ["*"] @@ -28,4 +28,13 @@ via_ir = false # Override the Solidity version (this overrides `auto_detect_solc`) solc_version = '0.8.12' +[fmt] +bracket_spacing = false +int_types = "long" +line_length = 100 +multiline_func_header = "params_first" +number_underscore = "thousands" +quote_style = "double" +tab_width = 4 + # See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/contracts/script/IncredibleSquaringDeployer.s.sol b/contracts/script/IncredibleSquaringDeployer.s.sol index fc5e9cd2..01eec860 100644 --- a/contracts/script/IncredibleSquaringDeployer.s.sol +++ b/contracts/script/IncredibleSquaringDeployer.s.sol @@ -12,13 +12,20 @@ import {StrategyBaseTVLLimits} from "@eigenlayer/contracts/strategies/StrategyBa import "@eigenlayer/test/mocks/EmptyContract.sol"; import "@eigenlayer-middleware/src/RegistryCoordinator.sol" as regcoord; -import {IBLSApkRegistry, IIndexRegistry, IStakeRegistry} from "@eigenlayer-middleware/src/RegistryCoordinator.sol"; +import { + IBLSApkRegistry, + IIndexRegistry, + IStakeRegistry +} from "@eigenlayer-middleware/src/RegistryCoordinator.sol"; import {BLSApkRegistry} from "@eigenlayer-middleware/src/BLSApkRegistry.sol"; import {IndexRegistry} from "@eigenlayer-middleware/src/IndexRegistry.sol"; import {StakeRegistry} from "@eigenlayer-middleware/src/StakeRegistry.sol"; import "@eigenlayer-middleware/src/OperatorStateRetriever.sol"; import {IRewardsCoordinator} from "@eigenlayer/contracts/interfaces/IRewardsCoordinator.sol"; -import {IncredibleSquaringServiceManager, IServiceManager} from "../src/IncredibleSquaringServiceManager.sol"; +import { + IncredibleSquaringServiceManager, + IServiceManager +} from "../src/IncredibleSquaringServiceManager.sol"; import {IncredibleSquaringTaskManager} from "../src/IncredibleSquaringTaskManager.sol"; import {IIncredibleSquaringTaskManager} from "../src/IIncredibleSquaringTaskManager.sol"; import "../src/ERC20Mock.sol"; @@ -73,21 +80,29 @@ contract IncredibleSquaringDeployer is Script, Utils { function run() external { // Eigenlayer contracts string memory eigenlayerDeployedContracts = readOutput("eigenlayer_deployment_output"); - IStrategyManager strategyManager = - IStrategyManager(stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.strategyManager")); - IDelegationManager delegationManager = - IDelegationManager(stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.delegation")); - IAVSDirectory avsDirectory = - IAVSDirectory(stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.avsDirectory")); - ProxyAdmin eigenLayerProxyAdmin = - ProxyAdmin(stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.eigenLayerProxyAdmin")); - PauserRegistry eigenLayerPauserReg = - PauserRegistry(stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.eigenLayerPauserReg")); + IStrategyManager strategyManager = IStrategyManager( + stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.strategyManager") + ); + IDelegationManager delegationManager = IDelegationManager( + stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.delegation") + ); + IAVSDirectory avsDirectory = IAVSDirectory( + stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.avsDirectory") + ); + ProxyAdmin eigenLayerProxyAdmin = ProxyAdmin( + stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.eigenLayerProxyAdmin") + ); + PauserRegistry eigenLayerPauserReg = PauserRegistry( + stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.eigenLayerPauserReg") + ); StrategyBaseTVLLimits baseStrategyImplementation = StrategyBaseTVLLimits( - stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.baseStrategyImplementation") + stdJson.readAddress( + eigenlayerDeployedContracts, ".addresses.baseStrategyImplementation" + ) + ); + IRewardsCoordinator rewardsCoordinator = IRewardsCoordinator( + stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.rewardsCoordinator") ); - IRewardsCoordinator rewardsCoordinator = - IRewardsCoordinator(stdJson.readAddress(eigenlayerDeployedContracts, ".addresses.rewardsCoordinator")); address credibleSquaringCommunityMultisig = msg.sender; address credibleSquaringPauser = msg.sender; @@ -159,7 +174,8 @@ contract IncredibleSquaringDeployer is Script, Utils { address[] memory pausers = new address[](2); pausers[0] = credibleSquaringPauser; pausers[1] = incredibleSquaringCommunityMultisig; - incredibleSquaringPauserReg = new PauserRegistry(pausers, incredibleSquaringCommunityMultisig); + incredibleSquaringPauserReg = + new PauserRegistry(pausers, incredibleSquaringCommunityMultisig); } EmptyContract emptyContract = new EmptyContract(); @@ -171,22 +187,46 @@ contract IncredibleSquaringDeployer is Script, Utils { * not yet deployed, we give these proxies an empty contract as the initial implementation, to act as if they have no code. */ incredibleSquaringServiceManager = IncredibleSquaringServiceManager( - address(new TransparentUpgradeableProxy(address(emptyContract), address(incredibleSquaringProxyAdmin), "")) + address( + new TransparentUpgradeableProxy( + address(emptyContract), address(incredibleSquaringProxyAdmin), "" + ) + ) ); incredibleSquaringTaskManager = IncredibleSquaringTaskManager( - address(new TransparentUpgradeableProxy(address(emptyContract), address(incredibleSquaringProxyAdmin), "")) + address( + new TransparentUpgradeableProxy( + address(emptyContract), address(incredibleSquaringProxyAdmin), "" + ) + ) ); registryCoordinator = regcoord.RegistryCoordinator( - address(new TransparentUpgradeableProxy(address(emptyContract), address(incredibleSquaringProxyAdmin), "")) + address( + new TransparentUpgradeableProxy( + address(emptyContract), address(incredibleSquaringProxyAdmin), "" + ) + ) ); blsApkRegistry = IBLSApkRegistry( - address(new TransparentUpgradeableProxy(address(emptyContract), address(incredibleSquaringProxyAdmin), "")) + address( + new TransparentUpgradeableProxy( + address(emptyContract), address(incredibleSquaringProxyAdmin), "" + ) + ) ); indexRegistry = IIndexRegistry( - address(new TransparentUpgradeableProxy(address(emptyContract), address(incredibleSquaringProxyAdmin), "")) + address( + new TransparentUpgradeableProxy( + address(emptyContract), address(incredibleSquaringProxyAdmin), "" + ) + ) ); stakeRegistry = IStakeRegistry( - address(new TransparentUpgradeableProxy(address(emptyContract), address(incredibleSquaringProxyAdmin), "")) + address( + new TransparentUpgradeableProxy( + address(emptyContract), address(incredibleSquaringProxyAdmin), "" + ) + ) ); operatorStateRetriever = new OperatorStateRetriever(); @@ -196,19 +236,22 @@ contract IncredibleSquaringDeployer is Script, Utils { stakeRegistryImplementation = new StakeRegistry(registryCoordinator, delegationManager); incredibleSquaringProxyAdmin.upgrade( - TransparentUpgradeableProxy(payable(address(stakeRegistry))), address(stakeRegistryImplementation) + TransparentUpgradeableProxy(payable(address(stakeRegistry))), + address(stakeRegistryImplementation) ); blsApkRegistryImplementation = new BLSApkRegistry(registryCoordinator); incredibleSquaringProxyAdmin.upgrade( - TransparentUpgradeableProxy(payable(address(blsApkRegistry))), address(blsApkRegistryImplementation) + TransparentUpgradeableProxy(payable(address(blsApkRegistry))), + address(blsApkRegistryImplementation) ); indexRegistryImplementation = new IndexRegistry(registryCoordinator); incredibleSquaringProxyAdmin.upgrade( - TransparentUpgradeableProxy(payable(address(indexRegistry))), address(indexRegistryImplementation) + TransparentUpgradeableProxy(payable(address(indexRegistry))), + address(indexRegistryImplementation) ); } @@ -228,8 +271,8 @@ contract IncredibleSquaringDeployer is Script, Utils { for (uint256 i = 0; i < numQuorums; i++) { // hard code these for now quorumsOperatorSetParams[i] = regcoord.IRegistryCoordinator.OperatorSetParam({ - maxOperatorCount: 10000, - kickBIPsOfOperatorStake: 15000, + maxOperatorCount: 10_000, + kickBIPsOfOperatorStake: 15_000, kickBIPsOfTotalStake: 100 }); } @@ -269,7 +312,11 @@ contract IncredibleSquaringDeployer is Script, Utils { } incredibleSquaringServiceManagerImplementation = new IncredibleSquaringServiceManager( - avsDirectory, rewardsCoordinator, registryCoordinator, stakeRegistry, incredibleSquaringTaskManager + avsDirectory, + rewardsCoordinator, + registryCoordinator, + stakeRegistry, + incredibleSquaringTaskManager ); // Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them. incredibleSquaringProxyAdmin.upgrade( @@ -300,14 +347,20 @@ contract IncredibleSquaringDeployer is Script, Utils { vm.serializeAddress(deployed_addresses, "erc20Mock", address(erc20Mock)); vm.serializeAddress(deployed_addresses, "erc20MockStrategy", address(erc20MockStrategy)); vm.serializeAddress( - deployed_addresses, "credibleSquaringServiceManager", address(incredibleSquaringServiceManager) + deployed_addresses, + "credibleSquaringServiceManager", + address(incredibleSquaringServiceManager) ); vm.serializeAddress( deployed_addresses, "credibleSquaringServiceManagerImplementation", address(incredibleSquaringServiceManagerImplementation) ); - vm.serializeAddress(deployed_addresses, "credibleSquaringTaskManager", address(incredibleSquaringTaskManager)); + vm.serializeAddress( + deployed_addresses, + "credibleSquaringTaskManager", + address(incredibleSquaringTaskManager) + ); vm.serializeAddress( deployed_addresses, "credibleSquaringTaskManagerImplementation", @@ -315,13 +368,17 @@ contract IncredibleSquaringDeployer is Script, Utils { ); vm.serializeAddress(deployed_addresses, "registryCoordinator", address(registryCoordinator)); vm.serializeAddress( - deployed_addresses, "registryCoordinatorImplementation", address(registryCoordinatorImplementation) + deployed_addresses, + "registryCoordinatorImplementation", + address(registryCoordinatorImplementation) + ); + string memory deployed_addresses_output = vm.serializeAddress( + deployed_addresses, "operatorStateRetriever", address(operatorStateRetriever) ); - string memory deployed_addresses_output = - vm.serializeAddress(deployed_addresses, "operatorStateRetriever", address(operatorStateRetriever)); // serialize all the data - string memory finalJson = vm.serializeString(parent_object, deployed_addresses, deployed_addresses_output); + string memory finalJson = + vm.serializeString(parent_object, deployed_addresses, deployed_addresses_output); writeOutput(finalJson, "credible_squaring_avs_deployment_output"); } diff --git a/contracts/script/utils/Utils.sol b/contracts/script/utils/Utils.sol index 6b8f041e..408580e9 100644 --- a/contracts/script/utils/Utils.sol +++ b/contracts/script/utils/Utils.sol @@ -10,14 +10,21 @@ import "forge-std/StdJson.sol"; contract Utils is Script { // Note that this fct will only work for the ERC20Mock that has a public mint function - function _mintTokens(address strategyAddress, address[] memory tos, uint256[] memory amounts) internal { + function _mintTokens( + address strategyAddress, + address[] memory tos, + uint256[] memory amounts + ) internal { for (uint256 i = 0; i < tos.length; i++) { - ERC20Mock underlyingToken = ERC20Mock(address(StrategyBase(strategyAddress).underlyingToken())); + ERC20Mock underlyingToken = + ERC20Mock(address(StrategyBase(strategyAddress).underlyingToken())); underlyingToken.mint(tos[i], amounts[i]); } } - function convertBoolToString(bool input) public pure returns (string memory) { + function convertBoolToString( + bool input + ) public pure returns (string memory) { if (input) { return "true"; } else { @@ -25,11 +32,9 @@ contract Utils is Script { } } - function convertOperatorStatusToString(IRegistryCoordinator.OperatorStatus operatorStatus) - public - pure - returns (string memory) - { + function convertOperatorStatusToString( + IRegistryCoordinator.OperatorStatus operatorStatus + ) public pure returns (string memory) { if (operatorStatus == IRegistryCoordinator.OperatorStatus.NEVER_REGISTERED) { return "NEVER_REGISTERED"; } else if (operatorStatus == IRegistryCoordinator.OperatorStatus.REGISTERED) { @@ -42,14 +47,18 @@ contract Utils is Script { } // Forge scripts best practice: https://book.getfoundry.sh/tutorials/best-practices#scripts - function readInput(string memory inputFileName) internal view returns (string memory) { + function readInput( + string memory inputFileName + ) internal view returns (string memory) { string memory inputDir = string.concat(vm.projectRoot(), "/script/input/"); string memory chainDir = string.concat(vm.toString(block.chainid), "/"); string memory file = string.concat(inputFileName, ".json"); return vm.readFile(string.concat(inputDir, chainDir, file)); } - function readOutput(string memory outputFileName) internal view returns (string memory) { + function readOutput( + string memory outputFileName + ) internal view returns (string memory) { string memory inputDir = string.concat(vm.projectRoot(), "/script/output/"); string memory chainDir = string.concat(vm.toString(block.chainid), "/"); string memory file = string.concat(outputFileName, ".json"); diff --git a/contracts/src/ERC20Mock.sol b/contracts/src/ERC20Mock.sol index 7115c2ae..9e885f2e 100644 --- a/contracts/src/ERC20Mock.sol +++ b/contracts/src/ERC20Mock.sol @@ -51,7 +51,9 @@ contract ERC20Mock is Context, IERC20 { /** * @dev See {IERC20-balanceOf}. */ - function balanceOf(address account) public view virtual override returns (uint256) { + function balanceOf( + address account + ) public view virtual override returns (uint256) { return _balances[account]; } @@ -76,7 +78,10 @@ contract ERC20Mock is Context, IERC20 { /** * @dev See {IERC20-allowance}. */ - function allowance(address owner, address spender) public view virtual override returns (uint256) { + function allowance( + address owner, + address spender + ) public view virtual override returns (uint256) { return _allowances[owner][spender]; } @@ -90,7 +95,10 @@ contract ERC20Mock is Context, IERC20 { * * - `spender` cannot be the zero address. */ - function approve(address, /*spender*/ uint256 /*amount*/ ) public virtual override returns (bool) { + function approve( + address, /*spender*/ + uint256 /*amount*/ + ) public virtual override returns (bool) { return true; } @@ -110,7 +118,11 @@ contract ERC20Mock is Context, IERC20 { * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ - function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { + function transferFrom( + address from, + address to, + uint256 amount + ) public virtual override returns (bool) { _transfer(from, to, amount); return true; } diff --git a/contracts/src/IIncredibleSquaringTaskManager.sol b/contracts/src/IIncredibleSquaringTaskManager.sol index 232dd4f4..978ebec1 100644 --- a/contracts/src/IIncredibleSquaringTaskManager.sol +++ b/contracts/src/IIncredibleSquaringTaskManager.sol @@ -52,8 +52,11 @@ interface IIncredibleSquaringTaskManager { // FUNCTIONS // NOTE: this function creates new task. - function createNewTask(uint256 numberToBeSquared, uint32 quorumThresholdPercentage, bytes calldata quorumNumbers) - external; + function createNewTask( + uint256 numberToBeSquared, + uint32 quorumThresholdPercentage, + bytes calldata quorumNumbers + ) external; /// @notice Returns the current 'taskNumber' for the middleware function taskNumber() external view returns (uint32); diff --git a/contracts/src/IncredibleSquaringServiceManager.sol b/contracts/src/IncredibleSquaringServiceManager.sol index 00b261b5..aa6b4432 100644 --- a/contracts/src/IncredibleSquaringServiceManager.sol +++ b/contracts/src/IncredibleSquaringServiceManager.sol @@ -29,14 +29,18 @@ contract IncredibleSquaringServiceManager is ServiceManagerBase { IRegistryCoordinator _registryCoordinator, IStakeRegistry _stakeRegistry, IIncredibleSquaringTaskManager _incredibleSquaringTaskManager - ) ServiceManagerBase(_avsDirectory, _rewardsCoordinator, _registryCoordinator, _stakeRegistry) { + ) + ServiceManagerBase(_avsDirectory, _rewardsCoordinator, _registryCoordinator, _stakeRegistry) + { incredibleSquaringTaskManager = _incredibleSquaringTaskManager; } /// @notice Called in the event of challenge resolution, in order to forward a call to the Slasher, which 'freezes' the `operator`. /// @dev The Slasher contract is under active development and its interface expected to change. /// We recommend writing slashing logic without integrating with the Slasher at this point in time. - function freezeOperator(address operatorAddr) external onlyIncredibleSquaringTaskManager { + function freezeOperator( + address operatorAddr + ) external onlyIncredibleSquaringTaskManager { // slasher.freezeOperator(operatorAddr); } } diff --git a/contracts/src/IncredibleSquaringTaskManager.sol b/contracts/src/IncredibleSquaringTaskManager.sol index e07f5571..f8371d33 100644 --- a/contracts/src/IncredibleSquaringTaskManager.sol +++ b/contracts/src/IncredibleSquaringTaskManager.sol @@ -7,7 +7,10 @@ import "@eigenlayer/contracts/permissions/Pausable.sol"; import "@eigenlayer-middleware/src/interfaces/IServiceManager.sol"; import {BLSApkRegistry} from "@eigenlayer-middleware/src/BLSApkRegistry.sol"; import {RegistryCoordinator} from "@eigenlayer-middleware/src/RegistryCoordinator.sol"; -import {BLSSignatureChecker, IRegistryCoordinator} from "@eigenlayer-middleware/src/BLSSignatureChecker.sol"; +import { + BLSSignatureChecker, + IRegistryCoordinator +} from "@eigenlayer-middleware/src/BLSSignatureChecker.sol"; import {OperatorStateRetriever} from "@eigenlayer-middleware/src/OperatorStateRetriever.sol"; import "@eigenlayer-middleware/src/libraries/BN254.sol"; import "./IIncredibleSquaringTaskManager.sol"; @@ -58,36 +61,44 @@ contract IncredibleSquaringTaskManager is _; } - constructor(IRegistryCoordinator _registryCoordinator, uint32 _taskResponseWindowBlock) - BLSSignatureChecker(_registryCoordinator) - { + constructor( + IRegistryCoordinator _registryCoordinator, + uint32 _taskResponseWindowBlock + ) BLSSignatureChecker(_registryCoordinator) { TASK_RESPONSE_WINDOW_BLOCK = _taskResponseWindowBlock; } - function initialize(IPauserRegistry _pauserRegistry, address initialOwner, address _aggregator, address _generator) - public - initializer - { + function initialize( + IPauserRegistry _pauserRegistry, + address initialOwner, + address _aggregator, + address _generator + ) public initializer { _initializePauser(_pauserRegistry, UNPAUSE_ALL); _transferOwnership(initialOwner); _setAggregator(_aggregator); _setGenerator(_generator); } - function setGenerator(address newGenerator) external onlyOwner { + function setGenerator( + address newGenerator + ) external onlyOwner { _setGenerator(newGenerator); } - function setAggregator(address newAggregator) external onlyOwner { + function setAggregator( + address newAggregator + ) external onlyOwner { _setAggregator(newAggregator); } /* FUNCTIONS */ // NOTE: this function creates new task, assigns it a taskId - function createNewTask(uint256 numberToBeSquared, uint32 quorumThresholdPercentage, bytes calldata quorumNumbers) - external - onlyTaskGenerator - { + function createNewTask( + uint256 numberToBeSquared, + uint32 quorumThresholdPercentage, + bytes calldata quorumNumbers + ) external onlyTaskGenerator { // create a new task struct Task memory newTask; newTask.numberToBeSquared = numberToBeSquared; @@ -145,9 +156,11 @@ contract IncredibleSquaringTaskManager is ); } - TaskResponseMetadata memory taskResponseMetadata = TaskResponseMetadata(uint32(block.number), hashOfNonSigners); + TaskResponseMetadata memory taskResponseMetadata = + TaskResponseMetadata(uint32(block.number), hashOfNonSigners); // updating the storage with task responsea - allTaskResponses[taskResponse.referenceTaskIndex] = keccak256(abi.encode(taskResponse, taskResponseMetadata)); + allTaskResponses[taskResponse.referenceTaskIndex] = + keccak256(abi.encode(taskResponse, taskResponseMetadata)); // emitting event emit TaskResponded(taskResponse, taskResponseMetadata); @@ -169,9 +182,12 @@ contract IncredibleSquaringTaskManager is uint32 referenceTaskIndex = taskResponse.referenceTaskIndex; uint256 numberToBeSquared = task.numberToBeSquared; // some logical checks - require(allTaskResponses[referenceTaskIndex] != bytes32(0), "Task hasn't been responded to yet"); require( - allTaskResponses[referenceTaskIndex] == keccak256(abi.encode(taskResponse, taskResponseMetadata)), + allTaskResponses[referenceTaskIndex] != bytes32(0), "Task hasn't been responded to yet" + ); + require( + allTaskResponses[referenceTaskIndex] + == keccak256(abi.encode(taskResponse, taskResponseMetadata)), "Task response does not match the one recorded in the contract" ); require( @@ -180,7 +196,8 @@ contract IncredibleSquaringTaskManager is ); require( - uint32(block.number) <= taskResponseMetadata.taskResponsedBlock + TASK_CHALLENGE_WINDOW_BLOCK, + uint32(block.number) + <= taskResponseMetadata.taskResponsedBlock + TASK_CHALLENGE_WINDOW_BLOCK, "The challenge period for this task has already expired." ); @@ -195,7 +212,8 @@ contract IncredibleSquaringTaskManager is } // get the list of hash of pubkeys of operators who weren't part of the task response submitted by the aggregator - bytes32[] memory hashesOfPubkeysOfNonSigningOperators = new bytes32[](pubkeysOfNonSigningOperators.length); + bytes32[] memory hashesOfPubkeysOfNonSigningOperators = + new bytes32[](pubkeysOfNonSigningOperators.length); for (uint256 i = 0; i < pubkeysOfNonSigningOperators.length; i++) { hashesOfPubkeysOfNonSigningOperators[i] = pubkeysOfNonSigningOperators[i].hashG1Point(); } @@ -213,10 +231,11 @@ contract IncredibleSquaringTaskManager is ); // get the address of operators who didn't sign - address[] memory addresssOfNonSigningOperators = new address[](pubkeysOfNonSigningOperators.length); + address[] memory addresssOfNonSigningOperators = + new address[](pubkeysOfNonSigningOperators.length); for (uint256 i = 0; i < pubkeysOfNonSigningOperators.length; i++) { - addresssOfNonSigningOperators[i] = - BLSApkRegistry(address(blsApkRegistry)).pubkeyHashToOperator(hashesOfPubkeysOfNonSigningOperators[i]); + addresssOfNonSigningOperators[i] = BLSApkRegistry(address(blsApkRegistry)) + .pubkeyHashToOperator(hashesOfPubkeysOfNonSigningOperators[i]); } // @dev the below code is commented out for the upcoming M2 release @@ -287,13 +306,17 @@ contract IncredibleSquaringTaskManager is return TASK_RESPONSE_WINDOW_BLOCK; } - function _setGenerator(address newGenerator) internal { + function _setGenerator( + address newGenerator + ) internal { address oldGenerator = generator; generator = newGenerator; emit GeneratorUpdated(oldGenerator, newGenerator); } - function _setAggregator(address newAggregator) internal { + function _setAggregator( + address newAggregator + ) internal { address oldAggregator = aggregator; aggregator = newAggregator; emit AggregatorUpdated(oldAggregator, newAggregator); diff --git a/contracts/test/CredibleSquaringTaskManager.t.sol b/contracts/test/CredibleSquaringTaskManager.t.sol index 1c7be0e5..a1f37529 100644 --- a/contracts/test/CredibleSquaringTaskManager.t.sol +++ b/contracts/test/CredibleSquaringTaskManager.t.sol @@ -4,7 +4,8 @@ pragma solidity ^0.8.12; import "../src/IncredibleSquaringServiceManager.sol" as incsqsm; import {IncredibleSquaringTaskManager} from "../src/IncredibleSquaringTaskManager.sol"; import {BLSMockAVSDeployer} from "@eigenlayer-middleware/test/utils/BLSMockAVSDeployer.sol"; -import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; +import {TransparentUpgradeableProxy} from + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; contract IncredibleSquaringTaskManagerTest is BLSMockAVSDeployer { incsqsm.IncredibleSquaringServiceManager sm; @@ -30,7 +31,11 @@ contract IncredibleSquaringTaskManagerTest is BLSMockAVSDeployer { address(tmImplementation), address(proxyAdmin), abi.encodeWithSelector( - tm.initialize.selector, pauserRegistry, registryCoordinatorOwner, aggregator, generator + tm.initialize.selector, + pauserRegistry, + registryCoordinatorOwner, + aggregator, + generator ) ) )