Repository navigation
fix(common): experimentalSelectUtxos selects utxos for assets that are not required - #884
Open
takinanton wants to merge 3 commits into
Open
takinanton wants to merge 3 commits into
takinanton wants to merge 3 commits into
Conversation
…e not required Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
twwu123
approved these changes
Nov 30, 2026
This branch has not been deployed
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.
Summary
experimentalSelectUtxossubtracts every asset of a picked UTxO from the required map even when that asset was never required. The missing entry turns into the stringNaNand the loop over required units then treats it as one more unit to cover so it grabs every UTxO holding that token. With one required token and three UTxOs where the first carries the token plus an unrelated one and the other two carry only the unrelated one the function returns all three instead of the first.Now only units that are already in the required map get reduced. Added a test with that case which fails on main and passes with the change.
Affect components
@meshsdk/common@meshsdk/contract@meshsdk/core@meshsdk/core-cst@meshsdk/hydra@meshsdk/provider@meshsdk/react@meshsdk/svelte@meshsdk/transaction@meshsdk/walletType of Change
Related Issues
None that I could find.
Checklist
npm run test)npm run build)Additional Information
I only built
@meshsdk/commonwithbuild:meshand ran its jest suite. 18 suites and 207 tests pass. The other 7 suites did not load because they import@meshsdk/coreor@meshsdk/core-cstwhich I did not build. Prettier is clean on both files. I did not run the full turbo build or the other packages.🤖 Generated with Claude Code