-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: do not rely on src libraries in test libraries (#210)
## Description We define a broad set of library functions to make testing the contracts in `src` easier. However, these libraries themselves rely on the tested contracts. This could lead to issues when the tests pass because both the libraries and the files in `src` are broken in the same way. To guarantee that tests are independent of the tested libraries, all use of `src` libraries has been removed. ## What I really wanted Unfortunately, it's still possible that we forget about this and use some function in, e.g., `GPv2Order` in the test library, especially since we need to import this library to get related types and constants. I tried to create a Solidity file that reexports everything we need from the libraries without the functions themselves (this would, for example, allow us to define a custom linting rule asserting that there's no import from `src` in any test file) but I was unsuccessful. It was very easy to reexport contracts (e.g., `GPv2Settlement`) and interfaces (e.g., `IERC20`), and it was also easy to reexport constants (e.g., `GPv2Order.KIND_SELL`), The issue was with reexporting type structs: to my understanding, this is impossible in Solidity ≤0.8.26, confirmed by the fact that there is no statement that appears to enable this use case in the [language grammar](https://docs.soliditylang.org/en/v0.8.26/grammar.html). Since neither reexporting everything but the structs nor reexporting the entire libraries make sense, I decided to keep everything as it is without further reexporting. ## Test Plan Nothing broken in CI.
- Loading branch information
Showing
4 changed files
with
36 additions
and
24 deletions.
There are no files selected for viewing
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
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
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
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