Skip to content

Commit

Permalink
Renaming the forking test modes
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed Oct 30, 2024
1 parent 85ed996 commit c6423d2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ 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: test-fork ## Fork test using the existing token(s) (testnet)
test-fork-prodnet: test-fork ## Fork test using the existing token(s) (production network)
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)

: ##

# Override the fork test mode (existing factory)
test-fork-factory-testnet: export FORK_TEST_MODE = fork-existing
test-fork-factory-prodnet: export FORK_TEST_MODE = fork-existing
test-fork-factory-testnet: export FORK_TEST_MODE = existing-factory
test-fork-factory-prodnet: export FORK_TEST_MODE = existing-factory

test-fork-factory-testnet: test-fork-testnet ## Fork test using an existing factory (testnet)
test-fork-factory-prodnet: test-fork-prodnet ## Fork test using an existing factory (production network)
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Available targets:
- make test-fork-mint-testnet Clean fork test, minting test tokens (testnet)
- make test-fork-mint-prodnet Clean fork test, minting test tokens (production network)
- make test-fork-testnet Fork test using the existing token(s) (testnet)
- make test-fork-prodnet Fork test using the existing token(s) (production network)
- make test-fork-testnet Fork test using the existing token(s), new factory (testnet)
- make test-fork-prodnet Fork test using the existing token(s), new factory (production network)
- make test-fork-factory-testnet Fork test using an existing factory (testnet)
- make test-fork-factory-prodnet Fork test using an existing factory (production network)
Expand Down Expand Up @@ -72,9 +72,9 @@ The env.example file contains descriptions for all the initial settings. You don

Fork testing has 2 modes:

1. "fork-deploy" will run against the live network fork, deploying new contracts via a new instance of the factory. See `make test-fork-testnet`, `make test-fork-prodnet` and simmilar
1. "new-factory" will run against the live network fork, deploying new contracts via a new instance of the factory. See `make test-fork-testnet`, `make test-fork-prodnet` and simmilar

2. "fork-existing" will run against the live network fork, using the existing factory & therefore the existing contracts. See `make test-exfork-testnet`, `make test-exfork-prodnet` and simmilar
2. "existing-factory" will run against the live network fork, using the existing factory & therefore the existing contracts. See `make test-fork-factory-testnet`, `make test-fork-factory-prodnet` and simmilar

In both cases, you will need to find the correct Aragon OSx contracts for the chain you wish to fork against. These can be found in the [OSx commons repo](https://github.com/aragon/osx-commons/tree/main/configs/src/deployments/json)

Expand Down Expand Up @@ -106,9 +106,9 @@ Check the available make targets to simulate and deploy the smart contracts:
- [ ] I have updated the `.env` with these parameters
- [ ] I have updated the `CurveConstantLib` and `Clock` with any new constants.
- [ ] All my unit tests pass
- [ ] I have run a fork test in `fork-deploy` mode against the OSx contracts on my target testnet
- [ ] I have run a fork test in `new-factory` mode against the OSx contracts on my target testnet
- [ ] I have deployed my contracts successfully to a target testnet
- [ ] I have confirmed my tests still work in `fork-existing` mode with the live tokens and the factory.
- [ ] I have confirmed my tests still work in `existing-factory` mode with the live tokens and the factory.
- [ ] I have run the same workflow against the mainnet I wish to deploy on
- [ ] I have previewed my deploy
- [ ] My deployer address is a fresh wallet or setup for repeat production deploys in a safe manner.
Expand Down
8 changes: 4 additions & 4 deletions test/fork/e2eV2.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1299,17 +1299,17 @@ contract TestE2EV2 is AragonTest, IWithdrawalQueueErrors, IGaugeVote, IEscrowCur

function _getTestMode() internal view returns (TestMode) {
// FORK_TEST_MODE is defined on the Makefile, depending on the target
string memory mode = vm.envOr("FORK_TEST_MODE", string("fork-deploy"));
if (keccak256(abi.encodePacked(mode)) == keccak256(abi.encodePacked("fork-deploy"))) {
string memory mode = vm.envOr("FORK_TEST_MODE", string("new-factory"));
if (keccak256(abi.encodePacked(mode)) == keccak256(abi.encodePacked("new-factory"))) {
return TestMode.ForkDeploy;
} else if (
keccak256(abi.encodePacked(mode)) == keccak256(abi.encodePacked("fork-existing"))
keccak256(abi.encodePacked(mode)) == keccak256(abi.encodePacked("existing-factory"))
) {
return TestMode.ForkExisting;
} else if (keccak256(abi.encodePacked(mode)) == keccak256(abi.encodePacked("local"))) {
return TestMode.Local;
} else {
revert("Invalid test mode - valid options are fork-deploy, fork-existing, local");
revert("Invalid test mode - valid options are new-factory, existing-factory, local");
}
}

Expand Down

0 comments on commit c6423d2

Please sign in to comment.