-
Notifications
You must be signed in to change notification settings - Fork 217
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
Tweak CLI help for --mainnet #1978
Merged
Merged
Conversation
This file contains 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
rvl
added
the
IMPROVEMENT
Mark a PR as an improvement, for auto-generated CHANGELOG
label
Jul 29, 2020
KtorZ
approved these changes
Jul 29, 2020
bors r+ |
Build succeeded |
rvl
added a commit
that referenced
this pull request
Nov 9, 2021
iohk-bors bot
added a commit
that referenced
this pull request
Aug 5, 2022
3423: Simplify validation of minimum UTxO values for user-specified outputs. r=Anviking a=jonathanknowles ## Issue Number #1978 ## Summary This PR adjusts the **_validation_** of **_user-specified_** outputs so that: - for a given user-specified output `out` with ada quantity `a0` - if Cardano API function [`calculateMinimumUTxO`](https://github.com/input-output-hk/cardano-node/blob/866c4211a1110ac67f3d866ca6632a6bc51f6041/cardano-api/src/Cardano/Api/Fees.hs#L1219) applied to `out` returns ada quantity `a1` such that `a1 <= a0` - then wallet API functions will not reject output `out` for having an ada quantity that is too low. In other words: if a user has previously used the Cardano API to validate the ada quantity of a given output, the wallet API should not reject that ada quantity. This PR does **_not_** change the way we assign minimum ada quantities to **_auto-generated_** outputs. For auto-generated outputs, we continue to use our previous approach of computing a minimum that can **_always be safely increased_**. This gives the coin selection and migration algorithms the flexibility to freely reassign spare ada without the risk of creating an ada quantity that is invalid. ## Details This PR introduces the following function: ```hs isBelowMinimumCoinForUTxO :: MinimumUTxO -> Address -> TokenBundle -> Bool ``` This function simply wraps the Cardano API function [`calculateMinimumUTxO`](https://github.com/input-output-hk/cardano-node/blob/866c4211a1110ac67f3d866ca6632a6bc51f6041/cardano-api/src/Cardano/Api/Fees.hs#L1219), returning `True` if (and only) if the resultant ada quantity is **_greater_** than the ada quantity of the original `TokenBundle`, which indicates that the original value was **_insufficient_**. If applying `isBelowMinimumCoinForUTxO` to a given `TokenBundle` returns `True`, then callers should use `computeMinimumCoinForUTxO` to get a `Coin` value that does satisfy the required minimum. In particular, the following composition should always evaluate to `False` (arguments left out for brevity): ```hs isBelowMinimumCoinForUTxO . computeMinimumCoinForUTxO == False ``` This PR makes the `isBelowMinimumCoinForUTxO` function available to the coin selection function `prepareOutputsInternal`, which uses it to validate the ada quantities of user-specified outputs. Co-authored-by: Jonathan Knowles <[email protected]>
iohk-bors bot
added a commit
that referenced
this pull request
Aug 5, 2022
3423: Simplify validation of minimum UTxO values for user-specified outputs. r=Anviking a=jonathanknowles ## Issue Number #1978 ## Summary This PR adjusts the **_validation_** of **_user-specified_** outputs so that: - for a given user-specified output `out` with ada quantity `a0` - if Cardano API function [`calculateMinimumUTxO`](https://github.com/input-output-hk/cardano-node/blob/866c4211a1110ac67f3d866ca6632a6bc51f6041/cardano-api/src/Cardano/Api/Fees.hs#L1219) applied to `out` returns ada quantity `a1` such that `a1 <= a0` - then wallet API functions will not reject output `out` for having an ada quantity that is too low. In other words: if a user has previously used the Cardano API to validate the ada quantity of a given output, the wallet API should not reject that ada quantity. This PR does **_not_** change the way we assign minimum ada quantities to **_auto-generated_** outputs. For auto-generated outputs, we continue to use our previous approach of computing a minimum that can **_always be safely increased_**. This gives the coin selection and migration algorithms the flexibility to freely reassign spare ada without the risk of creating an ada quantity that is invalid. ## Details This PR introduces the following function: ```hs isBelowMinimumCoinForUTxO :: MinimumUTxO -> Address -> TokenBundle -> Bool ``` This function simply wraps the Cardano API function [`calculateMinimumUTxO`](https://github.com/input-output-hk/cardano-node/blob/866c4211a1110ac67f3d866ca6632a6bc51f6041/cardano-api/src/Cardano/Api/Fees.hs#L1219), returning `True` if (and only) if the resultant ada quantity is **_greater_** than the ada quantity of the original `TokenBundle`, which indicates that the original value was **_insufficient_**. If applying `isBelowMinimumCoinForUTxO` to a given `TokenBundle` returns `True`, then callers should use `computeMinimumCoinForUTxO` to get a `Coin` value that does satisfy the required minimum. In particular, the following composition should always evaluate to `False` (arguments left out for brevity): ```hs isBelowMinimumCoinForUTxO . computeMinimumCoinForUTxO == False ``` This PR makes the `isBelowMinimumCoinForUTxO` function available to the coin selection function `prepareOutputsInternal`, which uses it to validate the ada quantities of user-specified outputs. Co-authored-by: Jonathan Knowles <[email protected]>
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.
Issue Number
ADP-356
Overview
--mainnet
option.Comments