Skip to content

feat(indexer): add Robinhood Chain (4663) - #20

Merged
AryanGodara merged 2 commits into
mainfrom
feat/robinhood
Nov 20, 2026
Merged

AryanGodara merged 2 commits into
mainfrom
feat/robinhood

Conversation

@AryanGodara

@AryanGodara AryanGodara commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Description

Adds Robinhood to the indexer, so CoW Swap can show EOA TWAPs on Robinhood: their parts, the live part for cancelling, and the user's CoW Shed.

Changes

  • src/chains/robinhood.ts, registered in CHAIN_CONFIGS:
    • ComposableCoW from block 94383853, its deploy block.
    • CoW Shed factories 0x221c… and 0x0a65…. legacy is left out, same as ink.
    • Settlement and flash loans off, as on Ink.
    • blockTime 0.1s. Orderbook poll and reorg window as on Base.
  • @cowprotocol/cow-sdk ^9.2.6 -> ^9.3.3 for SupportedChainId.ROBINHOOD.
  • viem → ^2.57.13. Ponder takes each chain's finality depth and multicall3 address from viem/chains, which has Robinhood only since 2.55.0. On the old version, context.client.multicall throws on 4663.
  • Ponder patch: finality depth of 600 blocks (~60 s) for 4663, as fix(indexer): adjust Base block time #18 did for Base.
  • ROBINHOOD_RPC_URL added to .env.example and docs/deployment.md.

How to test

  • Ran lint, typecheck, codegen and tests, all pass.
  • Ran a Robinhood-only build against Alchemy (ponder start + Postgres, default ethGetLogsBlockRange). The backfill from 94,383,853 to the tip (24.7M blocks) took 38 min with no RPC errors. It then ran live for 10 min at ≤ 1s lag (~10 blocks/s), with /readyz returning 200 throughout.

After merge, this needs a release (v0.4.7) so I can bump the image in the infra repo for the Robinhood launch.

Signed-off-by: Aryan Godara <aryangodara03@gmail.com>
@AryanGodara AryanGodara self-assigned this Nov 13, 2026
@socket-security

socket-security Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​cowprotocol/​cow-sdk@​9.2.6 ⏵ 9.3.397 +1810010099 +1100
Updatedviem@​2.46.3 ⏵ 2.57.1397100100 +198 +1100

View full report

Comment thread docs/deployment.md

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ AI Review (Claude Opus 5.5, worked 5m): config checks out on-chain; please confirm a run against Robinhood reaches and holds the tip

Finding: [QUESTION] Has the indexer been run against Robinhood up to the tip? This release can't be promoted for any chain until Robinhood is healthy

  • Location: src/chains/index.ts (ACTIVE_CHAINS = ALL_DEFINED_CHAINS), src/api/index.ts:35 (/readyz), src/api/freshness.ts:10 (DEFAULT_MAX_LAG_SECONDS = 300)
  • /readyz returns 200 only after Ponder's /ready passes, which needs historical sync done on every chain, and only while every active chain is within 300s of the tip. Robinhood is always active, so if Robinhood is slow or stuck, the v0.4.7 rollout never gets promoted. That holds back all 12 chains, not only Robinhood.
  • Robinhood is now the fastest chain we index: 100ms blocks, which is 2x Base and 3x Arbitrum. Prod /status shows Base and Arbitrum about 1s behind the tip today, so we know 3–5 blocks/s works. Nobody has watched 10 blocks/s yet. The PR's testing section only lists lint, typecheck, codegen and tests.
  • Backfill size: ComposableCoW starts at 94,383,853 and the head is about 117.5M, so roughly 23M blocks. With the default ethGetLogsBlockRange of 1000, that's about 23k eth_getLogs calls per contract (ComposableCow and CoWShedFactory).
  • Rollout ordering: viem 2.57 adds 4663 to viem/chains. Ponder now finds a match for this chain, so if ROBINHOOD_RPC_URL is unset it no longer fails at startup. It quietly uses viem's public rpc.mainnet.chain.robinhood.com and only logs a warning (build/config.js, buildConfig). The infra change needs to add the RPC env var together with the image bump.

Suggested fix

  • Add the actual results to the PR body from a local pnpm dev run against a Robinhood RPC: how long the backfill took, that live lag stays under 300s, and that /readyz returns 200.
  • In the infra PR, set ROBINHOOD_RPC_URL (and preferably ROBINHOOD_WS_RPC_URL). If the provider allows it, consider raising ETH_GET_LOGS_BLOCK_RANGE_4663 above 1000, since 1000 blocks is only about 100s of chain time here.

Finding: [NON-BLOCKING] Add the fixed-block-cadence note to robinhood.ts, like base.ts has

  • Location: src/chains/robinhood.ts:4-8, ponder.config.ts:148,162,176, src/constants.ts:59
  • Some intervals are fixed block counts and don't scale with blockTime. At 100ms, FlashLoanOrderEnricher, OwnerBackfillLive and CancellationWatcher fire every 10 blocks, about once per second. The DETERMINISTIC_CANCEL_SWEEP_INTERVAL re-reads singleOrders() for each deterministic generator every 100 blocks, about every 10s. On mainnet that's every 20 min.
  • fix(indexer): adjust Base block time #18 wrote down exactly this trade-off in base.ts. The Robinhood comment only covers finality, so the next person tuning RPC load won't find it.

Suggested fix

  • Copy the "fixed block counts do NOT scale" paragraph from base.ts into robinhood.ts with Robinhood's numbers (≈1s handlers, ≈10s cancel sweep).
Review scope and related context

No human review threads yet. The only comment is the Socket bot's dependency scan, and nothing here repeats it.

Checked against PR head 8758899, no issues found:

  • Addresses and start blocks. I recomputed the CREATE2 addresses from the deploy tx inputs (deployer 0x4e59…956c). ComposableCoW 0xfdaF…3b74 was deployed in 94,383,853 and CoWShed factory 0x0a65…7213 in 94,384,309, matching startBlock. 0x5e28… and 0xc94f… have no code on 4663, which matches the comment.
  • viem bump. Ponder looks up finalityBlockCount and multicall3 through the viem/chains match. Without the bump, 4663 would fall back to the default of 30 blocks (~3s) and the patch would never apply. viem 2.57.13 defines 4663 with multicall3 0xca11…ca11, and that contract has code on-chain. The lockfile resolves to a single viem (2.57.13), and the ponder patch hash is updated.
  • cow-sdk 9.3.3. It pulls major bumps of sub-packages (sdk-app-data 6, sdk-contracts-ts 4), but this repo imports only SupportedChainId, so no runtime code is affected.
  • orderbookApiPath: "robinhood". api.cow.fi/robinhood/api/v1/version responds (v2.388.1).
  • Finality and wall-clock settings. Finality of 600 blocks (~60s), a 40s orderbook recheck (400 blocks), and the 1200s reorg window all match Base and Arbitrum.
  • Checks. pnpm codegen, typecheck, lint and test (214 tests) all pass.
🤖 Prompt for AI agents
Verify these findings against current code on PR #20 (Robinhood Chain 4663). Keep changes minimal.

1. Validation / rollout (no code change expected):
   - /readyz (src/api/index.ts) requires Ponder /ready plus every ACTIVE_CHAINS entry within
     DEFAULT_MAX_LAG_SECONDS=300 (src/api/freshness.ts). Robinhood is always active.
   - Run `pnpm dev` against a Robinhood RPC; record backfill duration from block 94383853,
     live lag, and /readyz status. Add the observed results to the PR body.
   - Note for the infra PR: with viem >=2.55 an unset ROBINHOOD_RPC_URL falls back to viem's public
     RPC instead of failing; set ROBINHOOD_RPC_URL (and optionally ETH_GET_LOGS_BLOCK_RANGE_4663).

2. Docs-only change in src/chains/robinhood.ts:
   - Mirror the base.ts comment about fixed block counts not scaling with blockTime:
     FlashLoanOrderEnricher / OwnerBackfillLive / CancellationWatcher every 10 blocks (~1s at 0.1s),
     DETERMINISTIC_CANCEL_SWEEP_INTERVAL 100 blocks (~10s), TRY_NEXT_BLOCK backoff <= 50 blocks (~5s).
   - Run pnpm lint and pnpm typecheck.

Generated using the pr-review skill from the CoW Protocol skills repo.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran it against RH. The backfill from 94,383,853 took 38 min with no RPC errors, then 10 min live at <= 1s lag with /readyz 200 throughout.

I've added the results to the description.
And ROBINHOOD_RPC_URL is in 1pw, the infra PR will it alongwith the image bump.

smol correction: prod probes /health, not /readyz, so a slow Robinhood wouldn't hold back the other chains.

@AryanGodara
AryanGodara requested a review from azebuado November 20, 2026 13:41
Signed-off-by: Aryan Godara <aryangodara03@gmail.com>
@AryanGodara
AryanGodara merged commit 4179991 into main Nov 20, 2026
3 of 4 checks passed
@AryanGodara AryanGodara mentioned this pull request Nov 20, 2026
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.

2 participants