Skip to content

chore: prefer NEXT_PUBLIC_L2_RPC_URL over Infura so local forks receive traffic #747

Description

@rickstaa

lib/chains.ts:107-117 builds the RPC list with Infura first and the configured override second:

[chain.arbitrum.id]: [
  `https://arbitrum-mainnet.infura.io/v3/${INFURA_KEY}`,
  process.env.NEXT_PUBLIC_L2_RPC_URL,
].filter(Boolean)

viem's fallback() prefers the first entry and only rolls over on failure, so setting NEXT_PUBLIC_L2_RPC_URL makes the custom endpoint a backup to Infura rather than a replacement. Traffic keeps going to mainnet Infura.

That blocks local fork testing: pointing the explorer at anvil --fork-url … --chain-id 42161 has no effect. Blanking INFURA_KEY is not an option either — lib/chains.ts:21 throws without it.

Fix

When NEXT_PUBLIC_L2_RPC_URL (and the L1 equivalent) is set, put it first, or make it exclusive.

Unblocks testing flows that should not touch mainnet — treasury proposal creation and the transaction-lifecycle work in #739 both need it.

Related

#664 — wagmi config missing transports, same area.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions