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

Completing API support for Allegra and Mary eras #2121

Merged
merged 17 commits into from
Nov 26, 2020

Conversation

dcoutts
Copy link
Contributor

@dcoutts dcoutts commented Nov 25, 2020

Following on from #2111 with what is hopefully the last remaining API
changes needed to support all the Shelley-based eras.

All the representations and functions should now work for all
appropriate eras.

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.

Looking good!

cardano-api/src/Cardano/Api/TxBody.hs Outdated Show resolved Hide resolved
cardano-api/src/Cardano/Api/TxBody.hs Outdated Show resolved Hide resolved
cardano-api/src/Cardano/Api/TxBody.hs Show resolved Hide resolved
cardano-api/src/Cardano/Api/TxBody.hs Show resolved Hide resolved
cardano-api/src/Cardano/Api/Tx.hs Show resolved Hide resolved
cardano-api/src/Cardano/Api/Tx.hs Show resolved Hide resolved
cardano-api/src/Cardano/Api/Tx.hs Show resolved Hide resolved
@Jimbo4350 Jimbo4350 self-requested a review November 25, 2020 13:58
@dcoutts dcoutts force-pushed the dcoutts/api-allegra-mary branch 2 times, most recently from b9ae3ee to 15788c3 Compare November 25, 2020 22:08
GHC sometimes thinks these are in scope, and sometimes not. If we use
this explicit import then it is stable.
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.
@dcoutts
Copy link
Contributor Author

dcoutts commented Nov 26, 2020

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Nov 26, 2020

@iohk-bors iohk-bors bot merged commit 8be0a95 into master Nov 26, 2020
@iohk-bors iohk-bors bot deleted the dcoutts/api-allegra-mary branch November 26, 2020 03:31
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