fix: retry dca on router trading limit reached - #1498
Merged
Conversation
|
Crate versions that have been updated:
Runtime version has been increased. |
|
Quick benchmark at commit a9bc627 has been executed successfully. |
There was a problem hiding this comment.
Pull request overview
Ensures DCA schedules treat pallet_route_executor::Error::TradingLimitReached as a retriable failure (with backoff) to prevent immediate termination on expected ERC20/aToken rounding shortfalls observed on mainnet.
Changes:
- Whitelist
pallet_route_executor::Error::TradingLimitReachedin the runtime’sRetryOnErrorForDcaconfiguration. - Add unit + integration coverage verifying the error is retried (with exponential backoff) and eventually terminates with
MaxRetryReachedonce retries are exhausted. - Bump runtime / crate versions and lockfile to reflect the runtime behavior change.
Reviewed changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| runtime/hydradx/src/lib.rs | Bumps spec_version to 434 for the runtime behavior change. |
| runtime/hydradx/src/assets.rs | Adds router TradingLimitReached to RetryOnErrorForDca whitelist. |
| runtime/hydradx/Cargo.toml | Bumps hydradx-runtime crate version to 434.0.0. |
| pallets/dca/src/tests/on_initialize.rs | Adds a unit test asserting retry/backoff behavior and MaxRetryReached termination. |
| pallets/dca/src/tests/mock.rs | Extends the test router mock to emit TradingLimitReached and wires a RetryOnError mock. |
| pallets/dca/Cargo.toml | Bumps pallet-dca crate version to 1.18.2. |
| integration-tests/src/dca.rs | Adds runtime whitelist assertion + mainnet replay integration test for schedule 33794. |
| integration-tests/Cargo.toml | Bumps runtime-integration-tests version to 1.105.0. |
| Cargo.lock | Updates locked versions for the bumped crates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+945
to
+947
| // same class as dca's own retriable TradeLimitReached — erc20/aToken rounding | ||
| // can undershoot the dry-run output passed as router min limit | ||
| pallet_route_executor::Error::<Runtime>::TradingLimitReached.into(), |
| asset_out: 222, | ||
| }] | ||
| .try_into() | ||
| .unwrap(), |
enthusiastmartin
approved these changes
Jul 29, 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.
Fixes #1497
pallet_route_executor::Error::TradingLimitReachedto theRetryOnErrorForDcawhitelist → retried with backoff instead of instant terminationTradeLimitReached)Tests:
SNAPSHOT_13260776, scraper--slim), replays block 13260777 — schedule 33812's pool-111 liquidity removal, then 33794 fails with routerTradingLimitReachedexactly like mainnet; asserts it is retried (verified red without the fix → terminates like mainnet)MaxRetryReachedtermination after retries exhaustedVersions: hydradx-runtime 434.0.0 + spec_version 434, pallet-dca 1.18.2, integration-tests 1.105.0