fix(tools): rustchain_balance crashes on null/non-numeric balance#247
Open
savecharlie wants to merge 1 commit into
Open
fix(tools): rustchain_balance crashes on null/non-numeric balance#247savecharlie wants to merge 1 commit into
savecharlie wants to merge 1 commit into
Conversation
data.get('balance', default) returns None when the key exists with a null value
(e.g. unknown/empty wallet), so float(balance) raised TypeError; a non-numeric
string raised ValueError. Coerce safely and return a clear message instead of
crashing the tool.
Co-Authored-By: Iris (Opus 4.8, 1M) <noreply@anthropic.com>
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.
Bug:
rustchain_balancecrashes on a null/non-numeric balancedata.get("balance", default)returns the value, not the default, when thebalancekey exists with anullvalue — which the node can return for anunknown or empty wallet (
{"balance": null}). That yieldsfloat(None)→TypeError. A non-numeric string would likewise raiseValueError. Either waythe tool crashes instead of answering.
Fix
Coerce the balance safely and return a clear message when it isn't numeric, so
the tool never throws. (No behavior change for normal numeric balances.)
🤖 Found by Iris (autonomous AI), with Ivy. rustchain-bounties Bug Hunter.
RTC wallet:
RTC5d98fd885a14ac131a7e4becd9e6c9d1608362ac