Fix EVM wallets stuck at 50% sync when only evmScanApiKey is configured - #6115
Open
j0ntz wants to merge 1 commit into
Open
Fix EVM wallets stuck at 50% sync when only evmScanApiKey is configured#6115j0ntz wants to merge 1 commit into
j0ntz wants to merge 1 commit into
Conversation
edge-currency-accountbased resolves the Etherscan API key for api.etherscan.io from the deprecated etherscanApiKey init option and throws before it considers evmScanApiKey, the option this repo documents and cleans. A build whose env.json carries only evmScanApiKey therefore sends a keyless request, which Etherscan V2 rejects with 'Missing/Invalid API Key'. The EvmScan adapter is the only adapter with a non-null fetchTxs on the 15 EVM networks routed through that host, so the rejected request leaves transaction history permanently unsynced. The token sync tracker averages balance and history progress, so a wallet with a complete balance and no history reports exactly 0.5 and the app shows it stuck at 50% forever. Supply the deprecated option from the supported one at the env layer, which takes effect without waiting on a plugin release. An explicitly configured etherscanApiKey still wins, and an empty evmScanApiKey adds nothing.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
This is a stopgap for EdgeApp/edge-currency-accountbased#1078, which fixes the same defect at its source. Remove this shim once the app depends on a release carrying that fix.
Requirements
If you have made any visual changes to the GUI. Make sure you have:
No visual changes. Tested on the iOS simulator because the fix is only observable as wallet sync behavior.
Description
Asana task
Coinhub reported that ETH will not sync, sitting at 50% for both new and existing ETH wallets, and that resyncing does not help. It survived a full rebase of their branch onto develop because it was never a code defect in that branch, it is a configuration trap.
edge-currency-accountbased'sgetEvmScanApiKeyresolves the Etherscan key forapi.etherscan.iofrom the deprecatedetherscanApiKeyinit option, and throws before it considersevmScanApiKey, which is the option this repo declares and cleans insrc/envConfig.ts:So a build box whose env.json carries only the documented
evmScanApiKeysends no key at all, and Etherscan V2 rejects keyless requests:EvmScanAdapteris the only adapter with a non-nullfetchTxson the 15 EVM networks routed through that host (RpcAdapter,BlockbookAdapterandAmberdataAdapterall set it tonull), so transaction history never completes. The plugin'smakeTokenSyncTrackeraverages balance and history progress, so a wallet with a complete balance and no history reports exactly0.5, which the app renders as a wallet permanently stuck at 50%.Edge's own env.json still carries the legacy
etherscanApiKey, which is why the Edge app is unaffected and why this only surfaced on a white-label build. Any build box provisioned from the key set this repo documents hits it.This supplies the deprecated option from the supported one at the env layer, which takes effect without waiting on a plugin release. An explicitly configured
etherscanApiKeystill wins, and an emptyevmScanApiKeyadds nothing.Testing
Verified end to end on the iOS simulator against an env.json shaped like a build box (only
evmScanApiKey, noetherscanApiKey), on the same account and the same ETH wallet in both passes:Loading Transactions... 49.9% Completewith an empty transaction list, exactly as reported.Screenshots of both states are attached in a comment below.
Also:
src/__tests__/envConfig.test.tscover the derivation, an explicitetherscanApiKeywinning, an unconfiguredevmScanApiKeyadding nothing, the behavior applying to every EVM plugin init, and a disabled plugin init stayingfalse.tsc --noEmit: clean.jest --ci: 94 suites, 567 tests, 107 snapshots, all passing. Also re-run green underAPP_CONFIG=coinhub(93 suites, 562 tests) on the coinhub branch, where this commit is cherry-picked.Note
Low Risk
Configuration-layer shim with explicit precedence rules and unit tests; no auth or payment logic; temporary until the currency plugin fix ships.
Overview
Stopgap for EVM wallets stuck at ~50% sync when
env.jsononly setsevmScanApiKey(no legacyetherscanApiKey). The account-based currency plugin still resolves Etherscan keys forapi.etherscan.iofrometherscanApiKeyonly, so keyless V2 requests fail and transaction history never completes—balance sync finishes while history stays empty, which averages to ~50% in the UI.At env load,
asEvmApiKeysnow copiesevmScanApiKeyintoetherscanApiKeywhen the deprecated field is missing or empty; an explicitetherscanApiKeystill wins, and emptyevmScanApiKeyadds nothing. Applies to all EVM plugin init blocks (not only Ethereum). New tests inenvConfig.test.tscover derivation, precedence, and disabled plugins. CHANGELOG updated. Remove this shim after the app depends on a plugin release with the upstream fix.Reviewed by Cursor Bugbot for commit 030444b. Bugbot is set up for automated code reviews on this repo. Configure here.