-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try to lighten the test process. #5
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shahthepro
reviewed
Jul 19, 2024
Comment on lines
+67
to
+75
// Deploy OEthARM implementation. | ||
address implementation = address(new OEthARM()); | ||
vm.label(implementation, "OETH ARM IMPLEMENTATION"); | ||
|
||
// Initialize Proxy with OEthARM implementation. | ||
proxy.initialize(implementation, Mainnet.TIMELOCK, ""); | ||
|
||
// Set the Proxy as the OEthARM. | ||
oethARM = OEthARM(address(proxy)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For fork tests, I'd prefer if we use the same deploy framework as mainnet (So DeployManager
). This would ensure that the contracts and config being tested on fork would be same as on mainnet
naddison36
approved these changes
Jul 30, 2024
naddison36
approved these changes
Jul 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a PoC for a new testing structure.
Objectif
Main points
vm.createSelectFork()
. I.e. to run all tests, (fork and not fork),forge t
is enough.Advices
$PROVIDER_URL
, runanvil -f "RPC_URL" --fork-block-number "BLOCK_NUMBER"
and setPROVIDER_URL=http://localhost:8545
on.env
. This should speedup the process.OETH ARM 2
. Otherwise, test forrequestWithdraw()
andclaimWithdraw()
will fail.Test file structure
The test structure should be organized like the following:
Base.sol
: This contract is the base for ALL the tests in the repo (fork on not, invariant, fuzzing etc.). It should inherit (directly or indirectly) from theTest.sol
fromForge
. It should be abstract. See contract description.Addresses.sol
lib,Math.sol
lib etc.), that can be shared across all tests!Each test folder (fork, unit, or integration) should have the same structure inside:
functionName.t.sol
: One test file (ending with .t) per function teste (in the best case). This is here and only here that tests should happen. All test files should inherit (directly or indirectly) fromShared.sol
.functionName.t.sol
: Same as above.Shared.sol
: This contract should inherit (directly or indirectly) fromBase.sol
. It is in this contract that all contracts are deployed, addresses are generated (see contract description).Modifiers.sol
(used to simplify test setup)MockCall.sol
(used to mock call instead of creating a mock contract)Helpers.sol
(all that can help, like override forge function).Note: invariant testing architecture is a bit different.
This test structure is completely inspired from https://github.com/sablier-labs/v2-core/tree/main/test.