fix: wrap settlement.ts RPC calls in withTimeout, remove decode dead code (COW-991)#84
Conversation
…code (COW-991) Applies the COW-921 timeout discipline to the Settlement event handler: wraps getTransactionReceipt, getCode, call, and readContract in withTimeout using BLOCK_HANDLER_RPC_TIMEOUT_MS. Removes the decode-only-for-logging decodeAbiParameters block (F10) and replaces the inaccurate "volume is negligible" comment with the actual observed figure (27k+ adapters). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Indexer review — settlement.ts RPC timeout wrapping Good addition of The four calls — Consider either:
The |
|
Code review — settlement.ts withTimeout (COW-991) Worst-case latency per settlement event The handler now makes up to 4 sequential RPC calls per matching Trade log, each guarded by
For a settlement with N Trade logs that are all unseen contract addresses (e.g. a batch flashloan with many adapters), the sequential worst-case is Tighter timeout warranted for inner-loop calls
Dead code removal looks correct The removal of Summary: No bugs. One actionable recommendation: use a ~3–5 s timeout for |
…ndler (COW-991) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| ); | ||
| } catch (err) { | ||
| if (err instanceof TimeoutError) return; | ||
| throw err; |
There was a problem hiding this comment.
If any error is throw ponder will stop the indexing. Instead of having this here, it probably makes more sense to have a clear pool based async method as we have for the composable cow orders.
On the Anxo feedback report it mentions a decision of reserve I/O to block handlers. I think this was a misunderstanding of one of ours ADRs but it would make the system more robust.
There was a problem hiding this comment.
Refactored to pool-based: the event handler now just enqueues the tx hash into a settlementQueue table, and a new SettlementResolver:block handler drains the queue and does all RPC work — no throw anywhere, errors warn and skip.
…r (COW-991) The GPv2Settlement event handler now only enqueues the tx hash into settlementQueue. A new SettlementResolver:block handler drains the queue and performs all RPC calls (getTransactionReceipt, getCode, call, readContract). RPC errors warn + skip rather than re-throw, so the indexer can never crash from a transient node failure in settlement processing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…f8-wrap-settlement-rpc-calls-in-withtimeout
…entChains SettlementResolver now uses settlementChains.map() (chains with a flash loan router) instead of hardcoded mainnet, consistent with develop's dynamic chain config pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
yvesfracari
left a comment
There was a problem hiding this comment.
Please update the documentation on how the lifecycle of this kind of order works.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Added a lifecycle description for the flash loan adapter order flow in Stage 1 — Stage 2 — Also updated the overview paragraph to mention both stages and the |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…r import, handler renames (COW-991) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Grant Review Finding
[F8]
settlement.tsRPC calls not wrapped inwithTimeout+ inaccurate "negligible volume" comment — MINOR (correctness) (COW-991)Summary
settlement.ts(getTransactionReceipt,getCode,call,readContract) inwithTimeout(BLOCK_HANDLER_RPC_TIMEOUT_MS), applying the same COW-921 timeout discipline used in block handlersdecodeAbiParametersblock — the only consumer was theconsole.log; the log now showsadapter,eoa,block,chaindecodeAbiParametersfrom viem importTest plan
pnpm typecheck— passespnpm test— 19/19 passingwithTimeoutwrapper with a descriptive labelgetTransactionReceiptreturns early; TimeoutError on inner calls continues to next log🤖 Generated with Claude Code