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

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

carbolymer
Copy link
Contributor

@carbolymer carbolymer commented Feb 11, 2025

Changelog

- description: |
    Split compatible transaction building into separate building and signing functions.
    Rename `Cardano.Api.Internal.Tx.Compatible` to `Cardano.Api.Internal.Compatible.Tx`.
# 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
@carbolymer carbolymer force-pushed the mgalazyn/fix/compatible-tx-build branch from 04db64e to efef8d5 Compare February 13, 2025 20:17
@carbolymer carbolymer marked this pull request as draft February 13, 2025 20:17
@carbolymer carbolymer force-pushed the mgalazyn/fix/compatible-tx-build branch 3 times, most recently from 4bdc261 to d11b7af Compare February 17, 2025 20:47
makeShelleyKeyWitness sbe (ShelleyTxBody _ txBody _ _ _ _) =
makeShelleyKeyWitness' sbe (A.TxBody txBody)

makeShelleyKeyWitness'
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'm not sure what's the best approach here to naming and the argument for the version of this function working on ledger's tx body, so I went with this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest changing the directory name space from: Cardano.Api.Internal.Tx.Compatible to Cardano.Api.Internal.Compatible.Tx. Then you can create Cardano.Api.Internal.Compatible.Witness and add the witness related functions there.

Copy link
Contributor Author

@carbolymer carbolymer Feb 20, 2025

Choose a reason for hiding this comment

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

I've created Cardano.Api.Internal.Compatible.Tx, but no Cardano.Api.Internal.Compatible.Witness. It would require copying almost half of the cardano-api/src/Cardano/Api/Internal/Tx/Sign.hs into the new compatible module, which I think is not what we want. I think we need to figure out how to isolate this function, but I don't have any idea how to do it elegantly yet.

I'm leaving this out of scope of this PR.

@carbolymer carbolymer requested a review from Jimbo4350 February 17, 2025 20:49
@carbolymer carbolymer marked this pull request as ready for review February 17, 2025 20:50
Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

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

LGTM 👍. One suggestion.

@@ -224,3 +210,31 @@ createCommonTxBody era ins outs txFee' =
.~ Seq.fromList txOuts'
& L.feeTxBodyL
.~ txFee'

-- | Add provided witnesses to the transaction
addWitnesses
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest changing the directory name space from: Cardano.Api.Internal.Tx.Compatible to Cardano.Api.Internal.Compatible.Tx. Then you can add Cardano.Api.Internal.Compatible.Witness.

makeShelleyKeyWitness sbe (ShelleyTxBody _ txBody _ _ _ _) =
makeShelleyKeyWitness' sbe (A.TxBody txBody)

makeShelleyKeyWitness'
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest changing the directory name space from: Cardano.Api.Internal.Tx.Compatible to Cardano.Api.Internal.Compatible.Tx. Then you can create Cardano.Api.Internal.Compatible.Witness and add the witness related functions there.

@carbolymer carbolymer force-pushed the mgalazyn/fix/compatible-tx-build branch from d11b7af to a2e79ab Compare February 20, 2025 16:27
@carbolymer carbolymer force-pushed the mgalazyn/fix/compatible-tx-build branch from a2e79ab to 9d4a145 Compare February 20, 2025 16:29
@carbolymer carbolymer enabled auto-merge February 20, 2025 16:29
@carbolymer carbolymer added this pull request to the merge queue Feb 20, 2025
Merged via the queue into master with commit a1ba5b5 Feb 20, 2025
28 of 29 checks passed
@carbolymer carbolymer deleted the mgalazyn/fix/compatible-tx-build branch February 20, 2025 16:57
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