feat(pay): enforce minimum UTxO lovelace requirement in payToAddress operation#311
Open
Mavis2103 wants to merge 2 commits intoIntersectMBO:mainfrom
Open
feat(pay): enforce minimum UTxO lovelace requirement in payToAddress operation#311Mavis2103 wants to merge 2 commits intoIntersectMBO:mainfrom
Mavis2103 wants to merge 2 commits intoIntersectMBO:mainfrom
Conversation
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.
This pull request introduces automatic enforcement of the minimum UTxO (ADA) requirement for the
payToAddressoperation in the transaction builder. Now, if the requested amount of lovelace is below the protocol's minimum (or omitted), the builder will silently increase it to the required minimum, preventing on-chain rejections due to dust outputs. The change is thoroughly tested with new and updated test cases to ensure correct behavior across various scenarios.The most important changes are:
Minimum UTxO Enforcement
createPayToAddressProgramfunction now calculates the minimum required lovelace for a payment output and ensures the output contains at least this amount, updating assets as needed. This prevents creation of outputs that would be rejected on-chain for not meeting the minimum ADA requirement.New and Updated Tests
TxBuilder.PayMinUtxo.test.ts) to verify that payment outputs are automatically bumped to the protocol minimum when necessary, and remain unchanged when sufficient lovelace is provided.TxBuilder.UnfrackChangeHandling.test.ts) to reflect the new minimum UTxO enforcement: expected output values are increased where appropriate, initial UTxO values are raised to allow for valid transactions, and test assertions are updated to match the new behavior. [1] [2] [3] [4] [5] [6] [7] [8] [9]