Repository navigation
Keep mnemonic words out of exception messages - #161
Merged
ebellocchia merged 1 commit intoOct 20, 2026
Merged
Conversation
A misspelled word made the language detection copy the whole mnemonic into the ValueError message. The word lookup, the TON seed generator and the BIP39, Algorand and Monero checksum errors also put words or checksum bits of the mnemonic in their messages. The word lookup also chained the KeyError holding the word to its ValueError. It now raises without a caught exception. Close ebellocchia#160
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.
When the language is not given, a mnemonic with one misspelled word raises a
ValueErrorthat holds the whole mnemonic. I found five more messages with the same problem: the word lookup names the word it did not find,TonSeedGeneratorprints the whole mnemonic, and the BIP39, Algorand and Monero checksum errors print checksum words or bits of the mnemonic.This PR removes the mnemonic data from all six messages and keeps the exception types. The word lookup also chained the
KeyErrorholding the word, so it now raises with no exception chained. Thetest_invalid_mnemonictests of BIP39, Algorand, Monero, Polyseed, TON and Electrum v1/v2 now check the message and the chain. All seven fail on master. Closes #160.