Skip to content

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
mainfrom
fix/check-order-status-unsupported-chain-block-time
Open

fix(check-order-status): fall back to 12s block time for chains unsupported by sdk-core#671
aayala-uniswap wants to merge 1 commit into
mainfrom
fix/check-order-status-unsupported-chain-block-time

Conversation

@aayala-uniswap

Copy link
Copy Markdown
Collaborator

Problem

check-order-status is crashing on every retry for orders on Sepolia (chainId 11155111) — and potentially any other chain in SUPPORTED_CHAINS not 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_TIME in 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.

export const AVERAGE_BLOCK_TIME = (chainId: ChainId): number => {
  try {
    return getAverageBlockTimeSecs(chainId)
  } catch {
    return 12
  }
}

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

  • No more getAverageBlockTimeSecs: unsupported chainId 11155111 errors in GoudaServicebetaCheckOrd logs after deploy
  • Existing unit tests pass (yarn test)
  • Order posted on Sepolia reaches a terminal state (filled / expired) rather than looping forever

🤖 Generated with Claude Code

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant