Skip to content

Utilize leftover dust in conversions.#4287

Merged
mergify[bot] merged 2 commits intomainfrom
murisi/consolidate-dust
Feb 5, 2025
Merged

Utilize leftover dust in conversions.#4287
mergify[bot] merged 2 commits intomainfrom
murisi/consolidate-dust

Conversation

@murisi
Copy link
Copy Markdown
Collaborator

@murisi murisi commented Jan 31, 2025

Describe your changes

An attempt to address the reported bug where users' MASP balances are potentially underestimated. This bug is caused by compute_exchanged_amount not attempting to consolidate dust and apply conversions on that. This PR attempts to address this issue by always bringing relevant dust back into input before attempting a conversion. Under the assumption that the ledger's current epoch does not change during applying conversions, this code algorithm should terminate because:

  • If no conversions at all apply to the consolidated amount (i.e the principal plus the dust), then the consolidated amount is simply moved to output (so that output is greater than before) progressing the loop in the process
  • If a conversion does apply, then the consolidated amount is converted into something "better" and the dust left from this conversion is left in output again. Hence the (one-way) conversion progresses the loop.

Checklist before merging

  • If this PR has some consensus breaking changes, I added the corresponding breaking:: labels
    • This will require 2 reviewers to approve the changes
  • If this PR requires changes to the docs or specs, a corresponding PR is opened in the namada-docs repo
    • Relevant PR if applies:
  • If this PR affects services such as namada-indexer or namada-masp-indexer, a corresponding PR is opened in that repo
    • Relevant PR if applies:

@murisi murisi marked this pull request as draft January 31, 2025 08:00
@murisi murisi force-pushed the murisi/consolidate-dust branch from 2d68670 to 6d5c700 Compare January 31, 2025 08:31
@murisi murisi marked this pull request as ready for review January 31, 2025 08:31
@murisi murisi force-pushed the murisi/consolidate-dust branch from 6d5c700 to c97f79d Compare January 31, 2025 08:53
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.03%. Comparing base (1465f26) to head (c97f79d).
Report is 71 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4287      +/-   ##
==========================================
- Coverage   74.03%   74.03%   -0.01%     
==========================================
  Files         345      345              
  Lines      110047   110046       -1     
==========================================
- Hits        81476    81472       -4     
- Misses      28571    28574       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@murisi murisi mentioned this pull request Jan 31, 2025
3 tasks
@murisi murisi requested review from batconjurer, grarco and sug0 February 3, 2025 09:45
@murisi murisi added the MASP label Feb 4, 2025
@murisi murisi added the merge Ready to merge - mergifyio bot will add the PR to merge queue when all checks pass label Feb 5, 2025
mergify bot added a commit that referenced this pull request Feb 5, 2025
mergify bot added a commit that referenced this pull request Feb 5, 2025
@mergify mergify bot merged commit 305b70e into main Feb 5, 2025
24 of 25 checks passed
@mergify mergify bot deleted the murisi/consolidate-dust branch February 5, 2025 05:42
@tzemanovic tzemanovic added the backport-libs-0.251 Backport libraries to 0.251 maintenance branch label Feb 5, 2025
mergify bot added a commit that referenced this pull request Feb 5, 2025
Utilize leftover dust in conversions. (backport #4287)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-libs-0.251 Backport libraries to 0.251 maintenance branch MASP merge Ready to merge - mergifyio bot will add the PR to merge queue when all checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants