diff --git a/.env.example b/.env.example index a5a44d1..08bf36f 100644 --- a/.env.example +++ b/.env.example @@ -44,7 +44,7 @@ WARMUP_PERIOD="259200" # 3 days COOLDOWN_PERIOD="259200" # 3 days # Min seconds a user must have locked in escrow before they can queue an exit -MIN_LOCK_DURATION="259200" # 3 days +MIN_LOCK_DURATION="3600" # 1 hour # Prevent voting until manually activated by the multisig VOTING_PAUSED=true diff --git a/.env.test.example b/.env.test.example index 8e13ec4..475a364 100644 --- a/.env.test.example +++ b/.env.test.example @@ -6,3 +6,9 @@ TEST_TOKEN_WHALE="0x0000000000000000000000000000000000000000" # If you are testing with `make test-fork-factory-*`, you need to define the address of the # existing factory to use. Otherwise, you should use `make test-fork-*` FACTORY_ADDRESS="0x0000000000000000000000000000000000000000" + +# The block number to run fork tests on +# If left empty, the live onchain state will be used, which may +# consume API calls or cause rate limits +FORK_TESTNET_BLOCK_NUMBER=2643743 +FORK_PRODNET_BLOCK_NUMBER= diff --git a/Makefile b/Makefile index d27389b..280204e 100644 --- a/Makefile +++ b/Makefile @@ -82,6 +82,8 @@ test-fork-mint-prodnet: test-fork-prodnet ## Clean fork test, minting test token test-fork-testnet: export RPC_URL = $(TESTNET_RPC_URL) test-fork-prodnet: export RPC_URL = $(PRODNET_RPC_URL) +test-fork-testnet: export FORK_BLOCK_NUMBER = $(FORK_TESTNET_BLOCK_NUMBER) +test-fork-prodnet: export FORK_BLOCK_NUMBER = $(FORK_PRODNET_BLOCK_NUMBER) test-fork-testnet: test-fork ## Fork test using the existing token(s), new factory (testnet) test-fork-prodnet: test-fork ## Fork test using the existing token(s), new factory (production network) @@ -97,7 +99,16 @@ test-fork-factory-prodnet: test-fork-prodnet ## Fork test using an existing fact .PHONY: test-fork test-fork: - forge test --match-contract $(E2E_TEST_NAME) --rpc-url $(RPC_URL) $(VERBOSITY) + @if [ -z "$(strip $(FORK_BLOCK_NUMBER))" ] ; then \ + forge test --match-contract $(E2E_TEST_NAME) \ + --rpc-url $(RPC_URL) \ + $(VERBOSITY) ; \ + else \ + forge test --match-contract $(E2E_TEST_NAME) \ + --rpc-url $(RPC_URL) \ + --fork-block-number $(FORK_BLOCK_NUMBER) \ + $(VERBOSITY) ; \ + fi : ## diff --git a/README.md b/README.md index b6b4a88..4bfff9b 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ Check the available make targets to simulate and deploy the smart contracts: - [ ] I have updated the `CurveConstantLib` and `Clock` with any new constants. - [ ] All my unit tests pass (`make test`) - **Target test network** + - [ ] I have defined `FORK_TESTNET_BLOCK_NUMBER` on `.env.test`, with the current block number - [ ] I have run a fork test in `new-factory` mode with minted tokens against the official OSx contracts on the testnet - `make test-fork-mint-testnet` - [ ] I have deployed my contracts successfully to the target testnet @@ -145,6 +146,7 @@ Check the available make targets to simulate and deploy the smart contracts: - [ ] I have confirmed that tests still work in `existing-factory` mode with the live token(s) and the already deployed factory on the testnet. - `make test-fork-factory-testnet` - **Target production network** + - [ ] I have defined `FORK_PRODNET_BLOCK_NUMBER` on `.env.test`, with the current block number - [ ] I have run a fork test in `new-factory` mode with minted tokens against the official OSx contracts on the prodnet - `make test-fork-mint-prodnet` - If the live token has an address holding ≥ 3000 tokens on the prodnet: diff --git a/test/base/AragonTest.sol b/test/base/AragonTest.sol index 6615a12..0ac85f1 100644 --- a/test/base/AragonTest.sol +++ b/test/base/AragonTest.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.17; import {IPluginSetup, PluginSetup} from "@aragon/osx/framework/plugin/setup/PluginSetup.sol"; import {DAO} from "@aragon/osx/core/dao/DAO.sol"; import {RATIO_BASE} from "@aragon/osx/plugins/utils/Ratio.sol"; -import {ALICE_ADDRESS, BOB_ADDRESS, CAROL_ADDRESS, DAVID_ADDRESS, TAIKO_BRIDGE_ADDRESS} from "../constants.sol"; +import {ALICE_ADDRESS, BOB_ADDRESS, CAROL_ADDRESS, DAVID_ADDRESS} from "../constants.sol"; import {Test} from "forge-std/Test.sol"; contract AragonTest is Test { @@ -12,7 +12,6 @@ contract AragonTest is Test { address immutable bob = BOB_ADDRESS; address immutable carol = CAROL_ADDRESS; address immutable david = DAVID_ADDRESS; - address immutable taikoBridge = TAIKO_BRIDGE_ADDRESS; address immutable randomWallet = vm.addr(1234567890); address immutable DAO_BASE = address(new DAO()); diff --git a/test/constants.sol b/test/constants.sol index 87d06b5..09ba147 100644 --- a/test/constants.sol +++ b/test/constants.sol @@ -10,4 +10,3 @@ address constant ALICE_ADDRESS = address(0xa11ce); address constant BOB_ADDRESS = address(0xB0B); address constant CAROL_ADDRESS = address(0xc4601); address constant DAVID_ADDRESS = address(0xd471d); -address constant TAIKO_BRIDGE_ADDRESS = address(0xb61d6e);