drop the duplicate default-token pass after EVM wallet init (#3774)
What changed, and why it matters
This commit removes redundant code that was adding default cryptocurrency tokens and saving the wallet file twice whenever an Ethereum-compatible (EVM) wallet was created, opened, or restored. The duplicate work was already being done inside the wallet's initialization routine, so the extra calls were unnecessary. It is a cleanup/refactoring change with no apparent security impact.
No security action required; treat as routine code-quality cleanup. Reviewers may verify that `EVMChainWallet.init()` indeed calls `addInitialTokens()` and `save()` on all relevant code paths to confirm functional equivalence.
Security signals we found
No security-relevant behavior change: only duplicate operations removed
No input validation, authentication, cryptographic, or network code modified
No privilege boundary crossed
Evidence from the diff
The patch deletes duplicate wallet.addInitialTokens() and wallet.save() calls from six call sites in EVMChainWalletService (create, open, restore, and related flows). EVMChainWallet.init() already invokes initErc20Tokens() which calls addInitialTokens() and then save(), making the removed lines a second identical pass. The change reduces redundant I/O and token rewrites but does not alter access control, validation, cryptography, or network behavior.
Changed components
cw_evm/lib/evm_chain_wallet_service.dartInspect captured patch +0 / −12
### cw_evm/lib/evm_chain_wallet_service.dart
@@ -131,8 +131,6 @@ class EVMChainWalletService extends WalletService<
);
await wallet.init();
- await wallet.addInitialTokens();
- await wallet.save();
return wallet;
}
@@ -152,8 +150,6 @@ class EVMChainWalletService extends WalletService<
);
await wallet.init();
- await wallet.addInitialTokens();
- await wallet.save();
await saveBackup(name);
return wallet;
} catch (_) {
@@ -167,8 +163,6 @@ class EVMChainWalletService extends WalletService<
);
await wallet.init();
- await wallet.addInitialTokens();
- await wallet.save();
return wallet;
}
}
@@ -258,8 +252,6 @@ class EVMChainWalletService extends WalletService<
);
await wallet.init();
- await wallet.addInitialTokens();
- await wallet.save();
return wallet;
}
@@ -298,8 +290,6 @@ class EVMChainWalletService extends WalletService<
);
await wallet.init();
- await wallet.addInitialTokens();
- await wallet.save();
return wallet;
}
@@ -336,8 +326,6 @@ class EVMChainWalletService extends WalletService<
);
await wallet.init();
- await wallet.addInitialTokens();
- await wallet.save();
return wallet;
}
Why this scored 19/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.