feat: integrate zkSync Era (324) as second-class Relay chain#11934
feat: integrate zkSync Era (324) as second-class Relay chain#11934gomesalexandre merged 8 commits intodevelopfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughAdds feature-flagged zkSync Era (EVM chainId eip155:324) support across the app: CAIP constants, chain adapter, viem/ethers clients, HDWallet capability flags, swapper mappings, Coingecko mappings, asset-generation scripts, CSP and env config, plugin registration, feature flags, and related UI/state updates. Changes
Sequence Diagram(s)sequenceDiagram
participant App as App (PluginProvider)
participant Plugin as zksyncera Plugin
participant AssetSvc as AssetService
participant Adapter as ZkSyncEraChainAdapter
participant Viem as viemZkSyncEraClient
participant Wallet as HDWallet
App->>Plugin: register() (feature flag check)
Plugin->>AssetSvc: getAssets() (filter by zkSync Era)
AssetSvc-->>Plugin: tokens list
Plugin->>Adapter: construct(rpcUrl, getKnownTokens)
Adapter->>Viem: use viemZkSyncEraClient (RPC calls)
Wallet->>Adapter: supportsZkSyncEra? (capability flag)
Adapter-->>Wallet: returns adapter instance (if supported)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Blast's public RPC rate-limits debug_traceTransaction to 0/sec from browser origins. Skip it entirely (like hyperEVM) and fall through to the WETH Withdrawal event fallback, which reliably detects ETH received from Across/Relay SpokePool fills (SpokePool always calls WETH.withdraw() before sending native ETH to recipient). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gomesalexandre
left a comment
There was a problem hiding this comment.
Does what it says on the box.
Tested World Chain, Blast, and zkSync Era - all happy: https://jam.dev/c/9163ecc7-52c6-4f1e-a413-11d15c1da35a
Also includes fix for Blast execution price not showing post-swap: Blast's public RPC rate-limits debug_traceTransaction to 0/sec from browser origins, so we skip it entirely (like HyperEVM) and fall through to the WETH Withdrawal event fallback - which reliably detects ETH received from Across/Relay SpokePool fills since SpokePool always calls WETH.withdraw() before sending native ETH to recipient.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/chain-adapters/src/evm/SecondClassEvmAdapter.ts`:
- Around line 408-410: The early-return guard in fetchInternalTransactions
currently excludes hyperEvmChainId and blastChainId but misses zkSyncEraChainId,
causing extractCalls(trace) to receive an array-shaped debug_traceTransaction
result and fail to extract internals; update the guard in
fetchInternalTransactions to include zkSyncEraChainId alongside hyperEvmChainId
and blastChainId so the function returns [] early for zkSync Era traces (this
aligns with the WRAPPED_NATIVE_CONTRACT_BY_CHAIN_ID handling).
zksync era returns trace in an array-wrapped structure unlike standard evm, causing extractCalls to silently fail. skip it like blast/hyperevm and fall through to the weth withdrawal fallback. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@packages/chain-adapters/src/evm/SecondClassEvmAdapter.ts`:
- Line 17: No code change required; the additions for zkSyncEra are correct —
ensure the import zkSyncEraChainId is present, the WETH address
0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91 is added to the chain map, and the
parseTx guard that skips debug_traceTransaction for zkSyncEra (matching the
existing logic for blastChainId and hyperEvmChainId) remains so the WETH
withdrawal log fallback is used; verify these symbols (zkSyncEraChainId, the
WETH address entry, parseTx, debug_traceTransaction, blastChainId,
hyperEvmChainId) are consistent with the established pattern and approve the
changes.
Description
Add support for zkSync Era (EVM chain, chainId 324) as a second-class citizen. zkSync Era is a ZK rollup Layer 2 with native ETH, using zero-knowledge proofs for security.
This is PR 11 of 17 in a sequential chain integration series. These PRs must be reviewed and merged in order, as each builds on the previous one (stacked branches).
PR merge order:
Implements: CAIP constants, chain adapter (SecondClassEvmAdapter), plugin, feature flag, Relay + Across swapper mappings, HDWallet support flags, CSP headers, asset generation script, viem/ethers client configuration, CoinGecko price feed integration, Zerion portfolio tracking, and all required shared-file entries.
Issue (if applicable)
Part of #11902
Risk
Low - All changes are behind the
ZkSyncErafeature flag (VITE_FEATURE_ZK_SYNC_ERA), disabled by default in production.No new on-chain transactions or contract interactions. Standard EVM chain support using existing SecondClassEvmAdapter pattern.
Testing
Engineering
VITE_FEATURE_ZK_SYNC_ERA=truein.env.developmentyarn devyarn lint— passes with 0 errorsyarn type-check— verify no new type errorsOperations
Screenshots (if applicable)
N/A - Behind feature flag, no visual changes until enabled.
Summary by CodeRabbit
New Features
Chores