Skip to content
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

Remove 'coin_selection' field from the balance API's response #2964

Merged
merged 1 commit into from
Oct 11, 2021

Conversation

KtorZ
Copy link
Member

@KtorZ KtorZ commented Oct 11, 2021

  • 📍 Remove 'coin_selection' field from the Balance API's response
    (a) the implementation of this field was wrong, and getting it right is quite involved as it requires revising several parts of the core wallet. It is perhaps not desirable / out-of-scope for this endpoint actually.

    (b) the coin_selection result is only truly useful when constructing a transaction which is under control of the wallet. Balancing may be done on any arbitrary foreign transaction and as such, breaks several invariants of the wallet (only one withdrawal, only one delegation certificate at a time etc..).

Comments

Based off KtorZ/ADP-1183/balancing-execution-units

Issue Number

ADP-1183

@KtorZ KtorZ requested a review from paweljakubas October 11, 2021 08:20
@KtorZ KtorZ self-assigned this Oct 11, 2021
@@ -996,7 +996,7 @@ data PostTransactionFeeOldData (n :: NetworkDiscriminant) = PostTransactionFeeOl

type ApiBase64 = ApiBytesT 'Base64 ByteString

newtype ApiSignedTransaction = ApiSignedTransaction
newtype ApiSerializedTransaction = ApiSerializedTransaction
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed since it's no longer only used for the sign endpoint, but also as a result of the balance endpoint.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ApiSignedTransaction: &ApiSignedTransaction
description: |
The result of signing a transaction (serialized and encoded).
ApiSerializedTransaction: &ApiSerializedTransaction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have also this https://github.com/input-output-hk/cardano-wallet/blob/master/specifications/api/swagger.yaml#L2217
One letter difference 's' -> 'z'. Would be good to reconcile

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, they are the same. Both use serialisedTransactionBase64

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arg! Indeed. UK vs US. Seems like the API uses the UK's style more, so I'll go with that.

@KtorZ KtorZ force-pushed the KtorZ/ADP-1183/cleanup-balance-api branch from 624ce26 to 876dc62 Compare October 11, 2021 08:57
@@ -996,7 +996,7 @@ data PostTransactionFeeOldData (n :: NetworkDiscriminant) = PostTransactionFeeOl

type ApiBase64 = ApiBytesT 'Base64 ByteString

newtype ApiSignedTransaction = ApiSignedTransaction
newtype ApiSerialisedTransaction = ApiSerialisedTransaction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the idea is to use in response of balanceTx, and in response of signTx ApiSerialisedTransaction? and they are going to be base64 encoded bytestring (signTx will also accept hex coming from constructTx), the same as in case of request of submitTx. Right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this doesn't change anything compared to what was already there w.r.t to the serialised transaction returned by the API, it however removes the coin_selection field from the balance's result. For the rest, it's identical.

@KtorZ KtorZ force-pushed the KtorZ/ADP-1183/balancing-execution-units branch 2 times, most recently from 45d239c to 8305b23 Compare October 11, 2021 11:11
Base automatically changed from KtorZ/ADP-1183/balancing-execution-units to master October 11, 2021 11:54
@KtorZ KtorZ force-pushed the KtorZ/ADP-1183/cleanup-balance-api branch from 876dc62 to 8a2ac2b Compare October 11, 2021 14:05
@KtorZ
Copy link
Member Author

KtorZ commented Oct 11, 2021

bors r+

iohk-bors bot added a commit that referenced this pull request Oct 11, 2021
2964: Remove 'coin_selection' field from the balance API's response r=KtorZ a=KtorZ

<!--
Detail in a few bullet points the work accomplished in this PR.

Before you submit, don't forget to:

* 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.

* 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.

* 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.
-->


- 📍 **Remove 'coin_selection' field from the Balance API's response**
    (a) the implementation of this field was wrong, and getting it right is quite involved as it requires revising several parts of the core wallet. It is perhaps not desirable / out-of-scope for this endpoint actually.

  (b) the coin_selection result is only truly useful when constructing a transaction which is under control of the wallet. Balancing may be done on any arbitrary foreign transaction and as such, breaks several invariants of the wallet (only one withdrawal, only one delegation certificate at a time etc..).


### Comments

<!-- Additional comments, links, or screenshots to attach, if any. -->

Based off [`KtorZ/ADP-1183/balancing-execution-units`](#2952)

### Issue Number

<!-- 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. -->

ADP-1183


Co-authored-by: KtorZ <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Oct 11, 2021

Build failed:

@KtorZ KtorZ force-pushed the KtorZ/ADP-1183/cleanup-balance-api branch from 8a2ac2b to ef1fdcc Compare October 11, 2021 15:20
@KtorZ
Copy link
Member Author

KtorZ commented Oct 11, 2021

bors r+

iohk-bors bot added a commit that referenced this pull request Oct 11, 2021
2964: Remove 'coin_selection' field from the balance API's response r=KtorZ a=KtorZ

<!--
Detail in a few bullet points the work accomplished in this PR.

Before you submit, don't forget to:

* 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.

* 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.

* 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.
-->


- 📍 **Remove 'coin_selection' field from the Balance API's response**
    (a) the implementation of this field was wrong, and getting it right is quite involved as it requires revising several parts of the core wallet. It is perhaps not desirable / out-of-scope for this endpoint actually.

  (b) the coin_selection result is only truly useful when constructing a transaction which is under control of the wallet. Balancing may be done on any arbitrary foreign transaction and as such, breaks several invariants of the wallet (only one withdrawal, only one delegation certificate at a time etc..).


### Comments

<!-- Additional comments, links, or screenshots to attach, if any. -->

Based off [`KtorZ/ADP-1183/balancing-execution-units`](#2952)

### Issue Number

<!-- 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. -->

ADP-1183


Co-authored-by: KtorZ <[email protected]>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Oct 11, 2021

Build failed:

  (a) the implementation of this field was wrong, and getting it right is quite involved as it requires revising several parts of the core wallet. It is perhaps not desirable / out-of-scope for this endpoint actually.

  (b) the coin_selection result is only truly useful when constructing a transaction which is under control of the wallet. Balancing may be done on any arbitrary foreign transaction and as such, breaks several invariants of the wallet (only one withdrawal, only one delegation certificate at a time etc..).
@KtorZ KtorZ force-pushed the KtorZ/ADP-1183/cleanup-balance-api branch from ef1fdcc to 37f6a97 Compare October 11, 2021 15:37
@KtorZ
Copy link
Member Author

KtorZ commented Oct 11, 2021

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Oct 11, 2021

Build succeeded:

@iohk-bors iohk-bors bot merged commit 24cd824 into master Oct 11, 2021
@iohk-bors iohk-bors bot deleted the KtorZ/ADP-1183/cleanup-balance-api branch October 11, 2021 16:29
WilliamKingNoel-Bot pushed a commit that referenced this pull request Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants