Good Entry - Mitigation Review

The best day trading platform to make every trade entry a Good Entry.

  • Start date6 Sep 2023
  • End date11 Sep 2023
  • Total awards$26,000 USDC
  • Duration5 days

Good Entry - Mitigation Review details

Important note

Each warden must submit a mitigation review for every High and Medium finding from the parent audit that is listed as in-scope for the mitigation review. Incomplete mitigation reviews will not be eligible for awards.

Findings being mitigated

Mitigations of all High and Medium issues will be considered in-scope and listed here.

Overview of changes

Simple errors like the sqrt version were corrected.
The main change is to the fee system in TokenizsableRange. Because repaying a TR debt exactly is tricky and introduces several problems (addDust, fee clawing on deposit...), the system has been changed.
TokenisableRange fees aren't compounded anymore directly in TR, but are sent to the corresponding GeVault. The Gevault address is queried from a list (new addition to RoeRouter) (or to treasury is no such vault exists).
We added a depositExactly function to TR, which takes an additional expectedAmount parameter. When depositing in TR, if because of rounding the difference between the expected liquidity and the actually minted liquidity is dust (as defined by: value is 0, or lower than 1 unit of the underlying token), then mint the expected liquidity.

Another set of changes is for the GeVaults: the activeIndex system has been changed so that the index point to the first tick above current price. If 2 ticks below or above exist, it tries to deposit assets in them (and gracefully ignores errors so as to prevent revert, eg when price is inside a tick).
Instead of depositing half of the assets into each of the 2 ticks above and below, this has been parameterized, allowing to change asset distribution in case of high volatility.

Mitigations to be reviewed

Branch

All PR can be seen here, and have been linked in each issue's comments.

Individual PRs

Wherever possible, mitigations should be provided in separate pull requests, one per issue. If that is not possible (e.g. because several audit findings stem from the same core problem), then please link the PR to all relevant issues in your findings repo.

URLMitigation ofPurpose
https://github.com/GoodEntry-io/ge/pull/4H-01, H-04Remove complex fee clawing strategy
https://github.com/GoodEntry-io/ge/commit/a8ba6492b19154c72596086f5531f6821b4a46a2H-02Take unused funds into account for TVL
https://github.com/GoodEntry-io/ge/pull/3H-03Scale down sqrtPriceX96 to prevent overflow
https://github.com/GoodEntry-io/ge/pull/2H-05Send back unused funds to user
https://github.com/GoodEntry-io/ge/commit/8b0feaec0005937c8e6c7ef9bf039a0c2498529aH-06Use correct Uniswap for sol ^0.8 libs
https://github.com/GoodEntry-io/ge/pull/10M-01Added explicit require msg.sender == to
https://github.com/GoodEntry-io/ge/commit/bbbac57c110223f45851494971a34f57c55922c7M-02Prevent collect from reverting by adding a check that it doesnt try to collect 0
https://github.com/GoodEntry-io/ge/pull/11M-03Reworked activeTickIndex as per desc above
https://github.com/GoodEntry-io/ge/pull/8M-05, M-07Removed addDust mechanism, replaced by depositExactly in TR
https://github.com/GoodEntry-io/ge/pull/3M-06Added return value check

Out of Scope

M-04 is not really a problem as the team deploys the contract and can deposit a very small initial amount. The attack would then steal a negligible amount (likely less than the gas cost)