-
Notifications
You must be signed in to change notification settings - Fork 25
Better reporting of negative balance in transaction balancing #799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better reporting of negative balance in transaction balancing #799
Conversation
2f12867
to
7f277ba
Compare
7f277ba
to
2c1c371
Compare
2c1c371
to
b36cb5c
Compare
@Unisay FYI |
b36cb5c
to
98cb118
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! A couple comments.
-> Either | ||
(TransactionValidityError era) | ||
(Map ScriptWitnessIndex (Either ScriptExecutionError (EvalTxExecutionUnitsLog, ExecutionUnits))) | ||
-> Map ScriptWitnessIndex (Either ScriptExecutionError (EvalTxExecutionUnitsLog, ExecutionUnits)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💪
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💪
98cb118
to
857f03d
Compare
Changelog
Context
Fixes: #789 . Now instead of runtime exception,
TxBodyErrorBalanceNegative
is returned.Checklist