fix(check-order-status): fall back to 12s block time for chains unsupported by sdk-core#671
Open
aayala-uniswap wants to merge 1 commit into
Open
Conversation
…chains getAverageBlockTimeSecs throws for chains not yet registered in sdk-core (e.g. Sepolia / chainId 11155111). This causes the check-order-status step function to crash on every retry for any order posted on those chains, surfacing as repeated TaskFailed errors: Error: getAverageBlockTimeSecs: unsupported chainId 11155111; register it in chains.ts before use Wrap the call in a try/catch and fall back to 12 s (Ethereum PoS slot time) so status tracking degrades gracefully instead of looping forever. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Problem
check-order-statusis crashing on every retry for orders on Sepolia (chainId 11155111) — and potentially any other chain inSUPPORTED_CHAINSnot yet registered in@uniswap/sdk-core:```
Error: getAverageBlockTimeSecs: unsupported chainId 11155111;
register it in chains.ts before use
at AVERAGE_BLOCK_TIME (check-order-status/util.ts:251)
```
This was observed in beta CloudWatch logs (
GoudaServicebetaCheckOrd) hitting repeatedly today (June 3), triggered by the order posted at 22:25 UTC. The step function retries indefinitely, never reaching a terminal state.Fix
Wrap
AVERAGE_BLOCK_TIMEin a try/catch. Falls back to 12 seconds (Ethereum PoS slot time) for any chain the SDK doesn't know about yet, so status tracking degrades gracefully instead of looping forever.Why 12s?
Sepolia uses the same 12s PoS slot time as Ethereum mainnet. It's also a safe conservative default for any other unknown chain — block-number arithmetic will be slightly off but won't crash.
Test plan
getAverageBlockTimeSecs: unsupported chainId 11155111errors inGoudaServicebetaCheckOrdlogs after deployyarn test)🤖 Generated with Claude Code