-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fix signing of a transaction in compatible shelley transaction signed-transaction
command by not using an incomplete body for signing
#1057
Conversation
1897e91
to
efd2bed
Compare
compatible shelley transaction signed-transaction
command.
5de3eba
to
754d7db
Compare
b92af75
to
64e7f9e
Compare
cardano-cli/cardano-cli.cabal
Outdated
@@ -325,7 +325,7 @@ test-suite cardano-cli-test | |||
base16-bytestring, | |||
bech32 >=1.1.0, | |||
bytestring, | |||
cardano-api:{cardano-api, gen, internal}, |
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.
🥳
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 but I have a few questions
cardano-cli/src/Cardano/CLI/Read.hs
Outdated
:: () | ||
=> ShelleyBasedEra era | ||
-> Maybe NetworkId | ||
-> A.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.
🤦♂️ It confused me at first but I'm just noticing this type. What do we gain by wrapping the ledger type here? Why not directly use the ledger type?
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.
That we don't have to use ShelleyLedgerEra
type family and we can hide some calls to shelleyBasedEraConstraints
behind our lens. A little convenience for some boilerplate.
If we decide to not use this TxBody
type, we should deprecate the module Cardano.Api.Ledger.Lens
then to avoid confusion.
@@ -279,69 +277,29 @@ runCompatibleTransactionCmd | |||
) | |||
sbe | |||
|
|||
let certsRefInputs = |
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 assume we don't need reference inputs because QA does not use them?
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.
We do - but removed code was only used to build a body only for creating signatures. But it's problematic: it's a slightly different body than the one we're using in building compatible transaction. So the transaction building logic is duplicated in two places, and we had the bug with incorrect body hash used for the signatures.
let txCerts = mkTxCertificates sbe certsAndMaybeScriptWits | ||
|
||
-- this body is only for witnesses | ||
apiTxBody <- |
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.
👍
firstExceptT CompatiblePParamsConversionError . hoistEither $ | ||
createCompatibleTx sbe ins allOuts fee protocolUpdates votes txCerts | ||
|
||
let txBody = ledgerTx ^. A.txToTxBodyL sbe |
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.
We need to directly use the ledger tx body type instead.
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.
64e7f9e
to
fa52c7d
Compare
64e7f9e
to
b27c0c0
Compare
24a3f28
to
c62048c
Compare
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.
Fix signing how? Again, break this up in to sensible commits to make it easy for the reviewer to understand what has changed as there are lots of style related changes.
99bc559
to
d4c8068
Compare
compatible shelley transaction signed-transaction
command.compatible shelley transaction signed-transaction
command by not using an incomplete body for signing
d4c8068
to
d12f2e1
Compare
This avoids of implementation drift between cardano-api and cardano-cli. We were building two transaction bodies - one for just signatures and one is the resulting transaction. Thos bodies over time became different and resulted in a bug producing invalid transaction signatures. Now it's only one body used for both purposes.
bddf201
to
e3bdb30
Compare
e3bdb30
to
5e20af4
Compare
Changelog
Context
This PR contains two commits:
Fixes:
compatible shelley transaction signed-transaction
#1054Requires:
Checklist