Skip to content

fix: pass import+approve token e2e tests [PoC]#407

Open
dewanshparashar wants to merge 5 commits into
masterfrom
fix/e2e-wagmi-arbitrum-one
Open

fix: pass import+approve token e2e tests [PoC]#407
dewanshparashar wants to merge 5 commits into
masterfrom
fix/e2e-wagmi-arbitrum-one

Conversation

@dewanshparashar

@dewanshparashar dewanshparashar commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Important: this is just a POC. It is definitely worth breaking this into 3-4 focused, production-ready PRs. It is marked ready-for-review to let E2Es run.

The import token E2E tests were failing on every PR for months. It turned out to be five separate issues stacked on top of each other. Fixing all five (one commit each) got the tests passing.

What was wrong, step by step

  1. The E2E wagmi chain list was missing Arbitrum One. The import test bridges Ethereum -> Arbitrum One, and since the reown migration (feat(bridge): migrate rainbowkit to reown #293) a destination chain missing from the AppKit config breaks the page. Added arbitrum to the E2E chain list.

  2. The lifi token registry was too big to cache. The serialized registry (~2.6MB) is over Next.js' 2MB unstable_cache limit, so every cache write silently failed and every request refetched everything from li.quest. Trimmed the cached value to ~170KB (route output verified identical for all 25 chain pairs).

  3. The token search store was derived in a second async hook, so it could lag behind the fetched lists. It's a cheap synchronous derivation, so it now runs in useMemo during render.

  4. The E2E login helper passed an invalid chain pair. It forced destinationChain=nitro-testnode-l3 even when a test explicitly connects to Ethereum. It now only applies the L3 default when no network override is given.

  5. SWR was losing the token lists result. CI instrumentation showed the fetch resolving while every subscriber kept getting data: undefined, isLoading: false — indefinitely, with React rendering normally. useTokenLists now uses a small module-level store (cache + in-flight dedupe + useSyncExternalStore) instead of SWR, so a subscriber can never miss the result.

Result

All 5 import E2E jobs green: https://github.com/OffchainLabs/arbitrum-portal/actions/runs/29520381584

Copilot AI review requested due to automatic review settings July 16, 2026 13:48
@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
arbitrum-portal Ready Ready Preview Jul 16, 2026 5:37pm

Request Review

@dewanshparashar dewanshparashar changed the title fix(bridge): add arbitrum one to the e2e wagmi chain list wip(bridge): add arbitrum one to the e2e wagmi chain list Jul 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the E2E AppKit/Wagmi network configuration so the import-token E2E flow (Ethereum -> Arbitrum One) includes Arbitrum One in the configured chain list, preventing the re-render loop that leaves token search stuck.

Changes:

  • Add arbitrum to the E2E-only AppKit network list in Wagmi/AppKit setup.
  • Add a brief comment explaining why mainnet is included in the E2E chain list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/arb-token-bridge-ui/src/util/wagmi/setup.ts
@dewanshparashar

Copy link
Copy Markdown
Contributor Author

Cherry-picked the lifi registry cache fix from #406 onto this branch — the import test needs both fixes: the E2E chain list fix (this PR) and the cache fix (#406). Without the cache fix every page load refetches the full lifi token registry from li.quest, which alone blows past the test's 30s window. Will rebase once #406 merges.

@dewanshparashar dewanshparashar changed the title wip(bridge): add arbitrum one to the e2e wagmi chain list fix(bridge): get import token e2e tests green [WIP] Jul 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment on lines +20 to +21
// Derived synchronously so the tokens can never lag behind the fetched lists,
// which an extra async hook allowed under heavy re-rendering

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we used SWR because otherwise each caller of this hook would fetch and return their own instances, this was causing performance issues

@dewanshparashar dewanshparashar Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Understood. Worth noting that this is only a PoC which tries to get E2Es passing again by fixing some erroring parts of the bridge. If removing token-list SWR got the E2Es passing, then it doesn't necessarily mean we will remove SWR, but that the current implementation is worth going over and optimizing a bit to find out what's wrong with it. Just gives us a starting point of where to poke.

@dewanshparashar dewanshparashar changed the title fix(bridge): get import token e2e tests green [WIP] fix(bridge): fix import token e2e tests [WIP] Jul 17, 2026
@dewanshparashar dewanshparashar changed the title fix(bridge): fix import token e2e tests [WIP] fix(bridge): fix import+approve token e2e tests [WIP] Jul 17, 2026
@dewanshparashar dewanshparashar changed the title fix(bridge): fix import+approve token e2e tests [WIP] fix(bridge): fix import+approve token e2e tests [PoC] Jul 17, 2026
@dewanshparashar dewanshparashar changed the title fix(bridge): fix import+approve token e2e tests [PoC] fix: pass import+approve token e2e tests [PoC] Jul 17, 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.

3 participants