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

WIP: Propagate cardano-api Allegra/Mary changes to cardano-cli #2112

Closed
wants to merge 18 commits into from

Conversation

Jimbo4350
Copy link
Contributor

@Jimbo4350 Jimbo4350 commented Nov 22, 2020

Depends on #2111

@Jimbo4350 Jimbo4350 force-pushed the jordan/propagate-api-changes branch 2 times, most recently from e7e0aa0 to ab9260d Compare November 22, 2020 16:29
Copy link
Contributor

@dcoutts dcoutts left a comment

Choose a reason for hiding this comment

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

going in the right direction

Comment on lines 224 to 236
case era of
UseByronEra ->
withCardanoEra UseByronEra
$ \ _byronEra _byronEraStyle -> liftIO $ putTextLn "Not implemented yet"
UseShelleyEra ->
withCardanoEra UseShelleyEra
$ \_shelleyEra _shelleyEraStyle -> writeTx
UseAllegraEra ->
withCardanoEra UseAllegraEra
$ \ _allegraEra _allegraEraStyle -> writeTx
UseMaryEra ->
withCardanoEra UseMaryEra
$ \ _maryEra _maryEraStyle -> writeTx
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be the other way around:

withCardanoEra useera $ \_era _eraStyle ->
  case era of
    ByronEra -> ...
    ShelleyEra -> ...
    AllegraEra -> ...
    MaryEra -> ...

etc

@Jimbo4350 Jimbo4350 force-pushed the jordan/propagate-api-changes branch 2 times, most recently from 4a311bc to fce6a22 Compare November 23, 2020 12:03
@intricate intricate force-pushed the jordan/propagate-api-changes branch 2 times, most recently from cf35676 to c54cbfd Compare November 24, 2020 05:15
Introduce a TxBodyContent type containing all the tx body fields. This
type now covers all eras, including Byron. All the fields other than
inputs and outputs are era-dependent: whether they're supported, and if
so required or optional.

We introduce a slew of types to cover which fields are supported in
which eras. This makes a lot of things more uniform.

Also complete the conversion functions into the underlying ledger types.
This should now provide full support for the current Allegra and Mary
eras. It has stubs for the auxiliary scripts which will be supported in
the ledger shortly.

This patch does the minimal CLI updates but does not update the tests.
 We may yet find we need some more type classes, or extensions to
existing classes to make using this convenient.
This is just the initial step: the supporting functions remain
either monomorphic, or with error cases for the Allegra and Mary eras.
Rather than separate per-era instances we have one general instance for
both SerialiseAsCBOR and HasTextEnvelope.
Now needs a custom impl due to the GADT
Apply the same trick as before, but now to the Witness type. Remove
unnecessary era-specific constructors. We have constructors for
different kinds of witness, but the three Shelley style ones cover all
Shelley-based eras.

This is just the change of representation: the supporting functions remain
either monomorphic, or with error cases for the Allegra and Mary eras.

Comment out the Eq & Show instance for now. To restore in the next.
Now a single instance, but hand-written due to the GADTs.
Now a single instance, but hand-written due to the GADTs.
Same pattern we've used elsewhere. Add pattern aliases for compatibility.
Rather than separate per-era instances we have one general instance for
SerialiseAsCBOR and HasTextEnvelope.
With a single era-paramaterised impl for all Shelley-based eras
Use a single era-paramaterised impl for all Shelley-based eras
Use a single era-paramaterised impl for all Shelley-based eras
Use a single era-paramaterised impl for all Shelley-based eras
And export HasScriptFeatures. Both of these will be useful in the CLI
implementation.
@Jimbo4350 Jimbo4350 force-pushed the jordan/propagate-api-changes branch 2 times, most recently from 79bd697 to cb66e64 Compare November 25, 2020 13:36
@intricate
Copy link
Contributor

Replaced by #2129

@intricate intricate closed this Nov 26, 2020
@intricate intricate deleted the jordan/propagate-api-changes branch November 26, 2020 16:33
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.

3 participants