Skip to content

Commit

Permalink
Merge pull request #20 from OlympusDAO/remappings-fix
Browse files Browse the repository at this point in the history
Fix: remappings, proposal testing, fork tests
  • Loading branch information
0xJem authored Nov 12, 2024
2 parents 7a72e71 + 569643a commit 35b572a
Show file tree
Hide file tree
Showing 53 changed files with 233 additions and 169 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,23 @@ jobs:

- uses: pnpm/action-setup@v2
with:
version: 8
version: 9

- name: Install Node dependencies
run: pnpm install

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly-ca67d15f4abd46394b324c50e21e66f306a1162d

- name: Install Foundry dependencies
run: forge install
run: pnpm run build

- name: Run lint check
run: pnpm run lint:check

- name: Run unit tests
run: pnpm run test:unit

- name: Run proposal simulation tests
run: pnpm run test:proposal
env:
FORK_TEST_RPC_URL: ${{ secrets.FORK_TEST_RPC_URL }}

- name: Run fork tests
run: pnpm run test:fork
env:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/OCG.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: OCG Proposals
on:
push:
branches:
- master
pull_request:

jobs:
run-ci:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v2
with:
version: 9

- name: Install Node dependencies
run: pnpm install

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install Foundry dependencies
run: pnpm run build

- name: Run proposal simulation tests
run: pnpm run test:proposal
env:
FORK_TEST_RPC_URL: ${{ secrets.FORK_TEST_RPC_URL }}
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ remappings = [
'layer-zero/=lib/solidity-examples/contracts/',
'@openzeppelin/=lib/openzeppelin-contracts/',
'bonds/=lib/bonds/src/',
'test/=src/test/',
'clones/=lib/clones-with-immutable-args/src/',
'proposal-sim/=lib/forge-proposal-simulator/',
]
fs_permissions = [
{access = "write", path = "./src/test/sim/out/"},
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"yarn": "use-pnpm"
},
"scripts": {
"build": "chmod +x shell/* && ./shell/full_install.sh",
"build": "chmod +x shell/*.sh && ./shell/full_install.sh",
"prettier": "prettier --no-error-on-unmatched-pattern --write 'src/**/*.sol' '**/*.html'",
"prettier:list": "prettier --no-error-on-unmatched-pattern --list-different 'src/**/*.sol' '**/*.html'",
"prettier:check": "prettier --no-error-on-unmatched-pattern --check 'src/**/*.sol' '**/*.html'",
Expand All @@ -24,10 +24,10 @@
"lint": "pnpm run prettier && pnpm run solhint && pnpm run markdownlint",
"lint:check": "pnpm run prettier:check && pnpm run solhint:check && pnpm run markdownlint:check",
"test": "./shell/test_all.sh",
"test:unit": "forge test --no-match-contract '(Fork|OCGProposal|CoolerUtils)' -vvv",
"test:fork": "forge test --match-contract '($1.*Fork$|CoolerUtils)' --fork-url $FORK_TEST_RPC_URL -vvv",
"test:proposal": "forge test --match-contract OCGProposal --fork-url $FORK_TEST_RPC_URL -vvv",
"test:crosschainfork": "forge test --match-contract CrossChainBridgeFork -vvv",
"test:unit": "forge test --no-match-contract '(Fork)' --no-match-path 'src/test/proposals/*.t.sol' -vvv",
"test:fork": "forge test --match-contract 'Fork' --no-match-contract 'CrossChainBridgeFork' --fork-url $FORK_TEST_RPC_URL -vvv",
"test:proposal": "forge test --match-path 'src/test/proposals/*.t.sol' --fork-url $FORK_TEST_RPC_URL -vvv",
"test:crosschainfork": "forge test --match-contract 'CrossChainBridgeFork' -vvv",
"test:coverage": "./shell/test_coverage.sh",
"size": "forge clean && forge build --sizes --skip test --skip '*/*Mock*.sol' --skip 'UniswapDeployer.sol'",
"metrics": "node shell/metrics.js"
Expand Down
22 changes: 18 additions & 4 deletions remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,25 @@ modules/=src/modules/
policies/=src/policies/
libraries/=src/libraries/
solmate/=lib/solmate/src/
balancer-v2/=lib/balancer-v2/
layer-zero/=lib/solidity-examples/contracts/
@openzeppelin/=lib/openzeppelin-contracts/
bonds/=lib/bonds/src/
test/=src/test/
clones/=lib/clones-with-immutable-args/src/
proposal-sim=lib/forge-proposal-simulator/
proposal-sim/proposals/=lib/forge-proposal-simulator/proposals/
proposals/=src/proposals/
openzeppelin/=lib/openzeppelin-contracts/contracts
proposal-sim/=lib/forge-proposal-simulator/
@addresses/=lib/forge-proposal-simulator/addresses/
@examples/=lib/forge-proposal-simulator/examples/
@proposals/=lib/forge-proposal-simulator/proposals/
@script/=lib/forge-proposal-simulator/script/
@test/=lib/forge-proposal-simulator/test/
@utils/=lib/forge-proposal-simulator/utils/
clones-with-immutable-args/=lib/clones-with-immutable-args/src/
comp-governance/=lib/forge-proposal-simulator/lib/compound-governance/contracts/
compound-governance/=lib/forge-proposal-simulator/lib/compound-governance/contracts/
erc4626-tests/=lib/forge-proposal-simulator/lib/openzeppelin-contracts/lib/erc4626-tests/
forge-proposal-simulator/=lib/forge-proposal-simulator/
openzeppelin-contracts/=lib/openzeppelin-contracts/
openzeppelin/=lib/forge-proposal-simulator/lib/openzeppelin-contracts/contracts/
solidity-code-metrics/=node_modules/solidity-code-metrics/
solidity-examples/=lib/solidity-examples/contracts/
8 changes: 4 additions & 4 deletions src/scripts/deploy/DeployV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ import {ClaimTransfer} from "src/external/ClaimTransfer.sol";
import {Clearinghouse} from "policies/Clearinghouse.sol";
import {YieldRepurchaseFacility} from "policies/YieldRepurchaseFacility.sol";

import {MockPriceFeed} from "test/mocks/MockPriceFeed.sol";
import {MockAuraBooster, MockAuraRewardPool, MockAuraMiningLib, MockAuraVirtualRewardPool, MockAuraStashToken} from "test/mocks/AuraMocks.sol";
import {MockBalancerPool, MockVault} from "test/mocks/BalancerMocks.sol";
import {MockPriceFeed} from "src/test/mocks/MockPriceFeed.sol";
import {MockAuraBooster, MockAuraRewardPool, MockAuraMiningLib, MockAuraVirtualRewardPool, MockAuraStashToken} from "src/test/mocks/AuraMocks.sol";
import {MockBalancerPool, MockVault} from "src/test/mocks/BalancerMocks.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {Faucet} from "test/mocks/Faucet.sol";
import {Faucet} from "src/test/mocks/Faucet.sol";
import {CoolerUtils} from "src/external/cooler/CoolerUtils.sol";

import {TransferHelper} from "libraries/TransferHelper.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/deploy/LegacyBurnerDeps.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity 0.8.15;

import {Script, console2} from "forge-std/Script.sol";
import {MockLegacyInverseBondDepo} from "test/mocks/MockLegacyInverseBondDepo.sol";
import {MockLegacyInverseBondDepo} from "src/test/mocks/MockLegacyInverseBondDepo.sol";

contract LegacyBurnerDepsDeploy is Script {
address public authority = 0x4A8c9502A34962a2C6d73c5D181dAaeF3dcDc88D;
Expand Down
2 changes: 1 addition & 1 deletion src/test/Kernel.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity 0.8.15;

import {Test} from "forge-std/Test.sol";
import {UserFactory} from "test/lib/UserFactory.sol";
import {UserFactory} from "src/test/lib/UserFactory.sol";

import "./mocks/KernelTestMocks.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/test/external/ClaimTransfer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.8.15;
import {Test} from "forge-std/Test.sol";
import {stdError} from "forge-std/StdError.sol";
import {console2} from "forge-std/console2.sol";
import {UserFactory} from "test/lib/UserFactory.sol";
import {UserFactory} from "src/test/lib/UserFactory.sol";

import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";

Expand Down
6 changes: 3 additions & 3 deletions src/test/external/cooler/Cooler.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ pragma solidity ^0.8.15;

import {Test} from "forge-std/Test.sol";
import {console2} from "forge-std/console2.sol";
import {UserFactory} from "test/lib/UserFactory.sol";
import {UserFactory} from "src/test/lib/UserFactory.sol";

import {MockGohm} from "test/mocks/MockGohm.sol";
import {MockGohm} from "src/test/mocks/MockGohm.sol";
import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {MockLender} from "test/mocks/MockCallbackLender.sol";
import {MockLender} from "src/test/mocks/MockCallbackLender.sol";

import {Cooler} from "src/external/cooler/Cooler.sol";
import {CoolerFactory} from "src/external/cooler/CoolerFactory.sol";
Expand Down
4 changes: 2 additions & 2 deletions src/test/external/cooler/CoolerFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity ^0.8.15;

import {Test} from "forge-std/Test.sol";
import {UserFactory} from "test/lib/UserFactory.sol";
import {UserFactory} from "src/test/lib/UserFactory.sol";

import {MockERC20} from "test/mocks/OlympusMocks.sol";
import {MockERC20} from "src/test/mocks/OlympusMocks.sol";

import {CoolerFactory} from "src/external/cooler/CoolerFactory.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/test/external/cooler/CoolerUtils.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {Cooler} from "src/external/cooler/Cooler.sol";

import {CoolerUtils} from "src/external/cooler/CoolerUtils.sol";

contract CoolerUtilsTest is Test {
contract CoolerUtilsForkTest is Test {
CoolerUtils public utils;

ERC20 public gohm;
Expand Down
4 changes: 2 additions & 2 deletions src/test/external/governance/GovernorBravoDelegate.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
pragma solidity 0.8.15;

import {Test} from "forge-std/Test.sol";
import {UserFactory} from "test/lib/UserFactory.sol";
import {UserFactory} from "src/test/lib/UserFactory.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {console2} from "forge-std/console2.sol";

import {MockGohm} from "test/mocks/OlympusMocks.sol";
import {MockGohm} from "src/test/mocks/OlympusMocks.sol";

import {OlympusTreasury} from "modules/TRSRY/OlympusTreasury.sol";
import {OlympusRoles} from "modules/ROLES/OlympusRoles.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/test/modules/BLREG.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity 0.8.15;

import {Test} from "forge-std/Test.sol";
import {ModuleTestFixtureGenerator} from "test/lib/ModuleTestFixtureGenerator.sol";
import {ModuleTestFixtureGenerator} from "src/test/lib/ModuleTestFixtureGenerator.sol";

import "modules/BLREG/OlympusBoostedLiquidityRegistry.sol";
import "src/Kernel.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/test/modules/CHREG.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.15;

import {Test} from "forge-std/Test.sol";
import {console2} from "forge-std/console2.sol";
import {ModuleTestFixtureGenerator} from "test/lib/ModuleTestFixtureGenerator.sol";
import {ModuleTestFixtureGenerator} from "src/test/lib/ModuleTestFixtureGenerator.sol";

import "modules/CHREG/OlympusClearinghouseRegistry.sol";
import "src/Kernel.sol";
Expand Down
12 changes: 6 additions & 6 deletions src/test/modules/INSTR.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ pragma solidity >=0.8.0;

import {Test} from "forge-std/Test.sol";
import {console2} from "forge-std/console2.sol";
import {UserFactory} from "test/lib/UserFactory.sol";
import {ModuleTestFixtureGenerator} from "test/lib/ModuleTestFixtureGenerator.sol";
import {UserFactory} from "src/test/lib/UserFactory.sol";
import {ModuleTestFixtureGenerator} from "src/test/lib/ModuleTestFixtureGenerator.sol";

import {Parthenon} from "policies/Parthenon.sol";
import {MockModuleWriter} from "test/mocks/MockModuleWriter.sol";
import {MockInvalidModule} from "test/mocks/MockInvalidModule.sol";
import {MockValidModule} from "test/mocks/MockValidModule.sol";
import {MockValidUpgradedModule} from "test/mocks/MockValidUpgradedModule.sol";
import {MockModuleWriter} from "src/test/mocks/MockModuleWriter.sol";
import {MockInvalidModule} from "src/test/mocks/MockInvalidModule.sol";
import {MockValidModule} from "src/test/mocks/MockValidModule.sol";
import {MockValidUpgradedModule} from "src/test/mocks/MockValidUpgradedModule.sol";

import "modules/INSTR/OlympusInstructions.sol";
import "src/Kernel.sol";
Expand Down
10 changes: 5 additions & 5 deletions src/test/modules/MINTR.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ pragma solidity 0.8.15;

import {Test} from "forge-std/Test.sol";

import {UserFactory} from "test/lib/UserFactory.sol";
import {larping} from "test/lib/larping.sol";
import {Quabi} from "test/lib/quabi/Quabi.sol";
import {MockLegacyAuthority} from "test/mocks/MockLegacyAuthority.sol";
import {UserFactory} from "src/test/lib/UserFactory.sol";
import {larping} from "src/test/lib/larping.sol";
import {Quabi} from "src/test/lib/quabi/Quabi.sol";
import {MockLegacyAuthority} from "src/test/mocks/MockLegacyAuthority.sol";

import {ModuleTestFixtureGenerator} from "test/lib/ModuleTestFixtureGenerator.sol";
import {ModuleTestFixtureGenerator} from "src/test/lib/ModuleTestFixtureGenerator.sol";

import {OlympusERC20Token, IOlympusAuthority} from "src/external/OlympusERC20.sol";
import "modules/MINTR/OlympusMinter.sol";
Expand Down
6 changes: 3 additions & 3 deletions src/test/modules/PRICE.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ pragma solidity >=0.8.0;

import {Test} from "forge-std/Test.sol";
import {console2} from "forge-std/console2.sol";
import {UserFactory} from "test/lib/UserFactory.sol";
import {ModuleTestFixtureGenerator} from "test/lib/ModuleTestFixtureGenerator.sol";
import {UserFactory} from "src/test/lib/UserFactory.sol";
import {ModuleTestFixtureGenerator} from "src/test/lib/ModuleTestFixtureGenerator.sol";

import {MockERC20, ERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {FullMath} from "libraries/FullMath.sol";

import {MockPriceFeed} from "test/mocks/MockPriceFeed.sol";
import {MockPriceFeed} from "src/test/mocks/MockPriceFeed.sol";

import {OlympusPrice} from "modules/PRICE/OlympusPrice.sol";
import "src/Kernel.sol";
Expand Down
4 changes: 2 additions & 2 deletions src/test/modules/RANGE.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pragma solidity >=0.8.0;

import {Test} from "forge-std/Test.sol";
import {console2} from "forge-std/console2.sol";
import {UserFactory} from "test/lib/UserFactory.sol";
import {ModuleTestFixtureGenerator} from "test/lib/ModuleTestFixtureGenerator.sol";
import {UserFactory} from "src/test/lib/UserFactory.sol";
import {ModuleTestFixtureGenerator} from "src/test/lib/ModuleTestFixtureGenerator.sol";

import {MockERC20, ERC20} from "solmate/test/utils/mocks/MockERC20.sol";

Expand Down
4 changes: 2 additions & 2 deletions src/test/modules/ROLES.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity 0.8.15;

import {Test} from "forge-std/Test.sol";
import {UserFactory} from "test/lib/UserFactory.sol";
import {UserFactory} from "src/test/lib/UserFactory.sol";
import {console2 as console} from "forge-std/console2.sol";
import {ModuleTestFixtureGenerator} from "test/lib/ModuleTestFixtureGenerator.sol";
import {ModuleTestFixtureGenerator} from "src/test/lib/ModuleTestFixtureGenerator.sol";

import {ROLESv1} from "src/modules/ROLES/ROLES.v1.sol";
import {OlympusRoles} from "src/modules/ROLES/OlympusRoles.sol";
Expand Down
6 changes: 3 additions & 3 deletions src/test/modules/TRSRY.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
pragma solidity 0.8.15;

import {Test} from "forge-std/Test.sol";
import {UserFactory} from "test/lib/UserFactory.sol";
import {UserFactory} from "src/test/lib/UserFactory.sol";
import {console2 as console} from "forge-std/console2.sol";
import {ModuleTestFixtureGenerator} from "test/lib/ModuleTestFixtureGenerator.sol";
import {ModuleTestFixtureGenerator} from "src/test/lib/ModuleTestFixtureGenerator.sol";

import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {OlympusERC20Token} from "src/external/OlympusERC20.sol";
//import {MockPolicy} from "test/mocks/KernelTestMocks.sol";
//import {MockPolicy} from "src/test/mocks/KernelTestMocks.sol";

import {OlympusTreasury} from "src/modules/TRSRY/OlympusTreasury.sol";
import {TRSRYv1} from "src/modules/TRSRY/TRSRY.v1.sol";
Expand Down
4 changes: 2 additions & 2 deletions src/test/modules/VOTES.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {ERC20} from "solmate/tokens/ERC20.sol";

import {Test} from "forge-std/Test.sol";
import {console2} from "forge-std/console2.sol";
import {UserFactory} from "test/lib/UserFactory.sol";
import {UserFactory} from "src/test/lib/UserFactory.sol";

import {Kernel, Actions} from "src/Kernel.sol";
import {OlympusVotes} from "src/modules/VOTES/OlympusVotes.sol";

import "test/lib/ModuleTestFixtureGenerator.sol";
import {ModuleTestFixtureGenerator} from "src/test/lib/ModuleTestFixtureGenerator.sol";

contract VOTESTest is Test {
using ModuleTestFixtureGenerator for OlympusVotes;
Expand Down
12 changes: 6 additions & 6 deletions src/test/policies/BondCallback.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ pragma solidity >=0.8.0;

import {Test} from "forge-std/Test.sol";
import {console2} from "forge-std/console2.sol";
import {UserFactory} from "test/lib/UserFactory.sol";
import {UserFactory} from "src/test/lib/UserFactory.sol";

import {BondFixedTermSDA} from "test/lib/bonds/BondFixedTermSDA.sol";
import {BondAggregator} from "test/lib/bonds/BondAggregator.sol";
import {BondFixedTermTeller} from "test/lib/bonds/BondFixedTermTeller.sol";
import {IBondSDA as LibIBondSDA} from "test/lib/bonds/interfaces/IBondSDA.sol";
import {BondFixedTermSDA} from "src/test/lib/bonds/BondFixedTermSDA.sol";
import {BondAggregator} from "src/test/lib/bonds/BondAggregator.sol";
import {BondFixedTermTeller} from "src/test/lib/bonds/BondFixedTermTeller.sol";
import {IBondSDA as LibIBondSDA} from "src/test/lib/bonds/interfaces/IBondSDA.sol";
import {RolesAuthority, Authority as SolmateAuthority} from "solmate/auth/authorities/RolesAuthority.sol";

import {MockERC20, ERC20} from "solmate/test/utils/mocks/MockERC20.sol";
import {MockERC4626, ERC4626} from "solmate/test/utils/mocks/MockERC4626.sol";
import {MockPrice} from "test/mocks/MockPrice.sol";
import {MockPrice} from "src/test/mocks/MockPrice.sol";

import {IBondSDA} from "interfaces/IBondSDA.sol";
import {IBondAggregator} from "interfaces/IBondAggregator.sol";
Expand Down
Loading

0 comments on commit 35b572a

Please sign in to comment.