-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Fixed transaction imbalance when burning assets from the same policy #376
Fixed transaction imbalance when burning assets from the same policy #376
Conversation
Amazing! Thanks for the fix. Could you add a unit test to cover the new code being added? |
@cffls Please let me know if any changes are needed. Thanks! |
I had hoped that my changes to the multi asset/asset class would disallow empty/ zero assets (see the normalization methods). I am wondering if there is an oversight in the implementation that introduces this need for a fix inside the tx builder? Do we need to run normalization after init as well? |
In fact @xxAVOGADROxx I reverted your changes to the txbuilder class and the test case you added still passes. Please make sure that the test case fails before your applied change, otherwise it is not clear what exactly is the change introduced. I have enabled workflows for this PR so you can directly see if any added unit test increases coverage. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## chang #376 +/- ##
==========================================
- Coverage 85.24% 85.22% -0.02%
==========================================
Files 32 32
Lines 4209 4211 +2
Branches 1059 1059
==========================================
+ Hits 3588 3589 +1
Misses 435 435
- Partials 186 187 +1 ☔ View full report in Codecov by Sentry. |
Hello @nielstron, I've added the correct unit test (verifying that it solves the issue). Additionally, I realized the logic for filtering empty/zero assets wasn't necessary, so I've removed that part. |
Thanks @xxAVOGADROxx for adding the test. I realized that this error originated from |
Problem
The logic did not properly handle cases where assets under one policy were burned. This led to incorrect outputs in the
multi_asset
structure, causing transaction outputs to be improperly computed.Solution
A fix was applied to ensure proper handling of burning assets under the same policy.
Assets that are burned under a given policy ID (
policy_id_1
) are properly removed from themulti_asset
map.Changes
_calc_change
method oftxbuilder.py
.Additional information
Tested on preproduction.