-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add new types to list of accepted types #892
base: main
Are you sure you want to change the base?
Conversation
8e63873
to
ee43259
Compare
AnyShelleyBasedEra era <- H.noteShowM . forAll $ Gen.element [minBound .. maxBound] | ||
x <- forAll $ genTx era | ||
shelleyBasedEraConstraints era $ do | ||
let TextEnvelopeType d = textEnvelopeType (proxyToAsType (getProxy x)) |
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 this test is testing. Expected txTextEnvelopeTypes
is generated using textEnvelopeType
so this will always succeed.
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 ensures that the list has all the TextEnvelopeTypes
, see this comment: #892 (comment).
Now, the implementation gets updated automatically and it is pretty similar to the test so it doesn't make that much sense anymore.
Initially it wasn't, the list was a literal, so I didn't know to update it and that caused a bug.
Also the list could contain more things (like it did before), the test checks it at least contains the TextEnvelopeTypes
.
But we can remove the tests if they don't make sense anymore
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 for removing them. The expected values txTextEnvelopeTypes
are generated using HasTextEnvelope
. The envelopes for Tx
are also coming from HasTextEnvelope
. Does not make much sense to me.
hprop_test_cddl_tx_witness_envelope_completeness = property $ do | ||
AnyShelleyBasedEra era <- H.noteShowM . forAll $ Gen.element [minBound .. maxBound] | ||
x <- forAll $ genCardanoKeyWitness era | ||
shelleyBasedEraConstraints era $ do |
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.
Same as in the test above.
|
||
txTextEnvelopeTypes :: [Text] | ||
txTextEnvelopeTypes = | ||
[ let TextEnvelopeType d = shelleyBasedEraConstraints sbe $ textEnvelopeType (proxyToAsType (makeTxProxy 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.
Where are those HasTextEnvelope
and HasTypeProxy
instances defined? How this mapping works? Previously we had both Witnessed
and Unwitnessed
for each era, so this looks like it would support only one for each 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.
Where are those HasTextEnvelope and HasTypeProxy instances defined?
HasTypeProxy
is here: [cardano-api] Cadano.Api.Tx.Sign#L184
HasTextEnvelope
is here: [cardano-api] Cadano.Api.Tx.Sign#L281
How this mapping works? Previously we had both Witnessed and Unwitnessed for each era, so this looks like it would support only one for each era.
We will still support both, but we will use the same type annotation for both since we cannot tell which is which from the type when serialising. We have already been producing them like that, is just we will stop supporting the old format as input. See discussion here: Slack discussion
Serialisation of TextEnvelopes
is implemented here: [cardano-api] Cardano.Api.SerialiseTextEnvelope#L100
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.
Thanks for the links. Makes sense now.
where | ||
teTypes = | ||
[ FromCDDLTx "Witnessed Tx ShelleyEra" CddlTx |
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.
So now the types become:
["TxSignedShelley"
,"Tx AllegraEra"
,"Tx MaryEra"
,"Tx AlonzoEra"
,"Tx BabbageEra"
,"Tx ConwayEra"]
If I get this right, we won't be able to read transactions created in the previous version of cardano-cli.
I understand that it is expected?
|
||
txTextEnvelopeTypes :: [Text] | ||
txTextEnvelopeTypes = | ||
[ let TextEnvelopeType d = shelleyBasedEraConstraints sbe $ textEnvelopeType (proxyToAsType (makeTxProxy 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.
Thanks for the links. Makes sense now.
AnyShelleyBasedEra era <- H.noteShowM . forAll $ Gen.element [minBound .. maxBound] | ||
x <- forAll $ genTx era | ||
shelleyBasedEraConstraints era $ do | ||
let TextEnvelopeType d = textEnvelopeType (proxyToAsType (getProxy x)) |
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 for removing them. The expected values txTextEnvelopeTypes
are generated using HasTextEnvelope
. The envelopes for Tx
are also coming from HasTextEnvelope
. Does not make much sense to me.
DO NOT MERGE until the
source-repository-package
stanza is removedChangelog
Context
There was an issue with transactions created using the non-deprecated function
serialiseToTextEnvelope
as alternative toserialiseTxLedgerCddl
. Because the implementation incardano-cli
still doesn't accept it.This PR ensures the new types are accepted.
There is a corresponding PR that does a change required by this PR in
cardano-api
: IntersectMBO/cardano-api#634How to trust this PR
Ensure this solves the problem that was reported.
Checklist