DEX aggregators (like 1inch) don’t guarantee they will consume all of the approved input tokens. Due to routing choices, rounding, and min‑amount constraints, they may leave a tiny remainder (“dust”) of the borrow token in the caller. Robust flash‑loan callbacks tolerate tiny dust (or clean it up), instead of requiring exact zero.
In Stratax._executeOpenOperation, after swapping the borrowed token back to the flash‑loan asset via 1inch, the code enforces exactly zero leftover borrow tokens:
Likelihood: Medium
Aggregators frequently don’t spend full allowance, leaving minimal dust by design (router safety/rounding), especially across multi‑hop paths or partial‑fill scenarios.
Tokens with quirky transfer/rounding rules will produce small mismatches occasionally. Both conditions occur in normal operations.
Impact: High
Operational DoS on open: The flash‑loan callback reverts at the “no‑dust” check, bricking position creation even though the swap result is otherwise sufficient to repay the flash loan.
Poor UX / fragility: Small routing differences between blocks (or chains) unpredictably cause opens to fail, forcing operators to retry and absorb extra gas.
Copy test test_NoDustCheckBricksOpenWhen1WeiLeftover() to test/fork/Stratax.t.sol: inside the StrataxForkTest contract.
Copy mock contract MockOneInchRouterLeavesDust to test/fork/Stratax.t.sol: after the StrataxForkTest contract.
Run command forge test --mt test_NoDustCheckBricksOpenWhen1WeiLeftover --via-ir -vv.
Output:
Relax the check to tolerate tiny dust (or sweep it), e.g.:
Replace strict equality with a tolerance (configurable or a small constant).
Optionally sweep small borrow‑token dust by swapping it in a subsequent short path (only if dust ≥ a minimal economic threshold) or re‑supplying it to Aave.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.