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

Implement decode signed tx in shelley #1766

Merged

Conversation

paweljakubas
Copy link
Contributor

@paweljakubas paweljakubas commented Jun 16, 2020

Issue Number

#1758

Overview

  • I have implemented decodeSignedTx
  • I have added testing

Comments

@paweljakubas paweljakubas requested a review from piotr-iohk June 16, 2020 13:16
@paweljakubas paweljakubas self-assigned this Jun 16, 2020
Right (Cardano.TxSignedShelley txValid) -> pure $ toSealed txValid
Right (Cardano.TxSignedByron{}) ->
Left $ ErrDecodeSignedTxWrongPayload
"Detected Byron signed tx. Was expecting Shelley signed one!"
Copy link
Member

Choose a reason for hiding this comment

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

I think that TxSignedByron refers to Shelley transactions using Byron addresses (and requiring special Byron UTxO witnesses). They'd therefore be so-to-speak, valid in Shelley.

Copy link
Contributor Author

@paweljakubas paweljakubas Jun 16, 2020

Choose a reason for hiding this comment

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

the full constructor looks like that :

TxSignedByron !ByronTxBody !ByteString !(Byron.Hash ByronTxBody) !(Vector Byron.TxInWitness)

which supports what you wrote. Probably will leave it as TO_DO at first step - and return to it soon. nevertheless, we do not support in wallet sending such transactions - @KtorZ right? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

Not yet because those witnesses aren't yet supported in the node (although they landed in the ledger recently). So we will. Soon.

@piotr-iohk
Copy link
Contributor

piotr-iohk commented Jun 16, 2020

There is no longer "Something went wrong" error. But I still cannot submit the transaction... I get:

I couldn't verify that the payload has the correct binary format. Therefore I couldn't send it to the node. Please check the format and try again.

To reproduce:

Trying to re-play the tutorial on Shelley testnet:

  1. Source icarus wallet with 10ADA (fit today convince mixture crumble design identify swim jelly charge vast expect below science stove). 10 ADA being on "first" address of the wallet.

  2. Get signing key:

echo "fit today convince mixture crumble design identify swim jelly charge vast expect below science stove" \
	| cardano-address key from-recovery-phrase icarus \
	| cardano-address key child 44H/1815H/0H/0/0 --base16

and save key in XPRV env variable:

export XPRV=783de8e633c29f81503f3a72053d82ee117d2526bc7486699b7a6ccfef996b5580cabebeb11c44233b3159bcf962ac56db6f5eb68277171c22b88b7f579ab38b1233bbc1f45472837b904b719db5d32d947ec521e7fccd1aec6ad6cf884fc458
  1. Estimate fee:
$ cardano-wallet-byron transaction fees 761ddaf7760aaf9c98cd8956417760c4b7f2c656 --payment 1@2657WMsDfac6ivfhdAt33wmrS9PpYhtKi3jWcBduy7ecMRmE9dkPPMrzKnd9VE6e6
Ok.
{
    "estimated_min": {
        "quantity": 168141,
        "unit": "lovelace"
    },
    "estimated_max": {
        "quantity": 168141,
        "unit": "lovelace"
    }
}

  1. Calculate change -> 10000000-168141 = 9831859

  2. Construct transaction:

cardano-tx empty 42 \
  | cardano-tx add-input 1 91456e12a5944676647e0c3f7d6ed22daedbc4770abc940c9887705528a995be \
  | cardano-tx add-output 1 2657WMsDfac6ivfhdAt33wmrS9PpYhtKi3jWcBduy7ecMRmE9dkPPMrzKnd9VE6e6 \
  | cardano-tx add-output 9831859 2657WMsDfac6U62wnBwfX9oPzcyXxagZSBC7thfJFRJkEMMhBxiPBqMRCAhhnYc8A \
  | cardano-tx lock \
  | cardano-tx sign-with $XPRV \
  | cardano-tx serialize --base16
  1. Try to send over:
BLOB=82839f8200d818582482582091456e12a5944676647e0c3f7d6ed22daedbc4770abc940c9887705528a995be01ff9f8282d818582583581c9ecb495af2827bb6524939484fa63816d28832bbee61d7312d802dbfa10242182a001ab64ed263018282d818582583581c88115f4fc167e3a93f53bca2b6a5ef72df5e904efcef9c415bc439bda10242182a001a211ba8b31a009605b3ffa0818200d8185885825840b8cdd384ec1ef3dffe4db999d6bfce40afaa964543e2e1592c932f552fe9e8301233bbc1f45472837b904b719db5d32d947ec521e7fccd1aec6ad6cf884fc45858407c06b3249cb7d3c226126b4098e0f98b50a4f339bfc0f3b49852bdf5f66632f043b36388e09c68a73b75d511a29c8620c35934d9df8c9413c25fbac8aa2aef07

$ cardano-wallet-shelley transaction submit $BLOB
or
$ cardano-wallet-byron transaction submit $BLOB

👇

I couldn't verify that the payload has the correct binary format. Therefore I couldn't send it to the node. Please check the format and try again.

I guess that is not related to this PR, but still... seems that proxy submit transaction is somewhat borken?

@paweljakubas paweljakubas force-pushed the paweljakubas/1758/implement-decodeSignedTx-in-shelley branch from 7ef060c to 046f4e6 Compare June 17, 2020 13:05
@paweljakubas paweljakubas requested a review from KtorZ June 17, 2020 13:06
@paweljakubas
Copy link
Contributor Author

@piotr-iohk this PR is about implementing decodeSignedTx and testing it. It is problem number 1 to be solved to achieve what you are writing about. Let's tackle this it in separate PR. Maybe it is good idea to relocate your detailed comment with instructions to the issue form this place in order not to loose it.

@paweljakubas
Copy link
Contributor Author

bors try

iohk-bors bot added a commit that referenced this pull request Jun 17, 2020
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 17, 2020

@KtorZ KtorZ added the ADDING FEATURE Mark a PR as adding a new feature, for auto-generated CHANGELOG label Jun 18, 2020
@KtorZ KtorZ force-pushed the paweljakubas/1758/implement-decodeSignedTx-in-shelley branch from 431c608 to 63abe7f Compare June 18, 2020 22:27
Copy link
Member

@KtorZ KtorZ left a comment

Choose a reason for hiding this comment

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

👍 wrapped up "TODO" and added support for Byron transaction decoding as well.

@KtorZ
Copy link
Member

KtorZ commented Jun 18, 2020

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 18, 2020

@iohk-bors iohk-bors bot merged commit d55c14c into master Jun 18, 2020
@iohk-bors iohk-bors bot deleted the paweljakubas/1758/implement-decodeSignedTx-in-shelley branch June 18, 2020 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADDING FEATURE Mark a PR as adding a new feature, for auto-generated CHANGELOG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants