You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
0 commit comments