We have a trait TychoEncoder and then two implementations: TychoRouterEncoder and TychoExecutorEncoder.
This way we go a level above with the decision if it is a direct execution or if it should use the tycho router.
- Created two builders: one for each tycho encoder
- Delete ExecutorStrategyEncoder and move code straight into the TychoExecutorEncoder
- Add validate_solution to trait TychoEncoder
- Move group_swaps.rs a level up
- Update tests and usage cases
Doing this we get rid of all that weird stuff we were doing before
--- don't change below this line ---
ENG-4306 Took 2 hours 6 minutes
Took 12 seconds
- Had to take the implementation of the swap header encoding out of the main EVMStrategyEncoder trait, since it will now be difference for single and split swap strategies.
- Integration tests will be added in separate task/PR.
Took 7 seconds
- Had to take the implementation of the swap header encoding out of the main EVMStrategyEncoder trait, since it will now be difference for single and split swap strategies.
- Integration tests will be added in separate task/PR.
- Had to take the implementation of the swap header encoding out of the main EVMStrategyEncoder trait, since it will now be difference for single and split swap strategies.
- Integration tests will be added in separate task/PR.
- Need to manually install foundry and compile the project, or else it attempts to install the latest foundry version, which fails due to GLIBC not being found
- Add more test cases for sequential swap and single swap to match those of split swap (fee, slippage), to catch errors more easily if someone makes a small code change to either the single or sequential methods
- Excluded USV3 and USV4 tests on sequential and single swap, since these tests were more to test USV3 and USV4 executor functionality than the high level sswap methods - they should already be sufficiently tested.
- Remove `testSplitSwapSimple` and `testSplitSwapSingleUSV3` since this is already tested by several other high-level methods (see single USV3 and single USV4 tests). We should prioritize integration-testing public methods over private methods.
- The old way was useful when we just had split swaps. Unfortunately, we now have split, sequential, and single swaps, which don't always require token indices or split percentages, so we need to decode differently for each case.
- Add some basic tests (will add more in next commits)
- Adapt sequential tests (which originally tested split swap)
- Adapt a forgotten single swap test
TODO:
- Fix encoding of single and sequential swaps to not expect the split sawp format every time (the split and the token indices are not necessary and consume unnecessary gas).
- We have always been ok with risk here and ensured this won't happen for our use case, but slither actions version was recently updated so this fails in CI.