Skip to content

Commit

Permalink
fix: broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pinebit committed Jan 9, 2025
1 parent b2166ab commit c5ae5fa
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
GOERLI_RPC_URL=
SEPOLIA_RPC_URL=
HOLESKY_RPC_URL=
MAINNET_RPC_URL=
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 |
|--------------------------------------|-----------------------------------------------------------------------------------------------------|
Expand All @@ -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 |
|--------------------------------------|-----------------------------------------------------------------------------------------------------|
Expand Down
2 changes: 0 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 9 additions & 10 deletions src/test/controllers/IMSC.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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 =
Expand All @@ -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 {
Expand Down Expand Up @@ -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"
);
Expand Down Expand Up @@ -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 =
Expand All @@ -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);

Expand Down
9 changes: 4 additions & 5 deletions src/test/controllers/IMSCFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand Down

0 comments on commit c5ae5fa

Please sign in to comment.