Using Trail Of Bits Fix Review
$ claude
> /fix-review v0.8.1-beta develop --report report-competition-ammalgam.pdf
The initial scan did not find 3.2.10 and 3.2.12; these hashes were provided as additional inputs.
Source: v0.8.1-beta (976dcb9e)
Target: develop (e6b0c756)
Report: Cantina Competition - Ammalgam Contracts
Date: 2026-01-28
| Category | Count |
|---|---|
| Commits Analyzed | ~55 |
| HIGH Findings | 12 |
| MEDIUM Findings | 14 |
| FIXED | 26 |
| PARTIALLY_FIXED | 0 |
| NOT_ADDRESSED | 0 |
| Bug Introduction Concerns | None identified |
| Finding | Title | Status | Commit | Notes |
|---|---|---|---|---|
| 3.1.1 | onlyOwner should be applied to setPluginRegistry | FIXED | 7d6d17ce | Access control added |
| 3.1.2 | Parameter ordering bug in swap fee calculation | FIXED | cd2d4171 | Parameter order corrected |
| 3.1.3 | Interest underestimates initial borrower interest | FIXED | 7b8786a9 | Interest calculation fixed |
| 3.1.4 | Liquidity overpayment allows bad debt | FIXED | d2186c08 | Overpayment handling improved |
| 3.1.5 | Liquidation premium always rounds down | FIXED | c559ab93 | Rounding direction corrected |
| 3.1.6 | Incorrect observation index from TWAP | FIXED | 1e7bd94c | Index calculation fixed |
| 3.1.7 | Burn more than outstanding debt when depleted | FIXED | c90b7771 | Depleted logic removed entirely |
| 3.1.8 | Bypass saturation penalty during depletion | FIXED | fdfc6a98, f1ccc48b | Explicit saturation updates added |
| 3.1.9 | Unsafe withdraw during asset depletion | FIXED | c90b7771 | Depleted logic removed |
| 3.1.10 | Interest grows less than expected for short durations | FIXED | 2cae6962 | Swap fee growth refactored |
| 3.1.11 | Insufficient validation causes deposit to fail | FIXED | 0065bc5a | Validation improved |
| 3.1.12 | Incorrect rounding in burn functions | FIXED | aea59c71, 114f5dfc | Rounding direction corrected |
| Finding | Title | Status | Commit | Notes |
|---|---|---|---|---|
| 3.2.1 | Quadratic fee growth applied past 4000 bips | FIXED | 913518b7 | Boundary conditions fixed |
| 3.2.2 | Saturation fee could be applied twice | FIXED | d7d9dc98 | Double application prevented |
| 3.2.3 | Fee calculation uses wrong reserve reference | FIXED | cd2d4171 | Reserve reference corrected |
| 3.2.4 | Attacker can front-run and receive higher fees | FIXED | (via 3.2.6) | Addressed by interest refactor |
| 3.2.5 | Interest accrual order affects outcome | FIXED | 02a30d0a | Accrual ordering fixed |
| 3.2.6 | Incorrect ordering in repayLiquidity | FIXED | 78e80490 | Operation ordering corrected |
| 3.2.7 | Saturation calculation rounding issues | FIXED | cd3cf2ed | Rounding corrected |
| 3.2.8 | Fee loss from rounding error | FIXED | 913518b7 | Boundary conditions fixed |
| 3.2.9 | Liquidation despite LTV below 100% | FIXED | c90b7771 | Depleted logic removed |
| 3.2.10 | Burners receive excess lending fee | FIXED | 85735c78, 2cae6962 | Issue #1018, swap fee growth refactoring |
| 3.2.11 | Burners receive excess swap fees in current block | FIXED | 2cae6962 | Issue #984, swap fee growth removed |
| 3.2.12 | Liquidity of pool cannot be fully utilized | FIXED | 85735c78 | Issues #1019, #1016 |
| 3.2.13 | Unsafe casts in getClosestSafeValues() | FIXED | 9aaefd92 | Safe casting refactored |
| 3.2.14 | User minimum values not checked | FIXED | 82998744 | Protocol fees with validation |
The most significant fix removed the entire “depleted asset” mechanism which was the root cause of multiple vulnerabilities (3.1.7, 3.1.9, 3.2.9). This architectural change:
depletionReserveAdjustmentWhenAssetIsAdded()Convert.calcLiquidityConsideringDepletion()