-
Notifications
You must be signed in to change notification settings - Fork 212
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
Reuse balance transaction in construct transaction #3553
Reuse balance transaction in construct transaction #3553
Conversation
Hi @paweljakubas! EDIT: I've rebased the branch on It seems this branch currently doesn't build: There's also a (small) conflict with Many thanks! Jonathan |
615178a
to
92de589
Compare
bors try |
tryBuild failed: Failed as expected with , Left
( ClientError
( Object
( fromList
[
( "code"
, String "balance_tx_zero_ada_output"
)
,
( "message"
, String "I don't currently support balancing transactions containing one or more zero-ada outputs. In the future I might be able to increase the values to the minimum allowed ada value."
)
]
)
)
)
)
expected: Status {
statusCode = 202,
statusMessage = "Accepted"
}
but got: Status {
statusCode = 501,
statusMessage = "Not Implemented"
}
To rerun use: --match "/API Specifications/NEW_SHELLEY_TRANSACTIONS/TRANS_NEW_CREATE_10h - Minting assets without timelock to foreign address/" After the work for ADP-2347 (Support increasing zero-ada outputs to minimum in balanceTx) has been merged into |
8598029
to
7226abe
Compare
lib/wallet/src/Cardano/Wallet.hs
Outdated
@@ -2534,7 +2534,7 @@ constructTransaction | |||
-> WalletId | |||
-> Cardano.AnyCardanoEra | |||
-> TransactionCtx | |||
-> SelectionOf TxOut | |||
-> Either PreSelection (SelectionOf TxOut) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused about why this argument needs to be of type Either PreSelection Selection
.
Is there a good reason for this? (Perhaps preparing for the future?)
AFAICT, this function is only ever called with Left PreSelection
, so we could just simplify the argument type to PreSelection
.
See the following commit, which still compiles: 262b7b9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @jonathanknowles indeed. PreSelection
was introduced as the intention was to construct tx WITHOUT inputs and SelectionOf
has NonEmpty
of inputs. But when I proceeded then it turn out that node does not accept constructing tx with empty inputs. Hence this dummyInput
hack. But, node intends to lift this restriction in coming version of node, so I intended to stick to differentiating PreSelection
and SelectionOf
.
f154f16
to
eb72775
Compare
bors try |
tryBuild failed: |
eb72775
to
6b1f160
Compare
👎 Rejected by too few approved reviews |
d9a6ee6
to
86448bd
Compare
I am taking over this branch |
6b1f160
to
ab4539e
Compare
e903498
to
b38c399
Compare
Use `LambdaCase` instead of repeating patterns. Use `Coin.fromQuantity` instead of `fromIntegral`.
This removes the incomplete pattern match warnings.
The function `Cardano.Wallet.constructTransaction` is only ever called with a `Left PreSelection`, and never called with a `Right Selection`. Therefore, we can simplify the selection argument type from `Either PreSelection Selection` to just `PreSelection`.
This helper type is only used by the `constructTransaction` and `mkUnsignedTx` functions, and not used by anything within the `CoinSelection` module hierarchy.
Without this change integration tests would fail e.g. where: ```pseudo-code constructTx paymentTo addr1 (0 ada) | | V Tx output: addr1 (1 ada) -- min ada, set automatically output: addr2 (9 ada) -- change ``` as we'd believe both outputs in the resuling tx were change -- neither of them exists in the original output list. If there are 'n' outputs in the original unbalanced tx, we will with this commit instead judge that the first 'n' are "outputs" and that the ones after that are all change. While this makes assumptions about how balanceTx appends outputs, it is more importantly ressilient to outputs being modified, like with the `increaseZeroAdaOutputs` feature.
7e7a60b
to
6473ee4
Compare
bors merge |
Build succeeded: |
…ction r=Unisay a=paweljakubas <!-- Detail in a few bullet points the work accomplished in this PR. Before you submit, don't forget to: LICENSE README.md bors.toml cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json hie-direnv.yaml lib nix prototypes release.nix reports scripts shell.nix specifications test touch.me.CI weeder.dhall Make sure the GitHub PR fields are correct: ✓ Set a good Title for your PR. ✓ Assign yourself to the PR. ✓ Assign one or more reviewer(s). ✓ Link to a Jira issue, and/or other GitHub issues or PRs. ✓ In the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages. LICENSE README.md bors.toml cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json hie-direnv.yaml lib nix prototypes release.nix reports scripts shell.nix specifications test touch.me.CI weeder.dhall Don't waste reviewers' time: ✓ If it's a draft, select the Create Draft PR option. ✓ Self-review your changes to make sure nothing unexpected slipped through. LICENSE README.md bors.toml cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json hie-direnv.yaml lib nix prototypes release.nix reports scripts shell.nix specifications test touch.me.CI weeder.dhall Try to make your intent clear: ✓ Write a good Description that explains what this PR is meant to do. ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding Jira ticket. ✓ Highlight what Testing you have done. ✓ Acknowledge any changes required to the Documentation. --> - [x] Added PreSelection along side SelectionOf - [x] Enabled mkUnsignedTx to use either PreSelection or SelectionOf - [x] constructTransaction produces "no-inputs/no-fee" sealed tx using mkUnsignedTx - [x] constructTransaction uses balanceTransaction to add inputs and fees - [x] coin selection and fee are retrieved from decodeTransaction - [x] checking all integration tests - [x] adding dummyTxIn as node does not allow producing no-inputs txs at the moment ### Comments <!-- Additional comments, links, or screenshots to attach, if any. --> ### Issue Number adp-2257 <!-- Reference the Jira/GitHub issue that this PR relates to, and which requirements it tackles. Note: Jira issues of the form ADP- will be auto-linked. --> Co-authored-by: Pawel Jakubas <[email protected]> Co-authored-by: Johannes Lund <[email protected]> Co-authored-by: Jonathan Knowles <[email protected]> Co-authored-by: Yura Lazarev <[email protected]> Source commit: 2363059
Comments
Issue Number
adp-2257