Better reporting of negative balance in transaction balancing#799
Merged
carbolymer merged 1 commit intoApr 14, 2025
Merged
Conversation
2f12867 to
7f277ba
Compare
7f277ba to
2c1c371
Compare
2c1c371 to
b36cb5c
Compare
Contributor
Author
|
@Unisay FYI |
b36cb5c to
98cb118
Compare
Jimbo4350
approved these changes
Apr 11, 2025
Contributor
Jimbo4350
left a comment
There was a problem hiding this comment.
LGTM! A couple comments.
| -> Either | ||
| (TransactionValidityError era) | ||
| (Map ScriptWitnessIndex (Either ScriptExecutionError (EvalTxExecutionUnitsLog, ExecutionUnits))) | ||
| -> Map ScriptWitnessIndex (Either ScriptExecutionError (EvalTxExecutionUnitsLog, ExecutionUnits)) |
| TxBodyScriptBadScriptValidity | ||
| | -- | There is not enough ada to cover both the outputs and the fees. | ||
| -- The transaction should be changed to provide more input ada, or | ||
| | -- | There is not enough ada and non-ada to cover both the outputs and the fees. |
Contributor
There was a problem hiding this comment.
Why non-ada? Multi-asset would be the correct term but even then multi-assets do not count towards the tx fee. I think you're trying to say the transaction is unbalanced with respect to multi-assets.
Contributor
Author
There was a problem hiding this comment.
I mean ada and non-ada assets here as well. Previously this error was used for ada balancing only. Now it's returned when the multi-assets balance is negative as well.
Contributor
There was a problem hiding this comment.
I was referencing the term "non-ada" itself. Substituting "non-ada" with "multi-assets" is what I was suggesting.
| onlyAda = null . toList . filterValue isNotAda | ||
| balanceCheck sbe bpparams txout@(TxOut _ balance _ _) = do | ||
| let outValue@(L.MaryValue coin multiAsset) = toMaryValue $ txOutValueToValue balance | ||
| isPositiveValue = L.pointwise (>) outValue mempty |
98cb118 to
857f03d
Compare
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.
Changelog
Context
Fixes: #789 . Now instead of runtime exception,
TxBodyErrorBalanceNegativeis returned.Checklist