fix: correct inverted balance/min_base values in OPG insufficient-balance error#219
Merged
adambalogh merged 1 commit intoOpenGradient:mainfrom Apr 1, 2026
Conversation
Contributor
Author
adambalogh
approved these changes
Apr 1, 2026
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: Misleading Error Message in
ensure_opg_approvalFile:
src/opengradient/client/opg_token.py—ensure_opg_approval()What's broken
On line 207, when the wallet balance is below the minimum required allowance, the error message displays the two values in the wrong order:
The printed comparison
(min_base < {balance})is logically inverted — the condition fires precisely whenmin_base > balance, so printingmin_base < balanceshows a false statement and confuses debugging.Fix
Replace with a clear, accurate message that shows actual wallet balance vs. requirement:
Impact
Users encountering this error while debugging a low-balance issue would see a backwards comparison like
(1000000000000000000 < 500000000000000000)— which appears to say they have more than enough, when they actually don't. This causes significant confusion and wasted debugging time.Files Changed
src/opengradient/client/opg_token.py