From bb05b30c7e1adab14b7f1217a9e7fa40510a8a5c Mon Sep 17 00:00:00 2001 From: steven Date: Wed, 18 Dec 2024 14:44:41 -0500 Subject: [PATCH] test: update quorum --- .github/workflows/tests.yml | 4 ++-- test/unit/OperatorLib.t.sol | 32 +++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 660c8895..e4323e2d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,13 +33,13 @@ jobs: - name: Run Forge build run: | forge --version - forge build --sizes + forge build --sizes --skip script --skip test --via-ir id: build - name: Run tests shell: bash run: | - forge test --no-match-contract FFI + forge test --no-match-contract FFI --via-ir env: RPC_MAINNET: ${{ secrets.RPC_MAINNET }} diff --git a/test/unit/OperatorLib.t.sol b/test/unit/OperatorLib.t.sol index 38c3e0d8..ecac3c64 100644 --- a/test/unit/OperatorLib.t.sol +++ b/test/unit/OperatorLib.t.sol @@ -180,6 +180,36 @@ contract OperatorLibTest is Test { ); vm.stopPrank(); } + + // Fast forward 10 blocks + vm.roll(block.number + 10); + + // Get all registered operators and sort them + address[][] memory registeredOperators = new address[][](1); + registeredOperators[0] = new address[](5); + for (uint256 i = 0; i < 5; i++) { + registeredOperators[0][i] = operators[i].key.addr; + } + + // Sort operator addresses in ascending order + for (uint256 i = 0; i < registeredOperators[0].length - 1; i++) { + for (uint256 j = 0; j < registeredOperators[0].length - i - 1; j++) { + if (registeredOperators[0][j] > registeredOperators[0][j + 1]) { + address temp = registeredOperators[0][j]; + registeredOperators[0][j] = registeredOperators[0][j + 1]; + registeredOperators[0][j + 1] = temp; + } + } + } + + // Update operators for quorum 1 + bytes memory quorumNumbers = new bytes(1); + quorumNumbers[0] = bytes1(uint8(1)); // Quorum 1 + + vm.prank(middlewareConfig.admin); + RegistryCoordinator(middlewareDeployment.registryCoordinator).updateOperatorsForQuorum( + registeredOperators, + quorumNumbers + ); } } -