fix: dca rounding error from omnipool - #1449
Merged
Merged
Conversation
Aave aTokens are rebasing — `balanceOf` returns `rayMul(scaledBalance, liquidityIndex)`, which can round below the amount that was just transferred in. That trips the omnipool's pre-trade `ensure_can_withdraw` during a DCA execution and previously terminated the schedule. Add `pallet_omnipool::Error::InsufficientBalance` to `RetryOnErrorForDca` so the schedule is retried on a later block instead. Aave's `getReserveNormalizedIncome` is timestamp-dependent, so the rounding boundary moves between blocks and a later attempt succeeds. Test `dca_omni_should_succeed_after_retry_with_timestamp_drift` covers the full flow: first attempt fails with `InsufficientBalance`, retry is scheduled, timestamp drift moves the index, retry succeeds, counter resets. Snapshot replaced with a 16 MB slim version (vs. 385 MB). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rename SNAPSHOT to SNAPSHOT_12309734 to make the captured block explicit, and add the exact scraper invocation as a comment above PATH_TO_SNAPSHOT so the snapshot can be reproduced deterministically. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Crate versions that have been updated:
Runtime version has been increased. |
enthusiastmartin
approved these changes
May 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
aave returns balance with off by one, leading to this.
https://hydration.subscan.io/block/12309735?tab=event&event=12309735-8
