From c5ae5fadd6789dd5365e9d343fa50695490dfd6e Mon Sep 17 00:00:00 2001 From: Andrei Smirnov Date: Thu, 9 Jan 2025 16:53:47 +0300 Subject: [PATCH] fix: broken tests --- .env.sample | 3 ++- .github/workflows/ci.yml | 2 +- README.md | 13 +------------ foundry.toml | 2 -- src/test/controllers/IMSC.t.sol | 19 +++++++++---------- src/test/controllers/IMSCFactory.t.sol | 9 ++++----- ...tory.t.sol => OELPCFactory.t.sol.obsolete} | 3 +-- ...bolEigenLayerPodController.t.sol.obsolete} | 3 +-- ....t.sol => OELPCIntegration.t.sol.obsolete} | 3 +-- 9 files changed, 20 insertions(+), 37 deletions(-) rename src/test/eigenlayer/{OELPCFactory.t.sol => OELPCFactory.t.sol.obsolete} (95%) rename src/test/eigenlayer/{ObolEigenLayerPodController.t.sol => ObolEigenLayerPodController.t.sol.obsolete} (98%) rename src/test/eigenlayer/integration/{OELPCIntegration.t.sol => OELPCIntegration.t.sol.obsolete} (98%) diff --git a/.env.sample b/.env.sample index 938fe90..5b3bcc4 100644 --- a/.env.sample +++ b/.env.sample @@ -1,2 +1,3 @@ -GOERLI_RPC_URL= +SEPOLIA_RPC_URL= +HOLESKY_RPC_URL= MAINNET_RPC_URL= diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5bacd74..2b05fac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,6 @@ jobs: - name: Run tests env: - GOERLI_RPC_URL: ${{ secrets.GOERLI_RPC_URL }} + SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }} MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }} run: forge test -vvv diff --git a/README.md b/README.md index 016198e..5c884eb 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The following smart contracts are provided as is, without warranty. Details of t ## Quickstart -This repo is built with [foundry](https://github.com/foundry-rs/foundry), a rust-based solidity development environment, and relies on [solmate](https://github.com/Rari-Capital/solmate), an efficient solidity smart contract library. Read the docs on our [docs site](https://docs.obol.tech/docs/next/sc/introducing-obol-splits) for more information on what Distributed Validators are, and their smart contract lifecycle. +This repo is built with [foundry](https://github.com/foundry-rs/foundry), a rust-based solidity development environment, and relies on [solmate](https://github.com/Rari-Capital/solmate), an efficient solidity smart contract library. Read the docs on our [docs site](https://docs.obol.org/learn/intro/obol-splits) for more information on what Distributed Validators are, and their smart contract lifecycle. ### Installation @@ -55,16 +55,6 @@ This command generates compilation output into the `out` directory. This repo can be deployed with `forge create` or running the deployment scripts. -### Goerli Network Contracts -| Contract Type | Address | -|--------------------------------------|-----------------------------------------------------------------------------------------------------| -| OptimisticWithdrawalRecipientFactory | [0xe9557FCC055c89515AE9F3A4B1238575Fcd80c26](https://goerli.etherscan.io/address/0xe9557FCC055c89515AE9F3A4B1238575Fcd80c26) | -| OptimisticWithdrawalRecipient | [0x898516b26D99d0F389598acFcd9F115Ab8184Fe3](https://goerli.etherscan.io/address/0x898516b26D99d0F389598acFcd9F115Ab8184Fe3) | -| ImmutableSplitControllerFactory | [0x64a2c4A50B1f46c3e2bF753CFe270ceB18b5e18f](https://goerli.etherscan.io/address/0x64a2c4A50B1f46c3e2bF753CFe270ceB18b5e18f) | -| ImmutableSplitController | [0x009894cdA6cB6d99866ca8E04e8EDeabd625712F](https://goerli.etherscan.io/address/0x009894cdA6cB6d99866ca8E04e8EDeabd625712F) | -| ObolLidoSplitFactory | [0x40435F54cc57943C727d8f856A52d4E55501cA8C](https://goerli.etherscan.io/address/0x40435F54cc57943C727d8f856A52d4E55501cA8C) | -| ObolLidoSplit | [0xdF46B2f36ffb67492A73263Ae3C3849B99DA9967](https://goerli.etherscan.io/address/0xdF46B2f36ffb67492A73263Ae3C3849B99DA9967) | - ### Sepolia Network Contracts | Contract Type | Address | |--------------------------------------|-----------------------------------------------------------------------------------------------------| @@ -81,7 +71,6 @@ This repo can be deployed with `forge create` or running the deployment scripts. | OptimisticTokenWithdrawalRecipientFactory | [0xD6c9f28062834185FF65D61388D9E2d9D804Fc03](https://holesky.etherscan.io/address/0xD6c9f28062834185FF65D61388D9E2d9D804Fc03) | | OptimisticTokenWithdrawalRecipient | [0xb927bf07d1686A7Ad06Fae18e632232a8498F0f6](https://holesky.etherscan.io/address/0xb927bf07d1686A7Ad06Fae18e632232a8498F0f6) | - ### Mainnet Contracts | Contract Type | Address | |--------------------------------------|-----------------------------------------------------------------------------------------------------| diff --git a/foundry.toml b/foundry.toml index ad0debc..64f7397 100644 --- a/foundry.toml +++ b/foundry.toml @@ -15,10 +15,8 @@ fs_permissions = [{ access = "read-write", path = "./"}] [rpc_endpoints] -goerli = "${GOERLI_RPC_URL}" mainnet = "${MAINNET_RPC_URL}" sepolia = "${SEPOLIA_RPC_URL}" -# See more config options https://github.com/gakonst/foundry/tree/master/config [fmt] bracket_spacing = false diff --git a/src/test/controllers/IMSC.t.sol b/src/test/controllers/IMSC.t.sol index d6dd517..e3b8760 100644 --- a/src/test/controllers/IMSC.t.sol +++ b/src/test/controllers/IMSC.t.sol @@ -13,7 +13,7 @@ contract IMSC is Test { error Unauthorized(); error Invalid_SplitBalance(); - address internal SPLIT_MAIN_GOERLI = 0x2ed6c4B5dA6378c7897AC67Ba9e43102Feb694EE; + address internal SPLIT_MAIN_SEPOLIA = 0x5924cD81dC672151527B1E4b5Ef57B69cBD07Eda; uint256 public constant PERCENTAGE_SCALE = 1e6; ImmutableSplitControllerFactory public factory; @@ -31,10 +31,9 @@ contract IMSC is Test { address owner; function setUp() public { - uint256 goerliBlock = 8_529_931; - vm.createSelectFork(getChain("goerli").rpcUrl); + vm.createSelectFork(getChain("sepolia").rpcUrl); - factory = new ImmutableSplitControllerFactory(SPLIT_MAIN_GOERLI); + factory = new ImmutableSplitControllerFactory(SPLIT_MAIN_SEPOLIA); cntrlImpl = factory.controller(); accounts = new address[](2); @@ -63,7 +62,7 @@ contract IMSC is Test { address predictedControllerAddress = factory.predictSplitControllerAddress(owner, controllerAccounts, controllerPercentAllocations, 0, deploymentSalt); - split = ISplitMain(SPLIT_MAIN_GOERLI).createSplit(accounts, percentAllocations, 0, predictedControllerAddress); + split = ISplitMain(SPLIT_MAIN_SEPOLIA).createSplit(accounts, percentAllocations, 0, predictedControllerAddress); // deploy controller controller = @@ -77,7 +76,7 @@ contract IMSC is Test { } function testCan_getSplitMain() public { - assertEq(controller.splitMain(), SPLIT_MAIN_GOERLI, "valid splitMain address"); + assertEq(controller.splitMain(), SPLIT_MAIN_SEPOLIA, "valid splitMain address"); } function testCan_getOwner() public { @@ -136,7 +135,7 @@ contract IMSC is Test { controller.updateSplit(); assertEq( - ISplitMain(SPLIT_MAIN_GOERLI).getHash(split), + ISplitMain(SPLIT_MAIN_SEPOLIA).getHash(split), _hashSplit(controllerAccounts, controllerPercentAllocations, 0), "invalid split hash" ); @@ -168,7 +167,7 @@ contract IMSC is Test { // create split address fuzzSplit = - ISplitMain(SPLIT_MAIN_GOERLI).createSplit(splitterAccts, splitterPercentAlloc, 0, predictedControllerAddress); + ISplitMain(SPLIT_MAIN_SEPOLIA).createSplit(splitterAccts, splitterPercentAlloc, 0, predictedControllerAddress); // create controller controller = @@ -177,12 +176,12 @@ contract IMSC is Test { assertEq(controller.owner(), ownerAddress, "invalid owner address"); // get current split hash - bytes32 currentSplitHash = ISplitMain(SPLIT_MAIN_GOERLI).getHash(fuzzSplit); + bytes32 currentSplitHash = ISplitMain(SPLIT_MAIN_SEPOLIA).getHash(fuzzSplit); // update split vm.prank(ownerAddress); controller.updateSplit(); - bytes32 newSplitHash = ISplitMain(SPLIT_MAIN_GOERLI).getHash(fuzzSplit); + bytes32 newSplitHash = ISplitMain(SPLIT_MAIN_SEPOLIA).getHash(fuzzSplit); bytes32 calculatedSplitHash = _hashSplit(ctrllerAccounts, ctrllerPercentAlloc, 0); diff --git a/src/test/controllers/IMSCFactory.t.sol b/src/test/controllers/IMSCFactory.t.sol index e9e79de..33bb8de 100644 --- a/src/test/controllers/IMSCFactory.t.sol +++ b/src/test/controllers/IMSCFactory.t.sol @@ -19,7 +19,7 @@ contract IMSCFactory is Test { error InvalidSplit__AllocationMustBePositive(uint256 index); error InvalidSplit__InvalidDistributorFee(uint32 distributorFee); - address internal SPLIT_MAIN_GOERLI = 0x2ed6c4B5dA6378c7897AC67Ba9e43102Feb694EE; + address internal SPLIT_MAIN_SEPOLIA = 0x5924cD81dC672151527B1E4b5Ef57B69cBD07Eda; uint32 public constant SPLIT_MAIN_PERCENTAGE_SCALE = 1e6; uint256 public constant PERCENTAGE_SCALE = 1e6; @@ -32,10 +32,9 @@ contract IMSCFactory is Test { uint32[] percentAllocations; function setUp() public { - uint256 goerliBlock = 8_529_931; - vm.createSelectFork(getChain("goerli").rpcUrl); + vm.createSelectFork(getChain("sepolia").rpcUrl); - factory = new ImmutableSplitControllerFactory(SPLIT_MAIN_GOERLI); + factory = new ImmutableSplitControllerFactory(SPLIT_MAIN_SEPOLIA); cntrlImpl = factory.controller(); accounts = new address[](2); @@ -166,7 +165,7 @@ contract IMSCFactory is Test { address predictedAddress = factory.predictSplitControllerAddress(owner, accounts, percentAllocations, 0, deploymentSalt); - address split = ISplitMain(SPLIT_MAIN_GOERLI).createSplit(accounts, percentAllocations, 0, predictedAddress); + address split = ISplitMain(SPLIT_MAIN_SEPOLIA).createSplit(accounts, percentAllocations, 0, predictedAddress); ImmutableSplitController controller = factory.createController(split, owner, accounts, percentAllocations, 0, deploymentSalt); diff --git a/src/test/eigenlayer/OELPCFactory.t.sol b/src/test/eigenlayer/OELPCFactory.t.sol.obsolete similarity index 95% rename from src/test/eigenlayer/OELPCFactory.t.sol rename to src/test/eigenlayer/OELPCFactory.t.sol.obsolete index 78ecf40..907d76d 100644 --- a/src/test/eigenlayer/OELPCFactory.t.sol +++ b/src/test/eigenlayer/OELPCFactory.t.sol.obsolete @@ -3,7 +3,7 @@ pragma solidity 0.8.19; import "forge-std/Test.sol"; import {ObolEigenLayerPodControllerFactory} from "src/eigenlayer/ObolEigenLayerPodControllerFactory.sol"; -import {EigenLayerTestBase} from "src/test/eigenlayer/EigenLayerTestBase.sol"; +import {EigenLayerTestBase} from "./EigenLayerTestBase.sol"; contract ObolEigenLayerPodControllerFactoryTest is EigenLayerTestBase { error Invalid_Owner(); @@ -24,7 +24,6 @@ contract ObolEigenLayerPodControllerFactoryTest is EigenLayerTestBase { uint256 feeShare; function setUp() public { - uint256 goerliBlock = 10_205_449; vm.createSelectFork(getChain("goerli").rpcUrl); owner = makeAddr("owner"); diff --git a/src/test/eigenlayer/ObolEigenLayerPodController.t.sol b/src/test/eigenlayer/ObolEigenLayerPodController.t.sol.obsolete similarity index 98% rename from src/test/eigenlayer/ObolEigenLayerPodController.t.sol rename to src/test/eigenlayer/ObolEigenLayerPodController.t.sol.obsolete index c07ae90..013ef52 100644 --- a/src/test/eigenlayer/ObolEigenLayerPodController.t.sol +++ b/src/test/eigenlayer/ObolEigenLayerPodController.t.sol.obsolete @@ -16,7 +16,7 @@ import { OptimisticWithdrawalRecipientFactory, OptimisticWithdrawalRecipient } from "src/owr/OptimisticWithdrawalRecipientFactory.sol"; -import {EigenLayerTestBase} from "src/test/eigenlayer/EigenLayerTestBase.sol"; +import {EigenLayerTestBase} from "./EigenLayerTestBase.sol"; interface IDepositContract { function deposit( @@ -51,7 +51,6 @@ contract ObolEigenLayerPodControllerTest is EigenLayerTestBase { MockERC20 mERC20; function setUp() public { - uint256 goerliBlock = 10_205_449; vm.createSelectFork(getChain("goerli").rpcUrl); vm.mockCall( diff --git a/src/test/eigenlayer/integration/OELPCIntegration.t.sol b/src/test/eigenlayer/integration/OELPCIntegration.t.sol.obsolete similarity index 98% rename from src/test/eigenlayer/integration/OELPCIntegration.t.sol rename to src/test/eigenlayer/integration/OELPCIntegration.t.sol.obsolete index 64ffe9e..34ec4fe 100644 --- a/src/test/eigenlayer/integration/OELPCIntegration.t.sol +++ b/src/test/eigenlayer/integration/OELPCIntegration.t.sol.obsolete @@ -18,7 +18,7 @@ import { OptimisticWithdrawalRecipient } from "src/owr/OptimisticWithdrawalRecipientFactory.sol"; import {IENSReverseRegistrar} from "../../../interfaces/IENSReverseRegistrar.sol"; -import {EigenLayerTestBase} from "src/test/eigenlayer/EigenLayerTestBase.sol"; +import {EigenLayerTestBase} from "../EigenLayerTestBase.sol"; contract OELPCIntegration is EigenLayerTestBase { ObolEigenLayerPodControllerFactory factory; @@ -42,7 +42,6 @@ contract OELPCIntegration is EigenLayerTestBase { uint256 feeShare; function setUp() public { - uint256 goerliBlock = 10_653_080; vm.createSelectFork(getChain("goerli").rpcUrl); vm.mockCall(