-
Notifications
You must be signed in to change notification settings - Fork 23
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
base: master
Are you sure you want to change the base?
Conversation
ad9e94c
to
04db64e
Compare
04db64e
to
efef8d5
Compare
0bf7a3e
to
4bdc261
Compare
4bdc261
to
d11b7af
Compare
makeShelleyKeyWitness sbe (ShelleyTxBody _ txBody _ _ _ _) = | ||
makeShelleyKeyWitness' sbe (A.TxBody txBody) | ||
|
||
makeShelleyKeyWitness' |
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 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.
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 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.
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.
LGTM 👍. One suggestion.
@@ -164,11 +165,11 @@ createCompatibleSignedTx sbe ins outs witnesses txFee' anyProtocolUpdate anyVote | |||
:: [(ScriptWitnessIndex, Certificate era, StakeCredential, Witness WitCtxStake era)] | |||
indexedTxCerts = indexTxCertificates txCertificates' | |||
|
|||
allWitnesses | |||
setScriptWitnesses |
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.
This just occurred to me. Does QA need backwards compatibility for script witnesses? If not we can drop it.
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 think so. This was requested afair: https://github.com/IntersectMBO/cardano-cli/pull/972/files#diff-caae695482c364ec0098429ee19afc0089a97fe85de02cf1f81d3b029ef18109R41
@@ -224,3 +210,31 @@ createCommonTxBody era ins outs txFee' = | |||
.~ Seq.fromList txOuts' | |||
& L.feeTxBodyL | |||
.~ txFee' | |||
|
|||
-- | Add provided witnesses to the transaction | |||
addWitnesses |
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 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' |
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 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.
@@ -83,6 +84,12 @@ strictMaybeL = lens g s | |||
s :: StrictMaybe a -> Maybe a -> StrictMaybe a | |||
s _ = maybe SNothing SJust | |||
|
|||
txToTxBodyL :: ShelleyBasedEra era -> Lens' (L.Tx (ShelleyLedgerEra era)) (TxBody era) |
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.
Is this called in the cli? If it's not lets not expose this because it encourages the use of TxBody
.
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.
It's used here: https://github.com/IntersectMBO/cardano-cli/pull/1057/files#diff-725abf998f7812014ea390b5cde9b1fe273d7af84e585bc47f37f9052399e7f9R286
Note that it's a TxBody
from line 74, which is just a newtype over L.TxBody (ShelleyLedgerEra era)
Changelog
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