What changed, and why it matters
This commit adds a try/catch around a balance lookup for Ethereum-based tokens. If the network call fails, the wallet now silently records a zero balance instead of crashing or showing an error. On its own this looks like a stability improvement, but it could hide real balances if a node or network problem makes the lookup fail.
Treat this as a low-severity reliability issue unless it is part of a larger pattern of suppressing balance errors. If reviewing further, check whether other balance-fetch paths also swallow exceptions, whether the catch block should log or surface the error, and whether a zero balance could mislead users during node outages or RPC censorship.
Security signals we found
Silent failure path introduced: any exception during balance fetch is swallowed and replaced with a zero balance
No error logging or user notification for the catch block
Potential for displayed balance to diverge from on-chain balance due to transient node/network errors
Evidence from the diff
In cw_evm/lib/evm_chain_wallet.dart, the code that fetches an ERC-20 token balance is now wrapped in a try/catch. On any exception, the balance map is set to EVMChainERC20Balance(Money.zero(newToken)). This suppresses errors from fetchERC20Balances and treats all failures as a zero balance. There is no logging, retry, or user-facing indication that the fetch failed.
Changed components
cw_evm/lib/evm_chain_wallet.dartERC-20 token balance display for EVM chainsInspect captured patch +5 / −1
### cw_evm/lib/evm_chain_wallet.dart
@@ -1436,7 +1436,11 @@ abstract class EVMChainWalletBase
final newToken = createNewErc20TokenObject(token, iconPath);
if (newToken.enabled) {
- balance[newToken] = await _client.fetchERC20Balances(_evmChainPrivateKey.address, newToken);
+ try {
+ balance[newToken] = await _client.fetchERC20Balances(_evmChainPrivateKey.address, newToken);
+ } catch (_) {
+ balance[newToken] = EVMChainERC20Balance(Money.zero(newToken));
+ }
await newToken.save();
} else {Why this scored 23/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.