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

Split compatible transaction building and signing #750

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

carbolymer
Copy link
Contributor

@carbolymer carbolymer commented Feb 11, 2025

Changelog

- description: |
    Split compatible transaction building into separate building and signing functions
# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
   - breaking       # the API has changed in a breaking way
  # - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - refactoring    # QoL changes
  # - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

createCompatibleSignedTx wasn't really signing the transaction but just blindly adding signatures. It's split into two separate functions for building and signing.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

@carbolymer carbolymer self-assigned this Feb 11, 2025
@carbolymer carbolymer force-pushed the mgalazyn/fix/compatible-tx-build branch from ad9e94c to 04db64e Compare February 11, 2025 19:55
@carbolymer carbolymer marked this pull request as ready for review February 11, 2025 19:57
@@ -224,3 +210,77 @@ createCommonTxBody era ins outs txFee' =
.~ Seq.fromList txOuts'
& L.feeTxBodyL
.~ txFee'

-- | Sign a transaction body
makeSignedTransaction
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'ts a 1-1 copy from Cardano.Api.Internal.Tx.Sign. I imagine that we'll be deprecating eras and simplifying Cardano.Api.Internal.Tx.Sign so we won't be able to reuse code easily.

Copy link
Contributor

Choose a reason for hiding this comment

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

This will sit in a separate command group in cardano-cli. We need access to all the eras, so we won't be deprecating any eras. Remember QA has a hardforking test where they submit protocol parameter updates across all eras.

Copy link
Contributor Author

@carbolymer carbolymer Feb 13, 2025

Choose a reason for hiding this comment

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

We need access to all the eras, so we won't be deprecating any eras.

But we will be supporting only current and next eras so only Cardano.Api.Internal.Compatible will support older eras, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Cardano.Api.Internal.Compatible has to support all Shelley based eras only for the functionality QA needs.

Once we can provide what QA needs, we can consider parameterizing functions in Cardano.Api.Internal.Compatible on CardanoEra era however the Byron/Shelley split in the code makes things cleaner.

-- ^ a signed transaction
makeSignedTransaction
witnesses
( ShelleyTxBody
Copy link
Contributor

Choose a reason for hiding this comment

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

We want to eventually remove ShelleyTxBody so lets not do this.

Copy link
Contributor Author

@carbolymer carbolymer Feb 13, 2025

Choose a reason for hiding this comment

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

Ok I'll try to rewrite this without using our TxBody type

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