ton only wallet crash when update to cypherpunk
What changed, and why it matters
This commit fixes a firmware crash that could occur when a wallet created with only a TON (The Open Network) mnemonic was upgraded to the 'cypherpunk' firmware version. The crash happened because two code paths that handle public key/account setup did not recognize TON-only wallets and tried to perform operations that are invalid for them. The fix adds explicit TON checks so those paths return early instead of crashing.
Treat this as a reliability/availability fix. Verify that TON-only wallets can complete the cypherpunk update and subsequent account operations without crashing. Review other upgrade paths for similar missing MNEMONIC_TYPE_TON guards, and consider adding regression tests for TON-only wallet firmware updates.
Security signals we found
Denial-of-service condition: device crash during firmware update for a specific wallet type
Logic flaw: missing mnemonic-type guard for TON-only wallets in account setup paths
Preprocessor conditional (WEB3_VERSION) incorrectly excluded TON guard in some builds
Evidence from the diff
The patch removes a WEB3_VERSION preprocessor guard around a TON-only early return in AccountPublicInfoSwitch(), ensuring the guard is active in all builds. It also adds MNEMONIC_TYPE_TON to an early-return condition in SetupZcashCache(). Both changes prevent TON-only wallets from entering code paths that assume a standard BIP39/SLIP39 key structure, which caused a crash during the cypherpunk firmware update path.
Changed components
src/crypto/account_public_info.csrc/managers/account_manager.cTON-only wallet upgrade flow to cypherpunk firmwareInspect captured patch +1 / −3
diff --git a/src/crypto/account_public_info.c b/src/crypto/account_public_info.c
index 2950d85..4a97992 100644
--- a/src/crypto/account_public_info.c
+++ b/src/crypto/account_public_info.c
@@ -963,11 +963,9 @@ int32_t AccountPublicInfoSwitch(uint8_t accountIndex, const char *password, bool
bool regeneratePubKey = newKey;
ASSERT(accountIndex < 3);
-#ifdef WEB3_VERSION
if (GetMnemonicType() == MNEMONIC_TYPE_TON) {
return ret;
}
-#endif
FreePublicKeyRam();
//Load Multisig wallet Manager
diff --git a/src/managers/account_manager.c b/src/managers/account_manager.c
index 46899ec..6b09657 100644
--- a/src/managers/account_manager.c
+++ b/src/managers/account_manager.c
@@ -645,7 +645,7 @@ int32_t SetupZcashCache(uint8_t accountIndex, const char* password)
{
ASSERT(accountIndex <= 2);
- if (GetMnemonicType() == MNEMONIC_TYPE_SLIP39) {
+ if (GetMnemonicType() == MNEMONIC_TYPE_SLIP39 || GetMnemonicType() == MNEMONIC_TYPE_TON) {
return SUCCESS_CODE;
}
Why this scored 41/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.